From f65e7a4097d69f82c68dff04b675ee6a8069fd2b Mon Sep 17 00:00:00 2001 From: Xiang Xiao Date: Fri, 9 Nov 2018 09:38:59 -0600 Subject: [PATCH] drivers/net/lan91c111.c: Reuse lan91c111_reply for ARP case --- drivers/net/lan91c111.c | 27 ++++----------------------- 1 file changed, 4 insertions(+), 23 deletions(-) diff --git a/drivers/net/lan91c111.c b/drivers/net/lan91c111.c index 029545737e0..63107f13e4f 100644 --- a/drivers/net/lan91c111.c +++ b/drivers/net/lan91c111.c @@ -530,18 +530,13 @@ static int lan91c111_txpoll(FAR struct net_driver_s *dev) */ #ifdef CONFIG_NET_IPv4 -#ifdef CONFIG_NET_IPv6 if (IFF_IS_IPv4(dev->d_flags)) -#endif { arp_out(dev); } #endif /* CONFIG_NET_IPv4 */ - #ifdef CONFIG_NET_IPv6 -#ifdef CONFIG_NET_IPv4 - else -#endif + if (IFF_IS_IPv6(dev->d_flags)) { neighbor_out(dev); } @@ -598,22 +593,13 @@ static void lan91c111_reply(FAR struct net_driver_s *dev) /* Update the Ethernet header with the correct MAC address */ #ifdef CONFIG_NET_IPv4 -#ifdef CONFIG_NET_IPv6 - /* Check for an outgoing IPv4 packet */ - if (IFF_IS_IPv4(dev->d_flags)) -#endif { arp_out(dev); } #endif - #ifdef CONFIG_NET_IPv6 -#ifdef CONFIG_NET_IPv4 - /* Otherwise, it must be an outgoing IPv6 packet */ - - else -#endif + if (IFF_IS_IPv6(dev->d_flags)) { neighbor_out(dev); } @@ -752,14 +738,9 @@ static void lan91c111_receive(FAR struct net_driver_s *dev) arp_arpin(dev); - /* If the above function invocation resulted in data that should be - * sent out on the network, the field d_len will set to a value > 0. - */ + /* Check for a reply to the ARP packet */ - if (dev->d_len > 0) - { - lan91c111_transmit(dev); - } + lan91c111_reply(dev); } else #endif