Networking: Add missing raw/packet socket support to all Ethernet drivers

This commit is contained in:
Gregory Nutt 2015-01-20 15:14:29 -06:00
parent 232dbeb800
commit a53ae59284
20 changed files with 226 additions and 21 deletions

View File

@ -62,6 +62,10 @@
#include <nuttx/net/arp.h>
#include <nuttx/net/netdev.h>
#ifdef CONFIG_NET_PKT
# include <nuttx/net/pkt.h>
#endif
#include "chip.h"
#include "up_arch.h"
#include "up_internal.h"
@ -1230,6 +1234,12 @@ static void c5471_receive(struct c5471_driver_s *c5471)
nvdbg("Received packet, packetlen: %d type: %02x\n", packetlen, ntohs(BUF->type));
c5471_dumpbuffer("Received packet", dev->d_buf, dev->d_len);
#ifdef CONFIG_NET_PKT
/* When packet sockets are enabled, feed the frame into the packet tap */
pkt_input(dev);
#endif
/* We only accept IP packets of the configured type and ARP packets */
#ifdef CONFIG_NET_IPv4

View File

@ -57,6 +57,10 @@
#include <nuttx/net/arp.h>
#include <nuttx/net/netdev.h>
#ifdef CONFIG_NET_PKT
# include <nuttx/net/pkt.h>
#endif
#include "up_arch.h"
#include "chip.h"
#include "kinetis_internal.h"
@ -514,6 +518,12 @@ static void kinetis_receive(FAR struct kinetis_driver_s *priv)
putreg32(ENET_RDAR, KINETIS_ENET_RDAR);
#ifdef CONFIG_NET_PKT
/* When packet sockets are enabled, feed the frame into the packet tap */
pkt_input(&priv->dev);
#endif
/* We only accept IP packets of the configured type and ARP packets */
#ifdef CONFIG_NET_IPv4

View File

@ -58,6 +58,10 @@
#include <nuttx/net/arp.h>
#include <nuttx/net/netdev.h>
#ifdef CONFIG_NET_PKT
# include <nuttx/net/pkt.h>
#endif
#include "up_arch.h"
#include "chip.h"
#include "chip/lpc17_syscon.h"
@ -872,6 +876,14 @@ static void lpc17_rxdone(struct lpc17_driver_s *priv)
lpc17_dumppacket("Received packet",
priv->lp_dev.d_buf, priv->lp_dev.d_len);
#ifdef CONFIG_NET_PKT
/* When packet sockets are enabled, feed the frame into the packet
* tap.
*/
pkt_input(&priv->lp_dev);
#endif
/* We only accept IP packets of the configured type and ARP packets */
#ifdef CONFIG_NET_IPv4

View File

@ -69,6 +69,10 @@
#include <nuttx/net/netdev.h>
#include <nuttx/net/phy.h>
#ifdef CONFIG_NET_PKT
# include <nuttx/net/pkt.h>
#endif
#include "up_arch.h"
#include "up_internal.h"
@ -1136,8 +1140,14 @@ static void sam_receive(struct sam_emac_s *priv)
if (dev->d_len > CONFIG_NET_ETH_MTU)
{
nlldbg("DROPPED: Too big: %d\n", dev->d_len);
continue;
}
else
#ifdef CONFIG_NET_PKT
/* When packet sockets are enabled, feed the frame into the packet tap */
pkt_input(&priv->dev);
#endif
/* We only accept IP packets of the configured type and ARP packets */

View File

@ -70,6 +70,10 @@
#include <nuttx/net/netdev.h>
#include <nuttx/net/phy.h>
#ifdef CONFIG_NET_PKT
# include <nuttx/net/pkt.h>
#endif
#include "up_arch.h"
#include "up_internal.h"
#include "cache.h"
@ -1176,8 +1180,14 @@ static void sam_receive(struct sam_emac_s *priv)
if (dev->d_len > CONFIG_NET_ETH_MTU)
{
nlldbg("DROPPED: Too big: %d\n", dev->d_len);
continue;
}
else
#ifdef CONFIG_NET_PKT
/* When packet sockets are enabled, feed the frame into the packet tap */
pkt_input(&priv->dev);
#endif
/* We only accept IP packets of the configured type and ARP packets */

View File

