Netdev List
 help / color / mirror / Atom feed
* [PATCH net v2] net/mlx5e: Report a down device as -ENETDOWN to queue restarts
@ 2026-12-01 15:53 Björn Töpel
  0 siblings, 0 replies; only message in thread
From: Björn Töpel @ 2026-12-01 15:53 UTC (permalink / raw)
  To: Saeed Mahameed, Tariq Toukan, Mark Bloch, Leon Romanovsky,
	Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, netdev
  Cc: Björn Töpel, Stanislav Fomichev, Dragos Tatulea,
	Mina Almasry, linux-rdma

Unbinding a memory provider from a queue of an mlx5 device that is
down triggers the WARN_ON() in __netif_mp_close_rxq(). The core asks
the driver for queue memory before it checks netif_running(), and
takes only -ENETDOWN as nothing to restart, see commit 34f71de3f548
("net: avoid false positive warnings in __net_mp_close_rxq()").
mlx5e_queue_mem_alloc() refuses a device that is not open with
-ENODEV:

  WARNING: net/core/netdev_rx_queue.c:303 at __netif_mp_close_rxq+0x18f/0x1b0
  Call Trace:
   net_devmem_unbind_dmabuf+0x150/0x260
   netdev_nl_sock_priv_destroy+0x11d/0x160
   genl_release+0x107/0x130
   netlink_release+0x8a6/0x13f0
   sock_close+0x9c/0x1d0

io_uring zcrx unbind takes the same path.

Return -ENETDOWN for a device that is not open. The core has already
cleared the provider of the queue when it asks, and the device opens
without it, so nothing else changes.

Found by code review while adding a memory provider to mlx5.
Reproduced on a ConnectX-7 (firmware 28.48.1000): bind a devmem dmabuf
to a queue with ncdevmem, take the link down, then kill ncdevmem. With
this patch the same steps are silent, and the device comes back up
and receives.

Fixes: b2588ea40ec9 ("net/mlx5e: Implement queue mgmt ops and single channel swap")
Reviewed-by: Dragos Tatulea <dtatulea@nvidia.com>
Signed-off-by: Björn Töpel <bjorn@kernel.org>
---
Changes in v2:
- Drop the comment above the check (Dragos)
- Collect Reviewed-by from Dragos

v1: https://lore.kernel.org/netdev/20261201113925.1245805-1-bjorn@kernel.org/

 drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
index 227695dfa51d..1f5703605e62 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
@@ -5736,7 +5736,7 @@ static int mlx5e_queue_mem_alloc(struct net_device *dev,
 
 	mutex_lock(&priv->state_lock);
 	if (!test_bit(MLX5E_STATE_OPENED, &priv->state)) {
-		err = -ENODEV;
+		err = -ENETDOWN;
 		goto unlock;
 	}
 

base-commit: e2fb9368a41662bc54624f9be87ea8989b109306
-- 
2.56.1


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-12-01 15:53 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-01 15:53 [PATCH net v2] net/mlx5e: Report a down device as -ENETDOWN to queue restarts Björn Töpel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox