net/devif: move preprocess of txpoll into common code

Signed-off-by: chao an <anchao@xiaomi.com>
This commit is contained in:
chao an 2022-11-27 03:31:07 +08:00 committed by Xiang Xiao
parent db88554d7d
commit 8850dee746
61 changed files with 744 additions and 2381 deletions

View File

@ -1015,36 +1015,6 @@ static int c5471_txpoll(struct net_driver_s *dev)
{ {
struct c5471_driver_s *priv = (struct c5471_driver_s *)dev->d_private; struct c5471_driver_s *priv = (struct c5471_driver_s *)dev->d_private;
/* If the polling resulted in data that should be sent out on the network,
* the field d_len is set to a value > 0.
*/
if (priv->c_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(priv->c_dev.d_flags))
#endif
{
arp_out(&priv->c_dev);
}
#endif /* CONFIG_NET_IPv4 */
#ifdef CONFIG_NET_IPv6
#ifdef CONFIG_NET_IPv4
else
#endif
{
neighbor_out(&priv->c_dev);
}
#endif /* CONFIG_NET_IPv6 */
if (!devif_loopback(&priv->c_dev))
{
/* Send the packet */ /* Send the packet */
c5471_transmit(priv); c5471_transmit(priv);
@ -1059,8 +1029,6 @@ static int c5471_txpoll(struct net_driver_s *dev)
return 1; return 1;
} }
}
}
/* If zero is returned, the polling will continue until all connections /* If zero is returned, the polling will continue until all connections
* have been examined. * have been examined.

View File

@ -1205,24 +1205,6 @@ static int gd32_tx_poll(struct net_driver_s *dev)
DEBUGASSERT(priv->dev.d_buf != NULL); DEBUGASSERT(priv->dev.d_buf != NULL);
/* If the polling resulted in data that should be sent out on the network,
* the field d_len is set to a value > 0.
*/
if (priv->dev.d_len > 0)
{
/* Look up the destination MAC address and add it to the Ethernet
* header.
*/
#ifdef CONFIG_NET_IPv4
arp_out(&priv->dev);
#endif /* CONFIG_NET_IPv4 */
if (!devif_loopback(&priv->dev))
{
/* Send the packet */ /* Send the packet */
gd32_transmit(priv); gd32_transmit(priv);
@ -1262,8 +1244,6 @@ static int gd32_tx_poll(struct net_driver_s *dev)
return -ENOMEM; return -ENOMEM;
} }
}
}
/* If zero is returned, the polling will continue until all connections /* If zero is returned, the polling will continue until all connections
* have been examined. * have been examined.

View File

@ -705,38 +705,6 @@ static int imx_txpoll(struct net_driver_s *dev)
struct imx_driver_s *priv = struct imx_driver_s *priv =
(struct imx_driver_s *)dev->d_private; (struct imx_driver_s *)dev->d_private;
/* If the polling resulted in data that should be sent out on the network,
* the field d_len is set to a value > 0.
*/
ninfo("Poll result: d_len=%d\n", priv->dev.d_len);
if (priv->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(priv->dev.d_flags))
#endif
{
arp_out(&priv->dev);
}
#endif /* CONFIG_NET_IPv4 */
#ifdef CONFIG_NET_IPv6
#ifdef CONFIG_NET_IPv4
else
#endif
{
neighbor_out(&priv->dev);
}
#endif /* CONFIG_NET_IPv6 */
if (!devif_loopback(&priv->dev))
{
/* Send the packet */ /* Send the packet */
imx_transmit(priv); imx_transmit(priv);
@ -751,8 +719,6 @@ static int imx_txpoll(struct net_driver_s *dev)
{ {
return -EBUSY; return -EBUSY;
} }
}
}
/* If zero is returned, the polling will continue until /* If zero is returned, the polling will continue until
* all connections have been examined. * all connections have been examined.

View File

@ -747,36 +747,6 @@ static int imxrt_txpoll(struct net_driver_s *dev)
struct imxrt_driver_s *priv = struct imxrt_driver_s *priv =
(struct imxrt_driver_s *)dev->d_private; (struct imxrt_driver_s *)dev->d_private;
/* If the polling resulted in data that should be sent out on the network,
* the field d_len is set to a value > 0.
*/
if (priv->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(priv->dev.d_flags))
#endif
{
arp_out(&priv->dev);
}
#endif /* CONFIG_NET_IPv4 */
#ifdef CONFIG_NET_IPv6
#ifdef CONFIG_NET_IPv4
else
#endif
{
neighbor_out(&priv->dev);
}
#endif /* CONFIG_NET_IPv6 */
if (!devif_loopback(&priv->dev))
{
/* Send the packet */ /* Send the packet */
imxrt_transmit(priv); imxrt_transmit(priv);
@ -791,8 +761,6 @@ static int imxrt_txpoll(struct net_driver_s *dev)
{ {
return -EBUSY; return -EBUSY;
} }
}
}
/* If zero is returned, the polling will continue until /* If zero is returned, the polling will continue until
* all connections have been examined. * all connections have been examined.

View File

@ -771,8 +771,6 @@ static int imxrt_txpoll(struct net_driver_s *dev)
flags = spin_lock_irqsave(NULL); flags = spin_lock_irqsave(NULL);
if (priv->dev.d_len > 0) if (priv->dev.d_len > 0)
{
if (!devif_loopback(&priv->dev))
{ {
imxrt_txdone(priv); imxrt_txdone(priv);
@ -790,7 +788,6 @@ static int imxrt_txpoll(struct net_driver_s *dev)
return -EBUSY; return -EBUSY;
} }
} }
}
spin_unlock_irqrestore(NULL, flags); spin_unlock_irqrestore(NULL, flags);

View File

@ -531,36 +531,6 @@ static int kinetis_txpoll(struct net_driver_s *dev)
struct kinetis_driver_s *priv = struct kinetis_driver_s *priv =
(struct kinetis_driver_s *)dev->d_private; (struct kinetis_driver_s *)dev->d_private;
/* If the polling resulted in data that should be sent out on the network,
* the field d_len is set to a value > 0.
*/
if (priv->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(priv->dev.d_flags))
#endif
{
arp_out(&priv->dev);
}
#endif /* CONFIG_NET_IPv4 */
#ifdef CONFIG_NET_IPv6
#ifdef CONFIG_NET_IPv4
else
#endif
{
neighbor_out(&priv->dev);
}
#endif /* CONFIG_NET_IPv6 */
if (!devif_loopback(&priv->dev))
{
/* Send the packet */ /* Send the packet */
kinetis_transmit(priv); kinetis_transmit(priv);
@ -575,8 +545,6 @@ static int kinetis_txpoll(struct net_driver_s *dev)
{ {
return -EBUSY; return -EBUSY;
} }
}
}
/* If zero is returned, the polling will continue until all connections /* If zero is returned, the polling will continue until all connections
* have been examined. * have been examined.

View File

@ -794,8 +794,6 @@ static int kinetis_txpoll(struct net_driver_s *dev)
*/ */
if (priv->dev.d_len > 0) if (priv->dev.d_len > 0)
{
if (!devif_loopback(&priv->dev))
{ {
kinetis_txdone(priv); kinetis_txdone(priv);
@ -817,7 +815,6 @@ static int kinetis_txpoll(struct net_driver_s *dev)
} }
} }
} }
}
/* If zero is returned, the polling will continue until all connections /* If zero is returned, the polling will continue until all connections
* have been examined. * have been examined.

View File

@ -1048,8 +1048,6 @@ static int lpc17can_txpoll(struct net_driver_s *dev)
*/ */
if (priv->dev.d_len > 0) if (priv->dev.d_len > 0)
{
if (!devif_loopback(&priv->dev))
{ {
/* Send the packet */ /* Send the packet */
@ -1064,7 +1062,6 @@ static int lpc17can_txpoll(struct net_driver_s *dev)
return -EBUSY; return -EBUSY;
} }
} }
}
/* If zero is returned, the polling will continue until all connections /* If zero is returned, the polling will continue until all connections
* have been examined. * have been examined.

View File

@ -712,38 +712,7 @@ static int lpc17_40_txpoll(struct net_driver_s *dev)
{ {
struct lpc17_40_driver_s *priv = struct lpc17_40_driver_s *priv =
(struct lpc17_40_driver_s *)dev->d_private; (struct lpc17_40_driver_s *)dev->d_private;
int ret = OK;
/* If the polling resulted in data that should be sent out on the network,
* the field d_len is set to a value > 0.
*/
if (priv->lp_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(priv->lp_dev.d_flags))
#endif
{
arp_out(&priv->lp_dev);
}
#endif /* CONFIG_NET_IPv4 */
#ifdef CONFIG_NET_IPv6
#ifdef CONFIG_NET_IPv4
else
#endif
{
neighbor_out(&priv->lp_dev);
}
#endif /* CONFIG_NET_IPv6 */
if (!devif_loopback(&priv->lp_dev))
{
/* Send this packet. In this context, we know that there is space /* Send this packet. In this context, we know that there is space
* for at least one more packet in the descriptor list. * for at least one more packet in the descriptor list.
*/ */
@ -754,15 +723,7 @@ static int lpc17_40_txpoll(struct net_driver_s *dev)
* not, return any non-zero value to terminate the poll. * not, return any non-zero value to terminate the poll.
*/ */
ret = lpc17_40_txdesc(priv); return lpc17_40_txdesc(priv);
}
}
/* If zero is returned, the polling will continue until all connections
* have been examined.
*/
return ret;
} }
/**************************************************************************** /****************************************************************************

View File

@ -1128,38 +1128,6 @@ static int lpc43_txpoll(struct net_driver_s *dev)
struct lpc43_ethmac_s *priv = struct lpc43_ethmac_s *priv =
(struct lpc43_ethmac_s *)dev->d_private; (struct lpc43_ethmac_s *)dev->d_private;
DEBUGASSERT(priv->dev.d_buf != NULL);
/* If the polling resulted in data that should be sent out on the network,
* the field d_len is set to a value > 0.
*/
if (priv->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(priv->dev.d_flags))
#endif
{
arp_out(&priv->dev);
}
#endif /* CONFIG_NET_IPv4 */
#ifdef CONFIG_NET_IPv6
#ifdef CONFIG_NET_IPv4
else
#endif
{
neighbor_out(&priv->dev);
}
#endif /* CONFIG_NET_IPv6 */
if (!devif_loopback(&priv->dev))
{
/* Send the packet */ /* Send the packet */
lpc43_transmit(priv); lpc43_transmit(priv);
@ -1199,12 +1167,6 @@ static int lpc43_txpoll(struct net_driver_s *dev)
return -ENOMEM; return -ENOMEM;
} }
}
}
/* If zero is returned, the polling will continue until all connections
* have been examined.
*/
return 0; return 0;
} }

