[PATCH 25.11 v2] net/mlx5: fix LSC skip on shared device

Maayan Kashani mkashani at nvidia.com
Thu Nov 19 14:41:28 CET 2026


mlx5_dev_interrupt_nl_cb() walks every port registered on a shared
IB device to find the one whose netdev raised a link status event.
On a port that is configured without link status interrupts it
used "break", which ends the whole walk. A VF representor is often
configured without LSC, so when it sits ahead of the PF in the port
table the PF never receives the carrier event. Its cached link state
stays up while the kernel reports NO-CARRIER.

Use "continue" so only that port is skipped and the scan reaches the
port whose ifindex matches the event.

Initialize the interface index in the callback to silence static
analysis warnings about uninitialized variable usage.

Fixes: 17f95513adca ("net/mlx5: fix link status change detection")
Cc: stable at dpdk.org

Signed-off-by: Maayan Kashani <mkashani at nvidia.com>
Acked-by: Dariusz Sosnowski <dsosnowski at nvidia.com>
---
v2:
- Removed the Coverity issue tag from the commit message.
- Reworded the interface index initialization note to refer to static analysis.

 drivers/net/mlx5/linux/mlx5_ethdev_os.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/mlx5/linux/mlx5_ethdev_os.c b/drivers/net/mlx5/linux/mlx5_ethdev_os.c
index 4bbc590e916..10bc27e2e22 100644
--- a/drivers/net/mlx5/linux/mlx5_ethdev_os.c
+++ b/drivers/net/mlx5/linux/mlx5_ethdev_os.c
@@ -709,7 +709,7 @@ mlx5_dev_interrupt_nl_cb(struct nlmsghdr *hdr, void *cb_arg)
 {
 	struct mlx5_dev_ctx_shared *sh = cb_arg;
 	uint32_t i;
-	uint32_t if_index;
+	uint32_t if_index = 0;
 
 	if (mlx5_nl_parse_link_status_update(hdr, &if_index) < 0)
 		return;
@@ -725,7 +725,7 @@ mlx5_dev_interrupt_nl_cb(struct nlmsghdr *hdr, void *cb_arg)
 		/* Probing may initiate an LSC before configuration is done. */
 		if (dev->data->dev_configured &&
 		    !dev->data->dev_conf.intr_conf.lsc)
-			break;
+			continue;
 		priv = dev->data->dev_private;
 		if (mlx5_dev_nl_ifindex_verify(if_index, priv)) {
 			/* Block logical LSC events. */
-- 
2.25.1



More information about the stable mailing list