This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit 6fa60627ebea4a8028190fc6a2e05e1c13c03b47
Author: chao an <[email protected]>
AuthorDate: Sun Nov 27 02:13:21 2022 +0800

    net/devif/ip: build l2 header on the IP layer
    
    Signed-off-by: chao an <[email protected]>
---
 arch/arm/src/c5471/c5471_ethernet.c               | 35 +-------------------
 arch/arm/src/gd32f4/gd32f4xx_enet.c               |  9 +-----
 arch/arm/src/imx6/imx_enet.c                      | 35 +-------------------
 arch/arm/src/imxrt/imxrt_enet.c                   | 35 +-------------------
 arch/arm/src/kinetis/kinetis_enet.c               | 35 +-------------------
 arch/arm/src/lpc17xx_40xx/lpc17_40_ethernet.c     | 35 +-------------------
 arch/arm/src/lpc43xx/lpc43_ethernet.c             | 35 +-------------------
 arch/arm/src/lpc54xx/lpc54_ethernet.c             | 27 +---------------
 arch/arm/src/rtl8720c/amebaz_netdev.c             | 15 ---------
 arch/arm/src/s32k1xx/s32k1xx_enet.c               | 35 +-------------------
 arch/arm/src/s32k3xx/s32k3xx_emac.c               | 35 +-------------------
 arch/arm/src/sam34/sam_emac.c                     | 35 +-------------------
 arch/arm/src/sama5/sam_emaca.c                    | 35 +-------------------
 arch/arm/src/sama5/sam_emacb.c                    | 35 +-------------------
 arch/arm/src/sama5/sam_gmac.c                     | 35 +-------------------
 arch/arm/src/samd5e5/sam_gmac.c                   | 35 +-------------------
 arch/arm/src/samv7/sam_emac.c                     | 35 +-------------------
 arch/arm/src/stm32/stm32_eth.c                    | 35 +-------------------
 arch/arm/src/stm32f7/stm32_ethernet.c             | 35 +-------------------
 arch/arm/src/stm32h7/stm32_ethernet.c             | 35 +-------------------
 arch/arm/src/tiva/lm/lm3s_ethernet.c              | 38 ++--------------------
 arch/arm/src/tiva/tm4c/tm4c_ethernet.c            | 35 +-------------------
 arch/hc/src/m9s12/m9s12_ethernet.c                | 35 +-------------------
 arch/mips/src/pic32mx/pic32mx_ethernet.c          | 37 ++-------------------
 arch/mips/src/pic32mz/pic32mz_ethernet.c          | 39 +----------------------
 arch/misoc/src/common/misoc_net.c                 | 35 +-------------------
 arch/renesas/src/rx65n/rx65n_eth.c                | 37 ++-------------------
 arch/risc-v/src/bl602/bl602_netdev.c              | 29 +----------------
 arch/risc-v/src/esp32c3/esp32c3_wlan.c            | 35 +-------------------
 arch/risc-v/src/litex/litex_emac.c                | 35 +-------------------
 arch/risc-v/src/mpfs/mpfs_ethernet.c              | 33 +------------------
 arch/sim/src/sim/sim_netdriver.c                  | 27 +---------------
 arch/xtensa/src/esp32/esp32_emac.c                | 35 +-------------------
 arch/xtensa/src/esp32/esp32_wlan.c                | 35 +-------------------
 arch/z80/src/ez80/ez80_emac.c                     | 35 +-------------------
 drivers/net/dm90x0.c                              | 37 ++-------------------
 drivers/net/enc28j60.c                            | 35 +-------------------
 drivers/net/encx24j600.c                          | 35 +-------------------
 drivers/net/ftmac100.c                            | 35 +-------------------
 drivers/net/lan91c111.c                           | 21 +-----------
 drivers/net/rpmsgdrv.c                            | 21 +-----------
 drivers/net/skeleton.c                            | 29 +----------------
 drivers/net/tun.c                                 | 18 +----------
 drivers/net/w5500.c                               | 21 +-----------
 drivers/usbdev/cdcecm.c                           | 29 +----------------
 drivers/usbdev/rndis.c                            | 36 +--------------------
 drivers/wireless/ieee80211/bcm43xxx/bcmf_netdev.c | 35 +-------------------
 net/devif/ipv4_input.c                            | 22 ++++++++++---
 net/devif/ipv6_input.c                            | 10 +++++-
 49 files changed, 77 insertions(+), 1473 deletions(-)

diff --git a/arch/arm/src/c5471/c5471_ethernet.c 
b/arch/arm/src/c5471/c5471_ethernet.c
index b7de3b93b1..cb7db0b215 100644
--- a/arch/arm/src/c5471/c5471_ethernet.c
+++ b/arch/arm/src/c5471/c5471_ethernet.c
@@ -1290,11 +1290,8 @@ static void c5471_receive(struct c5471_driver_s *priv)
         {
           ninfo("IPv4 frame\n");
 
-          /* Handle ARP on input then give the IPv4 packet to the network
-           * layer
-           */
+          /* Receive an IPv4 packet from the network device */
 
-          arp_ipin(dev);
           ipv4_input(dev);
 
           /* If the above function invocation resulted in data that should be
@@ -1306,21 +1303,6 @@ static void c5471_receive(struct c5471_driver_s *priv)
           if (dev->d_len > 0 &&
              (EIM_TXDESC_OWN_HOST & getreg32(priv->c_rxcpudesc)) == 0)
             {
-              /* Update the Ethernet header with the correct MAC address */
-
-#ifdef CONFIG_NET_IPv6
-              if (IFF_IS_IPv4(dev->d_flags))
-#endif
-                {
-                  arp_out(dev);
-                }
-#ifdef CONFIG_NET_IPv6
-              else
-                {
-                  neighbor_out(dev);
-                }
-#endif
-
               /* And send the packet */
 
                c5471_transmit(priv);
@@ -1346,21 +1328,6 @@ static void c5471_receive(struct c5471_driver_s *priv)
           if (dev->d_len > 0 &&
              (EIM_TXDESC_OWN_HOST & getreg32(priv->c_rxcpudesc)) == 0)
             {
-              /* Update the Ethernet header with the correct MAC address */
-
-#ifdef CONFIG_NET_IPv4
-              if (IFF_IS_IPv4(dev->d_flags))
-                {
-                  arp_out(dev);
-                }
-              else
-#endif
-#ifdef CONFIG_NET_IPv6
-                {
-                  neighbor_out(dev);
-                }
-#endif
-
               /* And send the packet */
 
                c5471_transmit(priv);
diff --git a/arch/arm/src/gd32f4/gd32f4xx_enet.c 
b/arch/arm/src/gd32f4/gd32f4xx_enet.c
index ae3354198f..6fc85e2d10 100644
--- a/arch/arm/src/gd32f4/gd32f4xx_enet.c
+++ b/arch/arm/src/gd32f4/gd32f4xx_enet.c
@@ -1685,11 +1685,8 @@ static void gd32_receive(struct gd32_enet_mac_s *priv)
         {
           ninfo("IPv4 frame\n");
 
-          /* Handle ARP on input then give the IPv4 packet to the network
-           * layer
-           */
+          /* Receive an IPv4 packet from the network device */
 
-          arp_ipin(&priv->dev);
           ipv4_input(&priv->dev);
 
           /* If the above function invocation resulted in data that should be
@@ -1698,10 +1695,6 @@ static void gd32_receive(struct gd32_enet_mac_s *priv)
 
           if (priv->dev.d_len > 0)
             {
-              /* Update the Ethernet header with the correct MAC address */
-
-              arp_out(&priv->dev);
-
               /* And send the packet */
 
               gd32_transmit(priv);
diff --git a/arch/arm/src/imx6/imx_enet.c b/arch/arm/src/imx6/imx_enet.c
index 9789443a2a..a5302539f8 100644
--- a/arch/arm/src/imx6/imx_enet.c
+++ b/arch/arm/src/imx6/imx_enet.c
@@ -765,11 +765,8 @@ static inline void imx_dispatch(struct imx_driver_s *priv)
       ninfo("IPv4 frame\n");
       NETDEV_RXIPV4(&priv->dev);
 
-      /* Handle ARP on input then give the IPv4 packet to the network
-       * layer
-       */
+      /* Receive an IPv4 packet from the network device */
 
-      arp_ipin(&priv->dev);
       ipv4_input(&priv->dev);
 
       /* If the above function invocation resulted in data that should be
@@ -778,21 +775,6 @@ static inline void imx_dispatch(struct imx_driver_s *priv)
 
       if (priv->dev.d_len > 0)
         {
-          /* Update the Ethernet header with the correct MAC address */
-
-#ifdef CONFIG_NET_IPv6
-          if (IFF_IS_IPv4(priv->dev.d_flags))
-#endif
-            {
-              arp_out(&priv->dev);
-            }
-#ifdef CONFIG_NET_IPv6
-          else
-            {
-              neighbor_out(&priv->dev);
-            }
-#endif
-
           /* And send the packet */
 
           imx_transmit(priv);
@@ -818,21 +800,6 @@ static inline void imx_dispatch(struct imx_driver_s *priv)
 
       if (priv->dev.d_len > 0)
         {
-          /* Update the Ethernet header with the correct MAC address */
-
-#ifdef CONFIG_NET_IPv4
-          if (IFF_IS_IPv4(priv->dev.d_flags))
-            {
-              arp_out(&priv->dev);
-            }
-          else
-#endif
-#ifdef CONFIG_NET_IPv6
-            {
-              neighbor_out(&priv->dev);
-            }
-#endif
-
           /* And send the packet */
 
           imx_transmit(priv);
diff --git a/arch/arm/src/imxrt/imxrt_enet.c b/arch/arm/src/imxrt/imxrt_enet.c
index 7214745dd1..ad99ae9e9d 100644
--- a/arch/arm/src/imxrt/imxrt_enet.c
+++ b/arch/arm/src/imxrt/imxrt_enet.c
@@ -807,11 +807,8 @@ static inline void imxrt_dispatch(struct imxrt_driver_s 
*priv)
       ninfo("IPv4 frame\n");
       NETDEV_RXIPV4(&priv->dev);
 
-      /* Handle ARP on input then give the IPv4 packet to the network
-       * layer
-       */
+      /* Receive an IPv4 packet from the network device */
 
-      arp_ipin(&priv->dev);
       ipv4_input(&priv->dev);
 
       /* If the above function invocation resulted in data that should be
@@ -820,21 +817,6 @@ static inline void imxrt_dispatch(struct imxrt_driver_s 
*priv)
 
       if (priv->dev.d_len > 0)
         {
-          /* Update the Ethernet header with the correct MAC address */
-
-#ifdef CONFIG_NET_IPv6
-          if (IFF_IS_IPv4(priv->dev.d_flags))
-#endif
-            {
-              arp_out(&priv->dev);
-            }
-#ifdef CONFIG_NET_IPv6
-          else
-            {
-              neighbor_out(&priv->dev);
-            }
-#endif
-
           /* And send the packet */
 
           imxrt_transmit(priv);
@@ -860,21 +842,6 @@ static inline void imxrt_dispatch(struct imxrt_driver_s 
*priv)
 
       if (priv->dev.d_len > 0)
         {
-          /* Update the Ethernet header with the correct MAC address */
-
-#ifdef CONFIG_NET_IPv4
-          if (IFF_IS_IPv4(priv->dev.d_flags))
-            {
-              arp_out(&priv->dev);
-            }
-          else
-#endif
-#ifdef CONFIG_NET_IPv6
-            {
-              neighbor_out(&priv->dev);
-            }
-#endif
-
           /* And send the packet */
 
           imxrt_transmit(priv);
diff --git a/arch/arm/src/kinetis/kinetis_enet.c 
b/arch/arm/src/kinetis/kinetis_enet.c
index ac4b3bbfc0..078bd5e320 100644
--- a/arch/arm/src/kinetis/kinetis_enet.c
+++ b/arch/arm/src/kinetis/kinetis_enet.c
@@ -602,11 +602,8 @@ static void kinetis_receive(struct kinetis_driver_s *priv)
           ninfo("IPv4 frame\n");
           NETDEV_RXIPV4(&priv->dev);
 
-          /* Handle ARP on input then give the IPv4 packet to the network
-           * layer
-           */
+          /* Receive an IPv4 packet from the network device */
 
-          arp_ipin(&priv->dev);
           ipv4_input(&priv->dev);
 
           /* If the above function invocation resulted in data that should be
@@ -615,21 +612,6 @@ static void kinetis_receive(struct kinetis_driver_s *priv)
 
           if (priv->dev.d_len > 0)
             {
-              /* Update the Ethernet header with the correct MAC address */
-
-#ifdef CONFIG_NET_IPv6
-              if (IFF_IS_IPv4(priv->dev.d_flags))
-#endif
-                {
-                  arp_out(&priv->dev);
-                }
-#ifdef CONFIG_NET_IPv6
-              else
-                {
-                  neighbor_out(&priv->dev);
-                }
-#endif
-
               /* And send the packet */
 
               kinetis_transmit(priv);
@@ -653,21 +635,6 @@ static void kinetis_receive(struct kinetis_driver_s *priv)
 
           if (priv->dev.d_len > 0)
             {
-              /* Update the Ethernet header with the correct MAC address */
-
-#ifdef CONFIG_NET_IPv4
-              if (IFF_IS_IPv4(priv->dev.d_flags))
-                {
-                  arp_out(&priv->dev);
-                }
-              else
-#endif
-#ifdef CONFIG_NET_IPv6
-                {
-                  neighbor_out(&priv->dev);
-                }
-#endif
-
               /* And send the packet */
 
               kinetis_transmit(priv);
diff --git a/arch/arm/src/lpc17xx_40xx/lpc17_40_ethernet.c 
b/arch/arm/src/lpc17xx_40xx/lpc17_40_ethernet.c
index 77566e8582..6384323a9f 100644
--- a/arch/arm/src/lpc17xx_40xx/lpc17_40_ethernet.c
+++ b/arch/arm/src/lpc17xx_40xx/lpc17_40_ethernet.c
@@ -916,11 +916,8 @@ static void lpc17_40_rxdone_work(void *arg)
               ninfo("IPv4 frame\n");
               NETDEV_RXIPV4(&priv->lp_dev);
 
-              /* Handle ARP on input then give the IPv4 packet to the
-               * network layer
-               */
+              /* Receive an IPv4 packet from the network device */
 
-              arp_ipin(&priv->lp_dev);
               ipv4_input(&priv->lp_dev);
 
               /* If the above function invocation resulted in data that
@@ -930,21 +927,6 @@ static void lpc17_40_rxdone_work(void *arg)
 
               if (priv->lp_dev.d_len > 0)
                 {
-                  /* Update Ethernet header with the correct MAC address */
-
-#ifdef CONFIG_NET_IPv6
-                  if (IFF_IS_IPv4(priv->lp_dev.d_flags))
-#endif
-                    {
-                      arp_out(&priv->lp_dev);
-                    }
-#ifdef CONFIG_NET_IPv6
-                  else
-                    {
-                      neighbor_out(&priv->lp_dev);
-                    }
-#endif
-
                   /* And send the packet */
 
                   lpc17_40_response(priv);
@@ -969,21 +951,6 @@ static void lpc17_40_rxdone_work(void *arg)
 
               if (priv->lp_dev.d_len > 0)
                 {
-                  /* Update Ethernet header with the correct MAC address */
-
-#ifdef CONFIG_NET_IPv4
-                  if (IFF_IS_IPv4(priv->lp_dev.d_flags))
-                    {
-                      arp_out(&priv->lp_dev);
-                    }
-                  else
-#endif
-#ifdef CONFIG_NET_IPv6
-                    {
-                      neighbor_out(&priv->lp_dev);
-                    }
-#endif
-
                   /* And send the packet */
 
                   lpc17_40_response(priv);
diff --git a/arch/arm/src/lpc43xx/lpc43_ethernet.c 
b/arch/arm/src/lpc43xx/lpc43_ethernet.c
index c1dfac729f..830eba6192 100644
--- a/arch/arm/src/lpc43xx/lpc43_ethernet.c
+++ b/arch/arm/src/lpc43xx/lpc43_ethernet.c
@@ -1596,11 +1596,8 @@ static void lpc43_receive(struct lpc43_ethmac_s *priv)
         {
           ninfo("IPv4 frame\n");
 
-          /* Handle ARP on input then give the IPv4 packet to the network
-           * layer
-           */
+          /* Receive an IPv4 packet from the network device */
 
-          arp_ipin(&priv->dev);
           ipv4_input(&priv->dev);
 
           /* If the above function invocation resulted in data that should be
@@ -1609,21 +1606,6 @@ static void lpc43_receive(struct lpc43_ethmac_s *priv)
 
           if (priv->dev.d_len > 0)
             {
-              /* Update the Ethernet header with the correct MAC address */
-
-#ifdef CONFIG_NET_IPv6
-              if (IFF_IS_IPv4(priv->dev.d_flags))
-#endif
-                {
-                  arp_out(&priv->dev);
-                }
-#ifdef CONFIG_NET_IPv6
-              else
-                {
-                  neighbor_out(&priv->dev);
-                }
-#endif
-
               /* And send the packet */
 
               lpc43_transmit(priv);
@@ -1646,21 +1628,6 @@ static void lpc43_receive(struct lpc43_ethmac_s *priv)
 
           if (priv->dev.d_len > 0)
             {
-              /* Update the Ethernet header with the correct MAC address */
-
-#ifdef CONFIG_NET_IPv4
-              if (IFF_IS_IPv4(priv->dev.d_flags))
-                {
-                  arp_out(&priv->dev);
-                }
-              else
-#endif
-#ifdef CONFIG_NET_IPv6
-                {
-                  neighbor_out(&priv->dev);
-                }
-#endif
-
               /* And send the packet */
 
               lpc43_transmit(priv);
diff --git a/arch/arm/src/lpc54xx/lpc54_ethernet.c 
b/arch/arm/src/lpc54xx/lpc54_ethernet.c
index 9c552d5722..cfc3d0bc4b 100644
--- a/arch/arm/src/lpc54xx/lpc54_ethernet.c
+++ b/arch/arm/src/lpc54xx/lpc54_ethernet.c
@@ -847,28 +847,6 @@ static void lpc54_eth_reply(struct lpc54_ethdriver_s *priv)
 #warning Missing Logic
 #endif
 
-#ifdef CONFIG_NET_IPv4
-#ifdef CONFIG_NET_IPv6
-      /* Check for an outgoing IPv4 packet */
-
-      if (IFF_IS_IPv4(priv->eth_dev.d_flags))
-#endif
-        {
-          arp_out(&priv->eth_dev);
-        }
-#endif
-
-#ifdef CONFIG_NET_IPv6
-#ifdef CONFIG_NET_IPv4
-      /* Otherwise, it must be an outgoing IPv6 packet */
-
-      else
-#endif
-        {
-          neighbor_out(&priv->eth_dev);
-        }
-#endif
-
       /* And send the packet */
 
       chan   = lpc54_eth_getring(priv);
@@ -917,11 +895,8 @@ static void lpc54_eth_rxdispatch(struct lpc54_ethdriver_s 
*priv)
       ninfo("IPv4 packet\n");
       NETDEV_RXIPV4(dev);
 
-      /* Handle ARP on input,
-       * then dispatch IPv4 packet to the network layer
-       */
+      /* Receive an IPv4 packet from the network device */
 
-      arp_ipin(dev);
       ipv4_input(dev);
 
       /* Check for a reply to the IPv4 packet */
diff --git a/arch/arm/src/rtl8720c/amebaz_netdev.c 
b/arch/arm/src/rtl8720c/amebaz_netdev.c
index 6b8cd17efe..2ef7e0aef0 100644
--- a/arch/arm/src/rtl8720c/amebaz_netdev.c
+++ b/arch/arm/src/rtl8720c/amebaz_netdev.c
@@ -84,20 +84,6 @@ static void amebaz_reply(struct amebaz_dev_s *priv)
 {
   if (priv->dev.d_len > 0)
     {
-#ifdef CONFIG_NET_IPv6
-      if (IFF_IS_IPv4(priv->dev.d_flags))
-#endif
-        {
-          arp_out(&priv->dev);
-        }
-
-#ifdef CONFIG_NET_IPv6
-      else
-        {
-          neighbor_out(&priv->dev);
-        }
-
-#endif
       amebaz_transmit(priv);
     }
 }
@@ -143,7 +129,6 @@ void amebaz_netdev_notify_receive(struct amebaz_dev_s *priv,
   if (hdr->type == HTONS(ETHTYPE_IP))
     {
       NETDEV_RXIPV4(&priv->dev);
-      arp_ipin(&priv->dev);
       ipv4_input(&priv->dev);
       amebaz_reply(priv);
     }
diff --git a/arch/arm/src/s32k1xx/s32k1xx_enet.c 
b/arch/arm/src/s32k1xx/s32k1xx_enet.c
index 80c5e11d5b..301662cd40 100644
--- a/arch/arm/src/s32k1xx/s32k1xx_enet.c
+++ b/arch/arm/src/s32k1xx/s32k1xx_enet.c
@@ -650,11 +650,8 @@ static inline void s32k1xx_dispatch(struct 
s32k1xx_driver_s *priv)
       ninfo("IPv4 frame\n");
       NETDEV_RXIPV4(&priv->dev);
 
-      /* Handle ARP on input then give the IPv4 packet to the network
-       * layer
-       */
+      /* Receive an IPv4 packet from the network device */
 
-      arp_ipin(&priv->dev);
       ipv4_input(&priv->dev);
 
       /* If the above function invocation resulted in data that should be
@@ -663,21 +660,6 @@ static inline void s32k1xx_dispatch(struct 
s32k1xx_driver_s *priv)
 
       if (priv->dev.d_len > 0)
         {
-          /* Update the Ethernet header with the correct MAC address */
-
-#ifdef CONFIG_NET_IPv6
-          if (IFF_IS_IPv4(priv->dev.d_flags))
-#endif
-            {
-              arp_out(&priv->dev);
-            }
-#ifdef CONFIG_NET_IPv6
-          else
-            {
-              neighbor_out(&priv->dev);
-            }
-#endif
-
           /* And send the packet */
 
           s32k1xx_transmit(priv);
@@ -703,21 +685,6 @@ static inline void s32k1xx_dispatch(struct 
s32k1xx_driver_s *priv)
 
       if (priv->dev.d_len > 0)
         {
-          /* Update the Ethernet header with the correct MAC address */
-
-#ifdef CONFIG_NET_IPv4
-          if (IFF_IS_IPv4(priv->dev.d_flags))
-            {
-              arp_out(&priv->dev);
-            }
-          else
-#endif
-#ifdef CONFIG_NET_IPv6
-            {
-              neighbor_out(&priv->dev);
-            }
-#endif
-
           /* And send the packet */
 
           s32k1xx_transmit(priv);
diff --git a/arch/arm/src/s32k3xx/s32k3xx_emac.c 
b/arch/arm/src/s32k3xx/s32k3xx_emac.c
index 26b849d2bd..455f579f4c 100644
--- a/arch/arm/src/s32k3xx/s32k3xx_emac.c
+++ b/arch/arm/src/s32k3xx/s32k3xx_emac.c
@@ -1343,11 +1343,8 @@ static void s32k3xx_receive(struct s32k3xx_driver_s 
*priv)
         {
           ninfo("IPv4 frame\n");
 
-          /* Handle ARP on input then give the IPv4 packet to the network
-           * layer
-           */
+          /* Receive an IPv4 packet from the network device */
 
-          arp_ipin(&priv->dev);
           ipv4_input(&priv->dev);
 
           /* If the above function invocation resulted in data that should
@@ -1357,21 +1354,6 @@ static void s32k3xx_receive(struct s32k3xx_driver_s 
*priv)
 
           if (priv->dev.d_len > 0)
             {
-              /* Update the Ethernet header with the correct MAC address */
-
-#ifdef CONFIG_NET_IPv6
-              if (IFF_IS_IPv4(priv->dev.d_flags))
-#endif
-                {
-                  arp_out(&priv->dev);
-                }
-#ifdef CONFIG_NET_IPv6
-              else
-                {
-                  neighbor_out(&priv->dev);
-                }
-#endif
-
               /* And send the packet */
 
               s32k3xx_transmit(priv);
@@ -1395,21 +1377,6 @@ static void s32k3xx_receive(struct s32k3xx_driver_s 
*priv)
 
           if (priv->dev.d_len > 0)
             {
-              /* Update the Ethernet header with the correct MAC address */
-
-#ifdef CONFIG_NET_IPv4
-              if (IFF_IS_IPv4(priv->dev.d_flags))
-                {
-                  arp_out(&priv->dev);
-                }
-              else
-#endif
-#ifdef CONFIG_NET_IPv6
-                {
-                  neighbor_out(&priv->dev);
-                }
-#endif
-
               /* And send the packet */
 
               s32k3xx_transmit(priv);
diff --git a/arch/arm/src/sam34/sam_emac.c b/arch/arm/src/sam34/sam_emac.c
index f0cafc5762..9509ad2cbc 100644
--- a/arch/arm/src/sam34/sam_emac.c
+++ b/arch/arm/src/sam34/sam_emac.c
@@ -1181,11 +1181,8 @@ static void sam_receive(struct sam_emac_s *priv)
         {
           ninfo("IPv4 frame\n");
 
-          /* Handle ARP on input then give the IPv4 packet to the network
-           * layer
-           */
+          /* Receive an IPv4 packet from the network device */
 
-          arp_ipin(&priv->dev);
           ipv4_input(&priv->dev);
 
           /* If the above function invocation resulted in data that should be
@@ -1194,21 +1191,6 @@ static void sam_receive(struct sam_emac_s *priv)
 
           if (priv->dev.d_len > 0)
             {
-              /* Update the Ethernet header with the correct MAC address */
-
-#ifdef CONFIG_NET_IPv6
-              if (IFF_IS_IPv4(priv->dev.d_flags))
-#endif
-                {
-                  arp_out(&priv->dev);
-                }
-#ifdef CONFIG_NET_IPv6
-              else
-                {
-                  neighbor_out(&priv->dev);
-                }
-#endif
-
               /* And send the packet */
 
               sam_transmit(priv);
@@ -1231,21 +1213,6 @@ static void sam_receive(struct sam_emac_s *priv)
 
           if (priv->dev.d_len > 0)
             {
-              /* Update the Ethernet header with the correct MAC address */
-
-#ifdef CONFIG_NET_IPv4
-              if (IFF_IS_IPv4(priv->dev.d_flags))
-                {
-                  arp_out(&priv->dev);
-                }
-              else
-#endif
-#ifdef CONFIG_NET_IPv6
-                {
-                  neighbor_out(&priv->dev);
-                }
-#endif
-
               /* And send the packet */
 
               sam_transmit(priv);
diff --git a/arch/arm/src/sama5/sam_emaca.c b/arch/arm/src/sama5/sam_emaca.c
index 20d539cb32..b95fa28c5f 100644
--- a/arch/arm/src/sama5/sam_emaca.c
+++ b/arch/arm/src/sama5/sam_emaca.c
@@ -1244,11 +1244,8 @@ static void sam_receive(struct sam_emac_s *priv)
         {
           ninfo("IPv4 frame\n");
 
-          /* Handle ARP on input then give the IPv4 packet to the network
-           * layer
-           */
+          /* Receive an IPv4 packet from the network device */
 
-          arp_ipin(&priv->dev);
           ipv4_input(&priv->dev);
 
           /* If the above function invocation resulted in data that should be
@@ -1257,21 +1254,6 @@ static void sam_receive(struct sam_emac_s *priv)
 
           if (priv->dev.d_len > 0)
             {
-              /* Update the Ethernet header with the correct MAC address */
-
-#ifdef CONFIG_NET_IPv6
-              if (IFF_IS_IPv4(priv->dev.d_flags))
-#endif
-                {
-                  arp_out(&priv->dev);
-                }
-#ifdef CONFIG_NET_IPv6
-              else
-                {
-                  neighbor_out(&priv->dev);
-                }
-#endif
-
               /* And send the packet */
 
               sam_transmit(priv);
@@ -1294,21 +1276,6 @@ static void sam_receive(struct sam_emac_s *priv)
 
           if (priv->dev.d_len > 0)
             {
-              /* Update the Ethernet header with the correct MAC address */
-
-#ifdef CONFIG_NET_IPv4
-              if (IFF_IS_IPv4(priv->dev.d_flags))
-                {
-                  arp_out(&priv->dev);
-                }
-              else
-#endif
-#ifdef CONFIG_NET_IPv6
-                {
-                  neighbor_out(&priv->dev);
-                }
-#endif
-
               /* And send the packet */
 
               sam_transmit(priv);
diff --git a/arch/arm/src/sama5/sam_emacb.c b/arch/arm/src/sama5/sam_emacb.c
index 2b280b2f86..7143d67f84 100644
--- a/arch/arm/src/sama5/sam_emacb.c
+++ b/arch/arm/src/sama5/sam_emacb.c
@@ -1555,11 +1555,8 @@ static void sam_receive(struct sam_emac_s *priv)
         {
           ninfo("IPv4 frame\n");
 
-          /* Handle ARP on input then give the IPv4 packet to the network
-           * layer
-           */
+          /* Receive an IPv4 packet from the network device */
 
-          arp_ipin(&priv->dev);
           ipv4_input(&priv->dev);
 
           /* If the above function invocation resulted in data that should be
@@ -1568,21 +1565,6 @@ static void sam_receive(struct sam_emac_s *priv)
 
           if (priv->dev.d_len > 0)
             {
-              /* Update the Ethernet header with the correct MAC address */
-
-#ifdef CONFIG_NET_IPv6
-              if (IFF_IS_IPv4(priv->dev.d_flags))
-#endif
-                {
-                  arp_out(&priv->dev);
-                }
-#ifdef CONFIG_NET_IPv6
-              else
-                {
-                  neighbor_out(&priv->dev);
-                }
-#endif
-
               /* And send the packet */
 
               sam_transmit(priv);
@@ -1605,21 +1587,6 @@ static void sam_receive(struct sam_emac_s *priv)
 
           if (priv->dev.d_len > 0)
             {
-              /* Update the Ethernet header with the correct MAC address */
-
-#ifdef CONFIG_NET_IPv4
-              if (IFF_IS_IPv4(priv->dev.d_flags))
-                {
-                  arp_out(&priv->dev);
-                }
-              else
-#endif
-#ifdef CONFIG_NET_IPv6
-                {
-                  neighbor_out(&priv->dev);
-                }
-#endif
-
               /* And send the packet */
 
               sam_transmit(priv);
diff --git a/arch/arm/src/sama5/sam_gmac.c b/arch/arm/src/sama5/sam_gmac.c
index cd6f01d83c..f30904fc4b 100644
--- a/arch/arm/src/sama5/sam_gmac.c
+++ b/arch/arm/src/sama5/sam_gmac.c
@@ -1188,11 +1188,8 @@ static void sam_receive(struct sam_gmac_s *priv)
         {
           ninfo("IPv4 frame\n");
 
-          /* Handle ARP on input then give the IPv4 packet to the network
-           * layer
-           */
+          /* Receive an IPv4 packet from the network device */
 
-          arp_ipin(&priv->dev);
           ipv4_input(&priv->dev);
 
           /* If the above function invocation resulted in data that should be
@@ -1202,21 +1199,6 @@ static void sam_receive(struct sam_gmac_s *priv)
 
           if (priv->dev.d_len > 0)
             {
-              /* Update the Ethernet header with the correct MAC address */
-
-#ifdef CONFIG_NET_IPv6
-              if (IFF_IS_IPv4(priv->dev.d_flags))
-#endif
-                {
-                  arp_out(&priv->dev);
-                }
-#ifdef CONFIG_NET_IPv6
-              else
-                {
-                  neighbor_out(&priv->dev);
-                }
-#endif
-
               /* And send the packet */
 
               sam_transmit(priv);
@@ -1240,21 +1222,6 @@ static void sam_receive(struct sam_gmac_s *priv)
 
           if (priv->dev.d_len > 0)
             {
-              /* Update the Ethernet header with the correct MAC address */
-
-#ifdef CONFIG_NET_IPv4
-              if (IFF_IS_IPv4(priv->dev.d_flags))
-                {
-                  arp_out(&priv->dev);
-                }
-              else
-#endif
-#ifdef CONFIG_NET_IPv6
-                {
-                  neighbor_out(&priv->dev);
-                }
-#endif
-
               /* And send the packet */
 
               sam_transmit(priv);
diff --git a/arch/arm/src/samd5e5/sam_gmac.c b/arch/arm/src/samd5e5/sam_gmac.c
index 8ccc6914a9..be743c8e4b 100644
--- a/arch/arm/src/samd5e5/sam_gmac.c
+++ b/arch/arm/src/samd5e5/sam_gmac.c
@@ -1173,11 +1173,8 @@ static void sam_receive(struct sam_gmac_s *priv)
         {
           ninfo("IPv4 frame\n");
 
-          /* Handle ARP on input then give the IPv4 packet to the network
-           * layer
-           */
+          /* Receive an IPv4 packet from the network device */
 
-          arp_ipin(&priv->dev);
           ipv4_input(&priv->dev);
 
           /* If the above function invocation resulted in data that should be
@@ -1186,21 +1183,6 @@ static void sam_receive(struct sam_gmac_s *priv)
 
           if (priv->dev.d_len > 0)
             {
-              /* Update the Ethernet header with the correct MAC address */
-
-#ifdef CONFIG_NET_IPv6
-              if (IFF_IS_IPv4(priv->dev.d_flags))
-#endif
-                {
-                  arp_out(&priv->dev);
-                }
-#ifdef CONFIG_NET_IPv6
-              else
-                {
-                  neighbor_out(&priv->dev);
-                }
-#endif
-
               /* And send the packet */
 
               sam_transmit(priv);
@@ -1223,21 +1205,6 @@ static void sam_receive(struct sam_gmac_s *priv)
 
           if (priv->dev.d_len > 0)
             {
-              /* Update the Ethernet header with the correct MAC address */
-
-#ifdef CONFIG_NET_IPv4
-              if (IFF_IS_IPv4(priv->dev.d_flags))
-                {
-                  arp_out(&priv->dev);
-                }
-              else
-#endif
-#ifdef CONFIG_NET_IPv6
-                {
-                  neighbor_out(&priv->dev);
-                }
-#endif
-
               /* And send the packet */
 
               sam_transmit(priv);
diff --git a/arch/arm/src/samv7/sam_emac.c b/arch/arm/src/samv7/sam_emac.c
index 820bb693d0..8f69c0c1fd 100644
--- a/arch/arm/src/samv7/sam_emac.c
+++ b/arch/arm/src/samv7/sam_emac.c
@@ -1877,11 +1877,8 @@ static void sam_receive(struct sam_emac_s *priv, int qid)
           ninfo("IPv4 frame\n");
           NETDEV_RXIPV4(&priv->dev);
 
-          /* Handle ARP on input then give the IPv4 packet to the network
-           * layer
-           */
+          /* Receive an IPv4 packet from the network device */
 
-          arp_ipin(&priv->dev);
           ipv4_input(&priv->dev);
 
           /* If the above function invocation resulted in data that should be
@@ -1890,21 +1887,6 @@ static void sam_receive(struct sam_emac_s *priv, int qid)
 
           if (priv->dev.d_len > 0)
             {
-              /* Update the Ethernet header with the correct MAC address */
-
-#ifdef CONFIG_NET_IPv6
-              if (IFF_IS_IPv4(priv->dev.d_flags))
-#endif
-                {
-                  arp_out(&priv->dev);
-                }
-#ifdef CONFIG_NET_IPv6
-              else
-                {
-                  neighbor_out(&priv->dev);
-                }
-#endif
-
               /* And send the packet */
 
               sam_transmit(priv, qid);
@@ -1928,21 +1910,6 @@ static void sam_receive(struct sam_emac_s *priv, int qid)
 
           if (priv->dev.d_len > 0)
             {
-              /* Update the Ethernet header with the correct MAC address */
-
-#ifdef CONFIG_NET_IPv4
-              if (IFF_IS_IPv4(priv->dev.d_flags))
-                {
-                  arp_out(&priv->dev);
-                }
-              else
-#endif
-#ifdef CONFIG_NET_IPv6
-                {
-                  neighbor_out(&priv->dev);
-                }
-#endif
-
               /* And send the packet */
 
               sam_transmit(priv, qid);
diff --git a/arch/arm/src/stm32/stm32_eth.c b/arch/arm/src/stm32/stm32_eth.c
index 885417430b..d3c9058f83 100644
--- a/arch/arm/src/stm32/stm32_eth.c
+++ b/arch/arm/src/stm32/stm32_eth.c
@@ -1725,11 +1725,8 @@ static void stm32_receive(struct stm32_ethmac_s *priv)
         {
           ninfo("IPv4 frame\n");
 
-          /* Handle ARP on input then give the IPv4 packet to the network
-           * layer
-           */
+          /* Receive an IPv4 packet from the network device */
 
-          arp_ipin(&priv->dev);
           ipv4_input(&priv->dev);
 
           /* If the above function invocation resulted in data that should be
@@ -1738,21 +1735,6 @@ static void stm32_receive(struct stm32_ethmac_s *priv)
 
           if (priv->dev.d_len > 0)
             {
-              /* Update the Ethernet header with the correct MAC address */
-
-#ifdef CONFIG_NET_IPv6
-              if (IFF_IS_IPv4(priv->dev.d_flags))
-#endif
-                {
-                  arp_out(&priv->dev);
-                }
-#ifdef CONFIG_NET_IPv6
-              else
-                {
-                  neighbor_out(&priv->dev);
-                }
-#endif
-
               /* And send the packet */
 
               stm32_transmit(priv);
@@ -1775,21 +1757,6 @@ static void stm32_receive(struct stm32_ethmac_s *priv)
 
           if (priv->dev.d_len > 0)
             {
-              /* Update the Ethernet header with the correct MAC address */
-
-#ifdef CONFIG_NET_IPv4
-              if (IFF_IS_IPv4(priv->dev.d_flags))
-                {
-                  arp_out(&priv->dev);
-                }
-              else
-#endif
-#ifdef CONFIG_NET_IPv6
-                {
-                  neighbor_out(&priv->dev);
-                }
-#endif
-
               /* And send the packet */
 
               stm32_transmit(priv);
diff --git a/arch/arm/src/stm32f7/stm32_ethernet.c 
b/arch/arm/src/stm32f7/stm32_ethernet.c
index 1be315e72c..b1374e57bc 100644
--- a/arch/arm/src/stm32f7/stm32_ethernet.c
+++ b/arch/arm/src/stm32f7/stm32_ethernet.c
@@ -1806,11 +1806,8 @@ static void stm32_receive(struct stm32_ethmac_s *priv)
         {
           ninfo("IPv4 frame\n");
 
-          /* Handle ARP on input then give the IPv4 packet to the network
-           * layer
-           */
+          /* Receive an IPv4 packet from the network device */
 
-          arp_ipin(&priv->dev);
           ipv4_input(&priv->dev);
 
           /* If the above function invocation resulted in data that should be
@@ -1819,21 +1816,6 @@ static void stm32_receive(struct stm32_ethmac_s *priv)
 
           if (priv->dev.d_len > 0)
             {
-              /* Update the Ethernet header with the correct MAC address */
-
-#ifdef CONFIG_NET_IPv6
-              if (IFF_IS_IPv4(priv->dev.d_flags))
-#endif
-                {
-                  arp_out(&priv->dev);
-                }
-#ifdef CONFIG_NET_IPv6
-              else
-                {
-                  neighbor_out(&priv->dev);
-                }
-#endif
-
               /* And send the packet */
 
               stm32_transmit(priv);
@@ -1856,21 +1838,6 @@ static void stm32_receive(struct stm32_ethmac_s *priv)
 
           if (priv->dev.d_len > 0)
             {
-              /* Update the Ethernet header with the correct MAC address */
-
-#ifdef CONFIG_NET_IPv4
-              if (IFF_IS_IPv4(priv->dev.d_flags))
-                {
-                  arp_out(&priv->dev);
-                }
-              else
-#endif
-#ifdef CONFIG_NET_IPv6
-                {
-                  neighbor_out(&priv->dev);
-                }
-#endif
-
               /* And send the packet */
 
               stm32_transmit(priv);
diff --git a/arch/arm/src/stm32h7/stm32_ethernet.c 
b/arch/arm/src/stm32h7/stm32_ethernet.c
index 620983efc1..512438e627 100644
--- a/arch/arm/src/stm32h7/stm32_ethernet.c
+++ b/arch/arm/src/stm32h7/stm32_ethernet.c
@@ -1913,11 +1913,8 @@ static void stm32_receive(struct stm32_ethmac_s *priv)
         {
           ninfo("IPv4 frame\n");
 
-          /* Handle ARP on input then give the IPv4 packet to the network
-           * layer
-           */
+          /* Receive an IPv4 packet from the network device */
 
-          arp_ipin(&priv->dev);
           ipv4_input(&priv->dev);
 
           /* If the above function invocation resulted in data that should
@@ -1927,21 +1924,6 @@ static void stm32_receive(struct stm32_ethmac_s *priv)
 
           if (priv->dev.d_len > 0)
             {
-              /* Update the Ethernet header with the correct MAC address */
-
-#ifdef CONFIG_NET_IPv6
-              if (IFF_IS_IPv4(priv->dev.d_flags))
-#endif
-                {
-                  arp_out(&priv->dev);
-                }
-#ifdef CONFIG_NET_IPv6
-              else
-                {
-                  neighbor_out(&priv->dev);
-                }
-#endif
-
               /* And send the packet */
 
               stm32_transmit(priv);
@@ -1965,21 +1947,6 @@ static void stm32_receive(struct stm32_ethmac_s *priv)
 
           if (priv->dev.d_len > 0)
             {
-              /* Update the Ethernet header with the correct MAC address */
-
-#ifdef CONFIG_NET_IPv4
-              if (IFF_IS_IPv4(priv->dev.d_flags))
-                {
-                  arp_out(&priv->dev);
-                }
-              else
-#endif
-#ifdef CONFIG_NET_IPv6
-                {
-                  neighbor_out(&priv->dev);
-                }
-#endif
-
               /* And send the packet */
 
               stm32_transmit(priv);
diff --git a/arch/arm/src/tiva/lm/lm3s_ethernet.c 
b/arch/arm/src/tiva/lm/lm3s_ethernet.c
index f6fa7b254c..d6a46a1f99 100644
--- a/arch/arm/src/tiva/lm/lm3s_ethernet.c
+++ b/arch/arm/src/tiva/lm/lm3s_ethernet.c
@@ -762,11 +762,8 @@ static void tiva_receive(struct tiva_driver_s *priv)
           ninfo("IPv4 frame\n");
           NETDEV_RXIPV4(dev);
 
-          /* Handle ARP on input then give the IPv4 packet to the network
-           * layer
-           */
+          /* Receive an IPv4 packet from the network device */
 
-          arp_ipin(dev);
           ipv4_input(dev);
 
           /* If the above function invocation resulted in data that should be
@@ -775,21 +772,6 @@ static void tiva_receive(struct tiva_driver_s *priv)
 
           if (dev->d_len > 0)
             {
-              /* Update the Ethernet header with the correct MAC address */
-
-#ifdef CONFIG_NET_IPv6
-              if (IFF_IS_IPv4(dev->d_flags))
-#endif
-                {
-                  arp_out(dev);
-                }
-#ifdef CONFIG_NET_IPv6
-              else
-                {
-                  neighbor_out(dev);
-                }
-#endif
-
               /* And send the packet */
 
               tiva_transmit(priv);
@@ -805,7 +787,6 @@ static void tiva_receive(struct tiva_driver_s *priv)
 
           /* Give the IPv6 packet to the network layer */
 
-          arp_ipin(dev);
           ipv6_input(dev);
 
           /* If the above function invocation resulted in data that should be
@@ -813,22 +794,7 @@ static void tiva_receive(struct tiva_driver_s *priv)
            */
 
           if (priv->dev.d_len > 0)
-           {
-              /* Update the Ethernet header with the correct MAC address */
-
-#ifdef CONFIG_NET_IPv4
-              if (IFF_IS_IPv4(dev->d_flags))
-                {
-                  arp_out(dev);
-                }
-              else
-#endif
-#ifdef CONFIG_NET_IPv6
-                {
-                  neighbor_out(dev);
-                }
-#endif
-
+            {
               /* And send the packet */
 
               tiva_transmit(priv);
diff --git a/arch/arm/src/tiva/tm4c/tm4c_ethernet.c 
b/arch/arm/src/tiva/tm4c/tm4c_ethernet.c
index 9cc553bd8b..d7a60d5509 100644
--- a/arch/arm/src/tiva/tm4c/tm4c_ethernet.c
+++ b/arch/arm/src/tiva/tm4c/tm4c_ethernet.c
@@ -1699,11 +1699,8 @@ static void tiva_receive(struct tiva_ethmac_s *priv)
         {
           ninfo("IPv4 frame\n");
 
-          /* Handle ARP on input then give the IPv4 packet to the network
-           * layer
-           */
+          /* Receive an IPv4 packet from the network device */
 
-          arp_ipin(&priv->dev);
           ipv4_input(&priv->dev);
 
           /* If the above function invocation resulted in data that should be
@@ -1712,21 +1709,6 @@ static void tiva_receive(struct tiva_ethmac_s *priv)
 
           if (priv->dev.d_len > 0)
             {
-              /* Update the Ethernet header with the correct MAC address */
-
-#ifdef CONFIG_NET_IPv6
-              if (IFF_IS_IPv4(priv->dev.d_flags))
-#endif
-                {
-                  arp_out(&priv->dev);
-                }
-#ifdef CONFIG_NET_IPv6
-              else
-                {
-                  neighbor_out(&priv->dev);
-                }
-#endif
-
               /* And send the packet */
 
               tiva_transmit(priv);
@@ -1749,21 +1731,6 @@ static void tiva_receive(struct tiva_ethmac_s *priv)
 
           if (priv->dev.d_len > 0)
             {
-              /* Update the Ethernet header with the correct MAC address */
-
-#ifdef CONFIG_NET_IPv4
-              if (IFF_IS_IPv4(priv->dev.d_flags))
-                {
-                  arp_out(&priv->dev);
-                }
-              else
-#endif
-#ifdef CONFIG_NET_IPv6
-                {
-                  neighbor_out(&priv->dev);
-                }
-#endif
-
               /* And send the packet */
 
               tiva_transmit(priv);
diff --git a/arch/hc/src/m9s12/m9s12_ethernet.c 
b/arch/hc/src/m9s12/m9s12_ethernet.c
index a4761e095b..f29507ac2f 100644
--- a/arch/hc/src/m9s12/m9s12_ethernet.c
+++ b/arch/hc/src/m9s12/m9s12_ethernet.c
@@ -254,11 +254,8 @@ static void emac_receive(FAR struct emac_driver_s *priv)
         {
           ninfo("IPv4 frame\n");
 
-          /* Handle ARP on input then give the IPv4 packet to the network
-           * layer
-           */
+          /* Receive an IPv4 packet from the network device */
 
-          arp_ipin(&priv->d_dev);
           ipv4_input(&priv->d_dev);
 
           /* If the above function invocation resulted in data that should be
@@ -267,21 +264,6 @@ static void emac_receive(FAR struct emac_driver_s *priv)
 
           if (priv->d_dev.d_len > 0)
             {
-              /* Update the Ethernet header with the correct MAC address */
-
-#ifdef CONFIG_NET_IPv6
-              if (IFF_IS_IPv4(priv->d_dev.d_flags))
-#endif
-                {
-                  arp_out(&priv->d_dev);
-                }
-#ifdef CONFIG_NET_IPv6
-              else
-                {
-                  neighbor_out(&priv->d_dev);
-                }
-#endif
-
               /* And send the packet */
 
               emac_transmit(priv);
@@ -304,21 +286,6 @@ static void emac_receive(FAR struct emac_driver_s *priv)
 
           if (priv->d_dev.d_len > 0)
             {
-              /* Update the Ethernet header with the correct MAC address */
-
-#ifdef CONFIG_NET_IPv4
-              if (IFF_IS_IPv4(priv->d_dev.d_flags))
-                {
-                  arp_out(&priv->d_dev);
-                }
-              else
-#endif
-#ifdef CONFIG_NET_IPv6
-                {
-                  neighbor_out(&priv->d_dev);
-                }
-#endif
-
               /* And send the packet */
 
               emac_transmit(priv);
diff --git a/arch/mips/src/pic32mx/pic32mx_ethernet.c 
b/arch/mips/src/pic32mx/pic32mx_ethernet.c
index 66053d521c..91dd4ed651 100644
--- a/arch/mips/src/pic32mx/pic32mx_ethernet.c
+++ b/arch/mips/src/pic32mx/pic32mx_ethernet.c
@@ -1383,11 +1383,8 @@ static void pic32mx_rxdone(struct pic32mx_driver_s *priv)
               ninfo("IPv4 frame\n");
               NETDEV_RXIPV4(&priv->pd_dev);
 
-              /* Handle ARP on input then give the IPv4 packet to the network
-               * layer
-               */
+              /* Receive an IPv4 packet from the network device */
 
-              arp_ipin(&priv->pd_dev);
               ipv4_input(&priv->pd_dev);
 
               /* If the above function invocation resulted in data that
@@ -1397,24 +1394,9 @@ static void pic32mx_rxdone(struct pic32mx_driver_s *priv)
 
               if (priv->pd_dev.d_len > 0)
                 {
-                  /* Update Ethernet header with the correct MAC address */
-
-#ifdef CONFIG_NET_IPv6
-                  if (IFF_IS_IPv4(priv->pd_dev.d_flags))
-#endif
-                    {
-                      arp_out(&priv->pd_dev);
-                    }
-#ifdef CONFIG_NET_IPv6
-                  else
-                    {
-                      neighbor_out(&priv->pd_dev);
-                    }
-#endif
-
                   /* And send the packet */
 
-                      pic32mx_response(priv);
+                  pic32mx_response(priv);
                 }
             }
           else
@@ -1436,21 +1418,6 @@ static void pic32mx_rxdone(struct pic32mx_driver_s *priv)
 
               if (priv->pd_dev.d_len > 0)
                 {
-                  /* Update Ethernet header with the correct MAC address */
-
-#ifdef CONFIG_NET_IPv4
-                  if (IFF_IS_IPv4(priv->pd_dev.d_flags))
-                    {
-                      arp_out(&priv->pd_dev);
-                    }
-                  else
-#endif
-#ifdef CONFIG_NET_IPv6
-                    {
-                      neighbor_out(&priv->pd_dev);
-                    }
-#endif
-
                   /* And send the packet */
 
                   pic32mx_response(priv);
diff --git a/arch/mips/src/pic32mz/pic32mz_ethernet.c 
b/arch/mips/src/pic32mz/pic32mz_ethernet.c
index 08265311f0..2f66188fb8 100644
--- a/arch/mips/src/pic32mz/pic32mz_ethernet.c
+++ b/arch/mips/src/pic32mz/pic32mz_ethernet.c
@@ -1494,11 +1494,8 @@ static void pic32mz_rxdone(struct pic32mz_driver_s *priv)
               ninfo("IPv4 frame\n");
               NETDEV_RXIPV4(&priv->pd_dev);
 
-              /* Handle ARP on input then give the IPv4 packet to the network
-               * layer
-               */
+              /* Receive an IPv4 packet from the network device */
 
-              arp_ipin(&priv->pd_dev);
               ipv4_input(&priv->pd_dev);
 
               /* If the above function invocation resulted in data that
@@ -1508,23 +1505,6 @@ static void pic32mz_rxdone(struct pic32mz_driver_s *priv)
 
               if (priv->pd_dev.d_len > 0)
                 {
-                  /* Update the Ethernet header with the correct MAC
-                   * address
-                   */
-
-#ifdef CONFIG_NET_IPv6
-                  if (IFF_IS_IPv4(priv->pd_dev.d_flags))
-#endif
-                    {
-                      arp_out(&priv->pd_dev);
-                    }
-#ifdef CONFIG_NET_IPv6
-                  else
-                    {
-                      neighbor_out(&priv->pd_dev);
-                    }
-#endif
-
                   /* And send the packet */
 
                   pic32mz_response(priv);
@@ -1549,23 +1529,6 @@ static void pic32mz_rxdone(struct pic32mz_driver_s *priv)
 
               if (priv->pd_dev.d_len > 0)
                 {
-                  /* Update the Ethernet header with the correct MAC
-                   * address
-                   */
-
-#ifdef CONFIG_NET_IPv4
-                  if (IFF_IS_IPv4(priv->pd_dev.d_flags))
-                    {
-                      arp_out(&priv->pd_dev);
-                    }
-                  else
-#endif
-#ifdef CONFIG_NET_IPv6
-                    {
-                      neighbor_out(&priv->pd_dev);
-                    }
-#endif
-
                   /* And send the packet */
 
                   pic32mz_response(priv);
diff --git a/arch/misoc/src/common/misoc_net.c 
b/arch/misoc/src/common/misoc_net.c
index 7755bc2dfe..f75d6074e7 100644
--- a/arch/misoc/src/common/misoc_net.c
+++ b/arch/misoc/src/common/misoc_net.c
@@ -370,11 +370,8 @@ static void misoc_net_receive(struct misoc_net_driver_s 
*priv)
           ninfo("IPv4 frame\n");
           NETDEV_RXIPV4(&priv->misoc_net_dev);
 
-          /* Handle ARP on input then give the IPv4 packet to the network
-           * layer
-           */
+          /* Receive an IPv4 packet from the network device */
 
-          arp_ipin(&priv->misoc_net_dev);
           ipv4_input(&priv->misoc_net_dev);
 
           /* If the above function invocation resulted in data that should be
@@ -383,21 +380,6 @@ static void misoc_net_receive(struct misoc_net_driver_s 
*priv)
 
           if (priv->misoc_net_dev.d_len > 0)
             {
-              /* Update the Ethernet header with the correct MAC address */
-
-#ifdef CONFIG_NET_IPv6
-              if (IFF_IS_IPv4(priv->misoc_net_dev.d_flags))
-#endif
-                {
-                  arp_out(&priv->misoc_net_dev);
-                }
-#ifdef CONFIG_NET_IPv6
-              else
-                {
-                  neighbor_out(&kel->misoc_net_dev);
-                }
-#endif
-
               /* And send the packet */
 
               misoc_net_transmit(priv);
@@ -421,21 +403,6 @@ static void misoc_net_receive(struct misoc_net_driver_s 
*priv)
 
           if (priv->misoc_net_dev.d_len > 0)
             {
-              /* Update the Ethernet header with the correct MAC address */
-
-#ifdef CONFIG_NET_IPv4
-              if (IFF_IS_IPv4(priv->misoc_net_dev.d_flags))
-                {
-                  arp_out(&priv->misoc_net_dev);
-                }
-              else
-#endif
-#ifdef CONFIG_NET_IPv6
-                {
-                  neighbor_out(&priv->misoc_net_dev);
-                }
-#endif
-
               /* And send the packet */
 
               misoc_net_transmit(priv);
diff --git a/arch/renesas/src/rx65n/rx65n_eth.c 
b/arch/renesas/src/rx65n/rx65n_eth.c
index f58a016b25..5293d5faae 100644
--- a/arch/renesas/src/rx65n/rx65n_eth.c
+++ b/arch/renesas/src/rx65n/rx65n_eth.c
@@ -1516,17 +1516,14 @@ static void rx65n_receive(FAR struct rx65n_ethmac_s 
*priv)
         {
           ninfo("IPv4 frame\n");
 
-          /* Handle ARP on input then give the IPv4 packet to the network
-           * layer
-           */
+          /* Receive an IPv4 packet from the network device */
 
           /* Increment statistics */
 
 #if defined(CONFIG_NETDEV_STATISTICS)
-  (priv->dev.d_statistics.rx_ipv4)++;
+          (priv->dev.d_statistics.rx_ipv4)++;
 #endif
 
-          arp_ipin(&priv->dev);
           ipv4_input(&priv->dev);
 
           /* If the above function invocation resulted in data
@@ -1537,21 +1534,6 @@ static void rx65n_receive(FAR struct rx65n_ethmac_s 
*priv)
 
           if (priv->dev.d_len > 0)
             {
-              /* Update the Ethernet header with the correct MAC address */
-
-#ifdef CONFIG_NET_IPv6
-              if (IFF_IS_IPv4(priv->dev.d_flags))
-#endif
-                {
-                  arp_out(&priv->dev);
-                }
-#ifdef CONFIG_NET_IPv6
-              else
-                {
-                  neighbor_out(&priv->dev);
-                }
-#endif
-
               /* And send the packet */
 
               rx65n_transmit(priv);
@@ -1575,21 +1557,6 @@ static void rx65n_receive(FAR struct rx65n_ethmac_s 
*priv)
 
           if (priv->dev.d_len > 0)
             {
-              /* Update the Ethernet header with the correct MAC address */
-
-#ifdef CONFIG_NET_IPv4
-              if (IFF_IS_IPv4(priv->dev.d_flags))
-                {
-                  arp_out(&priv->dev);
-                }
-              else
-#endif
-#ifdef CONFIG_NET_IPv6
-                {
-                  neighbor_out(&priv->dev);
-                }
-#endif
-
               /* And send the packet */
 
               rx65n_transmit(priv);
diff --git a/arch/risc-v/src/bl602/bl602_netdev.c 
b/arch/risc-v/src/bl602/bl602_netdev.c
index a5795559df..409fbfbbec 100644
--- a/arch/risc-v/src/bl602/bl602_netdev.c
+++ b/arch/risc-v/src/bl602/bl602_netdev.c
@@ -419,30 +419,6 @@ static void bl602_net_reply(struct bl602_net_driver_s 
*priv)
 
   if (priv->net_dev.d_len > 0)
     {
-      /* 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(priv->net_dev.d_flags))
-#endif
-        {
-          arp_out(&priv->net_dev);
-        }
-#endif
-
-#ifdef CONFIG_NET_IPv6
-#ifdef CONFIG_NET_IPv4
-      /* Otherwise, it must be an outgoing IPv6 packet */
-
-      else
-#endif
-        {
-          neighbor_out(&priv->net_dev);
-        }
-#endif
-
       /* alloc tx buffer and copy to it */
 
       tx_p = bl602_netdev_alloc_txbuf();
@@ -519,11 +495,8 @@ static void bl602_net_receive(struct bl602_net_driver_s 
*priv)
       ninfo("IPv4 frame\n");
       NETDEV_RXIPV4(&priv->net_dev);
 
-      /* Handle ARP on input, then dispatch IPv4 packet to the network
-       * layer.
-       */
+      /* Receive an IPv4 packet from the network device */
 
-      arp_ipin(&priv->net_dev);
       ipv4_input(&priv->net_dev);
 
       /* Check for a reply to the IPv4 packet */
diff --git a/arch/risc-v/src/esp32c3/esp32c3_wlan.c 
b/arch/risc-v/src/esp32c3/esp32c3_wlan.c
index 9c24a26b85..2858d000c0 100644
--- a/arch/risc-v/src/esp32c3/esp32c3_wlan.c
+++ b/arch/risc-v/src/esp32c3/esp32c3_wlan.c
@@ -720,11 +720,8 @@ static void wlan_rxpoll(void *arg)
         {
           ninfo("IPv4 frame\n");
 
-          /* Handle ARP on input then give the IPv4 packet to the network
-           * layer
-           */
+          /* Receive an IPv4 packet from the network device */
 
-          arp_ipin(&priv->dev);
           ipv4_input(&priv->dev);
 
           /* If the above function invocation resulted in data
@@ -734,21 +731,6 @@ static void wlan_rxpoll(void *arg)
 
           if (priv->dev.d_len > 0)
             {
-              /* Update the Ethernet header with the correct MAC address */
-
-#ifdef CONFIG_NET_IPv6
-              if (IFF_IS_IPv4(priv->dev.d_flags))
-#endif
-                {
-                  arp_out(&priv->dev);
-                }
-#ifdef CONFIG_NET_IPv6
-              else
-                {
-                  neighbor_out(&priv->dev);
-                }
-#endif
-
               /* And send the packet */
 
               wlan_cache_txpkt_tail(priv);
@@ -772,21 +754,6 @@ static void wlan_rxpoll(void *arg)
 
           if (priv->dev.d_len > 0)
             {
-              /* Update the Ethernet header with the correct MAC address */
-
-#ifdef CONFIG_NET_IPv4
-              if (IFF_IS_IPv4(priv->dev.d_flags))
-                {
-                  arp_out(&priv->dev);
-                }
-              else
-#endif
-#ifdef CONFIG_NET_IPv6
-                {
-                  neighbor_out(&priv->dev);
-                }
-#endif
-
               /* And send the packet */
 
               wlan_cache_txpkt_tail(priv);
diff --git a/arch/risc-v/src/litex/litex_emac.c 
b/arch/risc-v/src/litex/litex_emac.c
index 6d1d6865af..27ed8ea079 100644
--- a/arch/risc-v/src/litex/litex_emac.c
+++ b/arch/risc-v/src/litex/litex_emac.c
@@ -568,11 +568,8 @@ static void litex_receive(struct litex_emac_s *priv)
       ninfo("IPv4 frame\n");
       NETDEV_RXIPV4(&priv->dev);
 
-      /* Handle ARP on input then give the IPv4 packet to the network
-       * layer
-       */
+      /* Receive an IPv4 packet from the network device */
 
-      arp_ipin(&priv->dev);
       ipv4_input(&priv->dev);
 
       /* If the above function invocation resulted in data that should be
@@ -581,21 +578,6 @@ static void litex_receive(struct litex_emac_s *priv)
 
       if (priv->dev.d_len > 0)
         {
-          /* Update the Ethernet header with the correct MAC address */
-
-#ifdef CONFIG_NET_IPv6
-          if (IFF_IS_IPv4(priv->dev.d_flags))
-#endif
-            {
-              arp_out(&priv->dev);
-            }
-#ifdef CONFIG_NET_IPv6
-          else
-            {
-              neighbor_out(&priv->dev);
-            }
-#endif
-
           /* And send the packet */
 
           litex_transmit(priv);
@@ -619,21 +601,6 @@ static void litex_receive(struct litex_emac_s *priv)
 
       if (priv->dev.d_len > 0)
         {
-          /* Update the Ethernet header with the correct MAC address */
-
-#ifdef CONFIG_NET_IPv4
-          if (IFF_IS_IPv4(priv->dev.d_flags))
-            {
-              arp_out(&priv->dev);
-            }
-          else
-#endif
-#ifdef CONFIG_NET_IPv6
-            {
-              neighbor_out(&priv->dev);
-            }
-#endif
-
           /* And send the packet */
 
           litex_transmit(priv);
diff --git a/arch/risc-v/src/mpfs/mpfs_ethernet.c 
b/arch/risc-v/src/mpfs/mpfs_ethernet.c
index 5e17e7c5b5..6378521486 100644
--- a/arch/risc-v/src/mpfs/mpfs_ethernet.c
+++ b/arch/risc-v/src/mpfs/mpfs_ethernet.c
@@ -835,11 +835,8 @@ static void mpfs_receive(struct mpfs_ethmac_s *priv, 
unsigned int queue)
         {
           ninfo("IPv4 frame\n");
 
-          /* Handle ARP on input then give the IPv4 packet to the network
-           * layer
-           */
+          /* Receive an IPv4 packet from the network device */
 
-          arp_ipin(&priv->dev);
           ipv4_input(&priv->dev);
 
           /* If the above function invocation resulted in data that should be
@@ -849,21 +846,6 @@ static void mpfs_receive(struct mpfs_ethmac_s *priv, 
unsigned int queue)
 
           if (priv->dev.d_len > 0)
             {
-              /* Update the Ethernet header with the correct MAC address */
-
-  #ifdef CONFIG_NET_IPv6
-              if (IFF_IS_IPv4(priv->dev.d_flags))
-  #endif
-                {
-                  arp_out(&priv->dev);
-                }
-  #ifdef CONFIG_NET_IPv6
-              else
-                {
-                  neighbor_out(&priv->dev);
-                }
-  #endif
-
               /* And send the packet */
 
               mpfs_transmit(priv, queue);
@@ -888,19 +870,6 @@ static void mpfs_receive(struct mpfs_ethmac_s *priv, 
unsigned int queue)
 
           if (priv->dev.d_len > 0)
             {
-              /* Update the Ethernet header with the correct MAC address */
-
-  #ifdef CONFIG_NET_IPv4
-              if (IFF_IS_IPv4(priv->dev.d_flags))
-                {
-                  arp_out(&priv->dev);
-                }
-              else
-  #endif
-                {
-                  neighbor_out(&priv->dev);
-                }
-
               /* And send the packet */
 
               mpfs_transmit(priv, queue);
diff --git a/arch/sim/src/sim/sim_netdriver.c b/arch/sim/src/sim/sim_netdriver.c
index dc85e4a139..d98c6fa99b 100644
--- a/arch/sim/src/sim/sim_netdriver.c
+++ b/arch/sim/src/sim/sim_netdriver.c
@@ -107,28 +107,6 @@ static void netdriver_reply(struct net_driver_s *dev)
 
   if (dev->d_len > 0)
     {
-      /* Look up the destination MAC address and add it to the Ethernet
-       * header.
-       */
-
-#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
-        {
-          neighbor_out(dev);
-        }
-#endif /* CONFIG_NET_IPv6 */
-
       /* Send the packet */
 
       NETDEV_TXPACKETS(dev);
@@ -189,11 +167,8 @@ static void netdriver_recv_work(void *arg)
                   ninfo("IPv4 frame\n");
                   NETDEV_RXIPV4(dev);
 
-                  /* Handle ARP on input then give the IPv4 packet to
-                   * the network layer
-                   */
+                  /* Receive an IPv4 packet from the network device */
 
-                  arp_ipin(dev);
                   ipv4_input(dev);
 
                   /* Check for a reply to the IPv4 packet */
diff --git a/arch/xtensa/src/esp32/esp32_emac.c 
b/arch/xtensa/src/esp32/esp32_emac.c
index a5ed30d60a..5dc17ed8bd 100644
--- a/arch/xtensa/src/esp32/esp32_emac.c
+++ b/arch/xtensa/src/esp32/esp32_emac.c
@@ -1370,11 +1370,8 @@ static void emac_rx_interrupt_work(void *arg)
         {
           ninfo("IPv4 frame\n");
 
-          /* Handle ARP on input then give the IPv4 packet to the network
-           * layer
-           */
+          /* Receive an IPv4 packet from the network device */
 
-          arp_ipin(&priv->dev);
           ipv4_input(&priv->dev);
 
           /* If the above function invocation resulted in data that should be
@@ -1383,21 +1380,6 @@ static void emac_rx_interrupt_work(void *arg)
 
           if (priv->dev.d_len > 0)
             {
-              /* Update the Ethernet header with the correct MAC address */
-
-#ifdef CONFIG_NET_IPv6
-              if (IFF_IS_IPv4(priv->dev.d_flags))
-#endif
-                {
-                  arp_out(&priv->dev);
-                }
-#ifdef CONFIG_NET_IPv6
-              else
-                {
-                  neighbor_out(&priv->dev);
-                }
-#endif
-
               /* And send the packet */
 
               emac_transmit(priv);
@@ -1420,21 +1402,6 @@ static void emac_rx_interrupt_work(void *arg)
 
           if (priv->dev.d_len > 0)
             {
-              /* Update the Ethernet header with the correct MAC address */
-
-#ifdef CONFIG_NET_IPv4
-              if (IFF_IS_IPv4(priv->dev.d_flags))
-                {
-                  arp_out(&priv->dev);
-                }
-              else
-#endif
-#ifdef CONFIG_NET_IPv6
-                {
-                  neighbor_out(&priv->dev);
-                }
-#endif
-
               /* And send the packet */
 
               emac_transmit(priv);
diff --git a/arch/xtensa/src/esp32/esp32_wlan.c 
b/arch/xtensa/src/esp32/esp32_wlan.c
index f279051a1e..16d309e361 100644
--- a/arch/xtensa/src/esp32/esp32_wlan.c
+++ b/arch/xtensa/src/esp32/esp32_wlan.c
@@ -717,11 +717,8 @@ static void wlan_rxpoll(void *arg)
         {
           ninfo("IPv4 frame\n");
 
-          /* Handle ARP on input then give the IPv4 packet to the network
-           * layer
-           */
+          /* Receive an IPv4 packet from the network device */
 
-          arp_ipin(&priv->dev);
           ipv4_input(&priv->dev);
 
           /* If the above function invocation resulted in data
@@ -731,21 +728,6 @@ static void wlan_rxpoll(void *arg)
 
           if (priv->dev.d_len > 0)
             {
-              /* Update the Ethernet header with the correct MAC address */
-
-#ifdef CONFIG_NET_IPv6
-              if (IFF_IS_IPv4(priv->dev.d_flags))
-#endif
-                {
-                  arp_out(&priv->dev);
-                }
-#ifdef CONFIG_NET_IPv6
-              else
-                {
-                  neighbor_out(&priv->dev);
-                }
-#endif
-
               /* And send the packet */
 
               wlan_cache_txpkt_tail(priv);
@@ -769,21 +751,6 @@ static void wlan_rxpoll(void *arg)
 
           if (priv->dev.d_len > 0)
             {
-              /* Update the Ethernet header with the correct MAC address */
-
-#ifdef CONFIG_NET_IPv4
-              if (IFF_IS_IPv4(priv->dev.d_flags))
-                {
-                  arp_out(&priv->dev);
-                }
-              else
-#endif
-#ifdef CONFIG_NET_IPv6
-                {
-                  neighbor_out(&priv->dev);
-                }
-#endif
-
               /* And send the packet */
 
               wlan_cache_txpkt_tail(priv);
diff --git a/arch/z80/src/ez80/ez80_emac.c b/arch/z80/src/ez80/ez80_emac.c
index 4742e52cc2..9a07cfd40f 100644
--- a/arch/z80/src/ez80/ez80_emac.c
+++ b/arch/z80/src/ez80/ez80_emac.c
@@ -1365,12 +1365,9 @@ static int ez80emac_receive(FAR struct ez80emac_driver_s 
*priv)
         {
           ninfo("IPv4 frame\n");
 
-          /* Handle ARP on input then give the IPv4 packet to the network
-           * layer
-           */
+          /* Receive an IPv4 packet from the network device */
 
           EMAC_STAT(priv, rx_ip);
-          arp_ipin(&priv->dev);
           ipv4_input(&priv->dev);
 
           /* If the above function invocation resulted in data that should be
@@ -1380,21 +1377,6 @@ static int ez80emac_receive(FAR struct ez80emac_driver_s 
*priv)
 
           if (priv->dev.d_len > 0)
             {
-              /* Update the Ethernet header with the correct MAC address */
-
-#ifdef CONFIG_NET_IPv6
-              if (IFF_IS_IPv4(priv->dev.d_flags))
-#endif
-                {
-                  arp_out(&priv->dev);
-                }
-#ifdef CONFIG_NET_IPv6
-              else
-                {
-                  neighbor_out(&priv->dev);
-                }
-#endif
-
               /* And send the packet */
 
               ez80emac_transmit(priv);
@@ -1419,21 +1401,6 @@ static int ez80emac_receive(FAR struct ez80emac_driver_s 
*priv)
 
           if (priv->dev.d_len > 0)
             {
-              /* Update the Ethernet header with the correct MAC address */
-
-#ifdef CONFIG_NET_IPv4
-              if (IFF_IS_IPv4(priv->dev.d_flags))
-                {
-                  arp_out(&priv->dev);
-                }
-              else
-#endif
-#ifdef CONFIG_NET_IPv6
-                {
-                  neighbor_out(&priv->dev);
-                }
-#endif
-
               /* And send the packet */
 
               ez80emac_transmit(priv);
diff --git a/drivers/net/dm90x0.c b/drivers/net/dm90x0.c
index 1af51eabdf..16a74901b8 100644
--- a/drivers/net/dm90x0.c
+++ b/drivers/net/dm90x0.c
@@ -901,11 +901,8 @@ static void dm9x_receive(FAR struct dm9x_driver_s *priv)
               ninfo("IPv4 frame\n");
               NETDEV_RXIPV4(&priv->dm_dev);
 
-              /* Handle ARP on input then give the IPv4 packet to the network
-               * layer
-               */
+              /* Receive an IPv4 packet from the network device */
 
-              arp_ipin(&priv->dm_dev);
               ipv4_input(&priv->dm_dev);
 
               /* If the above function invocation resulted in data that
@@ -915,21 +912,6 @@ static void dm9x_receive(FAR struct dm9x_driver_s *priv)
 
               if (priv->dm_dev.d_len > 0)
                 {
-                  /* Update Ethernet header with the correct MAC address */
-
-#ifdef CONFIG_NET_IPv6
-                  if (IFF_IS_IPv4(priv->dm_dev.d_flags))
-#endif
-                    {
-                      arp_out(&priv->dm_dev);
-                    }
-#ifdef CONFIG_NET_IPv6
-                  else
-                    {
-                      neighbor_out(&priv->dm_dev);
-                    }
-#endif
-
                   /* And send the packet */
 
                   dm9x_transmit(priv);
@@ -954,24 +936,9 @@ static void dm9x_receive(FAR struct dm9x_driver_s *priv)
 
               if (priv->dm_dev.d_len > 0)
                 {
-                  /* Update Ethernet header with the correct MAC address */
-
-#ifdef CONFIG_NET_IPv4
-                  if (IFF_IS_IPv4(priv->dm_dev.d_flags))
-                    {
-                      arp_out(&priv->dm_dev);
-                    }
-                  else
-#endif
-#ifdef CONFIG_NET_IPv6
-                    {
-                      neighbor_out(&priv->dm_dev);
-                    }
-#endif
-
                   /* And send the packet */
 
-                      dm9x_transmit(priv);
+                  dm9x_transmit(priv);
                 }
             }
           else
diff --git a/drivers/net/enc28j60.c b/drivers/net/enc28j60.c
index 65a276346f..9d656f9a60 100644
--- a/drivers/net/enc28j60.c
+++ b/drivers/net/enc28j60.c
@@ -1345,11 +1345,8 @@ static void enc_rxdispatch(FAR struct enc_driver_s *priv)
       ninfo("IPv4 frame\n");
       NETDEV_RXIPV4(&priv->dev);
 
-      /* Handle ARP on input then give the IPv4 packet to the network
-       * layer
-       */
+      /* Receive an IPv4 packet from the network device */
 
-      arp_ipin(&priv->dev);
       ipv4_input(&priv->dev);
 
       /* If the above function invocation resulted in data that should be
@@ -1358,21 +1355,6 @@ static void enc_rxdispatch(FAR struct enc_driver_s *priv)
 
       if (priv->dev.d_len > 0)
         {
-          /* Update the Ethernet header with the correct MAC address */
-
-#ifdef CONFIG_NET_IPv6
-          if (IFF_IS_IPv4(priv->dev.d_flags))
-#endif
-            {
-              arp_out(&priv->dev);
-            }
-#ifdef CONFIG_NET_IPv6
-          else
-            {
-              neighbor_out(&priv->dev);
-            }
-#endif
-
           /* And send the packet */
 
           enc_transmit(priv);
@@ -1396,21 +1378,6 @@ static void enc_rxdispatch(FAR struct enc_driver_s *priv)
 
       if (priv->dev.d_len > 0)
         {
-          /* Update the Ethernet header with the correct MAC address */
-
-#ifdef CONFIG_NET_IPv4
-          if (IFF_IS_IPv4(priv->dev.d_flags))
-            {
-              arp_out(&priv->dev);
-            }
-          else
-#endif
-#ifdef CONFIG_NET_IPv6
-            {
-              neighbor_out(&priv->dev);
-            }
-#endif
-
           /* And send the packet */
 
           enc_transmit(priv);
diff --git a/drivers/net/encx24j600.c b/drivers/net/encx24j600.c
index 9a4dbcabff..b17db6631c 100644
--- a/drivers/net/encx24j600.c
+++ b/drivers/net/encx24j600.c
@@ -1432,11 +1432,8 @@ static void enc_rxdispatch(FAR struct enc_driver_s *priv)
           ninfo("IPv4 frame\n");
           NETDEV_RXIPV4(&priv->dev);
 
-          /* Handle ARP on input then give the IPv4 packet to the network
-           * layer
-           */
+          /* Receive an IPv4 packet from the network device */
 
-          arp_ipin(&priv->dev);
           ipv4_input(&priv->dev);
 
           /* Free the packet */
@@ -1450,21 +1447,6 @@ static void enc_rxdispatch(FAR struct enc_driver_s *priv)
 
           if (priv->dev.d_len > 0)
             {
-              /* Update the Ethernet header with the correct MAC address */
-
-#ifdef CONFIG_NET_IPv6
-              if (IFF_IS_IPv4(priv->dev.d_flags))
-#endif
-                {
-                  arp_out(&priv->dev);
-                }
-#ifdef CONFIG_NET_IPv6
-              else
-                {
-                  neighbor_out(&priv->dev);
-                }
-#endif
-
               /* And send the packet */
 
               enc_txenqueue(priv);
@@ -1493,21 +1475,6 @@ static void enc_rxdispatch(FAR struct enc_driver_s *priv)
 
           if (priv->dev.d_len > 0)
             {
-              /* Update the Ethernet header with the correct MAC address */
-
-#ifdef CONFIG_NET_IPv4
-              if (IFF_IS_IPv4(priv->dev.d_flags))
-                {
-                  arp_out(&priv->dev);
-                }
-              else
-#endif
-#ifdef CONFIG_NET_IPv6
-                {
-                  neighbor_out(&priv->dev);
-                }
-#endif
-
               /* And send the packet */
 
               enc_txenqueue(priv);
diff --git a/drivers/net/ftmac100.c b/drivers/net/ftmac100.c
index 5cd26be1d5..d19d93d6cc 100644
--- a/drivers/net/ftmac100.c
+++ b/drivers/net/ftmac100.c
@@ -651,11 +651,8 @@ static void ftmac100_receive(FAR struct ftmac100_driver_s 
*priv)
         {
           ninfo("IPv4 frame\n");
 
-          /* Handle ARP on input then give the IPv4 packet to the network
-           * layer
-           */
+          /* Receive an IPv4 packet from the network device */
 
-          arp_ipin(&priv->ft_dev);
           ipv4_input(&priv->ft_dev);
 
           /* If the above function invocation resulted in data that should be
@@ -665,21 +662,6 @@ static void ftmac100_receive(FAR struct ftmac100_driver_s 
*priv)
 
           if (priv->ft_dev.d_len > 0)
             {
-              /* Update the Ethernet header with the correct MAC address */
-
-#ifdef CONFIG_NET_IPv6
-              if (IFF_IS_IPv4(priv->ft_dev.d_flags))
-#endif
-                {
-                  arp_out(&priv->ft_dev);
-                }
-#ifdef CONFIG_NET_IPv6
-              else
-                {
-                  neighbor_out(&priv->ft_dev);
-                }
-#endif
-
               /* And send the packet */
 
               ftmac100_transmit(priv);
@@ -703,21 +685,6 @@ static void ftmac100_receive(FAR struct ftmac100_driver_s 
*priv)
 
           if (priv->ft_dev.d_len > 0)
             {
-              /* Update the Ethernet header with the correct MAC address */
-
-#ifdef CONFIG_NET_IPv4
-              if (IFF_IS_IPv4(priv->ft_dev.d_flags))
-                {
-                  arp_out(&priv->ft_dev);
-                }
-              else
-#endif
-#ifdef CONFIG_NET_IPv6
-                {
-                  neighbor_out(&priv->ft_dev);
-                }
-#endif
-
               /* And send the packet */
 
               ftmac100_transmit(priv);
diff --git a/drivers/net/lan91c111.c b/drivers/net/lan91c111.c
index fcf1499be3..441277db45 100644
--- a/drivers/net/lan91c111.c
+++ b/drivers/net/lan91c111.c
@@ -534,22 +534,6 @@ static void lan91c111_reply(FAR struct net_driver_s *dev)
 
   if (dev->d_len > 0)
     {
-      /* Update the Ethernet header with the correct MAC address */
-
-#ifdef CONFIG_NET_IPv4
-      if (IFF_IS_IPv4(dev->d_flags))
-        {
-          arp_out(dev);
-        }
-#endif
-
-#ifdef CONFIG_NET_IPv6
-      if (IFF_IS_IPv6(dev->d_flags))
-        {
-          neighbor_out(dev);
-        }
-#endif
-
       /* And send the packet */
 
       lan91c111_transmit(dev);
@@ -645,11 +629,8 @@ static void lan91c111_receive(FAR struct net_driver_s *dev)
       ninfo("IPv4 frame\n");
       NETDEV_RXIPV4(dev);
 
-      /* Handle ARP on input, then dispatch IPv4 packet to the network
-       * layer.
-       */
+      /* Receive an IPv4 packet from the network device */
 
-      arp_ipin(dev);
       ipv4_input(dev);
 
       /* Check for a reply to the IPv4 packet */
diff --git a/drivers/net/rpmsgdrv.c b/drivers/net/rpmsgdrv.c
index 0595776d51..46fe044f11 100644
--- a/drivers/net/rpmsgdrv.c
+++ b/drivers/net/rpmsgdrv.c
@@ -300,22 +300,6 @@ static void net_rpmsg_drv_reply(FAR struct net_driver_s 
*dev)
 
   if (dev->d_len > 0)
     {
-      /* Update the Ethernet header with the correct MAC address */
-
-#ifdef CONFIG_NET_IPv4
-      if (IFF_IS_IPv4(dev->d_flags))
-        {
-          arp_out(dev);
-        }
-#endif
-
-#ifdef CONFIG_NET_IPv6
-      if (IFF_IS_IPv6(dev->d_flags))
-        {
-          neighbor_out(dev);
-        }
-#endif
-
       /* And send the packet */
 
       net_rpmsg_drv_transmit(dev, false);
@@ -520,11 +504,8 @@ static int net_rpmsg_drv_transfer_handler(FAR struct 
rpmsg_endpoint *ept,
       ninfo("IPv4 frame\n");
       NETDEV_RXIPV4(dev);
 
-      /* Handle ARP on input, then dispatch IPv4 packet to the network
-       * layer.
-       */
+      /* Receive an IPv4 packet from the network device */
 
-      arp_ipin(dev);
       ipv4_input(dev);
 
       /* Check for a reply to the IPv4 packet */
diff --git a/drivers/net/skeleton.c b/drivers/net/skeleton.c
index e9387180b0..949693c72d 100644
--- a/drivers/net/skeleton.c
+++ b/drivers/net/skeleton.c
@@ -293,30 +293,6 @@ static void skel_reply(struct skel_driver_s *priv)
 
   if (priv->sk_dev.d_len > 0)
     {
-      /* 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(priv->sk_dev.d_flags))
-#endif
-        {
-          arp_out(&priv->sk_dev);
-        }
-#endif
-
-#ifdef CONFIG_NET_IPv6
-#ifdef CONFIG_NET_IPv4
-      /* Otherwise, it must be an outgoing IPv6 packet */
-
-      else
-#endif
-        {
-          neighbor_out(&priv->sk_dev);
-        }
-#endif
-
       /* And send the packet */
 
       skel_transmit(priv);
@@ -368,11 +344,8 @@ static void skel_receive(FAR struct skel_driver_s *priv)
           ninfo("IPv4 frame\n");
           NETDEV_RXIPV4(&priv->sk_dev);
 
-          /* Handle ARP on input, then dispatch IPv4 packet to the network
-           * layer.
-           */
+          /* Receive an IPv4 packet from the network device */
 
-          arp_ipin(&priv->sk_dev);
           ipv4_input(&priv->sk_dev);
 
           /* Check for a reply to the IPv4 packet */
diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index c0935a77ee..e445906938 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -474,9 +474,8 @@ static void tun_net_receive_tap(FAR struct tun_device_s 
*priv)
       ninfo("IPv4 frame\n");
       NETDEV_RXIPV4(&priv->dev);
 
-      /* Give the IPv4 packet to the network layer. */
+      /* Receive an IPv4 packet from the network device */
 
-      arp_ipin(&priv->dev);
       ipv4_input(&priv->dev);
     }
   else
@@ -523,21 +522,6 @@ static void tun_net_receive_tap(FAR struct tun_device_s 
*priv)
 
   if (priv->dev.d_len > 0)
     {
-      /* Update the Ethernet header with the correct MAC address */
-
-#ifdef CONFIG_NET_IPv6
-      if (IFF_IS_IPv4(priv->dev.d_flags))
-#endif
-        {
-          arp_out(&priv->dev);
-        }
-#ifdef CONFIG_NET_IPv6
-      else
-        {
-          neighbor_out(&priv->dev);
-        }
-#endif
-
       /* And send the packet */
 
       priv->write_d_len = priv->dev.d_len;
diff --git a/drivers/net/w5500.c b/drivers/net/w5500.c
index 6d659d8319..74b0f4366e 100644
--- a/drivers/net/w5500.c
+++ b/drivers/net/w5500.c
@@ -1224,22 +1224,6 @@ static void w5500_reply(FAR struct w5500_driver_s *self)
 
   if (self->w_dev.d_len > 0)
     {
-      /* Update the Ethernet header with the correct MAC address */
-
-#ifdef CONFIG_NET_IPv4
-      if (IFF_IS_IPv4(self->w_dev.d_flags))
-        {
-          arp_out(&self->w_dev);
-        }
-#endif
-
-#ifdef CONFIG_NET_IPv6
-      if (IFF_IS_IPv6(self->w_dev.d_flags))
-        {
-          neighbor_out(&self->w_dev);
-        }
-#endif
-
       /* And send the packet */
 
       w5500_transmit(self);
@@ -1389,11 +1373,8 @@ static void w5500_receive(FAR struct w5500_driver_s 
*self)
           ninfo("IPv4 frame\n");
           NETDEV_RXIPV4(&self->w_dev);
 
-          /* Handle ARP on input, then dispatch IPv4 packet to the network
-           * layer.
-           */
+          /* Receive an IPv4 packet from the network device */
 
-          arp_ipin(&self->w_dev);
           ipv4_input(&self->w_dev);
 
           /* Check for a reply to the IPv4 packet */
diff --git a/drivers/usbdev/cdcecm.c b/drivers/usbdev/cdcecm.c
index 7bc5b4e9ec..3578dc8323 100644
--- a/drivers/usbdev/cdcecm.c
+++ b/drivers/usbdev/cdcecm.c
@@ -378,30 +378,6 @@ static void cdcecm_reply(struct cdcecm_driver_s *priv)
 
   if (priv->dev.d_len > 0)
     {
-      /* 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(priv->dev.d_flags))
-#endif
-        {
-          arp_out(&priv->dev);
-        }
-#endif
-
-#ifdef CONFIG_NET_IPv6
-#ifdef CONFIG_NET_IPv4
-      /* Otherwise, it must be an outgoing IPv6 packet */
-
-      else
-#endif
-        {
-          neighbor_out(&priv->dev);
-        }
-#endif
-
       /* And send the packet */
 
       cdcecm_transmit(priv);
@@ -454,11 +430,8 @@ static void cdcecm_receive(FAR struct cdcecm_driver_s 
*self)
       ninfo("IPv4 frame\n");
       NETDEV_RXIPV4(&self->dev);
 
-      /* Handle ARP on input, then dispatch IPv4 packet to the network
-       * layer.
-       */
+      /* Receive an IPv4 packet from the network device */
 
-      arp_ipin(&self->dev);
       ipv4_input(&self->dev);
 
       /* Check for a reply to the IPv4 packet */
diff --git a/drivers/usbdev/rndis.c b/drivers/usbdev/rndis.c
index 5b2775ab10..fb2e317f22 100644
--- a/drivers/usbdev/rndis.c
+++ b/drivers/usbdev/rndis.c
@@ -868,30 +868,12 @@ static void rndis_rxdispatch(FAR void *arg)
     {
       NETDEV_RXIPV4(&priv->netdev);
 
-      /* Handle ARP on input then give the IPv4 packet to the network
-       * layer
-       */
+      /* Receive an IPv4 packet from the network device */
 
-      arp_ipin(&priv->netdev);
       ipv4_input(&priv->netdev);
 
       if (priv->netdev.d_len > 0)
         {
-          /* Update the Ethernet header with the correct MAC address */
-
-#ifdef CONFIG_NET_IPv6
-          if (IFF_IS_IPv4(priv->netdev.d_flags))
-#endif
-            {
-              arp_out(&priv->netdev);
-            }
-#ifdef CONFIG_NET_IPv6
-          else
-            {
-              neighbor_out(&priv->netdev);
-            }
-#endif
-
           /* And send the packet */
 
           rndis_transmit(priv);
@@ -906,26 +888,10 @@ static void rndis_rxdispatch(FAR void *arg)
 
       /* Give the IPv6 packet to the network layer */
 
-      arp_ipin(&priv->netdev);
       ipv6_input(&priv->netdev);
 
       if (priv->netdev.d_len > 0)
         {
-          /* Update the Ethernet header with the correct MAC address */
-
-#ifdef CONFIG_NET_IPv4
-          if (IFF_IS_IPv4(priv->netdev.d_flags))
-            {
-              arp_out(&priv->netdev);
-            }
-          else
-#endif
-#ifdef CONFIG_NET_IPv6
-            {
-              neighbor_out(&priv->netdev);
-            }
-#endif
-
           /* And send the packet */
 
           rndis_transmit(priv);
diff --git a/drivers/wireless/ieee80211/bcm43xxx/bcmf_netdev.c 
b/drivers/wireless/ieee80211/bcm43xxx/bcmf_netdev.c
index e5e4b1ff31..8fe9b143ff 100644
--- a/drivers/wireless/ieee80211/bcm43xxx/bcmf_netdev.c
+++ b/drivers/wireless/ieee80211/bcm43xxx/bcmf_netdev.c
@@ -286,11 +286,8 @@ static void bcmf_receive(FAR struct bcmf_dev_s *priv)
           ninfo("IPv4 frame\n");
           NETDEV_RXIPV4(&priv->bc_dev);
 
-          /* Handle ARP on input then give the IPv4 packet to the network
-           * layer
-           */
+          /* Receive an IPv4 packet from the network device */
 
-          arp_ipin(&priv->bc_dev);
           ipv4_input(&priv->bc_dev);
 
           /* If the above function invocation resulted in data that should be
@@ -299,21 +296,6 @@ static void bcmf_receive(FAR struct bcmf_dev_s *priv)
 
           if (priv->bc_dev.d_len > 0)
             {
-              /* Update the Ethernet header with the correct MAC address */
-
-#ifdef CONFIG_NET_IPv6
-              if (IFF_IS_IPv4(priv->bc_dev.d_flags))
-#endif
-                {
-                  arp_out(&priv->bc_dev);
-                }
-#ifdef CONFIG_NET_IPv6
-              else
-                {
-                  neighbor_out(&kel->bc_dev);
-                }
-#endif
-
               /* And send the packet */
 
               bcmf_transmit(priv, frame);
@@ -343,21 +325,6 @@ static void bcmf_receive(FAR struct bcmf_dev_s *priv)
 
           if (priv->bc_dev.d_len > 0)
             {
-              /* Update the Ethernet header with the correct MAC address */
-
-#ifdef CONFIG_NET_IPv4
-              if (IFF_IS_IPv4(priv->bc_dev.d_flags))
-                {
-                  arp_out(&priv->bc_dev);
-                }
-              else
-#endif
-#ifdef CONFIG_NET_IPv6
-                {
-                  neighbor_out(&priv->bc_dev);
-                }
-#endif
-
               /* And send the packet */
 
               bcmf_transmit(priv, frame);
diff --git a/net/devif/ipv4_input.c b/net/devif/ipv4_input.c
index d492fff50d..8a6a82c902 100644
--- a/net/devif/ipv4_input.c
+++ b/net/devif/ipv4_input.c
@@ -92,6 +92,7 @@
 #include <nuttx/net/netconfig.h>
 #include <nuttx/net/netdev.h>
 #include <nuttx/net/netstats.h>
+#include <nuttx/net/arp.h>
 #include <nuttx/net/ip.h>
 
 #include "inet/inet.h"
@@ -137,6 +138,11 @@ int ipv4_input(FAR struct net_driver_s *dev)
   in_addr_t destipaddr;
   uint16_t llhdrlen;
   uint16_t totlen;
+  int ret = OK;
+
+  /* Handle ARP on input then give the IPv4 packet to the network layer */
+
+  arp_ipin(dev);
 
   /* This is where the input processing starts. */
 
@@ -236,7 +242,8 @@ int ipv4_input(FAR struct net_driver_s *dev)
 
       ipv4_forward_broadcast(dev, ipv4);
 #endif
-      return udp_ipv4_input(dev);
+      ret = udp_ipv4_input(dev);
+      goto done;
     }
   else
 #endif
@@ -256,7 +263,8 @@ int ipv4_input(FAR struct net_driver_s *dev)
 
       ipv4_forward_broadcast(dev, ipv4);
 #endif
-      return udp_ipv4_input(dev);
+      ret = udp_ipv4_input(dev);
+      goto done;
     }
   else
 #endif
@@ -296,7 +304,7 @@ int ipv4_input(FAR struct net_driver_s *dev)
                * it was received on.
                */
 
-              return OK;
+              goto done;
             }
           else
 #endif
@@ -394,9 +402,15 @@ int ipv4_input(FAR struct net_driver_s *dev)
         goto drop;
     }
 
+done:
+  if (dev->d_len > 0)
+    {
+      arp_out(dev);
+    }
+
   /* Return and let the caller do any pending transmission. */
 
-  return OK;
+  return ret;
 
   /* Drop the packet.  NOTE that OK is returned meaning that the
    * packet has been processed (although processed unsuccessfully).
diff --git a/net/devif/ipv6_input.c b/net/devif/ipv6_input.c
index 33ebba3d76..fe54dd3d5d 100644
--- a/net/devif/ipv6_input.c
+++ b/net/devif/ipv6_input.c
@@ -372,7 +372,7 @@ int ipv6_input(FAR struct net_driver_s *dev)
                * it was received on.
                */
 
-              return OK;
+              goto done;
             }
           else
 #endif
@@ -505,6 +505,14 @@ int ipv6_input(FAR struct net_driver_s *dev)
         goto drop;
     }
 
+#ifdef CONFIG_NET_IPFORWARD
+done:
+#endif
+  if (dev->d_len > 0)
+    {
+      neighbor_out(dev);
+    }
+
   /* Return and let the caller do any pending transmission. */
 
   return OK;

Reply via email to