net/mlx5e: RS FEC variant fixes
Subsystems (5)
Tariq Toukan
maintainercover net/mlx5e: RS FEC variant fixes
Hi,
This series by Shahar fixes three related bugs in the RS FEC handling for mlx5e, all stemming from incomplete coverage of the three RS FEC hardware variants: RS_528_514 (bit 2), RS_544_514_INTERLEAVED_QUAD (bit 4), and RS_544_514 (bit 7).
Regards,
Tariq
Shahar Shitrit (3):
net/mlx5e: Fix missing FEC mode mapping for
RS_544_514_INTERLEAVED_QUAD
net/mlx5e: Fix setting RS FEC after remapping net/mlx5e: Fix reporting support for all RS FEC variants
drivers/net/ethernet/mellanox/mlx5/core/en/port.c | 15 +++++++++------ drivers/net/ethernet/mellanox/mlx5/core/en/port.h | 4 ++++ .../net/ethernet/mellanox/mlx5/core/en_ethtool.c | 13 +++++++------ 3 files changed, 20 insertions(+), 12 deletions(-)
base-commit: 70f3995830d3f1e79faa14eb0605914f778feca9
Signature · 1 line
2.44.0
Tariq Toukan
maintainerPATCH 1/3 net/mlx5e: Fix missing FEC mode mapping for RS_544_514_INTERLEAVED_QUAD
From: Shahar Shitrit <[email protected]>
MLX5E_FEC_RS_544_514_INTERLEAVED_QUAD is missing from pplm_fec_2_ethtool_linkmodes[], leaving index 4 zero-initialized. As a result, when this FEC mode is active, find_first_bit() returns index 4, causing __set_bit() to set bit 0 (ETHTOOL_LINK_MODE_10baseT_Half_BIT) instead of ETHTOOL_LINK_MODE_FEC_RS_BIT. Consequently, ethtool reports:
Advertised FEC modes: Not reported
Add the missing mapping to ETHTOOL_LINK_MODE_FEC_RS_BIT.
--- drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c +1 -0
@@ -1013,6 +1013,7 @@ static const u32 pplm_fec_2_ethtool_linkmodes[] = { [MLX5E_FEC_NOFEC] = ETHTOOL_LINK_MODE_FEC_NONE_BIT, [MLX5E_FEC_FIRECODE] = ETHTOOL_LINK_MODE_FEC_BASER_BIT, [MLX5E_FEC_RS_528_514] = ETHTOOL_LINK_MODE_FEC_RS_BIT, + [MLX5E_FEC_RS_544_514_INTERLEAVED_QUAD] = ETHTOOL_LINK_MODE_FEC_RS_BIT, [MLX5E_FEC_RS_544_514] = ETHTOOL_LINK_MODE_FEC_RS_BIT, [MLX5E_FEC_LLRS_272_257_1] = ETHTOOL_LINK_MODE_FEC_LLRS_BIT, };
Signature · 1 line
2.44.0
Tariq Toukan
maintainerPATCH 2/3 net/mlx5e: Fix setting RS FEC after remapping
In reply to Tariq ToukanFrom: Shahar Shitrit <[email protected]>
When a user sets a FEC mode via ethtool, the driver maps the ethtool FEC type to the lowest mlx5 bit of that type. For RS FEC, this is MLX5E_FEC_RS_528_514 (bit 2). The driver then checks whether this bit is supported by at least one link mode by inspecting the fec_override_cap fields via mlx5e_fec_in_caps(), and returns -EOPNOTSUPP if not.
This check is incorrect. RS FEC has three supported hardware variants:RS_528_514 (bit 2), RS_544_514_INTERLEAVED_QUAD (bit 4), and RS_544_514 (bit 7). mlx5e_remap_fec_conf_mode() already remaps bit 2 to the appropriate RS variant per link mode when writing the admin fields, but the early capability check is done against the raw unmapped bit. As a result, a device that supports RS_544_514 or RS_544_514_INTERLEAVED_QUAD but not RS_528_514 will incorrectly reject the user's RS FEC request.
Remove the early support check from mlx5e_set_fec_mode() and fold it into the existing write loop, checking caps against the remapped policy per link mode. Return -EOPNOTSUPP before the final register write if no link mode accepted the policy.
--- drivers/net/ethernet/mellanox/mlx5/core/en/port.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en/port.c +9 -6
@@ -557,6 +557,7 @@ int mlx5e_set_fec_mode(struct mlx5_core_dev *dev, u16 fec_policy)u32 in[MLX5_ST_SZ_DW (pplm_reg)] = {};int sz =MLX5_ST_SZ_BYTES (pplm_reg);u16 fec_policy_auto =0 ; +bool fec_set = false;int err;int i;
@@ -569,9 +570,6 @@ int mlx5e_set_fec_mode(struct mlx5_core_dev *dev, u16 fec_policy)if (fec_policy >= (1 <<MLX5E_FEC_LLRS_272_257_1 ) && !fec_50g_per_lane)return -EOPNOTSUPP ; -if (fec_policy && !mlx5e_fec_in_caps (dev, fec_policy)) -return -EOPNOTSUPP ; -MLX5_SET (pplm_reg, in, local_port,1 ); err =mlx5_core_access_reg (dev, in, sz, out, sz,MLX5_REG_PPLM ,0 ,0 );if (err)
@@ -591,12 +589,17 @@ int mlx5e_set_fec_mode(struct mlx5_core_dev *dev, u16 fec_policy)mlx5e_get_fec_cap_field (out, &fec_caps, i);/* policy supported for link speed */ -if (fec_caps & conf_fec) +if (fec_caps & conf_fec) {mlx5e_fec_admin_field (out, &conf_fec,1 , i); -else -/* set FEC to auto*/ + fec_set = true; + }else { +/* set FEC to auto */ mlx5e_fec_admin_field (out, &fec_policy_auto,1 , i); + } } +if (fec_policy && !fec_set) +return -EOPNOTSUPP ; +return mlx5_core_access_reg (dev, out, sz, out, sz,MLX5_REG_PPLM ,0 ,1 ); }
Signature · 1 line
2.44.0
Tariq Toukan
maintainerPATCH 3/3 net/mlx5e: Fix reporting support for all RS FEC variants
In reply to Tariq ToukanFrom: Shahar Shitrit <[email protected]>
get_fec_supported_advertised() populates the FEC modes reported as supported to userspace. The MLX5E_ADVERTISE_SUPPORTED_FEC macro only checked MLX5E_FEC_RS_528_514, causing devices that support only the other RS variants (RS_544_514_INTERLEAVED_QUAD or RS_544_514) to not advertise RS as supported to ethtool at all.
Introduce MLX5E_FEC_RS_MASK covering all three RS bit positions, update the macro to accept a bitmask directly rather than a single enum value, and pass MLX5E_FEC_RS_MASK for the RS entry.
--- drivers/net/ethernet/mellanox/mlx5/core/en/port.h | 4 ++++ drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c | 12 ++++++------ 2 files changed, 10 insertions(+), 6 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en/port.h +4 -0
@@ -66,4 +66,8 @@ enum { MLX5E_FEC_LLRS_272_257_1 = 9, }; +#define MLX5E_FEC_RS_MASK (BIT(MLX5E_FEC_RS_528_514) | \ + BIT(MLX5E_FEC_RS_544_514_INTERLEAVED_QUAD) | \ + BIT(MLX5E_FEC_RS_544_514)) +#endif
drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c +6 -6
@@ -1002,9 +1002,9 @@ static u32 pplm2ethtool_fec(u_long fec_mode, unsigned long size)return 0 ; } -#define MLX5E_ADVERTISE_SUPPORTED_FEC (mlx5_fec, ethtool_fec) \ +#define MLX5E_ADVERTISE_SUPPORTED_FEC (fec_mask, ethtool_fec) \ do { \ - if (mlx5e_fec_in_caps(dev, 1 << (mlx5_fec))) \ + if (mlx5e_fec_in_caps(dev, fec_mask)) \ __set_bit(ethtool_fec, \ link_ksettings->link_modes.supported);\ } while (0)
@@ -1030,13 +1030,13 @@ static int get_fec_supported_advertised(struct mlx5_core_dev *dev,if (err)return (err == -EOPNOTSUPP ) ?0 : err; -MLX5E_ADVERTISE_SUPPORTED_FEC (MLX5E_FEC_NOFEC , +MLX5E_ADVERTISE_SUPPORTED_FEC (BIT (MLX5E_FEC_NOFEC ),ETHTOOL_LINK_MODE_FEC_NONE_BIT ); -MLX5E_ADVERTISE_SUPPORTED_FEC (MLX5E_FEC_FIRECODE , +MLX5E_ADVERTISE_SUPPORTED_FEC (BIT (MLX5E_FEC_FIRECODE ),ETHTOOL_LINK_MODE_FEC_BASER_BIT ); -MLX5E_ADVERTISE_SUPPORTED_FEC (MLX5E_FEC_RS_528_514 , +MLX5E_ADVERTISE_SUPPORTED_FEC (MLX5E_FEC_RS_MASK ,ETHTOOL_LINK_MODE_FEC_RS_BIT ); -MLX5E_ADVERTISE_SUPPORTED_FEC (MLX5E_FEC_LLRS_272_257_1 , +MLX5E_ADVERTISE_SUPPORTED_FEC (BIT (MLX5E_FEC_LLRS_272_257_1 ),ETHTOOL_LINK_MODE_FEC_LLRS_BIT ); active_fec_long = active_fec;
Signature · 1 line
2.44.0
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 Wed, 2 Sep 2026 19:46:31 +0300 you wrote:
Hi,
This series by Shahar fixes three related bugs in the RS FEC handling for mlx5e, all stemming from incomplete coverage of the three RS FEC hardware variants:
RS_528_514(bit 2),RS_544_514_INTERLEAVED_QUAD(bit 4), andRS_544_514(bit 7).[...]
Here is the summary with links:
- [net,1/3] net/mlx5e: Fix missing FEC mode mapping for RS_544_514_INTERLEAVED_QUAD
https://git.kernel.org/netdev/net/c/802eedcc0b25 - [net,2/3] net/mlx5e: Fix setting RS FEC after remapping https://git.kernel.org/netdev/net/c/b9d755c5a375 - [net,3/3] net/mlx5e: Fix reporting support for all RS FEC variants https://git.kernel.org/netdev/net/c/c84ce45a7a3f
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html