View File

@ -757,36 +757,6 @@ static int lpc54_eth_txpoll(struct net_driver_s *dev)
DEBUGASSERT(dev->d_private != NULL && dev->d_buf != NULL); DEBUGASSERT(dev->d_private != NULL && dev->d_buf != NULL);
priv = (struct lpc54_ethdriver_s *)dev->d_private; priv = (struct lpc54_ethdriver_s *)dev->d_private;
/* If the polling resulted in data that should be sent out on the network,
* the field d_len is set to a value > 0.
*/
if (priv->eth_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(priv->eth_dev.d_flags))
#endif
{
arp_out(&priv->eth_dev);
}
#endif /* CONFIG_NET_IPv4 */
#ifdef CONFIG_NET_IPv6
#ifdef CONFIG_NET_IPv4
else
#endif
{
neighbor_out(&priv->eth_dev);
}
#endif /* CONFIG_NET_IPv6 */
if (!devif_loopback(&priv->eth_dev))
{
/* Send the packet */ /* Send the packet */
chan = lpc54_eth_getring(priv); chan = lpc54_eth_getring(priv);
@ -831,8 +801,6 @@ static int lpc54_eth_txpoll(struct net_driver_s *dev)
return 1; return 1;
} }
}
}
/* If zero is returned, the polling will continue until all connections /* If zero is returned, the polling will continue until all connections
* have been examined. If there is nothing to be sent, we will return to * have been examined. If there is nothing to be sent, we will return to

View File

@ -42,28 +42,7 @@ static void amebaz_netdev_notify_tx_done(struct amebaz_dev_s *priv)
static int amebaz_txpoll(struct net_driver_s *dev) static int amebaz_txpoll(struct net_driver_s *dev)
{ {
struct amebaz_dev_s *priv = (struct amebaz_dev_s *)dev->d_private; struct amebaz_dev_s *priv = (struct amebaz_dev_s *)dev->d_private;
if (priv->dev.d_len > 0)
{
#ifdef CONFIG_NET_IPv4
#ifdef CONFIG_NET_IPv6
if (IFF_IS_IPv4(priv->dev.d_flags))
#endif
{
arp_out(&priv->dev);
}
#endif /* CONFIG_NET_IPv4 */
#ifdef CONFIG_NET_IPv6
#ifdef CONFIG_NET_IPv4
else
#endif
{
neighbor_out(&priv->dev);
}
#endif /* CONFIG_NET_IPv6 */
if (!devif_loopback(&priv->dev))
{
net_lock(); net_lock();
if (!priv->curr) if (!priv->curr)
{ {
@ -82,10 +61,6 @@ static int amebaz_txpoll(struct net_driver_s *dev)
amebaz_netdev_notify_tx_done(priv); amebaz_netdev_notify_tx_done(priv);
return true; return true;
} }
}
return false;
}
static int amebaz_transmit(struct amebaz_dev_s *priv) static int amebaz_transmit(struct amebaz_dev_s *priv)
{ {

View File

@ -590,36 +590,6 @@ static int s32k1xx_txpoll(struct net_driver_s *dev)
struct s32k1xx_driver_s *priv = struct s32k1xx_driver_s *priv =
(struct s32k1xx_driver_s *)dev->d_private; (struct s32k1xx_driver_s *)dev->d_private;
/* If the polling resulted in data that should be sent out on the network,
* the field d_len is set to a value > 0.
*/
if (priv->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(priv->dev.d_flags))
#endif
{
arp_out(&priv->dev);
}
#endif /* CONFIG_NET_IPv4 */
#ifdef CONFIG_NET_IPv6
#ifdef CONFIG_NET_IPv4
else
#endif
{
neighbor_out(&priv->dev);
}
#endif /* CONFIG_NET_IPv6 */
if (!devif_loopback(&priv->dev))
{
/* Send the packet */ /* Send the packet */
s32k1xx_transmit(priv); s32k1xx_transmit(priv);
@ -634,8 +604,6 @@ static int s32k1xx_txpoll(struct net_driver_s *dev)
{ {
return -EBUSY; return -EBUSY;
} }
}
}
/* If zero is returned, the polling will continue until all connections /* If zero is returned, the polling will continue until all connections
* have been examined. * have been examined.

View File

@ -795,8 +795,6 @@ static int s32k1xx_txpoll(struct net_driver_s *dev)
*/ */
if (priv->dev.d_len > 0) if (priv->dev.d_len > 0)
{
if (!devif_loopback(&priv->dev))
{ {
s32k1xx_txdone(priv); s32k1xx_txdone(priv);
@ -818,7 +816,6 @@ static int s32k1xx_txpoll(struct net_driver_s *dev)
} }
} }
} }
}
/* If zero is returned, the polling will continue until all connections /* If zero is returned, the polling will continue until all connections
* have been examined. * have been examined.

View File

@ -796,34 +796,6 @@ static int s32k3xx_txpoll(struct net_driver_s *dev)
DEBUGASSERT(priv->dev.d_buf != NULL); DEBUGASSERT(priv->dev.d_buf != NULL);
/* If the polling resulted in data that should be sent out on the network,
* the field d_len is set to a value > 0.
*/
if (priv->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(priv->dev.d_flags))
#endif
{
arp_out(&priv->dev);
}
#endif /* CONFIG_NET_IPv4 */
#ifdef CONFIG_NET_IPv6
#ifdef CONFIG_NET_IPv4
else
#endif
{
neighbor_out(&priv->dev);
}
#endif /* CONFIG_NET_IPv6 */
/* Send the packet */ /* Send the packet */
s32k3xx_transmit(priv); s32k3xx_transmit(priv);
@ -867,7 +839,6 @@ static int s32k3xx_txpoll(struct net_driver_s *dev)
return -ENOMEM; return -ENOMEM;
} }
}
/* If zero is returned, the polling will continue until all connections /* If zero is returned, the polling will continue until all connections
* have been examined. * have been examined.

View File

@ -960,8 +960,6 @@ static int s32k3xx_txpoll(struct net_driver_s *dev)
*/ */
if (priv->dev.d_len > 0) if (priv->dev.d_len > 0)
{
if (!devif_loopback(&priv->dev))
{ {
s32k3xx_txdone(priv); s32k3xx_txdone(priv);
@ -983,7 +981,6 @@ static int s32k3xx_txpoll(struct net_driver_s *dev)
} }
} }
} }
}
/* If zero is returned, the polling will continue until all connections /* If zero is returned, the polling will continue until all connections
* have been examined. * have been examined.

View File

@ -831,36 +831,6 @@ static int sam_txpoll(struct net_driver_s *dev)
{ {
struct sam_emac_s *priv = (struct sam_emac_s *)dev->d_private; struct sam_emac_s *priv = (struct sam_emac_s *)dev->d_private;
/* If the polling resulted in data that should be sent out on the network,
* the field d_len is set to a value > 0.
*/
if (priv->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(priv->dev.d_flags))
#endif
{
arp_out(&priv->dev);
}
#endif /* CONFIG_NET_IPv4 */
#ifdef CONFIG_NET_IPv6
#ifdef CONFIG_NET_IPv4
else
#endif
{
neighbor_out(&priv->dev);
}
#endif /* CONFIG_NET_IPv6 */
if (!devif_loopback(&priv->dev))
{
/* Send the packet */ /* Send the packet */
sam_transmit(priv); sam_transmit(priv);
@ -877,8 +847,6 @@ static int sam_txpoll(struct net_driver_s *dev)
return -EBUSY; return -EBUSY;
} }
}
}
/* If zero is returned, the polling will continue until all connections /* If zero is returned, the polling will continue until all connections
* have been examined. * have been examined.

View File

@ -866,36 +866,6 @@ static int sam_txpoll(struct net_driver_s *dev)
{ {
struct sam_emac_s *priv = (struct sam_emac_s *)dev->d_private; struct sam_emac_s *priv = (struct sam_emac_s *)dev->d_private;
/* If the polling resulted in data that should be sent out on the network,
* the field d_len is set to a value > 0.
*/
if (priv->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(priv->dev.d_flags))
#endif
{
arp_out(&priv->dev);
}
#endif /* CONFIG_NET_IPv4 */
#ifdef CONFIG_NET_IPv6
#ifdef CONFIG_NET_IPv4
else
#endif
{
neighbor_out(&priv->dev);
}
#endif /* CONFIG_NET_IPv6 */
if (!devif_loopback(&priv->dev))
{
/* Send the packet */ /* Send the packet */
sam_transmit(priv); sam_transmit(priv);
@ -912,8 +882,6 @@ static int sam_txpoll(struct net_driver_s *dev)
return -EBUSY; return -EBUSY;
} }
}
}
/* If zero is returned, the polling will continue until all connections /* If zero is returned, the polling will continue until all connections
* have been examined. * have been examined.

View File

@ -1179,36 +1179,6 @@ static int sam_txpoll(struct net_driver_s *dev)
{ {
struct sam_emac_s *priv = (struct sam_emac_s *)dev->d_private; struct sam_emac_s *priv = (struct sam_emac_s *)dev->d_private;
/* If the polling resulted in data that should be sent out on the network,
* the field d_len is set to a value > 0.
*/
if (priv->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(priv->dev.d_flags))
#endif
{
arp_out(&priv->dev);
}
#endif /* CONFIG_NET_IPv4 */
#ifdef CONFIG_NET_IPv6
#ifdef CONFIG_NET_IPv4
else
#endif
{
neighbor_out(&priv->dev);
}
#endif /* CONFIG_NET_IPv6 */
if (!devif_loopback(&priv->dev))
{
/* Send the packet */ /* Send the packet */
sam_transmit(priv); sam_transmit(priv);
@ -1225,8 +1195,6 @@ static int sam_txpoll(struct net_driver_s *dev)
return -EBUSY; return -EBUSY;
} }
}
}
/* If zero is returned, the polling will continue until all connections /* If zero is returned, the polling will continue until all connections
* have been examined. * have been examined.

View File

@ -808,36 +808,6 @@ static int sam_txpoll(struct net_driver_s *dev)
{ {
struct sam_gmac_s *priv = (struct sam_gmac_s *)dev->d_private; struct sam_gmac_s *priv = (struct sam_gmac_s *)dev->d_private;
/* If the polling resulted in data that should be sent out on the network,
* the field d_len is set to a value > 0.
*/
if (priv->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(priv->dev.d_flags))
#endif
{
arp_out(&priv->dev);
}
#endif /* CONFIG_NET_IPv4 */
#ifdef CONFIG_NET_IPv6
#ifdef CONFIG_NET_IPv4
else
#endif
{
neighbor_out(&priv->dev);
}
#endif /* CONFIG_NET_IPv6 */
if (!devif_loopback(&priv->dev))
{
/* Send the packet */ /* Send the packet */
sam_transmit(priv); sam_transmit(priv);
@ -854,8 +824,6 @@ static int sam_txpoll(struct net_driver_s *dev)
return -EBUSY; return -EBUSY;
} }
}
}
/* If zero is returned, the polling will continue until all connections /* If zero is returned, the polling will continue until all connections
* have been examined. * have been examined.

View File

@ -796,36 +796,6 @@ static int sam_txpoll(struct net_driver_s *dev)
{ {
struct sam_gmac_s *priv = (struct sam_gmac_s *)dev->d_private; struct sam_gmac_s *priv = (struct sam_gmac_s *)dev->d_private;
/* If the polling resulted in data that should be sent out on the network,
* the field d_len is set to a value > 0.
*/
if (priv->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(priv->dev.d_flags))
#endif
{
arp_out(&priv->dev);
}
#endif /* CONFIG_NET_IPv4 */
#ifdef CONFIG_NET_IPv6
#ifdef CONFIG_NET_IPv4
else
#endif
{
neighbor_out(&priv->dev);
}
#endif /* CONFIG_NET_IPv6 */
if (!devif_loopback(&priv->dev))
{
/* Send the packet */ /* Send the packet */
sam_transmit(priv); sam_transmit(priv);
@ -842,8 +812,6 @@ static int sam_txpoll(struct net_driver_s *dev)
return -EBUSY; return -EBUSY;
} }
}
}
/* If zero is returned, the polling will continue until all connections /* If zero is returned, the polling will continue until all connections
* have been examined. * have been examined.

View File

@ -1470,36 +1470,6 @@ static int sam_txpoll(struct net_driver_s *dev)
{ {
struct sam_emac_s *priv = (struct sam_emac_s *)dev->d_private; struct sam_emac_s *priv = (struct sam_emac_s *)dev->d_private;
/* If the polling resulted in data that should be sent out on the network,
* the field d_len is set to a value > 0.
*/
if (priv->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(priv->dev.d_flags))
#endif
{
arp_out(&priv->dev);
}
#endif /* CONFIG_NET_IPv4 */
#ifdef CONFIG_NET_IPv6
#ifdef CONFIG_NET_IPv4
else
#endif
{
neighbor_out(&priv->dev);
}
#endif /* CONFIG_NET_IPv6 */
if (!devif_loopback(&priv->dev))
{
/* Send the packet */ /* Send the packet */
sam_transmit(priv, EMAC_QUEUE_0); sam_transmit(priv, EMAC_QUEUE_0);
@ -1516,8 +1486,6 @@ static int sam_txpoll(struct net_driver_s *dev)
return -EBUSY; return -EBUSY;
} }
}
}
/* If zero is returned, the polling will continue until all connections /* If zero is returned, the polling will continue until all connections
* have been examined. * have been examined.

View File

@ -1020,8 +1020,6 @@ static int stm32can_txpoll(struct net_driver_s *dev)
*/ */
if (priv->dev.d_len > 0) if (priv->dev.d_len > 0)
{
if (!devif_loopback(&priv->dev))
{ {
stm32can_txdone(priv); stm32can_txdone(priv);
@ -1038,7 +1036,6 @@ static int stm32can_txpoll(struct net_driver_s *dev)
return -EBUSY; return -EBUSY;
} }
} }
}
/* If zero is returned, the polling will continue until all connections /* If zero is returned, the polling will continue until all connections
* have been examined. * have been examined.

View File

@ -1246,36 +1246,6 @@ static int stm32_txpoll(struct net_driver_s *dev)
DEBUGASSERT(priv->dev.d_buf != NULL); DEBUGASSERT(priv->dev.d_buf != NULL);
/* If the polling resulted in data that should be sent out on the network,
* the field d_len is set to a value > 0.
*/
if (priv->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(priv->dev.d_flags))
#endif
{
arp_out(&priv->dev);
}
#endif /* CONFIG_NET_IPv4 */
#ifdef CONFIG_NET_IPv6
#ifdef CONFIG_NET_IPv4
else
#endif
{
neighbor_out(&priv->dev);
}
#endif /* CONFIG_NET_IPv6 */
if (!devif_loopback(&priv->dev))
{
/* Send the packet */ /* Send the packet */
stm32_transmit(priv); stm32_transmit(priv);
@ -1315,8 +1285,6 @@ static int stm32_txpoll(struct net_driver_s *dev)
return -ENOMEM; return -ENOMEM;
} }
}
}
/* If zero is returned, the polling will continue until all connections /* If zero is returned, the polling will continue until all connections
* have been examined. * have been examined.

View File

@ -3044,8 +3044,6 @@ static int fdcan_txpoll(struct net_driver_s *dev)
*/ */
if (priv->dev.d_len > 0) if (priv->dev.d_len > 0)
{
if (!devif_loopback(&priv->dev))
{ {
fdcan_txdone(priv); fdcan_txdone(priv);
@ -3062,7 +3060,6 @@ static int fdcan_txpoll(struct net_driver_s *dev)
return -EBUSY; return -EBUSY;
} }
} }
}
/* If zero is returned, the polling will continue until all connections /* If zero is returned, the polling will continue until all connections
* have been examined. * have been examined.

View File

@ -1044,8 +1044,6 @@ static int stm32can_txpoll(struct net_driver_s *dev)
*/ */
if (priv->dev.d_len > 0) if (priv->dev.d_len > 0)
{
if (!devif_loopback(&priv->dev))
{ {
stm32can_txdone(priv); stm32can_txdone(priv);
@ -1062,7 +1060,6 @@ static int stm32can_txpoll(struct net_driver_s *dev)
return -EBUSY; return -EBUSY;
} }
} }
}
/* If zero is returned, the polling will continue until all connections /* If zero is returned, the polling will continue until all connections
* have been examined. * have been examined.

View File

@ -1288,36 +1288,6 @@ static int stm32_txpoll(struct net_driver_s *dev)
DEBUGASSERT(priv->dev.d_buf != NULL); DEBUGASSERT(priv->dev.d_buf != NULL);
/* If the polling resulted in data that should be sent out on the network,
* the field d_len is set to a value > 0.
*/
if (priv->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(priv->dev.d_flags))
#endif
{
arp_out(&priv->dev);
}
#endif /* CONFIG_NET_IPv4 */
#ifdef CONFIG_NET_IPv6
#ifdef CONFIG_NET_IPv4
else
#endif
{
neighbor_out(&priv->dev);
}
#endif /* CONFIG_NET_IPv6 */
if (!devif_loopback(&priv->dev))
{
/* Send the packet */ /* Send the packet */
stm32_transmit(priv); stm32_transmit(priv);
@ -1357,8 +1327,6 @@ static int stm32_txpoll(struct net_driver_s *dev)
return -ENOMEM; return -ENOMEM;
} }
}
}
/* If zero is returned, the polling will continue until all connections /* If zero is returned, the polling will continue until all connections
* have been examined. * have been examined.

View File

@ -1323,34 +1323,6 @@ static int stm32_txpoll(struct net_driver_s *dev)
DEBUGASSERT(priv->dev.d_buf != NULL); DEBUGASSERT(priv->dev.d_buf != NULL);
/* If the polling resulted in data that should be sent out on the network,
* the field d_len is set to a value > 0.
*/
if (priv->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(priv->dev.d_flags))
#endif
{
arp_out(&priv->dev);
}
#endif /* CONFIG_NET_IPv4 */
#ifdef CONFIG_NET_IPv6
#ifdef CONFIG_NET_IPv4
else
#endif
{
neighbor_out(&priv->dev);
}
#endif /* CONFIG_NET_IPv6 */
/* Send the packet */ /* Send the packet */
stm32_transmit(priv); stm32_transmit(priv);
@ -1394,7 +1366,6 @@ static int stm32_txpoll(struct net_driver_s *dev)
return -ENOMEM; return -ENOMEM;
} }
}
/* If zero is returned, the polling will continue until all connections /* If zero is returned, the polling will continue until all connections
* have been examined. * have been examined.

View File

@ -933,8 +933,6 @@ static int fdcan_txpoll(struct net_driver_s *dev)
*/ */
if (priv->dev.d_len > 0) if (priv->dev.d_len > 0)
{
if (!devif_loopback(&priv->dev))
{ {
/* Send the packet */ /* Send the packet */
@ -949,7 +947,6 @@ static int fdcan_txpoll(struct net_driver_s *dev)
return -EBUSY; return -EBUSY;
} }
} }
}
/* If zero is returned, the polling will continue until all connections /* If zero is returned, the polling will continue until all connections
* have been examined. * have been examined.

View File

@ -603,54 +603,12 @@ static int tiva_transmit(struct tiva_driver_s *priv)
static int tiva_txpoll(struct net_driver_s *dev) static int tiva_txpoll(struct net_driver_s *dev)
{ {
struct tiva_driver_s *priv = (struct tiva_driver_s *)dev->d_private; struct tiva_driver_s *priv = (struct tiva_driver_s *)dev->d_private;
int ret = OK;
/* If the polling resulted in data that should be sent out on the network,
* the field d_len is set to a value > 0.
*/
ninfo("Poll result: d_len=%d\n", priv->ld_dev.d_len);
if (priv->ld_dev.d_len > 0)
{
DEBUGASSERT(!(tiva_ethin(priv, TIVA_MAC_TR_OFFSET) & MAC_TR_NEWTX));
/* 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(priv->ld_dev.d_flags))
#endif
{
arp_out(&priv->ld_dev);
}
#endif /* CONFIG_NET_IPv4 */
#ifdef CONFIG_NET_IPv6
#ifdef CONFIG_NET_IPv4
else
#endif
{
neighbor_out(&priv->ld_dev);
}
#endif /* CONFIG_NET_IPv6 */
if (!devif_loopback(&priv->ld_dev))
{
/* Send the packet. tiva_transmit() will return zero if the /* Send the packet. tiva_transmit() will return zero if the
* packet was successfully handled. * packet was successfully handled.
*/ */
ret = tiva_transmit(priv); return tiva_transmit(priv);
}
}
/* If zero is returned, the polling will continue until all connections
* have been examined.
*/
return ret;
} }
/**************************************************************************** /****************************************************************************

View File

@ -1246,36 +1246,6 @@ static int tiva_txpoll(struct net_driver_s *dev)
DEBUGASSERT(priv->dev.d_buf != NULL); DEBUGASSERT(priv->dev.d_buf != NULL);
/* If the polling resulted in data that should be sent out on the network,
* the field d_len is set to a value > 0.
*/
if (priv->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(priv->dev.d_flags))
#endif
{
arp_out(&priv->dev);
}
#endif /* CONFIG_NET_IPv4 */
#ifdef CONFIG_NET_IPv6
#ifdef CONFIG_NET_IPv4
else
#endif
{
neighbor_out(&priv->dev);
}
#endif /* CONFIG_NET_IPv6 */
if (!devif_loopback(&priv->dev))
{
/* Send the packet */ /* Send the packet */
tiva_transmit(priv); tiva_transmit(priv);
@ -1315,8 +1285,6 @@ static int tiva_txpoll(struct net_driver_s *dev)
return -ENOMEM; return -ENOMEM;
} }
}
}
/* If zero is returned, the polling will continue until all connections /* If zero is returned, the polling will continue until all connections
* have been examined. * have been examined.

View File

@ -199,46 +199,10 @@ static int emac_txpoll(struct net_driver_s *dev)
FAR struct emac_driver_s *priv = FAR struct emac_driver_s *priv =
(FAR struct emac_driver_s *)dev->d_private; (FAR struct emac_driver_s *)dev->d_private;
/* If the polling resulted in data that should be sent out on the network,
* the field d_len is set to a value > 0.
*/
if (priv->d_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(priv->d_dev.d_flags))
#endif
{
arp_out(&priv->d_dev);
}
#endif /* CONFIG_NET_IPv4 */
#ifdef CONFIG_NET_IPv6
#ifdef CONFIG_NET_IPv4
else
#endif
{
neighbor_out(&priv->d_dev);
}
#endif /* CONFIG_NET_IPv6 */
if (!devif_loopback(&priv->d_dev))
{
/* Send the packet */ /* Send the packet */
emac_transmit(priv); emac_transmit(priv);
/* Check if there is room in the device to hold another packet.
* If not, return a non-zero value to terminate the poll.
*/
}
}
/* If zero is returned, the polling will continue until all connections /* If zero is returned, the polling will continue until all connections
* have been examined. * have been examined.
*/ */

View File

@ -1119,38 +1119,7 @@ static int pic32mx_transmit(struct pic32mx_driver_s *priv)
static int pic32mx_txpoll(struct net_driver_s *dev) static int pic32mx_txpoll(struct net_driver_s *dev)
{ {
struct pic32mx_driver_s *priv = (struct pic32mx_driver_s *)dev->d_private; struct pic32mx_driver_s *priv = (struct pic32mx_driver_s *)dev->d_private;
int ret = OK;
/* If the polling resulted in data that should be sent out on the network,
* the field d_len is set to a value > 0.
*/
if (priv->pd_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(priv->pd_dev.d_flags))
#endif
{
arp_out(&priv->pd_dev);
}
#endif /* CONFIG_NET_IPv4 */
#ifdef CONFIG_NET_IPv6
#ifdef CONFIG_NET_IPv4
else
#endif
{
neighbor_out(&priv->pd_dev);
}
#endif /* CONFIG_NET_IPv6 */
if (!devif_loopback(&priv->pd_dev))
{
/* Send this packet. In this context, we know that there is space /* Send this packet. In this context, we know that there is space
* for at least one more packet in the descriptor list. * for at least one more packet in the descriptor list.
*/ */
@ -1181,14 +1150,12 @@ static int pic32mx_txpoll(struct net_driver_s *dev)
return -ENOMEM; return -ENOMEM;
} }
}
}
/* If zero is returned, the polling will continue until all connections /* If zero is returned, the polling will continue until all connections
* have been examined. * have been examined.
*/ */
return ret; return 0;
} }
/**************************************************************************** /****************************************************************************

View File

@ -1221,38 +1221,7 @@ static int pic32mz_transmit(struct pic32mz_driver_s *priv)
static int pic32mz_txpoll(struct net_driver_s *dev) static int pic32mz_txpoll(struct net_driver_s *dev)
{ {
struct pic32mz_driver_s *priv = (struct pic32mz_driver_s *)dev->d_private; struct pic32mz_driver_s *priv = (struct pic32mz_driver_s *)dev->d_private;
int ret = OK;
/* If the polling resulted in data that should be sent out on the network,
* the field d_len is set to a value > 0.
*/
if (priv->pd_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(priv->pd_dev.d_flags))
#endif
{
arp_out(&priv->pd_dev);
}
#endif /* CONFIG_NET_IPv4 */
#ifdef CONFIG_NET_IPv6
#ifdef CONFIG_NET_IPv4
else
#endif
{
neighbor_out(&priv->pd_dev);
}
#endif /* CONFIG_NET_IPv6 */
if (!devif_loopback(&priv->pd_dev))
{
/* Send this packet. In this context, we know that there is space /* Send this packet. In this context, we know that there is space
* for at least one more packet in the descriptor list. * for at least one more packet in the descriptor list.
*/ */
@ -1283,14 +1252,12 @@ static int pic32mz_txpoll(struct net_driver_s *dev)
return -ENOMEM; return -ENOMEM;
} }
}
}
/* If zero is returned, the polling will continue until all connections /* If zero is returned, the polling will continue until all connections
* have been examined. * have been examined.
*/ */
return ret; return 0;
} }
/**************************************************************************** /****************************************************************************

View File

@ -282,46 +282,10 @@ static int misoc_net_txpoll(struct net_driver_s *dev)
struct misoc_net_driver_s *priv = struct misoc_net_driver_s *priv =
(struct misoc_net_driver_s *)dev->d_private; (struct misoc_net_driver_s *)dev->d_private;
/* If the polling resulted in data that should be sent out on the network,
* the field d_len is set to a value > 0.
*/
if (priv->misoc_net_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(priv->misoc_net_dev.d_flags))
#endif
{
arp_out(&priv->misoc_net_dev);
}
#endif /* CONFIG_NET_IPv4 */
#ifdef CONFIG_NET_IPv6
#ifdef CONFIG_NET_IPv4
else
#endif
{
neighbor_out(&priv->misoc_net_dev);
}
#endif /* CONFIG_NET_IPv6 */
if (!devif_loopback(&priv->misoc_net_dev))
{
/* Send the packet */ /* Send the packet */
misoc_net_transmit(priv); misoc_net_transmit(priv);
/* Check if there is room in the device to hold another packet.
* If not, return a non-zero value to terminate the poll.
*/
}
}
/* If zero is returned, the polling will continue until all connections /* If zero is returned, the polling will continue until all connections
* have been examined. * have been examined.
*/ */

