mlx5 misc fixes 2025-09-28
Subsystems (4)
Tariq Toukan
maintainercover mlx5 misc fixes 2025-09-28
Hi,
This patchset provides misc bug fixes from the team to the mlx5 core driver.
Thanks,
Tariq.
Moshe Shemesh (2):
net/mlx5: Stop polling for command response if interface goes down net/mlx5: fw reset, add reset timeout work
Shay Drory (1):
net/mlx5: pagealloc: Fix reclaim race during command interface
teardown
drivers/net/ethernet/mellanox/mlx5/core/cmd.c | 6 ++++- .../ethernet/mellanox/mlx5/core/fw_reset.c | 24 +++++++++++++++++++ .../ethernet/mellanox/mlx5/core/pagealloc.c | 7 ++++-- 3 files changed, 34 insertions(+), 3 deletions(-)
base-commit: 012ea489aedab1a4c08efbd936bb7be91a06d236
Signature · 1 line
2.31.1
Tariq Toukan
maintainerPATCH 1/3 net/mlx5: Stop polling for command response if interface goes down
From: Moshe Shemesh <[email protected]>
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.
--- drivers/net/ethernet/mellanox/mlx5/core/cmd.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/net/ethernet/mellanox/mlx5/core/cmd.c +5 -1
@@ -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); } }
Signature · 1 line
2.31.1
Tariq Toukan
maintainerPATCH 2/3 net/mlx5: pagealloc: Fix reclaim race during command interface teardown
In reply to Tariq ToukanFrom: Shay Drory <[email protected]>
The reclaim_pages_cmd() function sends a command to the firmware to reclaim pages if the command interface is active.
A race condition can occur if the command interface goes down (e.g., due to a PCI error) while the mlx5_cmd_do() call is in flight. In this case, mlx5_cmd_do() will return an error. The original code would propagate this error immediately, bypassing the software-based page reclamation logic that is supposed to run when the command interface is down.
Fix this by checking whether mlx5_cmd_do() returns -ENXIO, which mark that command interface is down. If this is the case, fall through to the software reclamation path. If the command failed for any another reason, or finished successfully, return as before.
--- drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c +5 -2
@@ -489,9 +489,12 @@ static int reclaim_pages_cmd(struct mlx5_core_dev *dev,u32 func_id;u32 npages;u32 i =0 ; +int err; -if (!mlx5_cmd_is_down (dev)) -return mlx5_cmd_do (dev, in, in_size, out, out_size); + err =mlx5_cmd_do (dev, in, in_size, out, out_size); +/* If FW is gone (-ENXIO), proceed to forceful reclaim */ +if (err != -ENXIO ) +return err;/* No hard feelings, we want our pages back! */ npages =MLX5_GET (manage_pages_in, in, input_num_entries);
Signature · 1 line
2.31.1
Tariq Toukan
maintainerPATCH 3/3 net/mlx5: fw reset, add reset timeout work
In reply to Tariq ToukanFrom: Moshe Shemesh <[email protected]>
Add sync reset timeout to stop poll_sync_reset in case there was no reset done or abort event within timeout. Otherwise poll sync reset will just continue and in case of fw fatal error no health reporting will be done.
--- .../ethernet/mellanox/mlx5/core/fw_reset.c | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+)
drivers/net/ethernet/mellanox/mlx5/core/fw_reset.c +24 -0
@@ -27,6 +27,7 @@ struct mlx5_fw_reset {struct work_struct reset_reload_work;struct work_struct reset_now_work;struct work_struct reset_abort_work; +struct delayed_work reset_timeout_work;unsigned long reset_flags;u8 reset_method;struct timer_list timer;
@@ -259,6 +260,8 @@ static int mlx5_sync_reset_clear_reset_requested(struct mlx5_core_dev *dev, boolreturn -EALREADY ; } +if (current_work () != &fw_reset->reset_timeout_work.work) +cancel_delayed_work (&fw_reset->reset_timeout_work);mlx5_stop_sync_reset_poll (dev);if (poll_health)mlx5_start_health_poll (dev);
@@ -330,6 +333,11 @@ static int mlx5_sync_reset_set_reset_requested(struct mlx5_core_dev *dev) }mlx5_stop_health_poll (dev, true);mlx5_start_sync_reset_poll (dev); + +if (!test_bit (MLX5_FW_RESET_FLAGS_DROP_NEW_REQUESTS , + &fw_reset->reset_flags)) +schedule_delayed_work (&fw_reset->reset_timeout_work, +msecs_to_jiffies (mlx5_tout_ms (dev,PCI_SYNC_UPDATE )));return 0 ; }
@@ -739,6 +747,19 @@ static void mlx5_sync_reset_events_handle(struct mlx5_fw_reset *fw_reset, struct } } +static void mlx5_sync_reset_timeout_work (struct work_struct *work) +{ + struct delayed_work *dwork = container_of(work, struct delayed_work, + work); +struct mlx5_fw_reset *fw_reset = + container_of(dwork, struct mlx5_fw_reset, reset_timeout_work); +struct mlx5_core_dev *dev = fw_reset->dev; + +if (mlx5_sync_reset_clear_reset_requested (dev, true)) +return ; +mlx5_core_warn (dev,"PCI Sync FW Update Reset Timeout.\n" ); +} +static int fw_reset_event_notifier (struct notifier_block *nb,unsigned long action,void *data) { struct mlx5_fw_reset *fw_reset = mlx5_nb_cof(nb, struct mlx5_fw_reset, nb);
@@ -822,6 +843,7 @@ void mlx5_drain_fw_reset(struct mlx5_core_dev *dev)cancel_work_sync (&fw_reset->reset_reload_work);cancel_work_sync (&fw_reset->reset_now_work);cancel_work_sync (&fw_reset->reset_abort_work); +cancel_delayed_work (&fw_reset->reset_timeout_work); }static const struct devlink_param mlx5_fw_reset_devlink_params[] = {
@@ -865,6 +887,8 @@ int mlx5_fw_reset_init(struct mlx5_core_dev *dev)INIT_WORK (&fw_reset->reset_reload_work, mlx5_sync_reset_reload_work);INIT_WORK (&fw_reset->reset_now_work, mlx5_sync_reset_now_event);INIT_WORK (&fw_reset->reset_abort_work, mlx5_sync_reset_abort_event); +INIT_DELAYED_WORK (&fw_reset->reset_timeout_work, + mlx5_sync_reset_timeout_work);init_completion (&fw_reset->done);return 0 ;
Signature · 1 line
2.31.1
This series was applied to netdev/net.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This series was applied to netdev/net.git (main)
by Jakub Kicinski <[email protected]>:
Quoted 9 lines · On Mon, 29 Sep 2025 00:02:06 +0300 you wrote:
Hi,
This patchset provides misc bug fixes from the team to the mlx5 core driver.
Thanks,
Tariq.[...]
Here is the summary with links:
- [net,1/3] net/mlx5: Stop polling for command response if interface goes down
https://git.kernel.org/netdev/net/c/b1f0349bd6d3 - [net,2/3] net/mlx5: pagealloc: Fix reclaim race during command interface teardown https://git.kernel.org/netdev/net/c/79a0e32b32ac - [net,3/3] net/mlx5: fw reset, add reset timeout work https://git.kernel.org/netdev/net/c/5cfbe7ebfa42
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html