Skip to contentSkip to conversation

mlx5 misc fixes 2025-03-18

PATCH Applied Tariq Toukan 4 participants 8 messages Mar 18, 2025 – Mar 24, 2025

Subsystems (4)
lore
Share & tools
lore

Tariq Toukan

author maintainer
#0 lore raw

cover mlx5 misc fixes 2025-03-18

Hi,

This small patchset provides misc bug fixes to the mlx5 core driver.

Thanks,
Tariq.

Mark Bloch (1):
net/mlx5: LAG, reload representors on LAG creation failure

Moshe Shemesh (1):
net/mlx5: Start health poll after enable hca

 drivers/net/ethernet/mellanox/mlx5/core/lag/lag.c |  4 ++++
 drivers/net/ethernet/mellanox/mlx5/core/main.c    | 15 +++++++--------
 2 files changed, 11 insertions(+), 8 deletions(-)

base-commit: daa624d3c2ddffdcbad140a9625a4064371db44f

Signature · 1 line
2.31.1
author maintainer
#1 lore raw

PATCH 1/2 net/mlx5: LAG, reload representors on LAG creation failure

From: Mark Bloch <[email protected]>

When LAG creation fails, the driver reloads the RDMA devices. If RDMA representors are present, they should also be reloaded. This step was missed in the cited commit.

Fixes 598fe77df855 ("net/mlx5: Lag, Create shared FDB when in switchdev mode")
---
 drivers/net/ethernet/mellanox/mlx5/core/lag/lag.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/net/ethernet/mellanox/mlx5/core/lag/lag.c +4 -0
