mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-10 06:49:29 -04:00
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: Parav Pandit <parav@nvidia.com> Reviewed-by: Sunil Sudhakar Rani <sunrani@nvidia.com> Reviewed-by: Mark Bloch <mbloch@nvidia.com> Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
This commit is contained in:
committed by
Saeed Mahameed
parent
819c319c8c
commit
fcf8ec54b0
@@ -1704,7 +1704,6 @@ int mlx5_devlink_port_function_hw_addr_get(struct devlink_port *port,
|
||||
{
|
||||
struct mlx5_eswitch *esw;
|
||||
struct mlx5_vport *vport;
|
||||
int err = -EOPNOTSUPP;
|
||||
u16 vport_num;
|
||||
|
||||
esw = mlx5_devlink_eswitch_get(port->devlink);
|
||||
@@ -1722,13 +1721,10 @@ int mlx5_devlink_port_function_hw_addr_get(struct devlink_port *port,
|
||||
}
|
||||
|
||||
mutex_lock(&esw->state_lock);
|
||||
if (vport->enabled) {
|
||||
ether_addr_copy(hw_addr, vport->info.mac);
|
||||
*hw_addr_len = ETH_ALEN;
|
||||
err = 0;
|
||||
}
|
||||
ether_addr_copy(hw_addr, vport->info.mac);
|
||||
*hw_addr_len = ETH_ALEN;
|
||||
mutex_unlock(&esw->state_lock);
|
||||
return err;
|
||||
return 0;
|
||||
}
|
||||
|
||||
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_vport *vport;
|
||||
int err = -EOPNOTSUPP;
|
||||
u16 vport_num;
|
||||
int err;
|
||||
|
||||
esw = mlx5_devlink_eswitch_get(port->devlink);
|
||||
if (IS_ERR(esw)) {
|
||||
@@ -1758,10 +1754,7 @@ int mlx5_devlink_port_function_hw_addr_set(struct devlink_port *port,
|
||||
}
|
||||
|
||||
mutex_lock(&esw->state_lock);
|
||||
if (vport->enabled)
|
||||
err = mlx5_esw_set_vport_mac_locked(esw, vport, hw_addr);
|
||||
else
|
||||
NL_SET_ERR_MSG_MOD(extack, "Eswitch vport is disabled");
|
||||
err = mlx5_esw_set_vport_mac_locked(esw, vport, hw_addr);
|
||||
mutex_unlock(&esw->state_lock);
|
||||
return err;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user