View File

@ -1047,36 +1047,6 @@ static int rx65n_txpoll(struct net_driver_s *dev)
DEBUGASSERT(priv->dev.d_buf != NULL); DEBUGASSERT(priv->dev.d_buf != NULL);
/* If the polling resulted in data that should be sent out on the network,
* the field d_len is set to a value > 0.
*/
if (priv->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(priv->dev.d_flags))
#endif
{
arp_out(&priv->dev);
}
#endif /* CONFIG_NET_IPv4 */
#ifdef CONFIG_NET_IPv6
#ifdef CONFIG_NET_IPv4
else
#endif
{
neighbor_out(&priv->dev);
}
#endif /* CONFIG_NET_IPv6 */
if (!devif_loopback(&priv->dev))
{
/* Send the packet */ /* Send the packet */
rx65n_transmit(priv); rx65n_transmit(priv);
@ -1116,8 +1086,6 @@ static int rx65n_txpoll(struct net_driver_s *dev)
return -ENOMEM; return -ENOMEM;
} }
}
}
/* If zero is returned, the polling will continue until all connections /* If zero is returned, the polling will continue until all connections
* have been examined. * have been examined.

View File

@ -372,39 +372,6 @@ static int bl602_net_txpoll(struct net_driver_s *dev)
struct bl602_net_driver_s *priv = struct bl602_net_driver_s *priv =
(struct bl602_net_driver_s *)dev->d_private; (struct bl602_net_driver_s *)dev->d_private;
if (priv->net_dev.d_len > 0)
{
DEBUGASSERT(priv->net_dev.d_buf);
/* 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(priv->net_dev.d_flags))
#endif
{
arp_out(&priv->net_dev);
}
#endif /* CONFIG_NET_IPv4 */
#ifdef CONFIG_NET_IPv6
#ifdef CONFIG_NET_IPv4
else
#endif
{
neighbor_out(&priv->net_dev);
}
#endif /* CONFIG_NET_IPv6 */
/* Check if the network is sending this packet to the IP address of
* this device. If so, just loop the packet back into the network but
* don't attempt to put it on the wire.
*/
if (!devif_loopback(&priv->net_dev))
{
/* Send the packet */ /* Send the packet */
bl602_net_transmit(priv); bl602_net_transmit(priv);
@ -422,14 +389,6 @@ static int bl602_net_txpoll(struct net_driver_s *dev)
return priv->net_dev.d_buf == NULL; return priv->net_dev.d_buf == NULL;
} }
}
/* If zero is returned, the polling will continue until all connections
* have been examined.
*/
return 0;
}
/**************************************************************************** /****************************************************************************
* Name: bl602_net_reply * Name: bl602_net_reply

View File

@ -883,34 +883,6 @@ static int wlan_txpoll(struct net_driver_s *dev)
DEBUGASSERT(dev->d_buf != NULL); DEBUGASSERT(dev->d_buf != NULL);
/* If the polling resulted in data that should be sent out on the network,
* the field d_len is set to a value > 0.
*/
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 */
wlan_cache_txpkt_tail(priv); wlan_cache_txpkt_tail(priv);
pktbuf = wlan_alloc_buffer(priv); pktbuf = wlan_alloc_buffer(priv);
@ -921,7 +893,6 @@ static int wlan_txpoll(struct net_driver_s *dev)
dev->d_buf = pktbuf->buffer; dev->d_buf = pktbuf->buffer;
dev->d_len = WLAN_BUF_SIZE; dev->d_len = WLAN_BUF_SIZE;
}
/* If zero is returned, the polling will continue until /* If zero is returned, the polling will continue until
* all connections have been examined. * all connections have been examined.

View File

@ -319,41 +319,9 @@ static int litex_txpoll(struct net_driver_s *dev)
DEBUGASSERT(priv->dev.d_buf != NULL); DEBUGASSERT(priv->dev.d_buf != NULL);
/* If the polling resulted in data that should be sent out on the network,
* the field d_len is set to a value > 0.
*/
if (priv->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(priv->dev.d_flags))
#endif
{
arp_out(&priv->dev);
}
#endif /* CONFIG_NET_IPv4 */
#ifdef CONFIG_NET_IPv6
#ifdef CONFIG_NET_IPv4
else
#endif
{
neighbor_out(&priv->dev);
}
#endif /* CONFIG_NET_IPv6 */
if (!devif_loopback(&priv->dev))
{
/* Send the packet */ /* Send the packet */
litex_transmit(priv); litex_transmit(priv);
}
}
/* If zero is returned, the polling will continue until all connections /* If zero is returned, the polling will continue until all connections
* have been examined. * have been examined.

View File

@ -1411,36 +1411,6 @@ static int mpfs_txpoll(struct net_driver_s *dev)
{ {
struct mpfs_ethmac_s *priv = (struct mpfs_ethmac_s *)dev->d_private; struct mpfs_ethmac_s *priv = (struct mpfs_ethmac_s *)dev->d_private;
/* If the polling resulted in data that should be sent out on the network,
* the field d_len is set to a value > 0.
*/
if (priv->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(priv->dev.d_flags))
#endif
{
arp_out(&priv->dev);
}
#endif /* CONFIG_NET_IPv4 */
#ifdef CONFIG_NET_IPv6
#ifdef CONFIG_NET_IPv4
else
#endif
{
neighbor_out(&priv->dev);
}
#endif /* CONFIG_NET_IPv6 */
if (!devif_loopback(&priv->dev))
{
/* Send the packet */ /* Send the packet */
mpfs_transmit(priv, 0); mpfs_transmit(priv, 0);
@ -1457,8 +1427,6 @@ static int mpfs_txpoll(struct net_driver_s *dev)
return -EBUSY; return -EBUSY;
} }
}
}
/* If zero is returned, the polling will continue until all connections /* If zero is returned, the polling will continue until all connections
* have been examined. * have been examined.

View File

@ -260,54 +260,11 @@ static int netdriver_txpoll(struct net_driver_s *dev)
UNUSED(devidx); UNUSED(devidx);
/* If the polling resulted in data that should be sent out on the network,
* the field d_len is set to a value > 0.
*/
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 */
if (!devif_loopback(dev))
{
/* Send the packet */ /* Send the packet */
NETDEV_TXPACKETS(dev); NETDEV_TXPACKETS(dev);
sim_netdev_send(devidx, dev->d_buf, dev->d_len); sim_netdev_send(devidx, dev->d_buf, dev->d_len);
NETDEV_TXDONE(dev); NETDEV_TXDONE(dev);
}
else
{
/* Calling txdone callback after loopback. NETDEV_TXDONE macro is
* already called in devif_loopback.
*
* TODO: Maybe a unified interface with txdone callback registered
* is needed, then we can let devif_loopback call this callback.
*/
netdriver_txdone_interrupt(dev);
}
}
/* If zero is returned, the polling will continue until all connections /* If zero is returned, the polling will continue until all connections
* have been examined. * have been examined.

View File

@ -1583,39 +1583,6 @@ static int emac_txpoll(struct net_driver_s *dev)
DEBUGASSERT(priv->dev.d_buf != NULL); DEBUGASSERT(priv->dev.d_buf != NULL);
/* If the polling resulted in data that should be sent out on the network,
* the field d_len is set to a value == 0.
*/
if (priv->dev.d_len == 0)
{
return 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(priv->dev.d_flags))
#endif
{
arp_out(&priv->dev);
}
#endif /* CONFIG_NET_IPv4 */
#ifdef CONFIG_NET_IPv6
#ifdef CONFIG_NET_IPv4
else
#endif
{
neighbor_out(&priv->dev);
}
#endif /* CONFIG_NET_IPv6 */
if (!devif_loopback(&priv->dev))
{
/* Send the packet */ /* Send the packet */
emac_transmit(priv); emac_transmit(priv);
@ -1642,7 +1609,6 @@ static int emac_txpoll(struct net_driver_s *dev)
} }
dev->d_len = EMAC_BUF_LEN; dev->d_len = EMAC_BUF_LEN;
}
/* If zero is returned, the polling will continue until all connections /* If zero is returned, the polling will continue until all connections
* have been examined. * have been examined.

View File

@ -880,34 +880,6 @@ static int wlan_txpoll(struct net_driver_s *dev)
DEBUGASSERT(dev->d_buf != NULL); DEBUGASSERT(dev->d_buf != NULL);
/* If the polling resulted in data that should be sent out on the network,
* the field d_len is set to a value > 0.
*/
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 */
wlan_cache_txpkt_tail(priv); wlan_cache_txpkt_tail(priv);
pktbuf = wlan_alloc_buffer(priv); pktbuf = wlan_alloc_buffer(priv);
@ -918,7 +890,6 @@ static int wlan_txpoll(struct net_driver_s *dev)
dev->d_buf = pktbuf->buffer; dev->d_buf = pktbuf->buffer;
dev->d_len = WLAN_BUF_SIZE; dev->d_len = WLAN_BUF_SIZE;
}
/* If zero is returned, the polling will continue until /* If zero is returned, the polling will continue until
* all connections have been examined. * all connections have been examined.

View File

@ -1151,52 +1151,12 @@ static int ez80emac_txpoll(FAR struct net_driver_s *dev)
{ {
FAR struct ez80emac_driver_s *priv = FAR struct ez80emac_driver_s *priv =
(FAR struct ez80emac_driver_s *)dev->d_private; (FAR struct ez80emac_driver_s *)dev->d_private;
int ret = 0;
/* If the polling resulted in data that should be sent out on the network,
* the field d_len is set to a value > 0.
*/
ninfo("Poll result: d_len=%d\n", priv->dev.d_len);
if (priv->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(priv->dev.d_flags))
#endif
{
arp_out(&priv->dev);
}
#endif /* CONFIG_NET_IPv4 */
#ifdef CONFIG_NET_IPv6
#ifdef CONFIG_NET_IPv4
else
#endif
{
neighbor_out(&priv->dev);
}
#endif /* CONFIG_NET_IPv6 */
if (!devif_loopback(&priv->dev))
{
/* Send the packet. ez80emac_transmit() will return zero if the /* Send the packet. ez80emac_transmit() will return zero if the
* packet was successfully handled. * packet was successfully handled.
*/ */
ret = ez80emac_transmit(priv); return ez80emac_transmit(priv);
}
}
/* If zero is returned, the polling will continue until all connections
* have been examined.
*/
return ret;
} }
/**************************************************************************** /****************************************************************************

View File

@ -782,36 +782,6 @@ static int dm9x_txpoll(FAR struct net_driver_s *dev)
FAR struct dm9x_driver_s *priv = FAR struct dm9x_driver_s *priv =
(FAR struct dm9x_driver_s *)dev->d_private; (FAR struct dm9x_driver_s *)dev->d_private;
/* If the polling resulted in data that should be sent out on the network,
* the field d_len is set to a value > 0.
*/
if (priv->dm_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(priv->dm_dev.d_flags))
#endif
{
arp_out(&priv->dm_dev);
}
#endif /* CONFIG_NET_IPv4 */
#ifdef CONFIG_NET_IPv6
#ifdef CONFIG_NET_IPv4
else
#endif
{
neighbor_out(&priv->dm_dev);
}
#endif /* CONFIG_NET_IPv6 */
if (!devif_loopback(&priv->dm_dev))
{
/* Send the packet */ /* Send the packet */
dm9x_transmit(priv); dm9x_transmit(priv);
@ -827,12 +797,6 @@ static int dm9x_txpoll(FAR struct net_driver_s *dev)
return 1; return 1;
} }
}
}
/* If zero is returned, the polling will continue until all connections
* have been examined.
*/
return 0; return 0;
} }

