MC_ADDR_CHANGE | \
PROMISC_CHANGE)
-static struct mlx5_vport *mlx5_eswitch_get_vport(struct mlx5_eswitch *esw,
- u16 vport_num)
+struct mlx5_vport *mlx5_eswitch_get_vport(struct mlx5_eswitch *esw,
+ u16 vport_num)
{
u16 idx = mlx5_eswitch_vport_num_to_index(esw, vport_num);
return -EINVAL;
mutex_lock(&esw->state_lock);
- evport = &esw->vports[vport];
+ evport = mlx5_eswitch_get_vport(esw, vport);
if (evport->info.spoofchk && !is_valid_ether_addr(mac))
mlx5_core_warn(esw->dev,
return -EINVAL;
mutex_lock(&esw->state_lock);
- evport = &esw->vports[vport];
+ evport = mlx5_eswitch_get_vport(esw, vport);
err = mlx5_modify_vport_admin_state(esw->dev,
MLX5_VPORT_STATE_OP_MOD_ESW_VPORT,
if (!LEGAL_VPORT(esw, vport))
return -EINVAL;
- evport = &esw->vports[vport];
+ evport = mlx5_eswitch_get_vport(esw, vport);
memset(ivi, 0, sizeof(*ivi));
ivi->vf = vport - 1;
return -EINVAL;
mutex_lock(&esw->state_lock);
- evport = &esw->vports[vport];
+ evport = mlx5_eswitch_get_vport(esw, vport);
err = modify_esw_vport_cvlan(esw->dev, vport, vlan, qos, set_flags);
if (err)
return -EINVAL;
mutex_lock(&esw->state_lock);
- evport = &esw->vports[vport];
+ evport = mlx5_eswitch_get_vport(esw, vport);
pschk = evport->info.spoofchk;
evport->info.spoofchk = spoofchk;
if (pschk && !is_valid_ether_addr(evport->info.mac))
return -EINVAL;
mutex_lock(&esw->state_lock);
- evport = &esw->vports[vport];
+ evport = mlx5_eswitch_get_vport(esw, vport);
evport->info.trusted = setting;
if (evport->enabled)
esw_vport_change_handle_locked(evport);
return -EOPNOTSUPP;
mutex_lock(&esw->state_lock);
- evport = &esw->vports[vport];
+ evport = mlx5_eswitch_get_vport(esw, vport);
if (min_rate == evport->info.min_rate)
goto set_max_rate;