From cc4d1384389f25fa4b437e636df92104f1426e8a Mon Sep 17 00:00:00 2001 From: Andrei Emeltchenko Date: Thu, 7 Sep 2017 10:59:17 +0300 Subject: [PATCH] net: l2: Correct debug message and avoid unneeded assignment At the moment we print "Sending ARP packet" even if we found ARP entry and send the packet directly. Signed-off-by: Andrei Emeltchenko --- subsys/net/ip/l2/ethernet.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/subsys/net/ip/l2/ethernet.c b/subsys/net/ip/l2/ethernet.c index d927214ad19..f0f953dc4c6 100644 --- a/subsys/net/ip/l2/ethernet.c +++ b/subsys/net/ip/l2/ethernet.c @@ -205,17 +205,20 @@ static enum net_verdict ethernet_send(struct net_if *iface, return NET_DROP; } - NET_DBG("Sending arp pkt %p (orig %p) to iface %p", - arp_pkt, pkt, iface); - if (pkt != arp_pkt) { + NET_DBG("Sending arp pkt %p (orig %p) to iface %p", + arp_pkt, pkt, iface); + /* Either pkt went to ARP pending queue * or there was not space in the queue anymore */ net_pkt_unref(pkt); - } - pkt = arp_pkt; + pkt = arp_pkt; + } else { + NET_DBG("Found ARP entry, sending pkt %p to iface %p", + pkt, iface); + } net_pkt_ll_src(pkt)->addr = (u8_t *)&NET_ETH_HDR(pkt)->src; net_pkt_ll_src(pkt)->len = sizeof(struct net_eth_addr);