From 9e0cfaf0a7af7524e40cd0ca91c7084263a67d0e Mon Sep 17 00:00:00 2001 From: Tomasz Bursztyka Date: Fri, 8 Jun 2018 14:32:23 +0200 Subject: [PATCH] net/arp: There is no need to fill in the header in all frags Only the first one requires it. Same issue as already fixed in ethernet side. Signed-off-by: Tomasz Bursztyka --- subsys/net/ip/l2/ethernet/arp.c | 20 +++----------------- 1 file changed, 3 insertions(+), 17 deletions(-) diff --git a/subsys/net/ip/l2/ethernet/arp.c b/subsys/net/ip/l2/ethernet/arp.c index 60b3f5ac821..1480e1ec6c3 100644 --- a/subsys/net/ip/l2/ethernet/arp.c +++ b/subsys/net/ip/l2/ethernet/arp.c @@ -198,7 +198,6 @@ struct net_pkt *net_arp_prepare(struct net_pkt *pkt) { struct arp_entry *entry, *free_entry = NULL, *non_pending = NULL; struct ethernet_context *ctx; - struct net_buf *frag; struct net_linkaddr *ll; struct net_eth_hdr *hdr; struct in_addr *addr; @@ -290,22 +289,9 @@ struct net_pkt *net_arp_prepare(struct net_pkt *pkt) net_sprint_ll_addr(ll->addr, sizeof(struct net_eth_addr)), net_sprint_ipv4_addr(&NET_IPV4_HDR(pkt)->src)); - frag = pkt->frags; - while (frag) { - /* If there is no room for link layer header, then - * just send the packet as is. - */ - if (!net_buf_headroom(frag)) { - frag = frag->frags; - continue; - } - - hdr = net_eth_fill_header(ctx, pkt, frag, - htons(NET_ETH_PTYPE_IP), - ll->addr, entry->eth.addr); - - frag = frag->frags; - } + net_eth_fill_header(ctx, pkt, pkt->frags, + htons(NET_ETH_PTYPE_IP), + ll->addr, entry->eth.addr); return pkt; }