Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit cc9c82a8 authored by Eran Ben Elisha's avatar Eran Ben Elisha Committed by David S. Miller
Browse files

net/mlx5: Rename modify/query_vport state related enums



Modify and query vport state commands share the same admin_state and
op_mod values, rename the enums to fit them both.

In addition, remove the esw prefix from the admin state enum as this
also applied for vnic.

Signed-off-by: default avatarEran Ben Elisha <eranbe@mellanox.com>
Signed-off-by: default avatarSaeed Mahameed <saeedm@mellanox.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 342ac844
Loading
Loading
Loading
Loading
+6 −6
Original line number Original line Diff line number Diff line
@@ -228,7 +228,7 @@ static void mlx5e_update_carrier(struct mlx5e_priv *priv)
	u8 port_state;
	u8 port_state;


	port_state = mlx5_query_vport_state(mdev,
	port_state = mlx5_query_vport_state(mdev,
					    MLX5_QUERY_VPORT_STATE_IN_OP_MOD_VNIC_VPORT,
					    MLX5_VPORT_STATE_OP_MOD_VNIC_VPORT,
					    0);
					    0);


	if (port_state == VPORT_STATE_UP) {
	if (port_state == VPORT_STATE_UP) {
@@ -3916,9 +3916,9 @@ static int mlx5e_set_vf_rate(struct net_device *dev, int vf, int min_tx_rate,
static int mlx5_vport_link2ifla(u8 esw_link)
static int mlx5_vport_link2ifla(u8 esw_link)
{
{
	switch (esw_link) {
	switch (esw_link) {
	case MLX5_ESW_VPORT_ADMIN_STATE_DOWN:
	case MLX5_VPORT_ADMIN_STATE_DOWN:
		return IFLA_VF_LINK_STATE_DISABLE;
		return IFLA_VF_LINK_STATE_DISABLE;
	case MLX5_ESW_VPORT_ADMIN_STATE_UP:
	case MLX5_VPORT_ADMIN_STATE_UP:
		return IFLA_VF_LINK_STATE_ENABLE;
		return IFLA_VF_LINK_STATE_ENABLE;
	}
	}
	return IFLA_VF_LINK_STATE_AUTO;
	return IFLA_VF_LINK_STATE_AUTO;
@@ -3928,11 +3928,11 @@ static int mlx5_ifla_link2vport(u8 ifla_link)
{
{
	switch (ifla_link) {
	switch (ifla_link) {
	case IFLA_VF_LINK_STATE_DISABLE:
	case IFLA_VF_LINK_STATE_DISABLE:
		return MLX5_ESW_VPORT_ADMIN_STATE_DOWN;
		return MLX5_VPORT_ADMIN_STATE_DOWN;
	case IFLA_VF_LINK_STATE_ENABLE:
	case IFLA_VF_LINK_STATE_ENABLE:
		return MLX5_ESW_VPORT_ADMIN_STATE_UP;
		return MLX5_VPORT_ADMIN_STATE_UP;
	}
	}
	return MLX5_ESW_VPORT_ADMIN_STATE_AUTO;
	return MLX5_VPORT_ADMIN_STATE_AUTO;
}
}


static int mlx5e_set_vf_link_state(struct net_device *dev, int vf,
static int mlx5e_set_vf_link_state(struct net_device *dev, int vf,
+4 −4
Original line number Original line Diff line number Diff line
@@ -698,8 +698,8 @@ static int mlx5e_rep_open(struct net_device *dev)
		goto unlock;
		goto unlock;


	if (!mlx5_modify_vport_admin_state(priv->mdev,
	if (!mlx5_modify_vport_admin_state(priv->mdev,
					   MLX5_QUERY_VPORT_STATE_IN_OP_MOD_ESW_VPORT,
					   MLX5_VPORT_STATE_OP_MOD_ESW_VPORT,
					   rep->vport, MLX5_ESW_VPORT_ADMIN_STATE_UP))
					   rep->vport, MLX5_VPORT_ADMIN_STATE_UP))
		netif_carrier_on(dev);
		netif_carrier_on(dev);


unlock:
unlock:
@@ -716,8 +716,8 @@ static int mlx5e_rep_close(struct net_device *dev)


	mutex_lock(&priv->state_lock);
	mutex_lock(&priv->state_lock);
	mlx5_modify_vport_admin_state(priv->mdev,
	mlx5_modify_vport_admin_state(priv->mdev,
				      MLX5_QUERY_VPORT_STATE_IN_OP_MOD_ESW_VPORT,
				      MLX5_VPORT_STATE_OP_MOD_ESW_VPORT,
				      rep->vport, MLX5_ESW_VPORT_ADMIN_STATE_DOWN);
				      rep->vport, MLX5_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;
+1 −1
Original line number Original line Diff line number Diff line
@@ -74,7 +74,7 @@ static int mlx5e_test_link_state(struct mlx5e_priv *priv)
	if (!netif_carrier_ok(priv->netdev))
	if (!netif_carrier_ok(priv->netdev))
		return 1;
		return 1;


	port_state = mlx5_query_vport_state(priv->mdev, MLX5_QUERY_VPORT_STATE_IN_OP_MOD_VNIC_VPORT, 0);
	port_state = mlx5_query_vport_state(priv->mdev, MLX5_VPORT_STATE_OP_MOD_VNIC_VPORT, 0);
	return port_state == VPORT_STATE_UP ? 0 : 1;
	return port_state == VPORT_STATE_UP ? 0 : 1;
}
}


+5 −5
Original line number Original line Diff line number Diff line
@@ -1469,7 +1469,7 @@ static void esw_apply_vport_conf(struct mlx5_eswitch *esw,
		return;
		return;


	mlx5_modify_vport_admin_state(esw->dev,
	mlx5_modify_vport_admin_state(esw->dev,
				      MLX5_QUERY_VPORT_STATE_IN_OP_MOD_ESW_VPORT,
				      MLX5_VPORT_STATE_OP_MOD_ESW_VPORT,
				      vport_num,
				      vport_num,
				      vport->info.link_state);
				      vport->info.link_state);
	mlx5_modify_nic_vport_mac_address(esw->dev, vport_num, vport->info.mac);
	mlx5_modify_nic_vport_mac_address(esw->dev, vport_num, vport->info.mac);
@@ -1582,9 +1582,9 @@ static void esw_disable_vport(struct mlx5_eswitch *esw, int vport_num)
	esw_vport_disable_qos(esw, vport_num);
	esw_vport_disable_qos(esw, vport_num);
	if (vport_num && esw->mode == SRIOV_LEGACY) {
	if (vport_num && esw->mode == SRIOV_LEGACY) {
		mlx5_modify_vport_admin_state(esw->dev,
		mlx5_modify_vport_admin_state(esw->dev,
					      MLX5_QUERY_VPORT_STATE_IN_OP_MOD_ESW_VPORT,
					      MLX5_VPORT_STATE_OP_MOD_ESW_VPORT,
					      vport_num,
					      vport_num,
					      MLX5_ESW_VPORT_ADMIN_STATE_DOWN);
					      MLX5_VPORT_ADMIN_STATE_DOWN);
		esw_vport_disable_egress_acl(esw, vport);
		esw_vport_disable_egress_acl(esw, vport);
		esw_vport_disable_ingress_acl(esw, vport);
		esw_vport_disable_ingress_acl(esw, vport);
		esw_vport_destroy_drop_counters(vport);
		esw_vport_destroy_drop_counters(vport);
@@ -1736,7 +1736,7 @@ int mlx5_eswitch_init(struct mlx5_core_dev *dev)
		struct mlx5_vport *vport = &esw->vports[vport_num];
		struct mlx5_vport *vport = &esw->vports[vport_num];


		vport->vport = vport_num;
		vport->vport = vport_num;
		vport->info.link_state = MLX5_ESW_VPORT_ADMIN_STATE_AUTO;
		vport->info.link_state = MLX5_VPORT_ADMIN_STATE_AUTO;
		vport->dev = dev;
		vport->dev = dev;
		INIT_WORK(&vport->vport_change_handler,
		INIT_WORK(&vport->vport_change_handler,
			  esw_vport_change_handler);
			  esw_vport_change_handler);
@@ -1860,7 +1860,7 @@ int mlx5_eswitch_set_vport_state(struct mlx5_eswitch *esw,
	evport = &esw->vports[vport];
	evport = &esw->vports[vport];


	err = mlx5_modify_vport_admin_state(esw->dev,
	err = mlx5_modify_vport_admin_state(esw->dev,
					    MLX5_QUERY_VPORT_STATE_IN_OP_MOD_ESW_VPORT,
					    MLX5_VPORT_STATE_OP_MOD_ESW_VPORT,
					    vport, link_state);
					    vport, link_state);
	if (err) {
	if (err) {
		mlx5_core_warn(esw->dev,
		mlx5_core_warn(esw->dev,
+3 −3
Original line number Original line Diff line number Diff line
@@ -946,9 +946,9 @@ enum {
};
};


enum {
enum {
	MLX5_ESW_VPORT_ADMIN_STATE_DOWN  = 0x0,
	MLX5_VPORT_ADMIN_STATE_DOWN  = 0x0,
	MLX5_ESW_VPORT_ADMIN_STATE_UP    = 0x1,
	MLX5_VPORT_ADMIN_STATE_UP    = 0x1,
	MLX5_ESW_VPORT_ADMIN_STATE_AUTO  = 0x2,
	MLX5_VPORT_ADMIN_STATE_AUTO  = 0x2,
};
};


enum {
enum {
Loading