Networking: All Ethernet drivers: Call ipv6_input if IPv6 is enabled and an IPv6 packet is received
This commit is contained in:
parent
836a8b1625
commit
ac69e11a5f
@ -1,7 +1,7 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* arch/arm/src/c5471/c5471_ethernet.c
|
* arch/arm/src/c5471/c5471_ethernet.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007, 2009-2010, 2014 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2007, 2009-2010, 2014-2015 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
*
|
*
|
||||||
* Based one a C5471 Linux driver and released under this BSD license with
|
* Based one a C5471 Linux driver and released under this BSD license with
|
||||||
@ -1232,12 +1232,15 @@ static void c5471_receive(struct c5471_driver_s *c5471)
|
|||||||
|
|
||||||
/* We only accept IP packets of the configured type and ARP packets */
|
/* We only accept IP packets of the configured type and ARP packets */
|
||||||
|
|
||||||
#ifdef CONFIG_NET_IPv6
|
#ifdef CONFIG_NET_IPv4
|
||||||
if (BUF->type == HTONS(ETHTYPE_IP6))
|
|
||||||
#else
|
|
||||||
if (BUF->type == HTONS(ETHTYPE_IP))
|
if (BUF->type == HTONS(ETHTYPE_IP))
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
|
nllvdbg("IPv4 frame\n");
|
||||||
|
|
||||||
|
/* Handle ARP on input then give the IPv4 packet to the network
|
||||||
|
* layer
|
||||||
|
*/
|
||||||
|
|
||||||
arp_ipin(dev);
|
arp_ipin(dev);
|
||||||
ipv4_input(dev);
|
ipv4_input(dev);
|
||||||
|
|
||||||
@ -1249,11 +1252,57 @@ static void c5471_receive(struct c5471_driver_s *c5471)
|
|||||||
|
|
||||||
if (dev->d_len > 0 &&
|
if (dev->d_len > 0 &&
|
||||||
(EIM_TXDESC_OWN_HOST & getreg32(c5471->c_rxcpudesc)) == 0)
|
(EIM_TXDESC_OWN_HOST & getreg32(c5471->c_rxcpudesc)) == 0)
|
||||||
|
{
|
||||||
|
/* Update the Ethernet header with the correct MAC address */
|
||||||
|
|
||||||
|
#ifdef CONFIG_NET_IPv6
|
||||||
|
if (BUF->type == HTONS(ETHTYPE_IP))
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
arp_out(dev);
|
arp_out(dev);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* And send the packet */
|
||||||
|
|
||||||
c5471_transmit(c5471);
|
c5471_transmit(c5471);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
#endif
|
||||||
|
#ifdef CONFIG_NET_IPv6
|
||||||
|
if (BUF->type == HTONS(ETHTYPE_IP6))
|
||||||
|
{
|
||||||
|
nllvdbg("Iv6 frame\n");
|
||||||
|
|
||||||
|
/* Give the IPv6 packet to the network layer */
|
||||||
|
|
||||||
|
ipv6_input(dev);
|
||||||
|
|
||||||
|
/* If the above function invocation resulted in data that should be
|
||||||
|
* sent out on the network, the field d_len will set to a value > 0.
|
||||||
|
* Send that data now if ESM has let go of the RX descriptor giving us
|
||||||
|
* access rights to submit another Ethernet frame.
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (dev->d_len > 0 &&
|
||||||
|
(EIM_TXDESC_OWN_HOST & getreg32(c5471->c_rxcpudesc)) == 0)
|
||||||
|
{
|
||||||
|
#ifdef CONFIG_NET_IPv4
|
||||||
|
/* Update the Ethernet header with the correct MAC address */
|
||||||
|
|
||||||
|
if (BUF->type == HTONS(ETHTYPE_IP))
|
||||||
|
{
|
||||||
|
arp_out(dev);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* And send the packet */
|
||||||
|
|
||||||
|
c5471_transmit(c5471);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
#endif
|
||||||
#ifdef CONFIG_NET_ARP
|
#ifdef CONFIG_NET_ARP
|
||||||
else if (BUF->type == HTONS(ETHTYPE_ARP))
|
else if (BUF->type == HTONS(ETHTYPE_ARP))
|
||||||
{
|
{
|
||||||
|
@ -516,12 +516,15 @@ static void kinetis_receive(FAR struct kinetis_driver_s *priv)
|
|||||||
|
|
||||||
/* We only accept IP packets of the configured type and ARP packets */
|
/* We only accept IP packets of the configured type and ARP packets */
|
||||||
|
|
||||||
#ifdef CONFIG_NET_IPv6
|
#ifdef CONFIG_NET_IPv4
|
||||||
if (BUF->type == HTONS(ETHTYPE_IP6))
|
|
||||||
#else
|
|
||||||
if (BUF->type == HTONS(ETHTYPE_IP))
|
if (BUF->type == HTONS(ETHTYPE_IP))
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
|
nllvdbg("IPv4 frame\n");
|
||||||
|
|
||||||
|
/* Handle ARP on input then give the IPv4 packet to the network
|
||||||
|
* layer
|
||||||
|
*/
|
||||||
|
|
||||||
arp_ipin(&priv->dev);
|
arp_ipin(&priv->dev);
|
||||||
ipv4_input(&priv->dev);
|
ipv4_input(&priv->dev);
|
||||||
|
|
||||||
@ -530,13 +533,56 @@ static void kinetis_receive(FAR struct kinetis_driver_s *priv)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
if (priv->dev.d_len > 0)
|
if (priv->dev.d_len > 0)
|
||||||
|
{
|
||||||
|
/* Update the Ethernet header with the correct MAC address */
|
||||||
|
|
||||||
|
#ifdef CONFIG_NET_IPv6
|
||||||
|
if (BUF->type == HTONS(ETHTYPE_IP))
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
arp_out(&priv->dev);
|
arp_out(&priv->dev);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* And send the packet */
|
||||||
|
|
||||||
kinetis_transmit(priv);
|
kinetis_transmit(priv);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
#endif
|
||||||
|
#ifdef CONFIG_NET_IPv6
|
||||||
|
if (BUF->type == HTONS(ETHTYPE_IP6))
|
||||||
|
{
|
||||||
|
nllvdbg("Iv6 frame\n");
|
||||||
|
|
||||||
|
/* Give the IPv6 packet to the network layer */
|
||||||
|
|
||||||
|
ipv6_input(&priv->dev);
|
||||||
|
|
||||||
|
/* If the above function invocation resulted in data that should be
|
||||||
|
* sent out on the network, the field d_len will set to a value > 0.
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (priv->dev.d_len > 0)
|
||||||
|
{
|
||||||
|
#ifdef CONFIG_NET_IPv4
|
||||||
|
/* Update the Ethernet header with the correct MAC address */
|
||||||
|
|
||||||
|
if (BUF->type == HTONS(ETHTYPE_IP))
|
||||||
|
{
|
||||||
|
arp_out(&priv->dev);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* And send the packet */
|
||||||
|
|
||||||
|
kinetis_transmit(priv);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
#endif
|
||||||
#ifdef CONFIG_NET_ARP
|
#ifdef CONFIG_NET_ARP
|
||||||
else if (BUF->type == htons(ETHTYPE_ARP))
|
if (BUF->type == htons(ETHTYPE_ARP))
|
||||||
{
|
{
|
||||||
arp_arpin(&priv->dev);
|
arp_arpin(&priv->dev);
|
||||||
|
|
||||||
|
@ -230,7 +230,12 @@ struct lpc17_statistics_s
|
|||||||
uint32_t rx_ovrerrors; /* Number of Rx overrun error interrupts */
|
uint32_t rx_ovrerrors; /* Number of Rx overrun error interrupts */
|
||||||
uint32_t rx_errors; /* Number of Rx error interrupts (OR of other errors) */
|
uint32_t rx_errors; /* Number of Rx error interrupts (OR of other errors) */
|
||||||
uint32_t rx_packets; /* Number of packets received (sum of the following): */
|
uint32_t rx_packets; /* Number of packets received (sum of the following): */
|
||||||
uint32_t rx_ip; /* Number of Rx IP packets received */
|
#ifdef CONFIG_NET_IPv4
|
||||||
|
uint32_t rx_ip; /* Number of Rx IPv4 packets received */
|
||||||
|
#endif
|
||||||
|
#ifdef CONFIG_NET_IPv6
|
||||||
|
uint32_t rx_ipv6; /* Number of Rx IPv6 packets received */
|
||||||
|
#endif
|
||||||
uint32_t rx_arp; /* Number of Rx ARP packets received */
|
uint32_t rx_arp; /* Number of Rx ARP packets received */
|
||||||
uint32_t rx_dropped; /* Number of dropped, unsupported Rx packets */
|
uint32_t rx_dropped; /* Number of dropped, unsupported Rx packets */
|
||||||
uint32_t rx_pkterr; /* Number of dropped, error in Rx descriptor */
|
uint32_t rx_pkterr; /* Number of dropped, error in Rx descriptor */
|
||||||
@ -869,13 +874,14 @@ static void lpc17_rxdone(struct lpc17_driver_s *priv)
|
|||||||
|
|
||||||
/* We only accept IP packets of the configured type and ARP packets */
|
/* We only accept IP packets of the configured type and ARP packets */
|
||||||
|
|
||||||
#ifdef CONFIG_NET_IPv6
|
#ifdef CONFIG_NET_IPv4
|
||||||
if (BUF->type == HTONS(ETHTYPE_IP6))
|
|
||||||
#else
|
|
||||||
if (BUF->type == HTONS(ETHTYPE_IP))
|
if (BUF->type == HTONS(ETHTYPE_IP))
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
/* Handle the incoming Rx packet */
|
nllvdbg("IPv4 frame\n");
|
||||||
|
|
||||||
|
/* Handle ARP on input then give the IPv4 packet to the
|
||||||
|
* network layer
|
||||||
|
*/
|
||||||
|
|
||||||
EMAC_STAT(priv, rx_ip);
|
EMAC_STAT(priv, rx_ip);
|
||||||
arp_ipin(&priv->lp_dev);
|
arp_ipin(&priv->lp_dev);
|
||||||
@ -887,12 +893,56 @@ static void lpc17_rxdone(struct lpc17_driver_s *priv)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
if (priv->lp_dev.d_len > 0)
|
if (priv->lp_dev.d_len > 0)
|
||||||
|
{
|
||||||
|
/* Update the Ethernet header with the correct MAC address */
|
||||||
|
|
||||||
|
#ifdef CONFIG_NET_IPv6
|
||||||
|
if (BUF->type == HTONS(ETHTYPE_IP))
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
arp_out(&priv->lp_dev);
|
arp_out(&priv->lp_dev);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* And send the packet */
|
||||||
|
|
||||||
lpc17_response(priv);
|
lpc17_response(priv);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
#endif
|
||||||
|
#ifdef CONFIG_NET_IPv6
|
||||||
|
if (BUF->type == HTONS(ETHTYPE_IP6))
|
||||||
|
{
|
||||||
|
nllvdbg("Iv6 frame\n");
|
||||||
|
|
||||||
|
/* Give the IPv6 packet to the network layer */
|
||||||
|
|
||||||
|
EMAC_STAT(priv, rx_ipv6);
|
||||||
|
ipv6_input(&priv->lp_dev);
|
||||||
|
|
||||||
|
/* If the above function invocation resulted in data that
|
||||||
|
* should be sent out on the network, the field d_len will
|
||||||
|
* set to a value > 0.
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (priv->lp_dev.d_len > 0)
|
||||||
|
{
|
||||||
|
#ifdef CONFIG_NET_IPv4
|
||||||
|
/* Update the Ethernet header with the correct MAC address */
|
||||||
|
|
||||||
|
if (BUF->type == HTONS(ETHTYPE_IP))
|
||||||
|
{
|
||||||
|
arp_out(&priv->lp_dev);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* And send the packet */
|
||||||
|
|
||||||
|
lpc17_response(priv);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
#endif
|
||||||
#ifdef CONFIG_NET_ARP
|
#ifdef CONFIG_NET_ARP
|
||||||
if (BUF->type == htons(ETHTYPE_ARP))
|
if (BUF->type == htons(ETHTYPE_ARP))
|
||||||
{
|
{
|
||||||
|
@ -1137,18 +1137,18 @@ static void sam_receive(struct sam_emac_s *priv)
|
|||||||
{
|
{
|
||||||
nlldbg("DROPPED: Too big: %d\n", dev->d_len);
|
nlldbg("DROPPED: Too big: %d\n", dev->d_len);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
|
||||||
/* We only accept IP packets of the configured type and ARP packets */
|
/* We only accept IP packets of the configured type and ARP packets */
|
||||||
|
|
||||||
#ifdef CONFIG_NET_IPv6
|
#ifdef CONFIG_NET_IPv4
|
||||||
else if (BUF->type == HTONS(ETHTYPE_IP6))
|
if (BUF->type == HTONS(ETHTYPE_IP))
|
||||||
#else
|
|
||||||
else if (BUF->type == HTONS(ETHTYPE_IP))
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
nllvdbg("IP frame\n");
|
nllvdbg("IPv4 frame\n");
|
||||||
|
|
||||||
/* Handle ARP on input then give the IP packet to uIP */
|
/* Handle ARP on input then give the IPv4 packet to the network
|
||||||
|
* layer
|
||||||
|
*/
|
||||||
|
|
||||||
arp_ipin(&priv->dev);
|
arp_ipin(&priv->dev);
|
||||||
ipv4_input(&priv->dev);
|
ipv4_input(&priv->dev);
|
||||||
@ -1158,12 +1158,54 @@ static void sam_receive(struct sam_emac_s *priv)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
if (priv->dev.d_len > 0)
|
if (priv->dev.d_len > 0)
|
||||||
|
{
|
||||||
|
/* Update the Ethernet header with the correct MAC address */
|
||||||
|
|
||||||
|
#ifdef CONFIG_NET_IPv6
|
||||||
|
if (BUF->type == HTONS(ETHTYPE_IP))
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
arp_out(&priv->dev);
|
arp_out(&priv->dev);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* And send the packet */
|
||||||
|
|
||||||
sam_transmit(priv);
|
sam_transmit(priv);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
#endif
|
||||||
|
#ifdef CONFIG_NET_IPv6
|
||||||
|
if (BUF->type == HTONS(ETHTYPE_IP6))
|
||||||
|
{
|
||||||
|
nllvdbg("Iv6 frame\n");
|
||||||
|
|
||||||
|
/* Give the IPv6 packet to the network layer */
|
||||||
|
|
||||||
|
ipv6_input(&priv->dev);
|
||||||
|
|
||||||
|
/* If the above function invocation resulted in data that should be
|
||||||
|
* sent out on the network, the field d_len will set to a value > 0.
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (priv->dev.d_len > 0)
|
||||||
|
{
|
||||||
|
#ifdef CONFIG_NET_IPv4
|
||||||
|
/* Update the Ethernet header with the correct MAC address */
|
||||||
|
|
||||||
|
if (BUF->type == HTONS(ETHTYPE_IP))
|
||||||
|
{
|
||||||
|
arp_out(&priv->dev);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* And send the packet */
|
||||||
|
|
||||||
|
sam_transmit(priv);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
#endif
|
||||||
#ifdef CONFIG_NET_ARP
|
#ifdef CONFIG_NET_ARP
|
||||||
if (BUF->type == htons(ETHTYPE_ARP))
|
if (BUF->type == htons(ETHTYPE_ARP))
|
||||||
{
|
{
|
||||||
|
@ -1177,18 +1177,18 @@ static void sam_receive(struct sam_emac_s *priv)
|
|||||||
{
|
{
|
||||||
nlldbg("DROPPED: Too big: %d\n", dev->d_len);
|
nlldbg("DROPPED: Too big: %d\n", dev->d_len);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
|
||||||
/* We only accept IP packets of the configured type and ARP packets */
|
/* We only accept IP packets of the configured type and ARP packets */
|
||||||
|
|
||||||
#ifdef CONFIG_NET_IPv6
|
#ifdef CONFIG_NET_IPv4
|
||||||
else if (BUF->type == HTONS(ETHTYPE_IP6))
|
if (BUF->type == HTONS(ETHTYPE_IP))
|
||||||
#else
|
|
||||||
else if (BUF->type == HTONS(ETHTYPE_IP))
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
nllvdbg("IP frame\n");
|
nllvdbg("IPv4 frame\n");
|
||||||
|
|
||||||
/* Handle ARP on input then give the IP packet to uIP */
|
/* Handle ARP on input then give the IPv4 packet to the network
|
||||||
|
* layer
|
||||||
|
*/
|
||||||
|
|
||||||
arp_ipin(&priv->dev);
|
arp_ipin(&priv->dev);
|
||||||
ipv4_input(&priv->dev);
|
ipv4_input(&priv->dev);
|
||||||
@ -1198,12 +1198,54 @@ static void sam_receive(struct sam_emac_s *priv)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
if (priv->dev.d_len > 0)
|
if (priv->dev.d_len > 0)
|
||||||
|
{
|
||||||
|
/* Update the Ethernet header with the correct MAC address */
|
||||||
|
|
||||||
|
#ifdef CONFIG_NET_IPv6
|
||||||
|
if (BUF->type == HTONS(ETHTYPE_IP))
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
arp_out(&priv->dev);
|
arp_out(&priv->dev);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* And send the packet */
|
||||||
|
|
||||||
sam_transmit(priv);
|
sam_transmit(priv);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
#endif
|
||||||
|
#ifdef CONFIG_NET_IPv6
|
||||||
|
if (BUF->type == HTONS(ETHTYPE_IP6))
|
||||||
|
{
|
||||||
|
nllvdbg("Iv6 frame\n");
|
||||||
|
|
||||||
|
/* Give the IPv6 packet to the network layer */
|
||||||
|
|
||||||
|
ipv6_input(&priv->dev);
|
||||||
|
|
||||||
|
/* If the above function invocation resulted in data that should be
|
||||||
|
* sent out on the network, the field d_len will set to a value > 0.
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (priv->dev.d_len > 0)
|
||||||
|
{
|
||||||
|
#ifdef CONFIG_NET_IPv4
|
||||||
|
/* Update the Ethernet header with the correct MAC address */
|
||||||
|
|
||||||
|
if (BUF->type == HTONS(ETHTYPE_IP))
|
||||||
|
{
|
||||||
|
arp_out(&priv->dev);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* And send the packet */
|
||||||
|
|
||||||
|
sam_transmit(priv);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
#endif
|
||||||
#ifdef CONFIG_NET_ARP
|
#ifdef CONFIG_NET_ARP
|
||||||
if (BUF->type == htons(ETHTYPE_ARP))
|
if (BUF->type == htons(ETHTYPE_ARP))
|
||||||
{
|
{
|
||||||
|
@ -1503,18 +1503,18 @@ static void sam_receive(struct sam_emac_s *priv)
|
|||||||
{
|
{
|
||||||
nlldbg("DROPPED: Too big: %d\n", dev->d_len);
|
nlldbg("DROPPED: Too big: %d\n", dev->d_len);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
|
||||||
/* We only accept IP packets of the configured type and ARP packets */
|
/* We only accept IP packets of the configured type and ARP packets */
|
||||||
|
|
||||||
#ifdef CONFIG_NET_IPv6
|
#ifdef CONFIG_NET_IPv4
|
||||||
else if (BUF->type == HTONS(ETHTYPE_IP6))
|
if (BUF->type == HTONS(ETHTYPE_IP))
|
||||||
#else
|
|
||||||
else if (BUF->type == HTONS(ETHTYPE_IP))
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
nllvdbg("IP frame\n");
|
nllvdbg("IPv4 frame\n");
|
||||||
|
|
||||||
/* Handle ARP on input then give the IP packet to uIP */
|
/* Handle ARP on input then give the IPv4 packet to the network
|
||||||
|
* layer
|
||||||
|
*/
|
||||||
|
|
||||||
arp_ipin(&priv->dev);
|
arp_ipin(&priv->dev);
|
||||||
ipv4_input(&priv->dev);
|
ipv4_input(&priv->dev);
|
||||||
@ -1524,12 +1524,54 @@ static void sam_receive(struct sam_emac_s *priv)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
if (priv->dev.d_len > 0)
|
if (priv->dev.d_len > 0)
|
||||||
|
{
|
||||||
|
/* Update the Ethernet header with the correct MAC address */
|
||||||
|
|
||||||
|
#ifdef CONFIG_NET_IPv6
|
||||||
|
if (BUF->type == HTONS(ETHTYPE_IP))
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
arp_out(&priv->dev);
|
arp_out(&priv->dev);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* And send the packet */
|
||||||
|
|
||||||
sam_transmit(priv);
|
sam_transmit(priv);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
#endif
|
||||||
|
#ifdef CONFIG_NET_IPv6
|
||||||
|
if (BUF->type == HTONS(ETHTYPE_IP6))
|
||||||
|
{
|
||||||
|
nllvdbg("Iv6 frame\n");
|
||||||
|
|
||||||
|
/* Give the IPv6 packet to the network layer */
|
||||||
|
|
||||||
|
ipv6_input(&priv->dev);
|
||||||
|
|
||||||
|
/* If the above function invocation resulted in data that should be
|
||||||
|
* sent out on the network, the field d_len will set to a value > 0.
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (priv->dev.d_len > 0)
|
||||||
|
{
|
||||||
|
#ifdef CONFIG_NET_IPv4
|
||||||
|
/* Update the Ethernet header with the correct MAC address */
|
||||||
|
|
||||||
|
if (BUF->type == HTONS(ETHTYPE_IP))
|
||||||
|
{
|
||||||
|
arp_out(&priv->dev);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* And send the packet */
|
||||||
|
|
||||||
|
sam_transmit(priv);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
#endif
|
||||||
#ifdef CONFIG_NET_ARP
|
#ifdef CONFIG_NET_ARP
|
||||||
if (BUF->type == htons(ETHTYPE_ARP))
|
if (BUF->type == htons(ETHTYPE_ARP))
|
||||||
{
|
{
|
||||||
|
@ -1107,18 +1107,18 @@ static void sam_receive(struct sam_gmac_s *priv)
|
|||||||
{
|
{
|
||||||
nlldbg("DROPPED: Too big: %d\n", dev->d_len);
|
nlldbg("DROPPED: Too big: %d\n", dev->d_len);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
|
||||||
/* We only accept IP packets of the configured type and ARP packets */
|
/* We only accept IP packets of the configured type and ARP packets */
|
||||||
|
|
||||||
#ifdef CONFIG_NET_IPv6
|
#ifdef CONFIG_NET_IPv4
|
||||||
else if (BUF->type == HTONS(ETHTYPE_IP6))
|
if (BUF->type == HTONS(ETHTYPE_IP))
|
||||||
#else
|
|
||||||
else if (BUF->type == HTONS(ETHTYPE_IP))
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
nllvdbg("IP frame\n");
|
nllvdbg("IPv4 frame\n");
|
||||||
|
|
||||||
/* Handle ARP on input then give the IP packet to uIP */
|
/* Handle ARP on input then give the IPv4 packet to the network
|
||||||
|
* layer
|
||||||
|
*/
|
||||||
|
|
||||||
arp_ipin(&priv->dev);
|
arp_ipin(&priv->dev);
|
||||||
ipv4_input(&priv->dev);
|
ipv4_input(&priv->dev);
|
||||||
@ -1128,12 +1128,54 @@ static void sam_receive(struct sam_gmac_s *priv)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
if (priv->dev.d_len > 0)
|
if (priv->dev.d_len > 0)
|
||||||
|
{
|
||||||
|
/* Update the Ethernet header with the correct MAC address */
|
||||||
|
|
||||||
|
#ifdef CONFIG_NET_IPv6
|
||||||
|
if (BUF->type == HTONS(ETHTYPE_IP))
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
arp_out(&priv->dev);
|
arp_out(&priv->dev);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* And send the packet */
|
||||||
|
|
||||||
sam_transmit(priv);
|
sam_transmit(priv);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
#endif
|
||||||
|
#ifdef CONFIG_NET_IPv6
|
||||||
|
if (BUF->type == HTONS(ETHTYPE_IP6))
|
||||||
|
{
|
||||||
|
nllvdbg("Iv6 frame\n");
|
||||||
|
|
||||||
|
/* Give the IPv6 packet to the network layer */
|
||||||
|
|
||||||
|
ipv6_input(&priv->dev);
|
||||||
|
|
||||||
|
/* If the above function invocation resulted in data that should be
|
||||||
|
* sent out on the network, the field d_len will set to a value > 0.
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (priv->dev.d_len > 0)
|
||||||
|
{
|
||||||
|
#ifdef CONFIG_NET_IPv4
|
||||||
|
/* Update the Ethernet header with the correct MAC address */
|
||||||
|
|
||||||
|
if (BUF->type == HTONS(ETHTYPE_IP))
|
||||||
|
{
|
||||||
|
arp_out(&priv->dev);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* And send the packet */
|
||||||
|
|
||||||
|
sam_transmit(priv);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
#endif
|
||||||
#ifdef CONFIG_NET_ARP
|
#ifdef CONFIG_NET_ARP
|
||||||
if (BUF->type == htons(ETHTYPE_ARP))
|
if (BUF->type == htons(ETHTYPE_ARP))
|
||||||
{
|
{
|
||||||
|
@ -1613,18 +1613,18 @@ static void stm32_receive(FAR struct stm32_ethmac_s *priv)
|
|||||||
{
|
{
|
||||||
nlldbg("DROPPED: Too big: %d\n", dev->d_len);
|
nlldbg("DROPPED: Too big: %d\n", dev->d_len);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
|
||||||
/* We only accept IP packets of the configured type and ARP packets */
|
/* We only accept IP packets of the configured type and ARP packets */
|
||||||
|
|
||||||
#ifdef CONFIG_NET_IPv6
|
#ifdef CONFIG_NET_IPv4
|
||||||
else if (BUF->type == HTONS(ETHTYPE_IP6))
|
if (BUF->type == HTONS(ETHTYPE_IP))
|
||||||
#else
|
|
||||||
else if (BUF->type == HTONS(ETHTYPE_IP))
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
nllvdbg("IP frame\n");
|
nllvdbg("IPv4 frame\n");
|
||||||
|
|
||||||
/* Handle ARP on input then give the IP packet to uIP */
|
/* Handle ARP on input then give the IPv4 packet to the network
|
||||||
|
* layer
|
||||||
|
*/
|
||||||
|
|
||||||
arp_ipin(&priv->dev);
|
arp_ipin(&priv->dev);
|
||||||
ipv4_input(&priv->dev);
|
ipv4_input(&priv->dev);
|
||||||
@ -1634,12 +1634,54 @@ static void stm32_receive(FAR struct stm32_ethmac_s *priv)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
if (priv->dev.d_len > 0)
|
if (priv->dev.d_len > 0)
|
||||||
|
{
|
||||||
|
/* Update the Ethernet header with the correct MAC address */
|
||||||
|
|
||||||
|
#ifdef CONFIG_NET_IPv6
|
||||||
|
if (BUF->type == HTONS(ETHTYPE_IP))
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
arp_out(&priv->dev);
|
arp_out(&priv->dev);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* And send the packet */
|
||||||
|
|
||||||
stm32_transmit(priv);
|
stm32_transmit(priv);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
#endif
|
||||||
|
#ifdef CONFIG_NET_IPv6
|
||||||
|
if (BUF->type == HTONS(ETHTYPE_IP6))
|
||||||
|
{
|
||||||
|
nllvdbg("Iv6 frame\n");
|
||||||
|
|
||||||
|
/* Give the IPv6 packet to the network layer */
|
||||||
|
|
||||||
|
ipv6_input(&priv->dev);
|
||||||
|
|
||||||
|
/* If the above function invocation resulted in data that should be
|
||||||
|
* sent out on the network, the field d_len will set to a value > 0.
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (priv->dev.d_len > 0)
|
||||||
|
{
|
||||||
|
#ifdef CONFIG_NET_IPv4
|
||||||
|
/* Update the Ethernet header with the correct MAC address */
|
||||||
|
|
||||||
|
if (BUF->type == HTONS(ETHTYPE_IP))
|
||||||
|
{
|
||||||
|
arp_out(&priv->dev);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* And send the packet */
|
||||||
|
|
||||||
|
stm32_transmit(priv);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
#endif
|
||||||
#ifdef CONFIG_NET_ARP
|
#ifdef CONFIG_NET_ARP
|
||||||
if (BUF->type == htons(ETHTYPE_ARP))
|
if (BUF->type == htons(ETHTYPE_ARP))
|
||||||
{
|
{
|
||||||
|
@ -172,7 +172,12 @@ struct tiva_statistics_s
|
|||||||
{
|
{
|
||||||
uint32_t rx_int; /* Number of Rx interrupts received */
|
uint32_t rx_int; /* Number of Rx interrupts received */
|
||||||
uint32_t rx_packets; /* Number of packets received (sum of the following): */
|
uint32_t rx_packets; /* Number of packets received (sum of the following): */
|
||||||
uint32_t rx_ip; /* Number of Rx IP packets received */
|
#ifdef CONFIG_NET_IPv4
|
||||||
|
uint32_t rx_ip; /* Number of Rx IPv4 packets received */
|
||||||
|
#endif
|
||||||
|
#ifdef CONFIG_NET_IPv6
|
||||||
|
uint32_t rx_ipv6; /* Number of Rx IPv6 packets received */
|
||||||
|
#endif
|
||||||
uint32_t rx_arp; /* Number of Rx ARP packets received */
|
uint32_t rx_arp; /* Number of Rx ARP packets received */
|
||||||
uint32_t rx_dropped; /* Number of dropped, unsupported Rx packets */
|
uint32_t rx_dropped; /* Number of dropped, unsupported Rx packets */
|
||||||
uint32_t rx_pktsize; /* Number of dropped, too small or too big */
|
uint32_t rx_pktsize; /* Number of dropped, too small or too big */
|
||||||
@ -763,15 +768,16 @@ static void tiva_receive(struct tiva_driver_s *priv)
|
|||||||
|
|
||||||
/* We only accept IP packets of the configured type and ARP packets */
|
/* We only accept IP packets of the configured type and ARP packets */
|
||||||
|
|
||||||
#ifdef CONFIG_NET_IPv6
|
#ifdef CONFIG_NET_IPv4
|
||||||
if (ETHBUF->type == HTONS(ETHTYPE_IP6))
|
|
||||||
#else
|
|
||||||
if (ETHBUF->type == HTONS(ETHTYPE_IP))
|
if (ETHBUF->type == HTONS(ETHTYPE_IP))
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
nllvdbg("IP packet received (%02x)\n", ETHBUF->type);
|
nllvdbg("IPv4 frame\n");
|
||||||
EMAC_STAT(priv, rx_ip);
|
|
||||||
|
|
||||||
|
/* Handle ARP on input then give the IPv4 packet to the network
|
||||||
|
* layer
|
||||||
|
*/
|
||||||
|
|
||||||
|
EMAC_STAT(priv, rx_ip);
|
||||||
arp_ipin(&priv->ld_dev);
|
arp_ipin(&priv->ld_dev);
|
||||||
ipv4_input(&priv->ld_dev);
|
ipv4_input(&priv->ld_dev);
|
||||||
|
|
||||||
@ -780,12 +786,56 @@ static void tiva_receive(struct tiva_driver_s *priv)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
if (priv->ld_dev.d_len > 0)
|
if (priv->ld_dev.d_len > 0)
|
||||||
|
{
|
||||||
|
/* Update the Ethernet header with the correct MAC address */
|
||||||
|
|
||||||
|
#ifdef CONFIG_NET_IPv6
|
||||||
|
if (ETHBUF->type == HTONS(ETHTYPE_IP))
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
arp_out(&priv->ld_dev);
|
arp_out(&priv->ld_dev);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* And send the packet */
|
||||||
|
|
||||||
tiva_transmit(priv);
|
tiva_transmit(priv);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
#endif
|
||||||
|
#ifdef CONFIG_NET_IPv6
|
||||||
|
if (ETHBUF->type == HTONS(ETHTYPE_IP6))
|
||||||
|
{
|
||||||
|
nllvdbg("Iv6 frame\n");
|
||||||
|
|
||||||
|
/* Give the IPv6 packet to the network layer */
|
||||||
|
|
||||||
|
EMAC_STAT(priv, rx_ipv6);
|
||||||
|
arp_ipin(&priv->ld_dev);
|
||||||
|
ipv6_input(&priv->ld_dev);
|
||||||
|
|
||||||
|
/* If the above function invocation resulted in data that should be
|
||||||
|
* sent out on the network, the field d_len will set to a value > 0.
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (priv->dev.d_len > 0)
|
||||||
|
{
|
||||||
|
#ifdef CONFIG_NET_IPv4
|
||||||
|
/* Update the Ethernet header with the correct MAC address */
|
||||||
|
|
||||||
|
if (ETHBUF->type == HTONS(ETHTYPE_IP))
|
||||||
|
{
|
||||||
|
arp_out(&priv->ld_dev);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* And send the packet */
|
||||||
|
|
||||||
|
tiva_transmit(priv);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
#endif
|
||||||
#ifdef CONFIG_NET_ARP
|
#ifdef CONFIG_NET_ARP
|
||||||
if (ETHBUF->type == htons(ETHTYPE_ARP))
|
if (ETHBUF->type == htons(ETHTYPE_ARP))
|
||||||
{
|
{
|
||||||
|
@ -1680,18 +1680,18 @@ static void tiva_receive(FAR struct tiva_ethmac_s *priv)
|
|||||||
{
|
{
|
||||||
nlldbg("DROPPED: Too big: %d\n", dev->d_len);
|
nlldbg("DROPPED: Too big: %d\n", dev->d_len);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
|
||||||
/* We only accept IP packets of the configured type and ARP packets */
|
/* We only accept IP packets of the configured type and ARP packets */
|
||||||
|
|
||||||
#ifdef CONFIG_NET_IPv6
|
#ifdef CONFIG_NET_IPv4
|
||||||
else if (BUF->type == HTONS(ETHTYPE_IP6))
|
if (BUF->type == HTONS(ETHTYPE_IP))
|
||||||
#else
|
|
||||||
else if (BUF->type == HTONS(ETHTYPE_IP))
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
nvdbg("IP frame\n");
|
nllvdbg("IPv4 frame\n");
|
||||||
|
|
||||||
/* Handle ARP on input then give the IP packet to uIP */
|
/* Handle ARP on input then give the IPv4 packet to the network
|
||||||
|
* layer
|
||||||
|
*/
|
||||||
|
|
||||||
arp_ipin(&priv->dev);
|
arp_ipin(&priv->dev);
|
||||||
ipv4_input(&priv->dev);
|
ipv4_input(&priv->dev);
|
||||||
@ -1701,12 +1701,54 @@ static void tiva_receive(FAR struct tiva_ethmac_s *priv)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
if (priv->dev.d_len > 0)
|
if (priv->dev.d_len > 0)
|
||||||
|
{
|
||||||
|
/* Update the Ethernet header with the correct MAC address */
|
||||||
|
|
||||||
|
#ifdef CONFIG_NET_IPv6
|
||||||
|
if (BUF->type == HTONS(ETHTYPE_IP))
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
arp_out(&priv->dev);
|
arp_out(&priv->dev);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* And send the packet */
|
||||||
|
|
||||||
tiva_transmit(priv);
|
tiva_transmit(priv);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
#endif
|
||||||
|
#ifdef CONFIG_NET_IPv6
|
||||||
|
if (BUF->type == HTONS(ETHTYPE_IP6))
|
||||||
|
{
|
||||||
|
nllvdbg("Iv6 frame\n");
|
||||||
|
|
||||||
|
/* Give the IPv6 packet to the network layer */
|
||||||
|
|
||||||
|
ipv6_input(&priv->dev);
|
||||||
|
|
||||||
|
/* If the above function invocation resulted in data that should be
|
||||||
|
* sent out on the network, the field d_len will set to a value > 0.
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (priv->dev.d_len > 0)
|
||||||
|
{
|
||||||
|
#ifdef CONFIG_NET_IPv4
|
||||||
|
/* Update the Ethernet header with the correct MAC address */
|
||||||
|
|
||||||
|
if (BUF->type == HTONS(ETHTYPE_IP))
|
||||||
|
{
|
||||||
|
arp_out(&priv->dev);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* And send the packet */
|
||||||
|
|
||||||
|
tiva_transmit(priv);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
#endif
|
||||||
#ifdef CONFIG_NET_ARP
|
#ifdef CONFIG_NET_ARP
|
||||||
if (BUF->type == htons(ETHTYPE_ARP))
|
if (BUF->type == htons(ETHTYPE_ARP))
|
||||||
{
|
{
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* drivers/net/m9s12_ethernet.c
|
* drivers/net/m9s12_ethernet.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2011, 2014 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2011, 2014-2015 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@ -258,12 +258,15 @@ static void emac_receive(FAR struct emac_driver_s *priv)
|
|||||||
|
|
||||||
/* We only accept IP packets of the configured type and ARP packets */
|
/* We only accept IP packets of the configured type and ARP packets */
|
||||||
|
|
||||||
#ifdef CONFIG_NET_IPv6
|
#ifdef CONFIG_NET_IPv4
|
||||||
if (BUF->type == HTONS(ETHTYPE_IP6))
|
|
||||||
#else
|
|
||||||
if (BUF->type == HTONS(ETHTYPE_IP))
|
if (BUF->type == HTONS(ETHTYPE_IP))
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
|
nllvdbg("IPv4 frame\n");
|
||||||
|
|
||||||
|
/* Handle ARP on input then give the IPv4 packet to the network
|
||||||
|
* layer
|
||||||
|
*/
|
||||||
|
|
||||||
arp_ipin(&priv->d_dev);
|
arp_ipin(&priv->d_dev);
|
||||||
ipv4_input(&priv->d_dev);
|
ipv4_input(&priv->d_dev);
|
||||||
|
|
||||||
@ -272,13 +275,56 @@ static void emac_receive(FAR struct emac_driver_s *priv)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
if (priv->d_dev.d_len > 0)
|
if (priv->d_dev.d_len > 0)
|
||||||
|
{
|
||||||
|
/* Update the Ethernet header with the correct MAC address */
|
||||||
|
|
||||||
|
#ifdef CONFIG_NET_IPv6
|
||||||
|
if (BUF->type == HTONS(ETHTYPE_IP))
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
arp_out(&priv->d_dev);
|
arp_out(&priv->d_dev);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* And send the packet */
|
||||||
|
|
||||||
emac_transmit(priv);
|
emac_transmit(priv);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
#endif
|
||||||
|
#ifdef CONFIG_NET_IPv6
|
||||||
|
if (BUF->type == HTONS(ETHTYPE_IP6))
|
||||||
|
{
|
||||||
|
nllvdbg("Iv6 frame\n");
|
||||||
|
|
||||||
|
/* Give the IPv6 packet to the network layer */
|
||||||
|
|
||||||
|
ipv6_input(&priv->d_dev);
|
||||||
|
|
||||||
|
/* If the above function invocation resulted in data that should be
|
||||||
|
* sent out on the network, the field d_len will set to a value > 0.
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (priv->d_dev.d_len > 0)
|
||||||
|
{
|
||||||
|
#ifdef CONFIG_NET_IPv4
|
||||||
|
/* Update the Ethernet header with the correct MAC address */
|
||||||
|
|
||||||
|
if (BUF->type == HTONS(ETHTYPE_IP))
|
||||||
|
{
|
||||||
|
arp_out(&priv->d_dev);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* And send the packet */
|
||||||
|
|
||||||
|
emac_transmit(priv);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
#endif
|
||||||
#ifdef CONFIG_NET_ARP
|
#ifdef CONFIG_NET_ARP
|
||||||
else if (BUF->type == htons(ETHTYPE_ARP))
|
if (BUF->type == htons(ETHTYPE_ARP))
|
||||||
{
|
{
|
||||||
arp_arpin(&priv->d_dev);
|
arp_arpin(&priv->d_dev);
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* arch/arm/src/pic32mx/pic32mx_ethernet.c
|
* arch/arm/src/pic32mx/pic32mx_ethernet.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2012, 2014 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2012, 2014-2015 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
*
|
*
|
||||||
* This driver derives from the PIC32MX Ethernet Driver
|
* This driver derives from the PIC32MX Ethernet Driver
|
||||||
@ -297,7 +297,12 @@ struct pic32mx_statistics_s
|
|||||||
uint32_t rx_bufna; /* Number of Rx buffer not available errors */
|
uint32_t rx_bufna; /* Number of Rx buffer not available errors */
|
||||||
uint32_t rx_buse; /* Number of Rx BVCI bus errors */
|
uint32_t rx_buse; /* Number of Rx BVCI bus errors */
|
||||||
uint32_t rx_packets; /* Number of packets received (sum of the following): */
|
uint32_t rx_packets; /* Number of packets received (sum of the following): */
|
||||||
uint32_t rx_ip; /* Number of Rx IP packets received */
|
#ifdef CONFIG_NET_IPv4
|
||||||
|
uint32_t rx_ip; /* Number of Rx IPv4 packets received */
|
||||||
|
#endif
|
||||||
|
#ifdef CONFIG_NET_IPv6
|
||||||
|
uint32_t rx_ipv6; /* Number of Rx IPv6 packets received */
|
||||||
|
#endif
|
||||||
uint32_t rx_arp; /* Number of Rx ARP packets received */
|
uint32_t rx_arp; /* Number of Rx ARP packets received */
|
||||||
uint32_t rx_dropped; /* Number of dropped, unsupported Rx packets */
|
uint32_t rx_dropped; /* Number of dropped, unsupported Rx packets */
|
||||||
uint32_t rx_pkterr; /* Number of dropped, error in Rx descriptor */
|
uint32_t rx_pkterr; /* Number of dropped, error in Rx descriptor */
|
||||||
@ -1426,13 +1431,14 @@ static void pic32mx_rxdone(struct pic32mx_driver_s *priv)
|
|||||||
|
|
||||||
/* We only accept IP packets of the configured type and ARP packets */
|
/* We only accept IP packets of the configured type and ARP packets */
|
||||||
|
|
||||||
#ifdef CONFIG_NET_IPv6
|
#ifdef CONFIG_NET_IPv4
|
||||||
if (BUF->type == HTONS(ETHTYPE_IP6))
|
|
||||||
#else
|
|
||||||
if (BUF->type == HTONS(ETHTYPE_IP))
|
if (BUF->type == HTONS(ETHTYPE_IP))
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
/* Handle the incoming IP packet */
|
nllvdbg("IPv4 frame\n");
|
||||||
|
|
||||||
|
/* Handle ARP on input then give the IPv4 packet to the network
|
||||||
|
* layer
|
||||||
|
*/
|
||||||
|
|
||||||
EMAC_STAT(priv, rx_ip);
|
EMAC_STAT(priv, rx_ip);
|
||||||
arp_ipin(&priv->pd_dev);
|
arp_ipin(&priv->pd_dev);
|
||||||
@ -1444,12 +1450,56 @@ static void pic32mx_rxdone(struct pic32mx_driver_s *priv)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
if (priv->pd_dev.d_len > 0)
|
if (priv->pd_dev.d_len > 0)
|
||||||
|
{
|
||||||
|
/* Update the Ethernet header with the correct MAC address */
|
||||||
|
|
||||||
|
#ifdef CONFIG_NET_IPv6
|
||||||
|
if (BUF->type == HTONS(ETHTYPE_IP))
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
arp_out(&priv->pd_dev);
|
arp_out(&priv->pd_dev);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* And send the packet */
|
||||||
|
|
||||||
pic32mx_response(priv);
|
pic32mx_response(priv);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
#endif
|
||||||
|
#ifdef CONFIG_NET_IPv6
|
||||||
|
if (BUF->type == HTONS(ETHTYPE_IP6))
|
||||||
|
{
|
||||||
|
nllvdbg("Iv6 frame\n");
|
||||||
|
|
||||||
|
/* Give the IPv6 packet to the network layer */
|
||||||
|
|
||||||
|
EMAC_STAT(priv, rx_ipv6);
|
||||||
|
ipv6_input(&priv->pd_dev);
|
||||||
|
|
||||||
|
/* If the above function invocation resulted in data that
|
||||||
|
* should be sent out on the network, the field d_len will
|
||||||
|
* set to a value > 0.
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (priv->pd_dev.d_len > 0)
|
||||||
|
{
|
||||||
|
#ifdef CONFIG_NET_IPv4
|
||||||
|
/* Update the Ethernet header with the correct MAC address */
|
||||||
|
|
||||||
|
if (BUF->type == HTONS(ETHTYPE_IP))
|
||||||
|
{
|
||||||
|
arp_out(&priv->pd_dev);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* And send the packet */
|
||||||
|
|
||||||
|
pic32mx_response(priv);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
#endif
|
||||||
#ifdef CONFIG_NET_ARP
|
#ifdef CONFIG_NET_ARP
|
||||||
if (BUF->type == htons(ETHTYPE_ARP))
|
if (BUF->type == htons(ETHTYPE_ARP))
|
||||||
{
|
{
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* arch/sim/src/up_netdriver.c
|
* arch/sim/src/up_netdriver.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007, 2009-2012 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2007, 2009-2012, 2015 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
*
|
*
|
||||||
* Based on code from uIP which also has a BSD-like license:
|
* Based on code from uIP which also has a BSD-like license:
|
||||||
@ -159,12 +159,15 @@ void netdriver_loop(void)
|
|||||||
{
|
{
|
||||||
/* We only accept IP packets of the configured type and ARP packets */
|
/* We only accept IP packets of the configured type and ARP packets */
|
||||||
|
|
||||||
#ifdef CONFIG_NET_IPv6
|
#ifdef CONFIG_NET_IPv4
|
||||||
if (BUF->ether_type == htons(ETHTYPE_IP6))
|
if (BUF->type == HTONS(ETHTYPE_IP))
|
||||||
#else
|
|
||||||
if (BUF->ether_type == htons(ETHTYPE_IP))
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
|
nllvdbg("IPv4 frame\n");
|
||||||
|
|
||||||
|
/* Handle ARP on input then give the IPv4 packet to the network
|
||||||
|
* layer
|
||||||
|
*/
|
||||||
|
|
||||||
arp_ipin(&g_sim_dev);
|
arp_ipin(&g_sim_dev);
|
||||||
ipv4_input(&g_sim_dev);
|
ipv4_input(&g_sim_dev);
|
||||||
|
|
||||||
@ -174,13 +177,57 @@ void netdriver_loop(void)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
if (g_sim_dev.d_len > 0)
|
if (g_sim_dev.d_len > 0)
|
||||||
|
{
|
||||||
|
/* Update the Ethernet header with the correct MAC address */
|
||||||
|
|
||||||
|
#ifdef CONFIG_NET_IPv6
|
||||||
|
if (BUF->type == HTONS(ETHTYPE_IP))
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
arp_out(&g_sim_dev);
|
arp_out(&g_sim_dev);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* And send the packet */
|
||||||
|
|
||||||
netdev_send(g_sim_dev.d_buf, g_sim_dev.d_len);
|
netdev_send(g_sim_dev.d_buf, g_sim_dev.d_len);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
#endif
|
||||||
|
#ifdef CONFIG_NET_IPv6
|
||||||
|
if (BUF->type == HTONS(ETHTYPE_IP6))
|
||||||
|
{
|
||||||
|
nllvdbg("Iv6 frame\n");
|
||||||
|
|
||||||
|
/* Give the IPv6 packet to the network layer */
|
||||||
|
|
||||||
|
ipv6_input(&g_sim_dev);
|
||||||
|
|
||||||
|
/* If the above function invocation resulted in data that
|
||||||
|
* should be sent out on the network, the global variable
|
||||||
|
* d_len is set to a value > 0.
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (g_sim_dev.d_len > 0)
|
||||||
|
{
|
||||||
|
#ifdef CONFIG_NET_IPv4
|
||||||
|
/* Update the Ethernet header with the correct MAC address */
|
||||||
|
|
||||||
|
if (BUF->type == HTONS(ETHTYPE_IP))
|
||||||
|
{
|
||||||
|
arp_out(&g_sim_dev);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* And send the packet */
|
||||||
|
|
||||||
|
netdev_send(g_sim_dev.d_buf, g_sim_dev.d_len);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
#endif
|
||||||
#ifdef CONFIG_NET_ARP
|
#ifdef CONFIG_NET_ARP
|
||||||
else if (BUF->ether_type == htons(ETHTYPE_ARP))
|
if (BUF->ether_type == htons(ETHTYPE_ARP))
|
||||||
{
|
{
|
||||||
arp_arpin(&g_sim_dev);
|
arp_arpin(&g_sim_dev);
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* drivers/net/ez80_emac.c
|
* drivers/net/ez80_emac.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2009-2010, 2012, 2014 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2009-2010, 2012, 2014-2015 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
*
|
*
|
||||||
* References:
|
* References:
|
||||||
@ -246,7 +246,12 @@ struct ez80mac_statistics_s
|
|||||||
{
|
{
|
||||||
uint32_t rx_int; /* Number of Rx interrupts received */
|
uint32_t rx_int; /* Number of Rx interrupts received */
|
||||||
uint32_t rx_packets; /* Number of packets received (sum of the following): */
|
uint32_t rx_packets; /* Number of packets received (sum of the following): */
|
||||||
uint32_t rx_ip; /* Number of Rx IP packets received */
|
#ifdef CONFIG_NET_IPv4
|
||||||
|
uint32_t rx_ip; /* Number of Rx IPv4 packets received */
|
||||||
|
#endif
|
||||||
|
#ifdef CONFIG_NET_IPv6
|
||||||
|
uint32_t rx_ipv6; /* Number of Rx IPv6 packets received */
|
||||||
|
#endif
|
||||||
uint32_t rx_arp; /* Number of Rx ARP packets received */
|
uint32_t rx_arp; /* Number of Rx ARP packets received */
|
||||||
uint32_t rx_dropped; /* Number of dropped, unsupported Rx packets */
|
uint32_t rx_dropped; /* Number of dropped, unsupported Rx packets */
|
||||||
uint32_t rx_nok; /* Number of Rx packets received without OK bit */
|
uint32_t rx_nok; /* Number of Rx packets received without OK bit */
|
||||||
@ -1265,15 +1270,16 @@ static int ez80emac_receive(struct ez80emac_driver_s *priv)
|
|||||||
|
|
||||||
/* We only accept IP packets of the configured type and ARP packets */
|
/* We only accept IP packets of the configured type and ARP packets */
|
||||||
|
|
||||||
#ifdef CONFIG_NET_IPv6
|
#ifdef CONFIG_NET_IPv4
|
||||||
if (ETHBUF->type == HTONS(ETHTYPE_IP6))
|
|
||||||
#else
|
|
||||||
if (ETHBUF->type == HTONS(ETHTYPE_IP))
|
if (ETHBUF->type == HTONS(ETHTYPE_IP))
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
nvdbg("IP packet received (%02x)\n", ETHBUF->type);
|
nllvdbg("IPv4 frame\n");
|
||||||
EMAC_STAT(priv, rx_ip);
|
|
||||||
|
|
||||||
|
/* Handle ARP on input then give the IPv4 packet to the network
|
||||||
|
* layer
|
||||||
|
*/
|
||||||
|
|
||||||
|
EMAC_STAT(priv, rx_ip);
|
||||||
arp_ipin(&priv->dev);
|
arp_ipin(&priv->dev);
|
||||||
ipv4_input(&priv->dev);
|
ipv4_input(&priv->dev);
|
||||||
|
|
||||||
@ -1282,12 +1288,55 @@ static int ez80emac_receive(struct ez80emac_driver_s *priv)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
if (priv->dev.d_len > 0)
|
if (priv->dev.d_len > 0)
|
||||||
|
{
|
||||||
|
/* Update the Ethernet header with the correct MAC address */
|
||||||
|
|
||||||
|
#ifdef CONFIG_NET_IPv6
|
||||||
|
if (ETHBUF->type == HTONS(ETHTYPE_IP))
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
arp_out(&priv->dev);
|
arp_out(&priv->dev);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* And send the packet */
|
||||||
|
|
||||||
ez80emac_transmit(priv);
|
ez80emac_transmit(priv);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
#endif
|
||||||
|
#ifdef CONFIG_NET_IPv6
|
||||||
|
if (ETHBUF->type == HTONS(ETHTYPE_IP6))
|
||||||
|
{
|
||||||
|
nllvdbg("Iv6 frame\n");
|
||||||
|
|
||||||
|
/* Give the IPv6 packet to the network layer */
|
||||||
|
|
||||||
|
EMAC_STAT(priv, rx_ip);
|
||||||
|
ipv6_input(&priv->dev);
|
||||||
|
|
||||||
|
/* If the above function invocation resulted in data that should be
|
||||||
|
* sent out on the network, the field d_len will set to a value > 0.
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (priv->dev.d_len > 0)
|
||||||
|
{
|
||||||
|
#ifdef CONFIG_NET_IPv4
|
||||||
|
/* Update the Ethernet header with the correct MAC address */
|
||||||
|
|
||||||
|
if (ETHBUF->type == HTONS(ETHTYPE_IP))
|
||||||
|
{
|
||||||
|
arp_out(&priv->dev);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* And send the packet */
|
||||||
|
|
||||||
|
ez80emac_transmit(priv);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
#endif
|
||||||
#ifdef CONFIG_NET_ARP
|
#ifdef CONFIG_NET_ARP
|
||||||
if (ETHBUF->type == htons(ETHTYPE_ARP))
|
if (ETHBUF->type == htons(ETHTYPE_ARP))
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user