index ed2ba272946b..6c9737c53734 100644
@@ -1052,6 +1052,10 @@ static void mlx5_do_bond(struct mlx5_lag *ldev)
 		if (err) {
 			if (shared_fdb || roce_lag)
 				mlx5_lag_add_devices(ldev);
+			if (shared_fdb) {
+				mlx5_ldev_for_each(i, 0, ldev)
+					mlx5_eswitch_reload_ib_reps(ldev->pf[i].dev->priv.eswitch);
+			}
 
 			return;
 		} else if (roce_lag) {
Signature · 1 line
2.31.1
Reviewed-by on v1 1/2
#2 lore raw

Re: [PATCH net 1/2] net/mlx5: LAG, reload representors on LAG creation failure

Quoted 20 lines · Tariq Toukan

From: Mark Bloch <[email protected]>

When LAG creation fails, the driver reloads the RDMA devices. If RDMA representors are present, they should also be reloaded. This step was missed in the cited commit.

Fixes 598fe77df855 ("net/mlx5: Lag, Create shared FDB when in switchdev mode")
---
 drivers/net/ethernet/mellanox/mlx5/core/lag/lag.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/net/ethernet/mellanox/mlx5/core/lag/lag.c +0 -0
index ed2ba272946b..6c9737c53734 100644

drivers/net/ethernet/mellanox/mlx5/core/lag/lag.c static void mlx5_do_bond(struct mlx5_lag *ldev) · line 1061

Quoted 10 lines
drivers/net/ethernet/mellanox/mlx5/core/lag/lag.c +4 -0
@@ -1052,6 +1052,10 @@ static void mlx5_do_bond(struct mlx5_lag *ldev)
 		if (err) {
 			if (shared_fdb || roce_lag)
 				mlx5_lag_add_devices(ldev);
+			if (shared_fdb) {
+				mlx5_ldev_for_each(i, 0, ldev)
+					mlx5_eswitch_reload_ib_reps(ldev->pf[i].dev->priv.eswitch);
+			}
 
 			return;
 		} else if (roce_lag) {
Quoted 1 line

2.31.1

Reviewed-by on v1 1/2
#3 lore raw

Re: [PATCH net 1/2] net/mlx5: LAG, reload representors on LAG creation failure

In reply to Tariq Toukan
Quoted 11 lines · Tariq Toukan

From: Mark Bloch <[email protected]>

When LAG creation fails, the driver reloads the RDMA devices. If RDMA representors are present, they should also be reloaded. This step was missed in the cited commit.

Fixes 598fe77df855 ("net/mlx5: Lag, Create shared FDB when in switchdev mode")
Signature · 2 lines
Regards,
Kalesh AP
author maintainer
#4 lore raw

PATCH 2/2 net/mlx5: Start health poll after enable hca

In reply to Tariq Toukan

From: Moshe Shemesh <[email protected]>

The health poll mechanism performs periodic checks to detect firmware errors. One of the checks verifies the function is still enabled on firmware side, but the function is enabled only after enable_hca command completed. Start health poll after enable_hca command to avoid a race between function enabled and first health polling.

Fixes 9b98d395b85d ("net/mlx5: Start health poll at earlier stage of driver load")
---
 drivers/net/ethernet/mellanox/mlx5/core/main.c | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/main.c +7 -8
index ec956c4bcebd..7c3312d6aed9 100644
@@ -1205,24 +1205,24 @@ static int mlx5_function_enable(struct mlx5_core_dev *dev, bool boot, u64 timeou
 	dev->caps.embedded_cpu = mlx5_read_embedded_cpu(dev);
 	mlx5_cmd_set_state(dev, MLX5_CMDIF_STATE_UP);
 
-	mlx5_start_health_poll(dev);
-
 	err = mlx5_core_enable_hca(dev, 0);
 	if (err) {
 		mlx5_core_err(dev, "enable hca failed\n");
-		goto stop_health_poll;
+		goto err_cmd_cleanup;
 	}
 
+	mlx5_start_health_poll(dev);
+
 	err = mlx5_core_set_issi(dev);
 	if (err) {
 		mlx5_core_err(dev, "failed to set issi\n");
-		goto err_disable_hca;
+		goto stop_health_poll;
 	}
 
 	err = mlx5_satisfy_startup_pages(dev, 1);
 	if (err) {
 		mlx5_core_err(dev, "failed to allocate boot pages\n");
-		goto err_disable_hca;
+		goto stop_health_poll;
 	}
 
 	err = mlx5_tout_query_dtor(dev);
@@ -1235,10 +1235,9 @@ static int mlx5_function_enable(struct mlx5_core_dev *dev, bool boot, u64 timeou
 
 reclaim_boot_pages:
 	mlx5_reclaim_startup_pages(dev);
-err_disable_hca:
-	mlx5_core_disable_hca(dev, 0);
 stop_health_poll:
 	mlx5_stop_health_poll(dev, boot);
+	mlx5_core_disable_hca(dev, 0);
 err_cmd_cleanup:
 	mlx5_cmd_set_state(dev, MLX5_CMDIF_STATE_DOWN);
 	mlx5_cmd_disable(dev);
@@ -1249,8 +1248,8 @@ static int mlx5_function_enable(struct mlx5_core_dev *dev, bool boot, u64 timeou
 static void mlx5_function_disable(struct mlx5_core_dev *dev, bool boot)
 {
 	mlx5_reclaim_startup_pages(dev);
-	mlx5_core_disable_hca(dev, 0);
 	mlx5_stop_health_poll(dev, boot);
+	mlx5_core_disable_hca(dev, 0);
 	mlx5_cmd_set_state(dev, MLX5_CMDIF_STATE_DOWN);
 	mlx5_cmd_disable(dev);
 }
Signature · 1 line
2.31.1
Reviewed-by on v1 2/2
#5 lore raw

Re: [PATCH net 2/2] net/mlx5: Start health poll after enable hca

Quoted 63 lines · Tariq Toukan

From: Moshe Shemesh <[email protected]>

The health poll mechanism performs periodic checks to detect firmware errors. One of the checks verifies the function is still enabled on firmware side, but the function is enabled only after enable_hca command completed. Start health poll after enable_hca command to avoid a race between function enabled and first health polling.

Fixes 9b98d395b85d ("net/mlx5: Start health poll at earlier stage of driver load")
---
 drivers/net/ethernet/mellanox/mlx5/core/main.c | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/main.c +6 -7
index ec956c4bcebd..7c3312d6aed9 100644
@@ -1205,24 +1205,24 @@ static int mlx5_function_enable(struct mlx5_core_dev *dev, bool boot, u64 timeou
 	dev->caps.embedded_cpu = mlx5_read_embedded_cpu(dev);
 	mlx5_cmd_set_state(dev, MLX5_CMDIF_STATE_UP);
 
-	mlx5_start_health_poll(dev);
-
 	err = mlx5_core_enable_hca(dev, 0);
 	if (err) {
 		mlx5_core_err(dev, "enable hca failed\n");
-		goto stop_health_poll;
+		goto err_cmd_cleanup;
 	}
 
+	mlx5_start_health_poll(dev);
+
 	err = mlx5_core_set_issi(dev);
 	if (err) {
 		mlx5_core_err(dev, "failed to set issi\n");
-		goto err_disable_hca;
+		goto stop_health_poll;
 	}
 
 	err = mlx5_satisfy_startup_pages(dev, 1);
 	if (err) {
 		mlx5_core_err(dev, "failed to allocate boot pages\n");
-		goto err_disable_hca;
+		goto stop_health_poll;
 	}
 
 	err = mlx5_tout_query_dtor(dev);
@@ -1235,10 +1235,9 @@ static int mlx5_function_enable(struct mlx5_core_dev *dev, bool boot, u64 timeou
 
 reclaim_boot_pages:
 	mlx5_reclaim_startup_pages(dev);
-err_disable_hca:
-	mlx5_core_disable_hca(dev, 0);
 stop_health_poll:
 	mlx5_stop_health_poll(dev, boot);
+	mlx5_core_disable_hca(dev, 0);
 err_cmd_cleanup:
 	mlx5_cmd_set_state(dev, MLX5_CMDIF_STATE_DOWN);
 	mlx5_cmd_disable(dev);

drivers/net/ethernet/mellanox/mlx5/core/main.c static int mlx5_function_enable(struct mlx5_core_dev *dev, bool boot, u64 timeou · line 1255

Quoted 9 lines
drivers/net/ethernet/mellanox/mlx5/core/main.c +1 -1
@@ -1249,8 +1248,8 @@ static int mlx5_function_enable(struct mlx5_core_dev *dev, bool boot, u64 timeou
 static void mlx5_function_disable(struct mlx5_core_dev *dev, bool boot)
 {
 	mlx5_reclaim_startup_pages(dev);
-	mlx5_core_disable_hca(dev, 0);
 	mlx5_stop_health_poll(dev, boot);
+	mlx5_core_disable_hca(dev, 0);
 	mlx5_cmd_set_state(dev, MLX5_CMDIF_STATE_DOWN);
 	mlx5_cmd_disable(dev);
 }
Quoted 2 lines
Signature · 1 line
2.31.1
Reviewed-by on v1 2/2
#6 lore raw

Re: [PATCH net 2/2] net/mlx5: Start health poll after enable hca

In reply to Tariq Toukan
Quoted 9 lines · Tariq Toukan

From: Moshe Shemesh <[email protected]>

The health poll mechanism performs periodic checks to detect firmware errors. One of the checks verifies the function is still enabled on firmware side, but the function is enabled only after enable_hca command completed. Start health poll after enable_hca command to avoid a race between function enabled and first health polling.

Quoted 4 lines
Fixes 9b98d395b85d ("net/mlx5: Start health poll at earlier stage of driver load")
Signature · 2 lines
Regards,
Kalesh AP
#7 lore raw
In reply to Tariq Toukan
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 8 lines · On Tue, 18 Mar 2025 22:51:15 +0200 you wrote:

Hi,

This small patchset provides misc bug fixes to the mlx5 core driver.

Thanks,
Tariq.

[...]

Here is the summary with links:
- [net,1/2] net/mlx5: LAG, reload representors on LAG creation failure

    https://git.kernel.org/netdev/net/c/bdf549a7a4d7
  - [net,2/2] net/mlx5: Start health poll after enable hca
    https://git.kernel.org/netdev/net/c/1726ad035cb0

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html