]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
net/mlx5: Stop polling for command response if interface goes down
authorMoshe Shemesh <moshe@nvidia.com>
Sun, 28 Sep 2025 21:02:07 +0000 (00:02 +0300)
committerJakub Kicinski <kuba@kernel.org>
Tue, 30 Sep 2025 01:51:22 +0000 (18:51 -0700)
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>
drivers/net/ethernet/mellanox/mlx5/core/cmd.c

index e395ef5f356eb57b96fb5f56d3eea17b29cd65e2..722282cebce9a6c84177665ddc3b6021a9ab11ff 100644 (file)
@@ -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);
        }
 }