Skip to content

Commit

Permalink
net/mlx5e: Enforce setting of a single FEC mode
Browse files Browse the repository at this point in the history
Ethtool command allow setting of several FEC modes in a single set
command. The driver can only set a single FEC mode at a time. With this
patch driver will reply not-supported on setting several FEC modes.

Signed-off-by: Aya Levin <ayal@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
  • Loading branch information
ayalevin123 authored and Saeed Mahameed committed Feb 19, 2020
1 parent 511aa2a commit 4bd9d50
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
Expand Up @@ -1541,6 +1541,10 @@ static int mlx5e_set_fecparam(struct net_device *netdev,
int mode;
int err;

if (bitmap_weight((unsigned long *)&fecparam->fec,
ETHTOOL_FEC_BASER_BIT + 1) > 1)
return -EOPNOTSUPP;

for (mode = 0; mode < ARRAY_SIZE(pplm_fec_2_ethtool); mode++) {
if (!(pplm_fec_2_ethtool[mode] & fecparam->fec))
continue;
Expand Down

0 comments on commit 4bd9d50

Please sign in to comment.