Skip to content

Commit 2608a2f

Browse files
ayalevin123Saeed Mahameed
authored andcommitted
net/mlx5e: Fix return status when setting unsupported FEC mode
Verify the configured FEC mode is supported by at least a single link mode before applying the command. Otherwise fail the command and return "Operation not supported". Prior to this patch, the command was successful, yet it falsely set all link modes to FEC auto mode - like configuring FEC mode to auto. Auto mode is the default configuration if a link mode doesn't support the configured FEC mode. Fixes: b5ede32 ("net/mlx5e: Add support for FEC modes based on 50G per lane links") Signed-off-by: Aya Levin <[email protected]> Reviewed-by: Eran Ben Elisha <[email protected]> Reviewed-by: Moshe Shemesh <[email protected]> Signed-off-by: Saeed Mahameed <[email protected]>
1 parent 3d093bc commit 2608a2f

File tree

1 file changed

+3
-0
lines changed
  • drivers/net/ethernet/mellanox/mlx5/core/en

1 file changed

+3
-0
lines changed

drivers/net/ethernet/mellanox/mlx5/core/en/port.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -569,6 +569,9 @@ int mlx5e_set_fec_mode(struct mlx5_core_dev *dev, u16 fec_policy)
569569
if (fec_policy >= (1 << MLX5E_FEC_LLRS_272_257_1) && !fec_50g_per_lane)
570570
return -EOPNOTSUPP;
571571

572+
if (fec_policy && !mlx5e_fec_in_caps(dev, fec_policy))
573+
return -EOPNOTSUPP;
574+
572575
MLX5_SET(pplm_reg, in, local_port, 1);
573576
err = mlx5_core_access_reg(dev, in, sz, out, sz, MLX5_REG_PPLM, 0, 0);
574577
if (err)

0 commit comments

Comments
 (0)