tests/net: Remove usage of net_pkt_ll() function
This function is planned to be removed, thus avoiding its usage. Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
This commit is contained in:
parent
7f8d92827f
commit
77d1c86478
|
@ -91,7 +91,7 @@ static int tester_send(struct device *dev, struct net_pkt *pkt)
|
|||
return -ENODATA;
|
||||
}
|
||||
|
||||
hdr = (struct net_eth_hdr *)net_pkt_ll(pkt);
|
||||
hdr = (struct net_eth_hdr *)net_pkt_data(pkt);
|
||||
|
||||
if (ntohs(hdr->type) == NET_ETH_PTYPE_ARP) {
|
||||
/* First frag has eth hdr */
|
||||
|
@ -191,6 +191,8 @@ static inline struct net_pkt *prepare_arp_reply(struct net_if *iface,
|
|||
|
||||
eth = NET_ETH_HDR(pkt);
|
||||
|
||||
net_buf_pull(frag, sizeof(struct net_eth_hdr));
|
||||
|
||||
(void)memset(ð->dst.addr, 0xff, sizeof(struct net_eth_addr));
|
||||
memcpy(ð->src.addr, net_if_get_link_addr(iface)->addr,
|
||||
sizeof(struct net_eth_addr));
|
||||
|
@ -255,8 +257,6 @@ static inline struct net_pkt *prepare_arp_request(struct net_if *iface,
|
|||
|
||||
req_hdr = NET_ARP_HDR(req);
|
||||
|
||||
eth = NET_ETH_HDR(pkt);
|
||||
|
||||
(void)memset(ð->dst.addr, 0xff, sizeof(struct net_eth_addr));
|
||||
memcpy(ð->src.addr, addr, sizeof(struct net_eth_addr));
|
||||
|
||||
|
@ -291,7 +291,7 @@ fail:
|
|||
static void setup_eth_header(struct net_if *iface, struct net_pkt *pkt,
|
||||
const struct net_eth_addr *hwaddr, u16_t type)
|
||||
{
|
||||
struct net_eth_hdr *hdr = (struct net_eth_hdr *)net_pkt_ll(pkt);
|
||||
struct net_eth_hdr *hdr = (struct net_eth_hdr *)net_pkt_data(pkt);
|
||||
|
||||
memcpy(&hdr->dst.addr, hwaddr, sizeof(struct net_eth_addr));
|
||||
memcpy(&hdr->src.addr, net_if_get_link_addr(iface)->addr,
|
||||
|
|
|
@ -155,12 +155,12 @@ static int eth_tx_offloading_disabled(struct device *dev, struct net_pkt *pkt)
|
|||
udp_hdr->dst_port = port;
|
||||
|
||||
memcpy(lladdr,
|
||||
((struct net_eth_hdr *)net_pkt_ll(pkt))->src.addr,
|
||||
((struct net_eth_hdr *)net_pkt_data(pkt))->src.addr,
|
||||
sizeof(lladdr));
|
||||
memcpy(((struct net_eth_hdr *)net_pkt_ll(pkt))->src.addr,
|
||||
((struct net_eth_hdr *)net_pkt_ll(pkt))->dst.addr,
|
||||
memcpy(((struct net_eth_hdr *)net_pkt_data(pkt))->src.addr,
|
||||
((struct net_eth_hdr *)net_pkt_data(pkt))->dst.addr,
|
||||
sizeof(lladdr));
|
||||
memcpy(((struct net_eth_hdr *)net_pkt_ll(pkt))->dst.addr,
|
||||
memcpy(((struct net_eth_hdr *)net_pkt_data(pkt))->dst.addr,
|
||||
lladdr, sizeof(lladdr));
|
||||
|
||||
net_pkt_ref(pkt);
|
||||
|
|
|
@ -215,9 +215,8 @@ static struct net_buf *pkt_get_data(struct net_pkt *pkt, struct net_if *iface)
|
|||
|
||||
net_buf_add(frag, sizeof(struct net_eth_hdr));
|
||||
net_pkt_frag_add(pkt, frag);
|
||||
net_pkt_set_ll(pkt, frag->data);
|
||||
|
||||
hdr = (struct net_eth_hdr *)(net_pkt_ll(pkt));
|
||||
hdr = (struct net_eth_hdr *)(net_pkt_data(pkt));
|
||||
hdr->type = htons(NET_ETH_PTYPE_IP);
|
||||
|
||||
net_ipaddr_copy(&hdr->dst, &src_addr);
|
||||
|
|
|
@ -184,9 +184,9 @@ static bool test_ns_sending(struct ieee802154_pkt_test *t)
|
|||
return false;
|
||||
}
|
||||
|
||||
pkt_hexdump(net_pkt_ll(current_pkt), net_pkt_get_len(current_pkt));
|
||||
pkt_hexdump(net_pkt_data(current_pkt), net_pkt_get_len(current_pkt));
|
||||
|
||||
if (!ieee802154_validate_frame(net_pkt_ll(current_pkt),
|
||||
if (!ieee802154_validate_frame(net_pkt_data(current_pkt),
|
||||
net_pkt_get_len(current_pkt), &mpdu)) {
|
||||
NET_ERR("*** Sent packet is not valid\n");
|
||||
net_pkt_unref(current_pkt);
|
||||
|
@ -241,9 +241,9 @@ static bool test_ack_reply(struct ieee802154_pkt_test *t)
|
|||
return false;
|
||||
}
|
||||
|
||||
pkt_hexdump(net_pkt_ll(current_pkt), net_pkt_get_len(current_pkt));
|
||||
pkt_hexdump(net_pkt_data(current_pkt), net_pkt_get_len(current_pkt));
|
||||
|
||||
if (!ieee802154_validate_frame(net_pkt_ll(current_pkt),
|
||||
if (!ieee802154_validate_frame(net_pkt_data(current_pkt),
|
||||
net_pkt_get_len(current_pkt), &mpdu)) {
|
||||
NET_ERR("*** ACK Reply is invalid\n");
|
||||
return false;
|
||||
|
|
|
@ -463,7 +463,7 @@ void test_utils(void)
|
|||
|
||||
net_pkt_frag_add(pkt, frag);
|
||||
|
||||
memcpy(net_pkt_ll(pkt), pkt4, sizeof(pkt4));
|
||||
memcpy(net_pkt_data(pkt), pkt4, sizeof(pkt4));
|
||||
net_buf_add(frag, sizeof(pkt4));
|
||||
|
||||
net_pkt_set_ip_hdr_len(pkt, sizeof(struct net_ipv4_hdr));
|
||||
|
@ -494,7 +494,7 @@ void test_utils(void)
|
|||
|
||||
net_pkt_frag_add(pkt, frag);
|
||||
|
||||
memcpy(net_pkt_ll(pkt), pkt5, sizeof(pkt5));
|
||||
memcpy(net_pkt_data(pkt), pkt5, sizeof(pkt5));
|
||||
net_buf_add(frag, sizeof(pkt5));
|
||||
|
||||
net_pkt_set_ip_hdr_len(pkt, sizeof(struct net_ipv4_hdr));
|
||||
|
|
Loading…
Reference in a new issue