net/devif_poll: optimize device buffer alloc in txpoll

Allocate the device buffer only if the protocol really need to send data.
not all protocols require the driver to prepare additional iob before
sending, especially UDP, each iob reserves l2/l3 header in advance
after prepare write buffer, net device could reuse this entry to send directly

Signed-off-by: chao an <anchao@xiaomi.com>
This commit is contained in:
chao an
2023-01-11 16:09:20 +08:00
committed by Xiang Xiao
parent 0cbbbb9215
commit 8a63d29c6e
19 changed files with 96 additions and 83 deletions
+1
View File
@@ -69,6 +69,7 @@ int netdev_iob_prepare(FAR struct net_driver_s *dev, bool throttled,
if (dev->d_iob == NULL)
{
nwarn("WARNING: IOB Prepare failed for dev %s!\n", dev->d_ifname);
return -ENOMEM;
}