Commit 84c9c8f2 authored by Jianbo Liu's avatar Jianbo Liu Committed by Saeed Mahameed

net/mlx5e: Don't override vport admin link state in switchdev mode

The vport admin original link state will be re-applied after returning
back to legacy mode, it is not right to change the admin link state value
when in switchdev mode.

Use direct vport commands to alter logical vport state in netdev
representor open/close flows rather than the administrative eswitch API.

Fixes: 20a1ea67 ('net/mlx5e: Support VF vport link state control for SRIOV switchdev mode')
Signed-off-by: default avatarJianbo Liu <jianbol@mellanox.com>
Reviewed-by: default avatarRoi Dayan <roid@mellanox.com>
Reviewed-by: default avatarOr Gerlitz <ogerlitz@mellanox.com>
Signed-off-by: default avatarSaeed Mahameed <saeedm@mellanox.com>
parent 3c82b372
...@@ -668,7 +668,6 @@ static int mlx5e_rep_open(struct net_device *dev) ...@@ -668,7 +668,6 @@ static int mlx5e_rep_open(struct net_device *dev)
struct mlx5e_priv *priv = netdev_priv(dev); struct mlx5e_priv *priv = netdev_priv(dev);
struct mlx5e_rep_priv *rpriv = priv->ppriv; struct mlx5e_rep_priv *rpriv = priv->ppriv;
struct mlx5_eswitch_rep *rep = rpriv->rep; struct mlx5_eswitch_rep *rep = rpriv->rep;
struct mlx5_eswitch *esw = priv->mdev->priv.eswitch;
int err; int err;
mutex_lock(&priv->state_lock); mutex_lock(&priv->state_lock);
...@@ -676,8 +675,9 @@ static int mlx5e_rep_open(struct net_device *dev) ...@@ -676,8 +675,9 @@ static int mlx5e_rep_open(struct net_device *dev)
if (err) if (err)
goto unlock; goto unlock;
if (!mlx5_eswitch_set_vport_state(esw, rep->vport, if (!mlx5_modify_vport_admin_state(priv->mdev,
MLX5_ESW_VPORT_ADMIN_STATE_UP)) MLX5_QUERY_VPORT_STATE_IN_OP_MOD_ESW_VPORT,
rep->vport, MLX5_ESW_VPORT_ADMIN_STATE_UP))
netif_carrier_on(dev); netif_carrier_on(dev);
unlock: unlock:
...@@ -690,11 +690,12 @@ static int mlx5e_rep_close(struct net_device *dev) ...@@ -690,11 +690,12 @@ static int mlx5e_rep_close(struct net_device *dev)
struct mlx5e_priv *priv = netdev_priv(dev); struct mlx5e_priv *priv = netdev_priv(dev);
struct mlx5e_rep_priv *rpriv = priv->ppriv; struct mlx5e_rep_priv *rpriv = priv->ppriv;
struct mlx5_eswitch_rep *rep = rpriv->rep; struct mlx5_eswitch_rep *rep = rpriv->rep;
struct mlx5_eswitch *esw = priv->mdev->priv.eswitch;
int ret; int ret;
mutex_lock(&priv->state_lock); mutex_lock(&priv->state_lock);
(void)mlx5_eswitch_set_vport_state(esw, rep->vport, MLX5_ESW_VPORT_ADMIN_STATE_DOWN); mlx5_modify_vport_admin_state(priv->mdev,
MLX5_QUERY_VPORT_STATE_IN_OP_MOD_ESW_VPORT,
rep->vport, MLX5_ESW_VPORT_ADMIN_STATE_DOWN);
ret = mlx5e_close_locked(dev); ret = mlx5e_close_locked(dev);
mutex_unlock(&priv->state_lock); mutex_unlock(&priv->state_lock);
return ret; return ret;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment