|
| 1 | +From e92df790d07a8eea873efcb84776e7b71f81c7d5 Mon Sep 17 00:00:00 2001 |
| 2 | +From: Carolina Jubran < [email protected]> |
| 3 | +Date: Tue, 11 Mar 2025 00:01:44 +0200 |
| 4 | +Subject: [PATCH] net/mlx5e: Prevent bridge link show failure for |
| 5 | + non-eswitch-allowed devices |
| 6 | + |
| 7 | +mlx5_eswitch_get_vepa returns -EPERM if the device lacks |
| 8 | +eswitch_manager capability, blocking mlx5e_bridge_getlink from |
| 9 | +retrieving VEPA mode. Since mlx5e_bridge_getlink implements |
| 10 | +ndo_bridge_getlink, returning -EPERM causes bridge link show to fail |
| 11 | +instead of skipping devices without this capability. |
| 12 | + |
| 13 | +To avoid this, return -EOPNOTSUPP from mlx5e_bridge_getlink when |
| 14 | +mlx5_eswitch_get_vepa fails, ensuring the command continues processing |
| 15 | +other devices while ignoring those without the necessary capability. |
| 16 | + |
| 17 | +Fixes: 4b89251de024 ("net/mlx5: Support ndo bridge_setlink and getlink") |
| 18 | +Signed-off-by: Carolina Jubran < [email protected]> |
| 19 | +Reviewed-by: Jianbo Liu < [email protected]> |
| 20 | +Signed-off-by: Tariq Toukan < [email protected]> |
| 21 | +Reviewed-by: Michal Swiatkowski < [email protected]> |
| 22 | +Link: https://patch.msgid.link/ [email protected] |
| 23 | +Signed-off-by: Paolo Abeni < [email protected]> |
| 24 | +--- |
| 25 | + drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 6 ++---- |
| 26 | + 1 file changed, 2 insertions(+), 4 deletions(-) |
| 27 | + |
| 28 | +diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c |
| 29 | +index a814b63ed97e57..8fcaee381b0e09 100644 |
| 30 | +--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c |
| 31 | ++++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c |
| 32 | +@@ -5132,11 +5132,9 @@ static int mlx5e_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq, |
| 33 | + struct mlx5e_priv *priv = netdev_priv(dev); |
| 34 | + struct mlx5_core_dev *mdev = priv->mdev; |
| 35 | + u8 mode, setting; |
| 36 | +- int err; |
| 37 | + |
| 38 | +- err = mlx5_eswitch_get_vepa(mdev->priv.eswitch, &setting); |
| 39 | +- if (err) |
| 40 | +- return err; |
| 41 | ++ if (mlx5_eswitch_get_vepa(mdev->priv.eswitch, &setting)) |
| 42 | ++ return -EOPNOTSUPP; |
| 43 | + mode = setting ? BRIDGE_MODE_VEPA : BRIDGE_MODE_VEB; |
| 44 | + return ndo_dflt_bridge_getlink(skb, pid, seq, dev, |
| 45 | + mode, |
0 commit comments