HedongGao commented on code in PR #21502:
URL: https://github.com/apache/nuttx/pull/21502#discussion_r4510123680


##########
include/nuttx/net/netdev_lowerhalf.h:
##########
@@ -180,6 +180,12 @@ struct netdev_ops_s
   /* reclaim - try to reclaim packets sent by netdev. */
 
   CODE void (*reclaim)(FAR struct netdev_lowerhalf_s *dev);
+
+#ifdef CONFIG_NET_NETPOLL
+  /* txpoll - Wait for transmission done. */
+
+  CODE void (*txpoll)(FAR struct netdev_lowerhalf_s *dev);

Review Comment:
   Sorry for the back and forth: I went back to `txpoll`. `reclaim` is going to 
be removed from `netdev_ops_s` in a follow-up (see @xiaoxiang781216's comment), 
so netpoll can't depend on it. The two ops are also called in different 
contexts: the upper half calls `reclaim` in normal context, while netpoll calls 
`txpoll` where interrupts may be off and the upper half can't run (e.g. the 
final panic path), so the driver has to reclaim TX synchronously there. 
virtio-net can use `virtio_net_txfree()` for both because reading the used ring 
doesn't depend on interrupts; a hardware NIC would usually need a separate 
`txpoll` that polls its TX descriptors. I updated the `txpoll` comment to say 
this.
   
   Re-tested on `qemu-armv8a:notenet` (ifup/ping, ifdown, 10 ifdown/ifup 
cycles), with `CONFIG_IOB_BUFSIZE=196` (92 multi-IOB frames, 0 length 
mismatches), and on `qemu-armv8a:netnsh_smp` with 4 CPUs and assertions on (0% 
loss).
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to