@ -84,6 +84,10 @@
#include <nuttx/net/netdev.h>
#include <nuttx/net/phy.h>
#ifdef CONFIG_NET_PKT
# include <nuttx/net/pkt.h>
#endif
#include "up_arch.h"
#include "up_internal.h"
#include "cache.h"
@ -1502,8 +1506,14 @@ static void sam_receive(struct sam_emac_s *priv)
if (dev->d_len > CONFIG_NET_ETH_MTU)
{
nlldbg("DROPPED: Too big: %d\n", dev->d_len);
continue;
}
else
#ifdef CONFIG_NET_PKT
/* When packet sockets are enabled, feed the frame into the packet tap */
pkt_input(&priv->dev);
#endif
/* We only accept IP packets of the configured type and ARP packets */

View File

@ -67,6 +67,10 @@
#include <nuttx/net/netdev.h>
#include <nuttx/net/phy.h>
#ifdef CONFIG_NET_PKT
# include <nuttx/net/pkt.h>
#endif
#include "up_arch.h"
#include "up_internal.h"
#include "cache.h"
@ -1106,8 +1110,14 @@ static void sam_receive(struct sam_gmac_s *priv)
if (dev->d_len > CONFIG_NET_ETH_MTU)
{
nlldbg("DROPPED: Too big: %d\n", dev->d_len);
continue;
}
else
#ifdef CONFIG_NET_PKT
/* When packet sockets are enabled, feed the frame into the packet tap */
pkt_input(&priv->dev);
#endif
/* We only accept IP packets of the configured type and ARP packets */

View File

@ -53,8 +53,8 @@
#include <nuttx/arch.h>
#include <nuttx/irq.h>
#include <nuttx/wdog.h>
#include <nuttx/net/mii.h>
#include <nuttx/net/mii.h>
#include <nuttx/net/arp.h>
#include <nuttx/net/netdev.h>
#if defined(CONFIG_NET_PKT)
@ -1612,8 +1612,14 @@ static void stm32_receive(FAR struct stm32_ethmac_s *priv)
if (dev->d_len > CONFIG_NET_ETH_MTU)
{
nlldbg("DROPPED: Too big: %d\n", dev->d_len);
continue;
}
else
#ifdef CONFIG_NET_PKT
/* When packet sockets are enabled, feed the frame into the packet tap */
pkt_input(&priv->dev);
#endif
/* We only accept IP packets of the configured type and ARP packets */

View File

@ -56,6 +56,10 @@
#include <nuttx/net/arp.h>
#include <nuttx/net/netdev.h>
#ifdef CONFIG_NET_PKT
# include <nuttx/net/pkt.h>
#endif
#include "chip.h"
#include "up_arch.h"
@ -766,6 +770,12 @@ static void tiva_receive(struct tiva_driver_s *priv)
priv->ld_dev.d_len = pktlen - 6;
tiva_dumppacket("Received packet", priv->ld_dev.d_buf, priv->ld_dev.d_len);
#ifdef CONFIG_NET_PKT
/* When packet sockets are enabled, feed the frame into the packet tap */
pkt_input(&priv->ld_dev);
#endif
/* We only accept IP packets of the configured type and ARP packets */
#ifdef CONFIG_NET_IPv4

View File

@ -55,6 +55,10 @@
#include <nuttx/net/arp.h>
#include <nuttx/net/netdev.h>
#ifdef CONFIG_NET_PKT
# include <nuttx/net/pkt.h>
#endif
/****************************************************************************
* Definitions
****************************************************************************/
@ -256,6 +260,12 @@ static void emac_receive(FAR struct emac_driver_s *priv)
* amount of data in priv->d_dev.d_len
*/
#ifdef CONFIG_NET_PKT
/* When packet sockets are enabled, feed the frame into the packet tap */
pkt_input(&priv->d_dev);
#endif
/* We only accept IP packets of the configured type and ARP packets */
#ifdef CONFIG_NET_IPv4

View File

@ -60,6 +60,10 @@
#include <nuttx/net/arp.h>
#include <nuttx/net/netdev.h>
#ifdef CONFIG_NET_PKT
# include <nuttx/net/pkt.h>
#endif
#include <arch/irq.h>
#include <arch/board/board.h>
@ -69,7 +73,7 @@
#include "pic32mx-ethernet.h"
#include "pic32mx-internal.h"
/* Does this chip have and ethernet controller? */
/* Does this chip have and Ethernet controller? */
#if CHIP_NETHERNET > 0
@ -1429,6 +1433,14 @@ static void pic32mx_rxdone(struct pic32mx_driver_s *priv)
pic32mx_dumppacket("Received packet",
priv->pd_dev.d_buf, priv->pd_dev.d_len);
#ifdef CONFIG_NET_PKT
/* When packet sockets are enabled, feed the frame into the packet
* tap.
*/
pkt_input(&priv->pd_dev);
#endif
/* We only accept IP packets of the configured type and ARP packets */
#ifdef CONFIG_NET_IPv4

