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
+2 -38
View File
@@ -345,45 +345,9 @@ static int ftmac100_txpoll(struct net_driver_s *dev)
FAR struct ftmac100_driver_s *priv =
(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.
*/
/* Send the packet */
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 */
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.
*/
}
}
ftmac100_transmit(priv);
/* If zero is returned, the polling will continue until all connections
* have been examined.