| From c2bc1f4b159d57ffaad0e169e03a5cc9d38e9b92 Mon Sep 17 00:00:00 2001 |
| From: Aya Levin <ayal@mellanox.com> |
| Date: Tue, 11 Feb 2020 14:32:49 -0800 |
| Subject: [PATCH] net/mlx5e: Enforce setting of a single FEC mode |
| |
| commit 4bd9d5070b92da012f2715cf8e4859acb78b8f35 upstream. |
| |
| 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> |
| Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com> |
| |
| diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c |
| index 21aeb0cf4b54..8b95a732da6f 100644 |
| --- a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c |
| +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c |
| @@ -1533,6 +1533,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; |
| -- |
| 2.7.4 |
| |