Thread View: linux.kernel.netdev
7 messages
7 total messages
Started by Dimitri Daskalakis
Sat, 21 Nov 2026 03:32
[PATCH net 0/4] eth: fbnic: queue stop fixes
Author: Dimitri Daskalakis
Date: Sat, 21 Nov 2026 03:32
Date: Sat, 21 Nov 2026 03:32
23 lines
11829 bytes
11829 bytes
From: Dimitri Daskalakis <daskald@meta.com> AI uncovered some pre-existing issues with fbnic's queue stop handling. If the idle wait fails in fbnic_queue_stop(), queues can be reset with in-flight DMAs and completions. fbnic_queue_stop() did not wait for in-flight xmits to complete before tearing down queues. And fbnic_wait_queue_idle() waited on the wrong idle bits for Tx queues. Patches 1 and 3 were verified on HW, and patch 4 was verified in QEMU. Dimitri Daskalakis (4): eth: fbnic: restart queues in place when fbnic_queue_stop() fails net: add netif_disable_subqueue() eth: fbnic: wait for in-flight xmit in fbnic_queue_stop() eth: fbnic: wait for both TWQs of a Tx queue to go idle drivers/net/ethernet/meta/fbnic/fbnic_txrx.c | 84 ++++++++++++++++---- include/linux/netdevice.h | 36 ++++++--- 2 files changed, 91 insertions(+), 29 deletions(-) -- 2.52.1
[PATCH net 2/4] net: add netif_disable_subqueue()
Author: Dimitri Daskalakis
Date: Sat, 21 Nov 2026 03:32
Date: Sat, 21 Nov 2026 03:32
67 lines
13205 bytes
13205 bytes
From: Dimitri Daskalakis <daskald@meta.com>
netif_tx_stop_queue() does not wait for xmit to finish, and with
queue API disabling a single queue is becoming more common.
Add a helper like netif_tx_disable() (which drivers commonly use
when stopping the interface) but for one queue.
Suggested-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Dimitri Daskalakis <daskald@meta.com>
---
include/linux/netdevice.h | 36 +++++++++++++++++++++++-------------
1 file changed, 23 insertions(+), 13 deletions(-)
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 435be7880d7e..e716b98e8b4c 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -4980,23 +4980,33 @@ static inline void netif_tx_unlock_bh(struct net_device *dev)
} \
}
+/**
+ * netif_disable_subqueue() - stop subqueue and wait for xmit to finish
+ * @dev: network device
+ * @queue_index: sub queue index
+ *
+ * Stop the subqueue like netif_stop_subqueue(), but also make sure that
+ * ndo_start_xmit() is not running on it once this function returns.
+ * Does not synchronize with xmit of lltx devices.
+ */
+static inline void
+netif_disable_subqueue(struct net_device *dev, u16 queue_index)
+{
+ struct netdev_queue *txq = netdev_get_tx_queue(dev, queue_index);
+
+ __netif_tx_lock_bh(txq);
+ netif_tx_stop_queue(txq);
+ __netif_tx_unlock_bh(txq);
+}
+
static inline void netif_tx_disable(struct net_device *dev)
{
unsigned int i;
- int cpu;
- local_bh_disable();
- cpu = smp_processor_id();
- spin_lock(&dev->tx_global_lock);
- for (i = 0; i < dev->num_tx_queues; i++) {
- struct netdev_queue *txq = netdev_get_tx_queue(dev, i);
-
- __netif_tx_lock(txq, cpu);
- netif_tx_stop_queue(txq);
- __netif_tx_unlock(txq);
- }
- spin_unlock(&dev->tx_global_lock);
- local_bh_enable();
+ spin_lock_bh(&dev->tx_global_lock);
+ for (i = 0; i < dev->num_tx_queues; i++)
+ netif_disable_subqueue(dev, i);
+ spin_unlock_bh(&dev->tx_global_lock);
}
#ifndef CONFIG_PREEMPT_RT
--
2.52.1
[PATCH net 3/4] eth: fbnic: wait for in-flight xmit in fbnic_queue_stop()
Author: Dimitri Daskalakis
Date: Sat, 21 Nov 2026 03:32
Date: Sat, 21 Nov 2026 03:32
39 lines
12706 bytes
12706 bytes
From: Dimitri Daskalakis <daskald@meta.com>
fbnic_queue_stop() stops the vector's Tx queues with netif_stop_subqueue(),
which only sets the stop bit. This races with senders who are already in
fbnic_xmit_frame().
Use the new netif_disable_subqueue() helper prevent freeing rings
while senders are still in xmit.
This bug was found by AI and verified on HW.
Forced by adding a 20ms delay in fbnic_tx_map() on Tx queue 5,
binding devmem to rxq 5 under traffic:
before: BUG: kernel NULL pointer dereference, address: 000000000000002e
RIP: 0010:fbnic_clean_twq0+0xa8/0x290
after: fbnic_queue_stop() waits for the in-flight xmit, no crash (10/10)
Fixes: da43127a8edc ("eth: fbnic: support queue ops / zero-copy Rx")
Signed-off-by: Dimitri Daskalakis <daskald@meta.com>
---
drivers/net/ethernet/meta/fbnic/fbnic_txrx.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/meta/fbnic/fbnic_txrx.c b/drivers/net/ethernet/meta/fbnic/fbnic_txrx.c
index c0fe89425430..62b67940c13e 100644
--- a/drivers/net/ethernet/meta/fbnic/fbnic_txrx.c
+++ b/drivers/net/ethernet/meta/fbnic/fbnic_txrx.c
@@ -3191,7 +3191,7 @@ static int fbnic_queue_stop(struct net_device *dev, void *qmem, int idx)
for (i = 0; i < nv->txt_count; i++) {
if (nv->qt[i].sub0.flags & FBNIC_RING_F_DISABLED)
continue;
- netif_stop_subqueue(dev, nv->qt[i].sub0.q_idx);
+ netif_disable_subqueue(dev, nv->qt[i].sub0.q_idx);
}
fbnic_nv_disable(fbn, nv);
--
2.52.1
Re: [PATCH net 2/4] net: add netif_disable_subqueue()
Author: netdev-bot+sashiko
Date: Tue, 24 Nov 2026 12:33
Date: Tue, 24 Nov 2026 12:33
74 lines
10524 bytes
10524 bytes
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] The commit message for "net: add netif_disable_subqueue()"
describes the patch as only adding a new helper ("Add a helper like…
--
net: add netif_disable_subqueue()
This commit adds netif_disable_subqueue(). The helper stops a single TX
subqueue while holding that queue's xmit lock, so ndo_start_xmit() is no
longer running on it when the helper returns. The commit also rewrites
netif_tx_disable() so that it calls the new helper for each queue.
> diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
> index 435be7880d7e5..e716b98e8b4c8 100644
> --- a/include/linux/netdevice.h
> +++ b/include/linux/netdevice.h
[ ... ]
> static inline void netif_tx_disable(struct net_device *dev)
> {
> unsigned int i;
> - int cpu;
>
> - local_bh_disable();
> - cpu = smp_processor_id();
> - spin_lock(&dev->tx_global_lock);
> - for (i = 0; i < dev->num_tx_queues; i++) {
> - struct netdev_queue *txq = netdev_get_tx_queue(dev, i);
> -
> - __netif_tx_lock(txq, cpu);
> - netif_tx_stop_queue(txq);
> - __netif_tx_unlock(txq);
> - }
> - spin_unlock(&dev->tx_global_lock);
> - local_bh_enable();
> + spin_lock_bh(&dev->tx_global_lock);
> + for (i = 0; i < dev->num_tx_queues; i++)
> + netif_disable_subqueue(dev, i);
> + spin_unlock_bh(&dev->tx_global_lock);
> }
[Severity: Low]
This isn't a bug, but the commit message only talks about adding a new
helper:
Add a helper like netif_tx_disable() (which drivers commonly use
when stopping the interface) but for one queue.
It doesn't say that netif_tx_disable() itself is rewritten here.
The old body disabled BH once, read smp_processor_id() once, and used
__netif_tx_lock(txq, cpu) for each queue. The new body uses
spin_lock_bh(&dev->tx_global_lock) and calls netif_disable_subqueue()
for each queue. That helper does its own nested
__netif_tx_lock_bh()/__netif_tx_unlock_bh(), and it takes the queue
index as u16 rather than the unsigned int loop counter.
As far as I can tell the behavior is unchanged. Still, every driver
calling netif_tx_disable() on its stop path picks up this change.
Could the commit log mention the conversion? Something like "Convert
netif_tx_disable() to use the new helper, no functional change
intended." would be enough.
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261121033215.1020506-1-dimitri.daskalakis1%40gmail.com
Re: [PATCH net 2/4] net: add netif_disable_subqueue()
Author: Dimitri Daskalakis
Date: Tue, 24 Nov 2026 17:43
Date: Tue, 24 Nov 2026 17:43
75 lines
14096 bytes
14096 bytes
On 11/24/26 4:33 AM, netdev-bot+sashiko@kernel.org wrote:
> 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] The commit message for "net: add netif_disable_subqueue()"
> describes the patch as only adding a new helper ("Add a helper like…
>
> --
>
> net: add netif_disable_subqueue()
>
> This commit adds netif_disable_subqueue(). The helper stops a single TX
> subqueue while holding that queue's xmit lock, so ndo_start_xmit() is no
> longer running on it when the helper returns. The commit also rewrites
> netif_tx_disable() so that it calls the new helper for each queue.
>
>> diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
>> index 435be7880d7e5..e716b98e8b4c8 100644
>> --- a/include/linux/netdevice.h
>> +++ b/include/linux/netdevice.h
>
> [ ... ]
>
>> static inline void netif_tx_disable(struct net_device *dev)
>> {
>> unsigned int i;
>> - int cpu;
>>
>> - local_bh_disable();
>> - cpu = smp_processor_id();
>> - spin_lock(&dev->tx_global_lock);
>> - for (i = 0; i < dev->num_tx_queues; i++) {
>> - struct netdev_queue *txq = netdev_get_tx_queue(dev, i);
>> -
>> - __netif_tx_lock(txq, cpu);
>> - netif_tx_stop_queue(txq);
>> - __netif_tx_unlock(txq);
>> - }
>> - spin_unlock(&dev->tx_global_lock);
>> - local_bh_enable();
>> + spin_lock_bh(&dev->tx_global_lock);
>> + for (i = 0; i < dev->num_tx_queues; i++)
>> + netif_disable_subqueue(dev, i);
>> + spin_unlock_bh(&dev->tx_global_lock);
>> }
>
> [Severity: Low]
> This isn't a bug, but the commit message only talks about adding a new
> helper:
>
> Add a helper like netif_tx_disable() (which drivers commonly use
> when stopping the interface) but for one queue.
>
> It doesn't say that netif_tx_disable() itself is rewritten here.
>
> The old body disabled BH once, read smp_processor_id() once, and used
> __netif_tx_lock(txq, cpu) for each queue. The new body uses
> spin_lock_bh(&dev->tx_global_lock) and calls netif_disable_subqueue()
> for each queue. That helper does its own nested
> __netif_tx_lock_bh()/__netif_tx_unlock_bh(), and it takes the queue
> index as u16 rather than the unsigned int loop counter.
>
> As far as I can tell the behavior is unchanged. Still, every driver
> calling netif_tx_disable() on its stop path picks up this change.
>
> Could the commit log mention the conversion? Something like "Convert
> netif_tx_disable() to use the new helper, no functional change
> intended." would be enough.
>
If this series needs a re-spin, I'll address the change in the commit msg.
Re: [PATCH net 2/4] net: add netif_disable_subqueue()
Author: Simon Horman
Date: Tue, 01 Dec 2026 12:40
Date: Tue, 01 Dec 2026 12:40
37 lines
9313 bytes
9313 bytes
On Tue, Nov 24, 2026 at 09:43:10AM -0800, Dimitri Daskalakis wrote: > On 11/24/26 4:33 AM, netdev-bot+sashiko@kernel.org wrote: ... > > [Severity: Low] > > This isn't a bug, but the commit message only talks about adding a new > > helper: > > > > Add a helper like netif_tx_disable() (which drivers commonly use > > when stopping the interface) but for one queue. > > > > It doesn't say that netif_tx_disable() itself is rewritten here. > > > > The old body disabled BH once, read smp_processor_id() once, and used > > __netif_tx_lock(txq, cpu) for each queue. The new body uses > > spin_lock_bh(&dev->tx_global_lock) and calls netif_disable_subqueue() > > for each queue. That helper does its own nested > > __netif_tx_lock_bh()/__netif_tx_unlock_bh(), and it takes the queue > > index as u16 rather than the unsigned int loop counter. > > > > As far as I can tell the behavior is unchanged. Still, every driver > > calling netif_tx_disable() on its stop path picks up this change. > > > > Could the commit log mention the conversion? Something like "Convert > > netif_tx_disable() to use the new helper, no functional change > > intended." would be enough. > > > > If this series needs a re-spin, I'll address the change in the commit msg. TBH, I think the commit message is completely fine as-is. It states the intent of the patch. And the implementation details are clear enough on examination of the code. Reviewed-by: Simon Horman <horms@kernel.org>
Re: [PATCH net 3/4] eth: fbnic: wait for in-flight xmit in fbnic_queue_stop()
Author: Simon Horman
Date: Tue, 01 Dec 2026 12:41
Date: Tue, 01 Dec 2026 12:41
23 lines
8877 bytes
8877 bytes
On Fri, Nov 20, 2026 at 07:32:14PM -0800, Dimitri Daskalakis wrote:
> From: Dimitri Daskalakis <daskald@meta.com>
>
> fbnic_queue_stop() stops the vector's Tx queues with netif_stop_subqueue(),
> which only sets the stop bit. This races with senders who are already in
> fbnic_xmit_frame().
>
> Use the new netif_disable_subqueue() helper prevent freeing rings
> while senders are still in xmit.
>
> This bug was found by AI and verified on HW.
>
> Forced by adding a 20ms delay in fbnic_tx_map() on Tx queue 5,
> binding devmem to rxq 5 under traffic:
> before: BUG: kernel NULL pointer dereference, address: 000000000000002e
> RIP: 0010:fbnic_clean_twq0+0xa8/0x290
> after: fbnic_queue_stop() waits for the in-flight xmit, no crash (10/10)
>
> Fixes: da43127a8edc ("eth: fbnic: support queue ops / zero-copy Rx")
> Signed-off-by: Dimitri Daskalakis <daskald@meta.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads