mirror of
https://github.com/apache/nuttx.git
synced 2026-05-28 03:45:50 +08:00
net/devif: move preprocess of txpoll into common code
Signed-off-by: chao an <anchao@xiaomi.com>
This commit is contained in:
+7
-41
@@ -496,49 +496,15 @@ static int lan91c111_txpoll(FAR struct net_driver_s *dev)
|
||||
{
|
||||
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.
|
||||
/* Send the packet */
|
||||
|
||||
lan91c111_transmit(dev);
|
||||
|
||||
/* Check if there is room in the device to hold another packet. If
|
||||
* not, return a non-zero value to terminate the poll.
|
||||
*/
|
||||
|
||||
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 */
|
||||
|
||||
lan91c111_transmit(dev);
|
||||
|
||||
/* Check if there is room in the device to hold another packet. If
|
||||
* not, return a non-zero value to terminate the poll.
|
||||
*/
|
||||
|
||||
return !(getreg16(priv, MIR_REG) & MIR_FREE_MASK);
|
||||
}
|
||||
}
|
||||
|
||||
/* If zero is returned, the polling will continue until all connections
|
||||
* have been examined.
|
||||
*/
|
||||
|
||||
return 0;
|
||||
return !(getreg16(priv, MIR_REG) & MIR_FREE_MASK);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
|
||||
Reference in New Issue
Block a user