Message ID | 20210602013723.1142650-2-saeed@kernel.org |
---|---|
State | New |
Headers | show |
Series | mlx5 fixes 2021-06-01 | expand |
Hello: This series was applied to netdev/net.git (refs/heads/master): On Tue, 1 Jun 2021 18:37:16 -0700 you wrote: > From: Aya Levin <ayal@nvidia.com> > > Device supports setting of a single fec mode at a time, enforce this > by bitmap_weight == 1. Input from fec command is in u32, avoid cast to > unsigned long and use bitmap_from_arr32 to populate bitmap safely. > > Fixes: 4bd9d5070b92 ("net/mlx5e: Enforce setting of a single FEC mode") > Signed-off-by: Aya Levin <ayal@nvidia.com> > Reviewed-by: Tariq Toukan <tariqt@nvidia.com> > Signed-off-by: Saeed Mahameed <saeedm@nvidia.com> > > [...] Here is the summary with links: - [net,1/8] net/mlx5e: Fix incompatible casting https://git.kernel.org/netdev/net/c/d8ec92005f80 - [net,2/8] net/mlx5e: Disable TLS offload for uplink representor https://git.kernel.org/netdev/net/c/b38742e41177 - [net,3/8] net/mlx5: Check firmware sync reset requested is set before trying to abort it https://git.kernel.org/netdev/net/c/5940e64281c0 - [net,4/8] net/mlx5e: Check for needed capability for cvlan matching https://git.kernel.org/netdev/net/c/afe93f71b5d3 - [net,5/8] net/mlx5e: Fix adding encap rules to slow path https://git.kernel.org/netdev/net/c/2a2c84facd4a - [net,6/8] net/mlx5e: Fix HW TS with CQE compression according to profile https://git.kernel.org/netdev/net/c/256f79d13c1d - [net,7/8] net/mlx5e: Fix conflict with HW TS and CQE compression https://git.kernel.org/netdev/net/c/5349cbba754e - [net,8/8] net/mlx5: DR, Create multi-destination flow table with level less than 64 https://git.kernel.org/netdev/net/c/216214c64a8c You are awesome, thank you! -- Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html
From: Saeed Mahameed > Sent: 02 June 2021 02:37 > > Device supports setting of a single fec mode at a time, enforce this > by bitmap_weight == 1. Input from fec command is in u32, avoid cast to > unsigned long and use bitmap_from_arr32 to populate bitmap safely. > ... > > diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c > b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c > index 8360289813f0..c4724742eef1 100644 > --- a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c > +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c > @@ -1624,12 +1624,13 @@ static int mlx5e_set_fecparam(struct net_device *netdev, > { > struct mlx5e_priv *priv = netdev_priv(netdev); > struct mlx5_core_dev *mdev = priv->mdev; > + unsigned long fec_bitmap; > u16 fec_policy = 0; > int mode; > int err; > > - if (bitmap_weight((unsigned long *)&fecparam->fec, > - ETHTOOL_FEC_LLRS_BIT + 1) > 1) > + bitmap_from_arr32(&fec_bitmap, &fecparam->fec, sizeof(fecparam->fec) * BITS_PER_BYTE); > + if (bitmap_weight(&fec_bitmap, ETHTOOL_FEC_LLRS_BIT + 1) > 1) > return -EOPNOTSUPP; What is wrong with: if (fecparam->fec & (fecparam->fec - 1)) return -EOPNOTSUPP; David - Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c index 8360289813f0..c4724742eef1 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c @@ -1624,12 +1624,13 @@ static int mlx5e_set_fecparam(struct net_device *netdev, { struct mlx5e_priv *priv = netdev_priv(netdev); struct mlx5_core_dev *mdev = priv->mdev; + unsigned long fec_bitmap; u16 fec_policy = 0; int mode; int err; - if (bitmap_weight((unsigned long *)&fecparam->fec, - ETHTOOL_FEC_LLRS_BIT + 1) > 1) + bitmap_from_arr32(&fec_bitmap, &fecparam->fec, sizeof(fecparam->fec) * BITS_PER_BYTE); + if (bitmap_weight(&fec_bitmap, ETHTOOL_FEC_LLRS_BIT + 1) > 1) return -EOPNOTSUPP; for (mode = 0; mode < ARRAY_SIZE(pplm_fec_2_ethtool); mode++) {