Skip to contentSkip to conversation

net/mlx5: Remove dead code from total_vfs setter

PATCH Applied Vlad Dumitrescu 2 participants 2 messages Sep 18, 2025 – Sep 20, 2025

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net/mlx5: Remove dead code from total_vfs setter

The mlx5_devlink_total_vfs_set function branches based on per_pf_support twice. Remove the second branch as the first one exits the function when per_pf_support is false.

Accidentally added as part of commit a4c49611cf4f ("net/mlx5: Implement devlink total_vfs parameter").

---
 .../net/ethernet/mellanox/mlx5/core/lib/nv_param.c  | 13 ++-----------
 1 file changed, 2 insertions(+), 11 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/lib/nv_param.c +2 -11
index 383d8cfe4c0a..459a0b4d08e6 100644
@@ -458,7 +458,6 @@ static int mlx5_devlink_total_vfs_set(struct devlink *devlink, u32 id,
 {
 	struct mlx5_core_dev *dev = devlink_priv(devlink);
 	u32 mnvda[MLX5_ST_SZ_DW(mnvda_reg)];
-	bool per_pf_support;
 	void *data;
 	int err;
 
@@ -474,9 +473,7 @@ static int mlx5_devlink_total_vfs_set(struct devlink *devlink, u32 id,
 		return -EOPNOTSUPP;
 	}
 
-	per_pf_support = MLX5_GET(nv_global_pci_cap, data,
-				  per_pf_total_vf_supported);
-	if (!per_pf_support) {
+	if (!MLX5_GET(nv_global_pci_cap, data, per_pf_total_vf_supported)) {
 		/* We don't allow global SRIOV setting on per PF devlink */
 		NL_SET_ERR_MSG_MOD(extack,
 				   "SRIOV is not per PF on this device");
@@ -489,14 +486,8 @@ static int mlx5_devlink_total_vfs_set(struct devlink *devlink, u32 id,
 		return err;
 
 	MLX5_SET(nv_global_pci_conf, data, sriov_valid, 1);
-	MLX5_SET(nv_global_pci_conf, data, per_pf_total_vf, per_pf_support);
-
-	if (!per_pf_support) {
-		MLX5_SET(nv_global_pci_conf, data, total_vfs, ctx->val.vu32);
-		return mlx5_nv_param_write(dev, mnvda, sizeof(mnvda));
-	}
+	MLX5_SET(nv_global_pci_conf, data, per_pf_total_vf, 1);
 
-	/* SRIOV is per PF */
 	err = mlx5_nv_param_write(dev, mnvda, sizeof(mnvda));
 	if (err)
 		return err;
Signature · 1 line
2.49.0
#1 lore raw
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Hello:

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

Quoted 8 lines · On Thu, 18 Sep 2025 15:05:07 -0700 you wrote:

The mlx5_devlink_total_vfs_set function branches based on per_pf_support twice. Remove the second branch as the first one exits the function when per_pf_support is false.

Accidentally added as part of commit a4c49611cf4f ("net/mlx5: Implement devlink total_vfs parameter").

[...]

Here is the summary with links:
- [net-next] net/mlx5: Remove dead code from total_vfs setter

    https://git.kernel.org/netdev/net-next/c/6a46e4faa8fd

You are awesome, thank you!

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