Commit b22fd438 authored by Parav Pandit's avatar Parav Pandit Committed by Saeed Mahameed
Browse files

net/mlx5: E-switch, Reuse mlx5_eswitch_set_vport_mac



mlx5_eswitch_set_vport_mac() routine already does necessary checks which
are duplicated in implementation of
mlx5_devlink_port_function_hw_addr_set().

Hence, reuse mlx5_eswitch_set_vport_mac() and cut down the code.

Signed-off-by: default avatarParav Pandit <parav@nvidia.com>
Reviewed-by: default avatarMark Bloch <mbloch@nvidia.com>
Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
parent fcf8ec54
Loading
Loading
Loading
Loading
+1 −11
Original line number Diff line number Diff line
@@ -1732,9 +1732,7 @@ int mlx5_devlink_port_function_hw_addr_set(struct devlink_port *port,
					   struct netlink_ext_ack *extack)
{
	struct mlx5_eswitch *esw;
	struct mlx5_vport *vport;
	u16 vport_num;
	int err;

	esw = mlx5_devlink_eswitch_get(port->devlink);
	if (IS_ERR(esw)) {
@@ -1747,16 +1745,8 @@ int mlx5_devlink_port_function_hw_addr_set(struct devlink_port *port,
		NL_SET_ERR_MSG_MOD(extack, "Port doesn't support set hw_addr");
		return -EINVAL;
	}
	vport = mlx5_eswitch_get_vport(esw, vport_num);
	if (IS_ERR(vport)) {
		NL_SET_ERR_MSG_MOD(extack, "Invalid port");
		return PTR_ERR(vport);
	}

	mutex_lock(&esw->state_lock);
	err = mlx5_esw_set_vport_mac_locked(esw, vport, hw_addr);
	mutex_unlock(&esw->state_lock);
	return err;
	return mlx5_eswitch_set_vport_mac(esw, vport_num, hw_addr);
}

int mlx5_eswitch_set_vport_state(struct mlx5_eswitch *esw,