devif_poll: only call the corresponding xxx_poll when there is data to be sent

reduce the execution consumption of irrelevant code

testing the TX rates of TCP and UDP based on the Infineon board can
increase them by 13%.

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
This commit is contained in:
zhanghongyu
2025-11-05 17:47:10 +08:00
committed by Xiang Xiao
parent a0b847bf1b
commit c481374fb8
38 changed files with 241 additions and 214 deletions
+11 -5
View File
@@ -57,11 +57,12 @@
****************************************************************************/
#ifdef CONFIG_NET_IPv4
void netdev_ipv4_txnotify(in_addr_t lipaddr, in_addr_t ripaddr)
void netdev_ipv4_txnotify(in_addr_t lipaddr, in_addr_t ripaddr,
uint32_t polltype)
{
/* Find the device driver that serves the subnet of the remote address */
netdev_txnotify_dev(netdev_findby_ripv4addr(lipaddr, ripaddr));
netdev_txnotify_dev(netdev_findby_ripv4addr(lipaddr, ripaddr), polltype);
}
#endif /* CONFIG_NET_IPv4 */
@@ -83,11 +84,12 @@ void netdev_ipv4_txnotify(in_addr_t lipaddr, in_addr_t ripaddr)
#ifdef CONFIG_NET_IPv6
void netdev_ipv6_txnotify(FAR const net_ipv6addr_t lipaddr,
FAR const net_ipv6addr_t ripaddr)
FAR const net_ipv6addr_t ripaddr,
uint32_t polltype)
{
/* Find the device driver that serves the subnet of the remote address */
netdev_txnotify_dev(netdev_findby_ripv6addr(lipaddr, ripaddr));
netdev_txnotify_dev(netdev_findby_ripv6addr(lipaddr, ripaddr), polltype);
}
#endif /* CONFIG_NET_IPv6 */
@@ -107,10 +109,14 @@ void netdev_ipv6_txnotify(FAR const net_ipv6addr_t lipaddr,
*
****************************************************************************/
void netdev_txnotify_dev(FAR struct net_driver_s *dev)
void netdev_txnotify_dev(FAR struct net_driver_s *dev, uint32_t polltype)
{
if (dev != NULL && dev->d_txavail != NULL)
{
/* Set the poll type flags */
dev->d_polltype |= polltype;
/* Notify the device driver that new TX data is available. */
dev->d_txavail(dev);