Skip to content

Commit abf298d

Browse files
cjubranopsiff
authored andcommitted
net/mlx5e: Prevent bridge link show failure for non-eswitch-allowed devices
[ Upstream commit e92df79 ] mlx5_eswitch_get_vepa returns -EPERM if the device lacks eswitch_manager capability, blocking mlx5e_bridge_getlink from retrieving VEPA mode. Since mlx5e_bridge_getlink implements ndo_bridge_getlink, returning -EPERM causes bridge link show to fail instead of skipping devices without this capability. To avoid this, return -EOPNOTSUPP from mlx5e_bridge_getlink when mlx5_eswitch_get_vepa fails, ensuring the command continues processing other devices while ignoring those without the necessary capability. Fixes: 4b89251 ("net/mlx5: Support ndo bridge_setlink and getlink") Signed-off-by: Carolina Jubran <cjubran@nvidia.com> Reviewed-by: Jianbo Liu <jianbol@nvidia.com> Signed-off-by: Tariq Toukan <tariqt@nvidia.com> Reviewed-by: Michal Swiatkowski <michal.swiatkowski@linux.intel.com> Link: https://patch.msgid.link/1741644104-97767-7-git-send-email-tariqt@nvidia.com Signed-off-by: Paolo Abeni <pabeni@redhat.com> Signed-off-by: Sasha Levin <sashal@kernel.org> (cherry picked from commit 885b727)
1 parent 307b17d commit abf298d

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

  • drivers/net/ethernet/mellanox/mlx5/core

drivers/net/ethernet/mellanox/mlx5/core/en_main.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4891,11 +4891,9 @@ static int mlx5e_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq,
48914891
struct mlx5e_priv *priv = netdev_priv(dev);
48924892
struct mlx5_core_dev *mdev = priv->mdev;
48934893
u8 mode, setting;
4894-
int err;
48954894

4896-
err = mlx5_eswitch_get_vepa(mdev->priv.eswitch, &setting);
4897-
if (err)
4898-
return err;
4895+
if (mlx5_eswitch_get_vepa(mdev->priv.eswitch, &setting))
4896+
return -EOPNOTSUPP;
48994897
mode = setting ? BRIDGE_MODE_VEPA : BRIDGE_MODE_VEB;
49004898
return ndo_dflt_bridge_getlink(skb, pid, seq, dev,
49014899
mode,

0 commit comments

Comments
 (0)