View File

@ -1175,37 +1175,6 @@ static int enc_txpoll(struct net_driver_s *dev)
{ {
FAR struct enc_driver_s *priv = (FAR struct enc_driver_s *)dev->d_private; FAR struct enc_driver_s *priv = (FAR struct enc_driver_s *)dev->d_private;
/* If the polling resulted in data that should be sent out on the network,
* the field d_len is set to a value > 0.
*/
ninfo("Poll result: d_len=%d\n", priv->dev.d_len);
if (priv->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(priv->dev.d_flags))
#endif
{
arp_out(&priv->dev);
}
#endif /* CONFIG_NET_IPv4 */
#ifdef CONFIG_NET_IPv6
#ifdef CONFIG_NET_IPv4
else
#endif
{
neighbor_out(&priv->dev);
}
#endif /* CONFIG_NET_IPv6 */
if (!devif_loopback(&priv->dev))
{
/* Send the packet */ /* Send the packet */
enc_transmit(priv); enc_transmit(priv);
@ -1214,14 +1183,6 @@ static int enc_txpoll(struct net_driver_s *dev)
return -EBUSY; return -EBUSY;
} }
}
/* If zero is returned, the polling will continue until all connections
* have been examined.
*/
return OK;
}
/**************************************************************************** /****************************************************************************
* Name: enc_linkstatus * Name: enc_linkstatus

View File

@ -1146,51 +1146,8 @@ static int enc_txenqueue(FAR struct enc_driver_s *priv)
static int enc_txpoll(struct net_driver_s *dev) static int enc_txpoll(struct net_driver_s *dev)
{ {
FAR struct enc_driver_s *priv = (FAR struct enc_driver_s *)dev->d_private; FAR struct enc_driver_s *priv = (FAR struct enc_driver_s *)dev->d_private;
int ret = OK;
/* If the polling resulted in data that should be sent out on the network, return enc_txenqueue(priv);
* the field d_len is set to a value > 0.
*/
ninfo("Poll result: d_len=%d\n", priv->dev.d_len);
if (priv->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(priv->dev.d_flags))
#endif
{
arp_out(&priv->dev);
}
#endif /* CONFIG_NET_IPv4 */
#ifdef CONFIG_NET_IPv6
#ifdef CONFIG_NET_IPv4
else
#endif
{
neighbor_out(&priv->dev);
}
#endif /* CONFIG_NET_IPv6 */
if (!devif_loopback(&priv->dev))
{
/* Send the packet */
ret = enc_txenqueue(priv);
}
}
/* If zero is returned, the polling will continue until all connections
* have been examined.
*/
return ret;
} }
/**************************************************************************** /****************************************************************************

View File

@ -345,46 +345,10 @@ static int ftmac100_txpoll(struct net_driver_s *dev)
FAR struct ftmac100_driver_s *priv = FAR struct ftmac100_driver_s *priv =
(FAR struct ftmac100_driver_s *)dev->d_private; (FAR struct ftmac100_driver_s *)dev->d_private;
/* If the polling resulted in data that should be sent out on the network,
* the field d_len is set to a value > 0.
*/
if (priv->ft_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(priv->ft_dev.d_flags))
#endif
{
arp_out(&priv->ft_dev);
}
#endif /* CONFIG_NET_IPv4 */
#ifdef CONFIG_NET_IPv6
#ifdef CONFIG_NET_IPv4
else
#endif
{
neighbor_out(&priv->ft_dev);
}
#endif /* CONFIG_NET_IPv6 */
if (!devif_loopback(&priv->ft_dev))
{
/* Send the packet */ /* Send the packet */
ftmac100_transmit(priv); ftmac100_transmit(priv);
/* Check if there is room in the device to hold another packet. If
* not, return a non-zero value to terminate the poll.
*/
}
}
/* If zero is returned, the polling will continue until all connections /* If zero is returned, the polling will continue until all connections
* have been examined. * have been examined.
*/ */

