Skip to contentSkip to conversation

net/mlx5: E-switch, Restore host PF enable for ECPF that isn't E-switch manager

PATCH Applied Tariq Toukan 2 participants 2 messages Nov 4 – Nov 10

Subsystems (4)
lore
Share & tools
lore

Tariq Toukan

author maintainer
#0 lore raw

PATCH 1/1 net/mlx5: E-switch, Restore host PF enable for ECPF that isn't E-switch manager

From: Shay Drory <[email protected]>

The cited commit breaks host PF enable_hca when the ECPF isn't E-switch manager. For example, when the link layer is infiniband, the ECPF isn't E-switch manager, so after the cited commit enable_hca is never issued for the host PF, it stays in initializing state and fails to probe.

Fix it by checking esw_allowed() only for vport bookkeeping

Fixes 0e6c95c98829 ("net/mlx5: Support devlink port state for host PF")
---
 .../net/ethernet/mellanox/mlx5/core/eswitch.c | 24 +++++++++----------
 1 file changed, 12 insertions(+), 12 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/eswitch.c +12 -12
index 2d289fb1353b..dd7e33a20ab0 100644
@@ -1514,13 +1514,9 @@ int mlx5_esw_pf_enable_hca(struct mlx5_core_dev *dev, u16 vport_num)
 	struct mlx5_vport *vport;
 	int err;
 
-	if (!mlx5_core_is_ecpf(dev) || !mlx5_esw_allowed(esw))
+	if (!mlx5_core_is_ecpf(dev))
 		return 0;
 
-	vport = mlx5_eswitch_get_vport(esw, vport_num);
-	if (IS_ERR(vport))
-		return PTR_ERR(vport);
-
 	/* Once vport and representor are ready, take the PF out of
 	 * initializing state. Enabling HCA clears the iser->initializing
 	 * bit and PF driver loading can progress.
@@ -1529,7 +1525,11 @@ int mlx5_esw_pf_enable_hca(struct mlx5_core_dev *dev, u16 vport_num)
 	if (err)
 		return err;
 
-	vport->pf_activated = true;
+	if (mlx5_esw_allowed(esw)) {
+		vport = mlx5_eswitch_get_vport(esw, vport_num);
+		if (!IS_ERR(vport))
+			vport->pf_activated = true;
+	}
 
 	return 0;
 }
@@ -1540,18 +1540,18 @@ int mlx5_esw_pf_disable_hca(struct mlx5_core_dev *dev, u16 vport_num)
 	struct mlx5_vport *vport;
 	int err;
 
-	if (!mlx5_core_is_ecpf(dev) || !mlx5_esw_allowed(esw))
+	if (!mlx5_core_is_ecpf(dev))
 		return 0;
 
-	vport = mlx5_eswitch_get_vport(esw, vport_num);
-	if (IS_ERR(vport))
-		return PTR_ERR(vport);
-
 	err = mlx5_cmd_pf_disable_hca(dev, vport_num);
 	if (err)
 		return err;
 
-	vport->pf_activated = false;
+	if (mlx5_esw_allowed(esw)) {
+		vport = mlx5_eswitch_get_vport(esw, vport_num);
+		if (!IS_ERR(vport))
+			vport->pf_activated = false;
+	}
 
 	return 0;
 }

base-commit: 647b81ddefc6364290e67bf33c89d54971f8995e

Signature · 1 line
2.44.0
#1 lore raw
This patch was applied to netdev/net.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net.git (main)
by Jakub Kicinski <[email protected]>:

Quoted 8 lines · On Wed, 4 Nov 2026 20:47:56 +0200 you wrote:

From: Shay Drory <[email protected]>

The cited commit breaks host PF enable_hca when the ECPF isn't E-switch manager. For example, when the link layer is infiniband, the ECPF isn't E-switch manager, so after the cited commit enable_hca is never issued for the host PF, it stays in initializing state and fails to probe.

[...]

Here is the summary with links:
- [net] net/mlx5: E-switch, Restore host PF enable for ECPF that isn't E-switch manager

    https://git.kernel.org/netdev/net/c/4777203cc9af

You are awesome, thank you!

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