Add API functions to query and modify local loopback of multicast and
unicast traffic in mlx5 core. Sponsored by: Mellanox Technologies MFC after: 1 week
This commit is contained in:
parent
2fd90b8297
commit
f4554f7830
@ -1485,6 +1485,72 @@ int mlx5_modify_nic_vport_promisc(struct mlx5_core_dev *mdev,
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(mlx5_modify_nic_vport_promisc);
|
||||
|
||||
int mlx5_nic_vport_modify_local_lb(struct mlx5_core_dev *mdev,
|
||||
enum mlx5_local_lb_selection selection,
|
||||
u8 value)
|
||||
{
|
||||
void *in;
|
||||
int inlen = MLX5_ST_SZ_BYTES(modify_nic_vport_context_in);
|
||||
int err;
|
||||
|
||||
in = mlx5_vzalloc(inlen);
|
||||
if (!in) {
|
||||
mlx5_core_warn(mdev, "failed to allocate inbox\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
MLX5_SET(modify_nic_vport_context_in, in, vport_number, 0);
|
||||
|
||||
if (selection == MLX5_LOCAL_MC_LB) {
|
||||
MLX5_SET(modify_nic_vport_context_in, in,
|
||||
field_select.disable_mc_local_lb, 1);
|
||||
MLX5_SET(modify_nic_vport_context_in, in,
|
||||
nic_vport_context.disable_mc_local_lb,
|
||||
value);
|
||||
} else {
|
||||
MLX5_SET(modify_nic_vport_context_in, in,
|
||||
field_select.disable_uc_local_lb, 1);
|
||||
MLX5_SET(modify_nic_vport_context_in, in,
|
||||
nic_vport_context.disable_uc_local_lb,
|
||||
value);
|
||||
}
|
||||
|
||||
err = mlx5_modify_nic_vport_context(mdev, in, inlen);
|
||||
|
||||
kvfree(in);
|
||||
return err;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(mlx5_nic_vport_modify_local_lb);
|
||||
|
||||
int mlx5_nic_vport_query_local_lb(struct mlx5_core_dev *mdev,
|
||||
enum mlx5_local_lb_selection selection,
|
||||
u8 *value)
|
||||
{
|
||||
void *out;
|
||||
int outlen = MLX5_ST_SZ_BYTES(query_nic_vport_context_out);
|
||||
int err;
|
||||
|
||||
out = kzalloc(outlen, GFP_KERNEL);
|
||||
if (!out)
|
||||
return -ENOMEM;
|
||||
|
||||
err = mlx5_query_nic_vport_context(mdev, 0, out, outlen);
|
||||
if (err)
|
||||
goto done;
|
||||
|
||||
if (selection == MLX5_LOCAL_MC_LB)
|
||||
*value = MLX5_GET(query_nic_vport_context_out, out,
|
||||
nic_vport_context.disable_mc_local_lb);
|
||||
else
|
||||
*value = MLX5_GET(query_nic_vport_context_out, out,
|
||||
nic_vport_context.disable_uc_local_lb);
|
||||
|
||||
done:
|
||||
kfree(out);
|
||||
return err;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(mlx5_nic_vport_query_local_lb);
|
||||
|
||||
int mlx5_query_vport_counter(struct mlx5_core_dev *dev,
|
||||
u8 port_num, u16 vport_num,
|
||||
void *out, int out_size)
|
||||
|
@ -41,7 +41,17 @@ int mlx5_vport_query_q_counter(struct mlx5_core_dev *mdev,
|
||||
int mlx5_vport_query_out_of_rx_buffer(struct mlx5_core_dev *mdev,
|
||||
u16 counter_set_id,
|
||||
u32 *out_of_rx_buffer);
|
||||
enum mlx5_local_lb_selection {
|
||||
MLX5_LOCAL_MC_LB,
|
||||
MLX5_LOCAL_UC_LB
|
||||
};
|
||||
|
||||
int mlx5_nic_vport_query_local_lb(struct mlx5_core_dev *mdev,
|
||||
enum mlx5_local_lb_selection selection,
|
||||
u8 *value);
|
||||
int mlx5_nic_vport_modify_local_lb(struct mlx5_core_dev *mdev,
|
||||
enum mlx5_local_lb_selection selection,
|
||||
u8 value);
|
||||
u8 mlx5_query_vport_state(struct mlx5_core_dev *mdev, u8 opmod, u16 vport);
|
||||
u8 mlx5_query_vport_admin_state(struct mlx5_core_dev *mdev, u8 opmod,
|
||||
u16 vport);
|
||||
|
Loading…
x
Reference in New Issue
Block a user