View File

@ -496,32 +496,6 @@ static int lan91c111_txpoll(FAR struct net_driver_s *dev)
{ {
FAR struct lan91c111_driver_s *priv = dev->d_private; FAR struct lan91c111_driver_s *priv = dev->d_private;
/* If the polling resulted in data that should be sent out on the network,
* the field d_len is set to a value > 0.
*/
if (dev->d_len > 0)
{
/* Look up the destination MAC address and add it to the Ethernet
* header.
*/
#ifdef CONFIG_NET_IPv4
if (IFF_IS_IPv4(dev->d_flags))
{
arp_out(dev);
}
#endif /* CONFIG_NET_IPv4 */
#ifdef CONFIG_NET_IPv6
if (IFF_IS_IPv6(dev->d_flags))
{
neighbor_out(dev);
}
#endif /* CONFIG_NET_IPv6 */
if (!devif_loopback(dev))
{
/* Send the packet */ /* Send the packet */
lan91c111_transmit(dev); lan91c111_transmit(dev);
@ -532,14 +506,6 @@ static int lan91c111_txpoll(FAR struct net_driver_s *dev)
return !(getreg16(priv, MIR_REG) & MIR_FREE_MASK); return !(getreg16(priv, MIR_REG) & MIR_FREE_MASK);
} }
}
/* If zero is returned, the polling will continue until all connections
* have been examined.
*/
return 0;
}
/**************************************************************************** /****************************************************************************
* Name: lan91c111_reply * Name: lan91c111_reply

View File

@ -255,32 +255,6 @@ static int net_rpmsg_drv_txpoll(FAR struct net_driver_s *dev)
FAR struct net_rpmsg_drv_s *priv = dev->d_private; FAR struct net_rpmsg_drv_s *priv = dev->d_private;
uint32_t size; uint32_t size;
/* If the polling resulted in data that should be sent out on the network,
* the field d_len is set to a value > 0.
*/
if (dev->d_len > 0)
{
/* Look up the destination MAC address and add it to the Ethernet
* header.
*/
#ifdef CONFIG_NET_IPv4
if (IFF_IS_IPv4(dev->d_flags))
{
arp_out(dev);
}
#endif /* CONFIG_NET_IPv4 */
#ifdef CONFIG_NET_IPv6
if (IFF_IS_IPv6(dev->d_flags))
{
neighbor_out(dev);
}
#endif /* CONFIG_NET_IPv6 */
if (!devif_loopback(dev))
{
/* Send the packet */ /* Send the packet */
net_rpmsg_drv_transmit(dev, true); net_rpmsg_drv_transmit(dev, true);
@ -298,14 +272,6 @@ static int net_rpmsg_drv_txpoll(FAR struct net_driver_s *dev)
return dev->d_buf == NULL; return dev->d_buf == NULL;
} }
}
/* If zero is returned, the polling will continue until all connections
* have been examined.
*/
return 0;
}
/**************************************************************************** /****************************************************************************
* Name: net_rpmsg_drv_reply * Name: net_rpmsg_drv_reply

View File

@ -255,51 +255,10 @@ static int skel_txpoll(FAR struct net_driver_s *dev)
FAR struct skel_driver_s *priv = FAR struct skel_driver_s *priv =
(FAR struct skel_driver_s *)dev->d_private; (FAR struct skel_driver_s *)dev->d_private;
/* If the polling resulted in data that should be sent out on the network,
* the field d_len is set to a value > 0.
*/
if (priv->sk_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(priv->sk_dev.d_flags))
#endif
{
arp_out(&priv->sk_dev);
}
#endif /* CONFIG_NET_IPv4 */
#ifdef CONFIG_NET_IPv6
#ifdef CONFIG_NET_IPv4
else
#endif
{
neighbor_out(&priv->sk_dev);
}
#endif /* CONFIG_NET_IPv6 */
/* Check if the network is sending this packet to the IP address of
* this device. If so, just loop the packet back into the network but
* don't attempt to put it on the wire.
*/
if (!devif_loopback(&priv->sk_dev))
{
/* Send the packet */ /* Send the packet */
skel_transmit(priv); skel_transmit(priv);
/* Check if there is room in the device to hold another packet.
* If not, return a non-zero value to terminate the poll.
*/
}
}
/* If zero is returned, the polling will continue until all connections /* If zero is returned, the polling will continue until all connections
* have been examined. * have been examined.
*/ */

