net/mlx5e: Don't support phys switch id if not in switchdev mode
authorRoi Dayan <roid@mellanox.com>
Fri, 7 Aug 2020 02:05:42 +0000 (19:05 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 21 Aug 2020 09:01:53 +0000 (11:01 +0200)
Support for phys switch id ndo added for representors and if
we do not have representors there is no need to support it.
Since each port return different switch id supporting this
block support for creating bond over PFs and attaching to bridge
in legacy mode.

This bug doesn't exist upstream as the code got refactored and the
netdev api is totally different.

Fixes: cb67b832921c ("net/mlx5e: Introduce SRIOV VF representors")
Signed-off-by: Roi Dayan <roid@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/net/ethernet/mellanox/mlx5/core/en_rep.c

index b210c171a38066a04a07767a3e54f47a2d3ec8bf..f3d3ad25f05e9fdc0adaa71e5e2639e8d47a08ba 100644 (file)
@@ -139,7 +139,7 @@ int mlx5e_attr_get(struct net_device *dev, struct switchdev_attr *attr)
        struct mlx5_eswitch_rep *rep = priv->ppriv;
        struct mlx5_eswitch *esw = priv->mdev->priv.eswitch;
 
-       if (esw->mode == SRIOV_NONE)
+       if (esw->mode != SRIOV_OFFLOADS)
                return -EOPNOTSUPP;
 
        switch (attr->id) {