mirror of
https://github.com/apache/nuttx.git
synced 2026-06-07 17:33:08 +08:00
Networking: Add missing raw/packet socket support to all Ethernet drivers
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 */
|
||||
|
||||
|
||||
@@ -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 */
|
||||
|
||||
|
||||
@@ -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 */
|
||||
|
||||
|
||||
@@ -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 */
|
||||
|
||||
|
||||
@@ -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 */
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user