View File

@ -355,17 +355,7 @@ static int slip_txpoll(FAR struct net_driver_s *dev)
FAR struct slip_driver_s *priv = FAR struct slip_driver_s *priv =
(FAR struct slip_driver_s *)dev->d_private; (FAR struct slip_driver_s *)dev->d_private;
/* If the polling resulted in data that should be sent out on the network,
* the field d_len is set to a value > 0.
*/
if (priv->dev.d_len > 0)
{
if (!devif_loopback(&priv->dev))
{
slip_transmit(priv); slip_transmit(priv);
}
}
/* If zero is returned, the polling will continue until all connections /* If zero is returned, the polling will continue until all connections
* have been examined. * have been examined.

View File

@ -358,32 +358,6 @@ static int tun_txpoll_tap(FAR struct net_driver_s *dev)
{ {
FAR struct tun_device_s *priv = (FAR struct tun_device_s *)dev->d_private; FAR struct tun_device_s *priv = (FAR struct tun_device_s *)dev->d_private;
/* If the polling resulted in data that should be sent out on the network,
* the field d_len is set to a value > 0.
*/
if (priv->dev.d_len > 0)
{
/* Look up the destination MAC address and add it to the Ethernet
* header.
*/
#ifdef CONFIG_NET_IPv4
if (IFF_IS_IPv4(priv->dev.d_flags))
{
arp_out(&priv->dev);
}
#endif /* CONFIG_NET_IPv4 */
#ifdef CONFIG_NET_IPv6
if (IFF_IS_IPv6(priv->dev.d_flags))
{
neighbor_out(&priv->dev);
}
#endif /* CONFIG_NET_IPv6 */
if (!devif_loopback(dev))
{
/* Send the packet */ /* Send the packet */
priv->read_d_len = priv->dev.d_len; priv->read_d_len = priv->dev.d_len;
@ -391,14 +365,6 @@ static int tun_txpoll_tap(FAR struct net_driver_s *dev)
return 1; return 1;
} }
}
/* If zero is returned, the polling will continue until all connections
* have been examined.
*/
return 0;
}
#endif #endif
/**************************************************************************** /****************************************************************************
@ -430,29 +396,11 @@ static int tun_txpoll_tun(FAR struct net_driver_s *dev)
{ {
FAR struct tun_device_s *priv = (FAR struct tun_device_s *)dev->d_private; FAR struct tun_device_s *priv = (FAR struct tun_device_s *)dev->d_private;
/* If the polling resulted in data that should be sent out on the network,
* the field d_len is set to a value > 0.
*/
if (priv->dev.d_len > 0)
{
if (!devif_loopback(dev))
{
/* Send the packet */
priv->read_d_len = priv->dev.d_len; priv->read_d_len = priv->dev.d_len;
tun_fd_transmit(priv); tun_fd_transmit(priv);
return 1; return 1;
} }
}
/* If zero is returned, the polling will continue until all connections
* have been examined.
*/
return 0;
}
/**************************************************************************** /****************************************************************************
* Name: tun_net_receive * Name: tun_net_receive

View File

@ -1186,37 +1186,6 @@ static int w5500_txpoll(FAR struct net_driver_s *dev)
FAR struct w5500_driver_s *self = FAR struct w5500_driver_s *self =
(FAR struct w5500_driver_s *)dev->d_private; (FAR struct w5500_driver_s *)dev->d_private;
/* If the polling resulted in data that should be sent out on the network,
* the field d_len is set to a value > 0.
*/
if (self->w_dev.d_len > 0)
{
/* Look up the destination MAC address and add it to the Ethernet
* header.
*/
#ifdef CONFIG_NET_IPv4
if (IFF_IS_IPv4(self->w_dev.d_flags))
{
arp_out(&self->w_dev);
}
#endif /* CONFIG_NET_IPv4 */
#ifdef CONFIG_NET_IPv6
if (IFF_IS_IPv6(self->w_dev.d_flags))
{
neighbor_out(&self->w_dev);
}
#endif /* CONFIG_NET_IPv6 */
/* Check if the network is sending this packet to the IP address of
* this device. If so, just loop the packet back into the network but
* don't attempt to put it on the wire.
*/
if (!devif_loopback(&self->w_dev))
{
/* Send the packet */ /* Send the packet */
w5500_transmit(self); w5500_transmit(self);
@ -1225,18 +1194,7 @@ static int w5500_txpoll(FAR struct net_driver_s *dev)
* If not, return a non-zero value to terminate the poll. * If not, return a non-zero value to terminate the poll.
*/ */
if (!w5500_txbuf_numfree(self)) return !w5500_txbuf_numfree(self);
{
return -EBUSY;
}
}
}
/* If zero is returned, the polling will continue until all connections
* have been examined.
*/
return OK;
} }
/**************************************************************************** /****************************************************************************

View File

@ -340,36 +340,6 @@ static int cdcecm_txpoll(FAR struct net_driver_s *dev)
FAR struct cdcecm_driver_s *priv = FAR struct cdcecm_driver_s *priv =
(FAR struct cdcecm_driver_s *)dev->d_private; (FAR struct cdcecm_driver_s *)dev->d_private;
/* If the polling resulted in data that should be sent out on the network,
* the field d_len is set to a value > 0.
*/
if (priv->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(priv->dev.d_flags))
#endif
{
arp_out(&priv->dev);
}
#endif /* CONFIG_NET_IPv4 */
#ifdef CONFIG_NET_IPv6
#ifdef CONFIG_NET_IPv4
else
#endif
{
neighbor_out(&priv->dev);
}
#endif /* CONFIG_NET_IPv6 */
if (!devif_loopback(&priv->dev))
{
/* Send the packet */ /* Send the packet */
cdcecm_transmit(priv); cdcecm_transmit(priv);
@ -380,14 +350,6 @@ static int cdcecm_txpoll(FAR struct net_driver_s *dev)
return 1; return 1;
} }
}
/* If zero is returned, the polling will continue until all connections
* have been examined.
*/
return 0;
}
/**************************************************************************** /****************************************************************************
* Name: cdcecm_reply * Name: cdcecm_reply

View File

@ -983,53 +983,13 @@ static void rndis_rxdispatch(FAR void *arg)
static int rndis_txpoll(FAR struct net_driver_s *dev) static int rndis_txpoll(FAR struct net_driver_s *dev)
{ {
FAR struct rndis_dev_s *priv = (FAR struct rndis_dev_s *)dev->d_private; FAR struct rndis_dev_s *priv = (FAR struct rndis_dev_s *)dev->d_private;
int ret = OK;
if (!priv->connected) if (!priv->connected)
{ {
return -EBUSY; return -EBUSY;
} }
/* If the polling resulted in data that should be sent out on the network, return rndis_transmit(priv);
* the field d_len is set to a value > 0.
*/
ninfo("Poll result: d_len=%d\n", priv->netdev.d_len);
if (priv->netdev.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(priv->netdev.d_flags))
#endif
{
arp_out(&priv->netdev);
}
#endif /* CONFIG_NET_IPv4 */
#ifdef CONFIG_NET_IPv6
#ifdef CONFIG_NET_IPv4
else
#endif
{
neighbor_out(&priv->netdev);
}
#endif /* CONFIG_NET_IPv6 */
if (!devif_loopback(&priv->netdev))
{
ret = rndis_transmit(priv);
}
}
/* If zero is returned, the polling will continue until all connections
* have been examined.
*/
return ret;
} }
/**************************************************************************** /****************************************************************************

View File

@ -2277,15 +2277,9 @@ static int cdcmbim_txpoll(struct net_driver_s *dev)
nxmutex_lock(&priv->lock); nxmutex_lock(&priv->lock);
if (priv->netdev.d_len > 0)
{
if (!devif_loopback(&priv->netdev))
{
/* Send the packet */ /* Send the packet */
cdcmbim_transmit(priv); cdcmbim_transmit(priv);
}
}
nxmutex_unlock(&priv->lock); nxmutex_unlock(&priv->lock);

