Thank you for your contribution! Sashiko AI review found more severe
issue(s) in other patches of this series. This mail is only an FYI, in case
you want to address the nit picks below when you respin.
Low priority / nit picks for your consideration:
- [Low] tbnet_connected_work() in drivers/net/thunderbolt/main.c gains a
napi_enable()/napi_schedule() pair in this patch.
--
net: thunderbolt: Stop queueing Rx buffers if allocation fails
With this patch, tbnet_alloc_rx_buffers() stops and keeps the buffers it
has already queued when an allocation fails, instead of freeing them while
their descriptors are still in the hardware ring. tbnet_poll() keeps NAPI
polling so the allocation can be retried. NAPI enable and disable move into
tbnet_connected_work() and tbnet_tear_down() so that they bracket the time
the rings are running.
Closes: https://sashiko.dev/#/patchset/2026…%40linux.intel.com
> diff --git a/drivers/net/thunderbolt/main.c b/drivers/net/thunderbolt/main.c
> index ede105cdc3a37..d5e49bc381041 100644
> --- a/drivers/net/thunderbolt/main.c
> +++ b/drivers/net/thunderbolt/main.c
[ ... ]
> @@ -691,7 +698,11 @@ static void tbnet_connected_work(struct work_struct *work)
>
> ret = tbnet_alloc_tx_buffers(net);
> if (ret)
> - goto err_free_rx_buffers;
> + goto err_stop_rings;
> +
> + napi_enable(&net->napi);
> + /* Unmasks the ring interrupt if it was masked */
> + napi_schedule(&net->napi);
[Severity: Low]
tbnet_connected_work() is a work item queued on system_long_wq. It runs in
a kworker in process context with BH enabled.
Called from there, napi_schedule() leads to:
napi_schedule()
__napi_schedule()
____napi_schedule()
raise_softirq_irqoff(NET_RX_SOFTIRQ)
Because !in_interrupt(), raise_softirq_irqoff() only marks NET_RX_SOFTIRQ
pending and wakes ksoftirqd. The softirq does not run right away.
Does that mean the first tbnet_poll() waits for ksoftirqd or the next
irq_exit? If so, the tb_ring_poll_complete() call that unmasks the Rx ring
interrupt, which the comment above refers to, waits as well.
Other drivers wrap this call in a BH-disabled section, for example
virtnet_napi_do_enable() in drivers/net/virtio_net.c:
napi_enable(napi);
...
* Call local_bh_enable after to trigger softIRQ processing.
*/
local_bh_disable();
virtqueue_napi_schedule(napi, vq);
local_bh_enable();
Would wrapping this napi_schedule() in local_bh_disable() and
local_bh_enable() make the initial poll run as soon as BH is re-enabled?
>
> ret = tb_xdomain_enable_paths(net->xd, net->local_transmit_path,
> net->tx_ring.ring->hop,
[ ... ]
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/2026…%40linux.intel.com