View File

@ -56,6 +56,10 @@
#include <nuttx/net/netdev.h>
#include <nuttx/net/arp.h>
#ifdef CONFIG_NET_PKT
# include <nuttx/net/pkt.h>
#endif
#include "up_internal.h"
/****************************************************************************
@ -157,6 +161,14 @@ void netdriver_loop(void)
if (g_sim_dev.d_len > ETH_HDRLEN && up_comparemac(BUF->ether_dhost, &g_sim_dev.d_mac) == 0)
{
#ifdef CONFIG_NET_PKT
/* When packet sockets are enabled, feed the frame into the packet
* tap.
*/
pkt_input(&g_sim_dev);
#endif
/* We only accept IP packets of the configured type and ARP packets */
#ifdef CONFIG_NET_IPv4

View File

@ -60,6 +60,10 @@
#include <nuttx/net/arp.h>
#include <nuttx/net/netdev.h>
#ifdef CONFIG_NET_PKT
# include <nuttx/net/pkt.h>
#endif
#include <arch/io.h>
#include "chip.h"
@ -1268,6 +1272,12 @@ static int ez80emac_receive(struct ez80emac_driver_s *priv)
ez80emac_rrp(), rwp,
inp(EZ80_EMAC_BLKSLFT_H), inp(EZ80_EMAC_BLKSLFT_L));
#ifdef CONFIG_NET_PKT
/* When packet sockets are enabled, feed the frame into the packet tap */
pkt_input(&priv->dev);
#endif
/* We only accept IP packets of the configured type and ARP packets */
#ifdef CONFIG_NET_IPv4

View File

