On Fri, 26 Sep 2025 01:35:07 +0000 Stefan Mätje wrote:
Using the netif_txq_maybe_stop() / netif_txq_completed_wake() pair seem
not the right thing for me because I don't understand the code completely
and the netif_txq_completed_wake() should only called from NAPI poll
context where I would need to call it from the USB callback handler
possibly on IRQ level.
Ah, true, not NAPI, but you don't use BQL so we'd need a flavor of
the macro that doesn't picky back on the mb() in BQL.
The main point of the macro is that on one side you need to re-check
after a barrier. No matter how many barriers you put in place you
can still have:
CPU 0 CPU 1
used++
if (used > threshold)
/* long IRQ comes */
used--
if (used <= threshold)
wake();
/* long IRQ ends */
stop();