mirror of
https://github.com/apache/nuttx.git
synced 2026-05-30 13:27:01 +08:00
net/devif: move preprocess of txpoll into common code
Signed-off-by: chao an <anchao@xiaomi.com>
This commit is contained in:
+4
-43
@@ -1175,52 +1175,13 @@ static int enc_txpoll(struct net_driver_s *dev)
|
||||
{
|
||||
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.
|
||||
*/
|
||||
/* Send the packet */
|
||||
|
||||
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.
|
||||
*/
|
||||
enc_transmit(priv);
|
||||
|
||||
#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 */
|
||||
/* Stop the poll now because we can queue only one packet */
|
||||
|
||||
#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 */
|
||||
|
||||
enc_transmit(priv);
|
||||
|
||||
/* Stop the poll now because we can queue only one packet */
|
||||
|
||||
return -EBUSY;
|
||||
}
|
||||
}
|
||||
|
||||
/* If zero is returned, the polling will continue until all connections
|
||||
* have been examined.
|
||||
*/
|
||||
|
||||
return OK;
|
||||
return -EBUSY;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
|
||||
Reference in New Issue
Block a user