aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJianbo Liu <jianbol@mellanox.com>2018-03-01 21:09:08 -0500
committerSaeed Mahameed <saeedm@mellanox.com>2018-03-26 16:58:15 -0400
commit84c9c8f2ac3c22924d30643894fcf7597c633d3e (patch)
treec3025635c0c3b61388e1b24daf8ca3e315bb9798
parent3c82b372a9f44aa224b8d5106ff6f1ad516fa8a8 (diff)
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: 20a1ea674783 ('net/mlx5e: Support VF vport link state control for SRIOV switchdev mode') Signed-off-by: Jianbo Liu <jianbol@mellanox.com> Reviewed-by: Roi Dayan <roid@mellanox.com> Reviewed-by: Or Gerlitz <ogerlitz@mellanox.com> Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
-rw-r--r--drivers/net/ethernet/mellanox/mlx5/core/en_rep.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
index 363d8dcb7f17..0273c233bc85 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
@@ -668,7 +668,6 @@ static int mlx5e_rep_open(struct net_device *dev)
668 struct mlx5e_priv *priv = netdev_priv(dev); 668 struct mlx5e_priv *priv = netdev_priv(dev);
669 struct mlx5e_rep_priv *rpriv = priv->ppriv; 669 struct mlx5e_rep_priv *rpriv = priv->ppriv;
670 struct mlx5_eswitch_rep *rep = rpriv->rep; 670 struct mlx5_eswitch_rep *rep = rpriv->rep;
671 struct mlx5_eswitch *esw = priv->mdev->priv.eswitch;
672 int err; 671 int err;
673 672
674 mutex_lock(&priv->state_lock); 673 mutex_lock(&priv->state_lock);
@@ -676,8 +675,9 @@ static int mlx5e_rep_open(struct net_device *dev)
676 if (err) 675 if (err)
677 goto unlock; 676 goto unlock;
678 677
679 if (!mlx5_eswitch_set_vport_state(esw, rep->vport, 678 if (!mlx5_modify_vport_admin_state(priv->mdev,
680 MLX5_ESW_VPORT_ADMIN_STATE_UP)) 679 MLX5_QUERY_VPORT_STATE_IN_OP_MOD_ESW_VPORT,
680 rep->vport, MLX5_ESW_VPORT_ADMIN_STATE_UP))
681 netif_carrier_on(dev); 681 netif_carrier_on(dev);
682 682
683unlock: 683unlock:
@@ -690,11 +690,12 @@ static int mlx5e_rep_close(struct net_device *dev)
690 struct mlx5e_priv *priv = netdev_priv(dev); 690 struct mlx5e_priv *priv = netdev_priv(dev);
691 struct mlx5e_rep_priv *rpriv = priv->ppriv; 691 struct mlx5e_rep_priv *rpriv = priv->ppriv;
692 struct mlx5_eswitch_rep *rep = rpriv->rep; 692 struct mlx5_eswitch_rep *rep = rpriv->rep;
693 struct mlx5_eswitch *esw = priv->mdev->priv.eswitch;
694 int ret; 693 int ret;
695 694
696 mutex_lock(&priv->state_lock); 695 mutex_lock(&priv->state_lock);
697 (void)mlx5_eswitch_set_vport_state(esw, rep->vport, MLX5_ESW_VPORT_ADMIN_STATE_DOWN); 696 mlx5_modify_vport_admin_state(priv->mdev,
697 MLX5_QUERY_VPORT_STATE_IN_OP_MOD_ESW_VPORT,
698 rep->vport, MLX5_ESW_VPORT_ADMIN_STATE_DOWN);
698 ret = mlx5e_close_locked(dev); 699 ret = mlx5e_close_locked(dev);
699 mutex_unlock(&priv->state_lock); 700 mutex_unlock(&priv->state_lock);
700 return ret; 701 return ret;