kernel/SOURCES/1561-net-mlx5-stop-polling-for-command-response-if-interface-goes.patch

57 lines
2.0 KiB
Diff

From 0064b668708144129c1860bcc8a92fb74d68f8e1 Mon Sep 17 00:00:00 2001
From: Kamal Heib <kheib@redhat.com>
Date: Sun, 19 Apr 2026 18:24:30 -0400
Subject: [PATCH] net/mlx5: Stop polling for command response if interface goes
down
JIRA: https://redhat.atlassian.net/browse/RHEL-169055
commit b1f0349bd6d320c382df2e7f6fc2ac95c85f2b18
Author: Moshe Shemesh <moshe@nvidia.com>
Date: Mon Sep 29 00:02:07 2025 +0300
net/mlx5: Stop polling for command response if interface goes down
Stop polling on firmware response to command in polling mode if the
command interface got down. This situation can occur, for example, if a
firmware fatal error is detected during polling.
This change halts the polling process when the command interface goes
down, preventing unnecessary waits.
Fixes: b898ce7bccf1 ("net/mlx5: cmdif, Avoid skipping reclaim pages if FW is not accessible")
Signed-off-by: Moshe Shemesh <moshe@nvidia.com>
Reviewed-by: Shay Drori <shayd@nvidia.com>
Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Kamal Heib <kheib@redhat.com>
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/cmd.c b/drivers/net/ethernet/mellanox/mlx5/core/cmd.c
index e395ef5f356e..722282cebce9 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/cmd.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/cmd.c
@@ -294,6 +294,10 @@ static void poll_timeout(struct mlx5_cmd_work_ent *ent)
return;
}
cond_resched();
+ if (mlx5_cmd_is_down(dev)) {
+ ent->ret = -ENXIO;
+ return;
+ }
} while (time_before(jiffies, poll_end));
ent->ret = -ETIMEDOUT;
@@ -1070,7 +1074,7 @@ static void cmd_work_handler(struct work_struct *work)
poll_timeout(ent);
/* make sure we read the descriptor after ownership is SW */
rmb();
- mlx5_cmd_comp_handler(dev, 1ULL << ent->idx, (ent->ret == -ETIMEDOUT));
+ mlx5_cmd_comp_handler(dev, 1ULL << ent->idx, !!ent->ret);
}
}
--
2.50.1 (Apple Git-155)