Commit fcf8ec54 authored by Parav Pandit's avatar Parav Pandit Committed by Saeed Mahameed

net/mlx5: E-switch, Remove vport enabled check

An eswitch vport of the devlink port is always enabled before a
devlink port is registered. And a eswitch vport is always disabled
after a devlink port is unregistered.
Hence avoid the vport enabled check in the devlink callback routine.
Such check is only applicable in the legacy SR-IOV callbacks.
Signed-off-by: default avatarParav Pandit <parav@nvidia.com>
Reviewed-by: default avatarSunil Sudhakar Rani <sunrani@nvidia.com>
Reviewed-by: default avatarMark Bloch <mbloch@nvidia.com>
Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
parent 819c319c
...@@ -1704,7 +1704,6 @@ int mlx5_devlink_port_function_hw_addr_get(struct devlink_port *port, ...@@ -1704,7 +1704,6 @@ int mlx5_devlink_port_function_hw_addr_get(struct devlink_port *port,
{ {
struct mlx5_eswitch *esw; struct mlx5_eswitch *esw;
struct mlx5_vport *vport; struct mlx5_vport *vport;
int err = -EOPNOTSUPP;
u16 vport_num; u16 vport_num;
esw = mlx5_devlink_eswitch_get(port->devlink); esw = mlx5_devlink_eswitch_get(port->devlink);
...@@ -1722,13 +1721,10 @@ int mlx5_devlink_port_function_hw_addr_get(struct devlink_port *port, ...@@ -1722,13 +1721,10 @@ int mlx5_devlink_port_function_hw_addr_get(struct devlink_port *port,
} }
mutex_lock(&esw->state_lock); mutex_lock(&esw->state_lock);
if (vport->enabled) { ether_addr_copy(hw_addr, vport->info.mac);
ether_addr_copy(hw_addr, vport->info.mac); *hw_addr_len = ETH_ALEN;
*hw_addr_len = ETH_ALEN;
err = 0;
}
mutex_unlock(&esw->state_lock); mutex_unlock(&esw->state_lock);
return err; return 0;
} }
int mlx5_devlink_port_function_hw_addr_set(struct devlink_port *port, int mlx5_devlink_port_function_hw_addr_set(struct devlink_port *port,
...@@ -1737,8 +1733,8 @@ int mlx5_devlink_port_function_hw_addr_set(struct devlink_port *port, ...@@ -1737,8 +1733,8 @@ int mlx5_devlink_port_function_hw_addr_set(struct devlink_port *port,
{ {
struct mlx5_eswitch *esw; struct mlx5_eswitch *esw;
struct mlx5_vport *vport; struct mlx5_vport *vport;
int err = -EOPNOTSUPP;
u16 vport_num; u16 vport_num;
int err;
esw = mlx5_devlink_eswitch_get(port->devlink); esw = mlx5_devlink_eswitch_get(port->devlink);
if (IS_ERR(esw)) { if (IS_ERR(esw)) {
...@@ -1758,10 +1754,7 @@ int mlx5_devlink_port_function_hw_addr_set(struct devlink_port *port, ...@@ -1758,10 +1754,7 @@ int mlx5_devlink_port_function_hw_addr_set(struct devlink_port *port,
} }
mutex_lock(&esw->state_lock); mutex_lock(&esw->state_lock);
if (vport->enabled) err = mlx5_esw_set_vport_mac_locked(esw, vport, hw_addr);
err = mlx5_esw_set_vport_mac_locked(esw, vport, hw_addr);
else
NL_SET_ERR_MSG_MOD(extack, "Eswitch vport is disabled");
mutex_unlock(&esw->state_lock); mutex_unlock(&esw->state_lock);
return err; return err;
} }
......
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