View File

@ -436,36 +436,6 @@ static int bcmf_txpoll(FAR struct net_driver_s *dev)
{ {
FAR struct bcmf_dev_s *priv = (FAR struct bcmf_dev_s *)dev->d_private; FAR struct bcmf_dev_s *priv = (FAR struct bcmf_dev_s *)dev->d_private;
/* If the polling resulted in data that should be sent out on the network,
* the field d_len is set to a value > 0.
*/
if (priv->bc_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(priv->bc_dev.d_flags))
#endif
{
arp_out(&priv->bc_dev);
}
#endif /* CONFIG_NET_IPv4 */
#ifdef CONFIG_NET_IPv6
#ifdef CONFIG_NET_IPv4
else
#endif
{
neighbor_out(&priv->bc_dev);
}
#endif /* CONFIG_NET_IPv6 */
if (!devif_loopback(&priv->bc_dev))
{
/* Send the packet */ /* Send the packet */
bcmf_transmit(priv, priv->cur_tx_frame); bcmf_transmit(priv, priv->cur_tx_frame);
@ -477,14 +447,6 @@ static int bcmf_txpoll(FAR struct net_driver_s *dev)
priv->cur_tx_frame = NULL; priv->cur_tx_frame = NULL;
return 1; return 1;
} }
}
/* If zero is returned, the polling will continue until all connections
* have been examined.
*/
return 0;
}
/**************************************************************************** /****************************************************************************
* Function: bcmf_tx_poll_work * Function: bcmf_tx_poll_work

View File

@ -594,23 +594,6 @@ int devif_poll(FAR struct net_driver_s *dev, devif_poll_callback_t callback);
void neighbor_out(FAR struct net_driver_s *dev); void neighbor_out(FAR struct net_driver_s *dev);
#endif /* CONFIG_NET_IPv6 */ #endif /* CONFIG_NET_IPv6 */
/****************************************************************************
* Name: devif_loopback
*
* Description:
* This function should be called before sending out a packet. The function
* checks the destination address of the packet to see whether the target
* of packet is ourself and then consume the packet directly by calling
* input process functions.
*
* Returned Value:
* Zero is returned if the packet don't loop back to ourself, otherwise
* a non-zero value is returned.
*
****************************************************************************/
int devif_loopback(FAR struct net_driver_s *dev);
/**************************************************************************** /****************************************************************************
* Name: netdev_ifup / netdev_ifdown * Name: netdev_ifup / netdev_ifdown
* *

View File

@ -528,6 +528,23 @@ void devif_can_send(FAR struct net_driver_s *dev, FAR const void *buf,
int devif_out(FAR struct net_driver_s *dev, devif_poll_callback_t callback); int devif_out(FAR struct net_driver_s *dev, devif_poll_callback_t callback);
/****************************************************************************
* Name: devif_loopback
*
* Description:
* This function should be called before sending out a packet. The function
* checks the destination address of the packet to see whether the target
* of packet is ourself and then consume the packet directly by calling
* input process functions.
*
* Returned Value:
* Zero is returned if the packet don't loop back to ourself, otherwise
* a non-zero value is returned.
*
****************************************************************************/
int devif_loopback(FAR struct net_driver_s *dev);
#undef EXTERN #undef EXTERN
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -31,6 +31,7 @@
#include <nuttx/net/netconfig.h> #include <nuttx/net/netconfig.h>
#include <nuttx/net/netdev.h> #include <nuttx/net/netdev.h>
#include <nuttx/net/net.h> #include <nuttx/net/net.h>
#include <nuttx/net/arp.h>
#include "devif/devif.h" #include "devif/devif.h"
#include "arp/arp.h" #include "arp/arp.h"
@ -785,11 +786,43 @@ int devif_poll(FAR struct net_driver_s *dev, devif_poll_callback_t callback)
int devif_out(FAR struct net_driver_s *dev, devif_poll_callback_t callback) int devif_out(FAR struct net_driver_s *dev, devif_poll_callback_t callback)
{ {
int bstop;
if (dev->d_len == 0) if (dev->d_len == 0)
{ {
return 0; return 0;
} }
bstop = devif_loopback(dev);
if (bstop)
{
return bstop;
}
#ifdef CONFIG_NET_ETHERNET
if (dev->d_lltype == NET_LL_ETHERNET ||
dev->d_lltype == NET_LL_IEEE80211)
{
# ifdef CONFIG_NET_IPv4
# ifdef CONFIG_NET_IPv6
if (IFF_IS_IPv4(dev->d_flags))
# endif /* CONFIG_NET_IPv6 */
{
arp_out(dev);
}
# endif /* CONFIG_NET_IPv4 */
# ifdef CONFIG_NET_IPv6
# ifdef CONFIG_NET_IPv4
else
# endif /* CONFIG_NET_IPv4 */
{
neighbor_out(dev);
}
# endif /* CONFIG_NET_IPv6 */
}
#endif /* CONFIG_NET_ETHERNET */
return callback(dev); return callback(dev);
} }