@ -55,6 +55,10 @@
#include <nuttx/net/arp.h>
#include <nuttx/net/netdev.h>
#ifdef CONFIG_NET_PKT
# include <nuttx/net/pkt.h>
#endif
/****************************************************************************
* Definitions
****************************************************************************/
@ -387,10 +391,12 @@ static void cs89x0_receive(struct cs89x0_driver_s *cs89x0, uint16_t isq)
{
cd89x0->cs_stats.rx_lengtherrors++;
}
if ((isq & RX_EXTRA_DATA) != 0)
{
cd89x0->cs_stats.rx_lengtherrors++;
}
if (isq & RX_CRC_ERROR) != 0)
{
if (!(isq & (RX_EXTRA_DATA|RX_RUNT)))
@ -398,6 +404,7 @@ static void cs89x0_receive(struct cs89x0_driver_s *cs89x0, uint16_t isq)
cd89x0->cs_stats.rx_crcerrors++;
}
}
if ((isq & RX_DRIBBLE) != 0)
{
cd89x0->cs_stats.rx_frameerrors++;
@ -431,6 +438,12 @@ static void cs89x0_receive(struct cs89x0_driver_s *cs89x0, uint16_t isq)
cd89x0->cs_stats.rx_packets++;
#endif
#ifdef CONFIG_NET_PKT
/* When packet sockets are enabled, feed the frame into the packet tap */
pkt_input(&cs89x0->cs_dev);
#endif
/* We only accept IP packets of the configured type and ARP packets */
#ifdef CONFIG_NET_IPv4
@ -454,7 +467,7 @@ static void cs89x0_receive(struct cs89x0_driver_s *cs89x0, uint16_t isq)
/* Update the Ethernet header with the correct MAC address */
#ifdef CONFIG_NET_IPv6
if (BUF->type == HTONS(ETHTYPE_IP))
if (IFF_IS_IPv4(cs89x0->cs_dev.d_flags))
#endif
{
arp_out(&cs89x0->cs_dev);
@ -485,7 +498,7 @@ static void cs89x0_receive(struct cs89x0_driver_s *cs89x0, uint16_t isq)
#ifdef CONFIG_NET_IPv4
/* Update the Ethernet header with the correct MAC address */
if (BUF->type == HTONS(ETHTYPE_IP))
if (IFF_IS_IPv4(cs89x0->cs_dev.d_flags))
{
arp_out(&cs89x0->cs_dev);
}

View File

@ -68,6 +68,10 @@
#include <nuttx/net/arp.h>
#include <nuttx/net/netdev.h>
#ifdef CONFIG_NET_PKT
# include <nuttx/net/pkt.h>
#endif
/****************************************************************************
* Definitions
****************************************************************************/
@ -978,6 +982,12 @@ static void dm9x_receive(struct dm9x_driver_s *dm9x)
dm9x->dm_dev.d_len = rx.desc.rx_len;
dm9x->dm_read(dm9x->dm_dev.d_buf, rx.desc.rx_len);
#ifdef CONFIG_NET_PKT
/* When packet sockets are enabled, feed the frame into the packet tap */
pkt_input(&dm9x->dm_dev);
#endif
/* We only accept IP packets of the configured type and ARP packets */
#ifdef CONFIG_NET_IPv4
@ -1001,7 +1011,7 @@ static void dm9x_receive(struct dm9x_driver_s *dm9x)
/* Update the Ethernet header with the correct MAC address */
#ifdef CONFIG_NET_IPv6
if (BUF->type == HTONS(ETHTYPE_IP))
if (IFF_IS_IPv4(dm9x->dm_dev.d_flags))
#endif
{
arp_out(&dm9x->dm_dev);
@ -1032,7 +1042,7 @@ static void dm9x_receive(struct dm9x_driver_s *dm9x)
#ifdef CONFIG_NET_IPv4
/* Update the Ethernet header with the correct MAC address */
if (BUF->type == HTONS(ETHTYPE_IP))
if (IFF_IS_IPv4(dm9x->dm_dev.d_flags))
{
arp_out(&dm9x->dm_dev);
}

View File

@ -58,6 +58,10 @@
#include <nuttx/net/arp.h>
#include <nuttx/net/netdev.h>
#ifdef CONFIG_NET_PKT
# include <nuttx/net/pkt.h>
#endif
#include <rgmp/pmap.h>
#include <rgmp/string.h>
#include <rgmp/stdio.h>
@ -565,6 +569,12 @@ static void e1000_receive(struct e1000_dev *e1000)
memcpy(e1000->netdev.d_buf, cp, cnt);
e1000->netdev.d_len = cnt;
#ifdef CONFIG_NET_PKT
/* When packet sockets are enabled, feed the frame into the packet tap */
pkt_input(&e1000->netdev);
#endif
/* We only accept IP packets of the configured type and ARP packets */
#ifdef CONFIG_NET_IPv4
@ -588,7 +598,7 @@ static void e1000_receive(struct e1000_dev *e1000)
/* Update the Ethernet header with the correct MAC address */
#ifdef CONFIG_NET_IPv6
if (BUF->type == HTONS(ETHTYPE_IP))
if (IFF_IS_IPv4(e1000->netdev.d_flags))
#endif
{
arp_out(&e1000->netdev);
@ -619,7 +629,7 @@ static void e1000_receive(struct e1000_dev *e1000)
#ifdef CONFIG_NET_IPv4
/* Update the Ethernet header with the correct MAC address */
if (BUF->type == HTONS(ETHTYPE_IP))
if (IFF_IS_IPv4(e1000->netdev.d_flags))
{
arp_out(&e1000->netdev);
}

View File

@ -66,6 +66,10 @@
#include <nuttx/net/arp.h>
#include <nuttx/net/netdev.h>
#ifdef CONFIG_NET_PKT
# include <nuttx/net/pkt.h>
#endif
#include "enc28j60.h"
/****************************************************************************
@ -1374,6 +1378,12 @@ static void enc_rxerif(FAR struct enc_driver_s *priv)
static void enc_rxdispatch(FAR struct enc_driver_s *priv)
{
#ifdef CONFIG_NET_PKT
/* When packet sockets are enabled, feed the frame into the packet tap */
pkt_input(&priv->dev);
#endif
/* We only accept IP packets of the configured type and ARP packets */
#ifdef CONFIG_NET_IPv4
@ -1397,7 +1407,7 @@ static void enc_rxdispatch(FAR struct enc_driver_s *priv)
/* Update the Ethernet header with the correct MAC address */
#ifdef CONFIG_NET_IPv6
if (BUF->type == HTONS(ETHTYPE_IP))
if (IFF_IS_IPv4(priv->dev.d_flags))
#endif
{
arp_out(&priv->dev);
@ -1428,7 +1438,7 @@ static void enc_rxdispatch(FAR struct enc_driver_s *priv)
#ifdef CONFIG_NET_IPv4
/* Update the Ethernet header with the correct MAC address */
if (BUF->type == HTONS(ETHTYPE_IP))
if (IFF_IS_IPv4(priv->dev.d_flags))
{
arp_out(&priv->dev);
}

View File

@ -72,6 +72,10 @@
#include <nuttx/net/netdev.h>
#include <nuttx/net/encx24j600.h>
#ifdef CONFIG_NET_PKT
# include <nuttx/net/pkt.h>
#endif
#include "encx24j600.h"
/****************************************************************************
@ -1493,6 +1497,12 @@ static void enc_rxdispatch(FAR struct enc_driver_s *priv)
enc_rxldpkt(priv, descr);
#ifdef CONFIG_NET_PKT
/* When packet sockets are enabled, feed the frame into the packet tap */
pkt_input(&priv->dev);
#endif
/* We only accept IP packets of the configured type and ARP packets */
#ifdef CONFIG_NET_IPv4
@ -1525,7 +1535,7 @@ static void enc_rxdispatch(FAR struct enc_driver_s *priv)
/* Update the Ethernet header with the correct MAC address */
#ifdef CONFIG_NET_IPv6
if (BUF->type == HTONS(ETHTYPE_IP))
if (IFF_IS_IPv4(priv->dev.d_flags))
#endif
{
arp_out(&priv->dev);
@ -1565,7 +1575,7 @@ static void enc_rxdispatch(FAR struct enc_driver_s *priv)
#ifdef CONFIG_NET_IPv4
/* Update the Ethernet header with the correct MAC address */
if (BUF->type == HTONS(ETHTYPE_IP))
if (IFF_IS_IPv4(priv->dev.d_flags))
{
arp_out(&priv->dev);
}

View File

@ -60,6 +60,10 @@
# include <nuttx/wqueue.h>
#endif
#ifdef CONFIG_NET_PKT
# include <nuttx/net/pkt.h>
#endif
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
@ -288,6 +292,12 @@ static void skel_receive(FAR struct skel_driver_s *skel)
* amount of data in skel->sk_dev.d_len
*/
#ifdef CONFIG_NET_PKT
/* When packet sockets are enabled, feed the frame into the packet tap */
pkt_input(&skel->sk_dev);
#endif
/* We only accept IP packets of the configured type and ARP packets */
#ifdef CONFIG_NET_IPv4
@ -311,7 +321,7 @@ static void skel_receive(FAR struct skel_driver_s *skel)
/* Update the Ethernet header with the correct MAC address */
#ifdef CONFIG_NET_IPv6
if (BUF->type == HTONS(ETHTYPE_IP))
if (IFF_IS_IPv4(skel->sk_dev.d_flags))
#endif
{
arp_out(&skel->sk_dev);
@ -342,7 +352,7 @@ static void skel_receive(FAR struct skel_driver_s *skel)
#ifdef CONFIG_NET_IPv4
/* Update the Ethernet header with the correct MAC address */
if (BUF->type == HTONS(ETHTYPE_IP))
if (IFF_IS_IPv4(skel->sk_dev.d_flags))
{
arp_out(&skel->sk_dev);
}

View File

@ -59,6 +59,10 @@
#include <nuttx/net/arp.h>
#include <nuttx/net/netdev.h>
#ifdef CONFIG_NET_PKT
# include <nuttx/net/pkt.h>
#endif
#include <rgmp/vnet.h>
#include <rgmp/stdio.h>
@ -301,6 +305,12 @@ void rtos_vnet_recv(struct rgmp_vnet *rgmp_vnet, char *data, int len)
memcpy(vnet->sk_dev.d_buf, data, len);
vnet->sk_dev.d_len = len;
#ifdef CONFIG_NET_PKT
/* When packet sockets are enabled, feed the frame into the packet tap */
pkt_input(&vnet->sk_dev);
#endif
/* We only accept IP packets of the configured type and ARP packets */
#ifdef CONFIG_NET_IPv4
@ -324,7 +334,7 @@ void rtos_vnet_recv(struct rgmp_vnet *rgmp_vnet, char *data, int len)
/* Update the Ethernet header with the correct MAC address */
#ifdef CONFIG_NET_IPv6
if (BUF->type == HTONS(ETHTYPE_IP))
if (IFF_IS_IPv4(vnet->sk_dev.d_flags))
#endif
{
arp_out(&vnet->sk_dev);
@ -355,7 +365,7 @@ void rtos_vnet_recv(struct rgmp_vnet *rgmp_vnet, char *data, int len)
#ifdef CONFIG_NET_IPv4
/* Update the Ethernet header with the correct MAC address */
if (BUF->type == HTONS(ETHTYPE_IP))
if (IFF_IS_IPv4(vnet->sk_dev.d_flags))
{
arp_out(&vnet->sk_dev);
}