mlx5: Implement mlx5_nic_vport_update_local_lb()
MFC after: 1 week Sponsored by: NVIDIA Networking
This commit is contained in:
parent
5381f93647
commit
c1b76119cb
@ -1510,6 +1510,44 @@ int mlx5_modify_nic_vport_promisc(struct mlx5_core_dev *mdev,
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(mlx5_modify_nic_vport_promisc);
|
||||
|
||||
int mlx5_nic_vport_update_local_lb(struct mlx5_core_dev *mdev, bool enable)
|
||||
{
|
||||
int inlen = MLX5_ST_SZ_BYTES(modify_nic_vport_context_in);
|
||||
void *in;
|
||||
int err;
|
||||
|
||||
if (!MLX5_CAP_GEN(mdev, disable_local_lb_mc) &&
|
||||
!MLX5_CAP_GEN(mdev, disable_local_lb_uc))
|
||||
return 0;
|
||||
|
||||
in = kvzalloc(inlen, GFP_KERNEL);
|
||||
if (!in)
|
||||
return -ENOMEM;
|
||||
|
||||
MLX5_SET(modify_nic_vport_context_in, in,
|
||||
nic_vport_context.disable_mc_local_lb, !enable);
|
||||
MLX5_SET(modify_nic_vport_context_in, in,
|
||||
nic_vport_context.disable_uc_local_lb, !enable);
|
||||
|
||||
if (MLX5_CAP_GEN(mdev, disable_local_lb_mc))
|
||||
MLX5_SET(modify_nic_vport_context_in, in,
|
||||
field_select.disable_mc_local_lb, 1);
|
||||
|
||||
if (MLX5_CAP_GEN(mdev, disable_local_lb_uc))
|
||||
MLX5_SET(modify_nic_vport_context_in, in,
|
||||
field_select.disable_uc_local_lb, 1);
|
||||
|
||||
err = mlx5_modify_nic_vport_context(mdev, in, inlen);
|
||||
|
||||
if (!err)
|
||||
mlx5_core_dbg(mdev, "%s local_lb\n",
|
||||
enable ? "enable" : "disable");
|
||||
|
||||
kvfree(in);
|
||||
return err;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(mlx5_nic_vport_update_local_lb);
|
||||
|
||||
int mlx5_nic_vport_modify_local_lb(struct mlx5_core_dev *mdev,
|
||||
enum mlx5_local_lb_selection selection,
|
||||
u8 value)
|
||||
|
@ -1233,7 +1233,7 @@ mlx5e_ethtool_handler(SYSCTL_HANDLER_ARGS)
|
||||
priv->params_ethtool.mc_local_lb =
|
||||
priv->params_ethtool.mc_local_lb ? 1 : 0;
|
||||
|
||||
if (MLX5_CAP_GEN(priv->mdev, disable_local_lb)) {
|
||||
if (MLX5_CAP_GEN(priv->mdev, disable_local_lb_mc)) {
|
||||
error = mlx5_nic_vport_modify_local_lb(priv->mdev,
|
||||
MLX5_LOCAL_MC_LB, priv->params_ethtool.mc_local_lb);
|
||||
} else {
|
||||
@ -1245,7 +1245,7 @@ mlx5e_ethtool_handler(SYSCTL_HANDLER_ARGS)
|
||||
priv->params_ethtool.uc_local_lb =
|
||||
priv->params_ethtool.uc_local_lb ? 1 : 0;
|
||||
|
||||
if (MLX5_CAP_GEN(priv->mdev, disable_local_lb)) {
|
||||
if (MLX5_CAP_GEN(priv->mdev, disable_local_lb_uc)) {
|
||||
error = mlx5_nic_vport_modify_local_lb(priv->mdev,
|
||||
MLX5_LOCAL_UC_LB, priv->params_ethtool.uc_local_lb);
|
||||
} else {
|
||||
@ -1446,7 +1446,8 @@ mlx5e_create_ethtool(struct mlx5e_priv *priv)
|
||||
mlx5e_ethtool_sync_tx_completion_fact(priv);
|
||||
|
||||
/* get default values for local loopback, if any */
|
||||
if (MLX5_CAP_GEN(priv->mdev, disable_local_lb)) {
|
||||
if (MLX5_CAP_GEN(priv->mdev, disable_local_lb_mc) ||
|
||||
MLX5_CAP_GEN(priv->mdev, disable_local_lb_uc)) {
|
||||
int err;
|
||||
u8 val;
|
||||
|
||||
|
@ -1342,8 +1342,9 @@ struct mlx5_ifc_cmd_hca_cap_bits {
|
||||
u8 log_max_wq_sz[0x5];
|
||||
|
||||
u8 nic_vport_change_event[0x1];
|
||||
u8 disable_local_lb[0x1];
|
||||
u8 reserved_59[0x9];
|
||||
u8 disable_local_lb_uc[0x1];
|
||||
u8 disable_local_lb_mc[0x1];
|
||||
u8 reserved_59[0x8];
|
||||
u8 log_max_vlan_list[0x5];
|
||||
u8 reserved_60[0x3];
|
||||
u8 log_max_current_mc_list[0x5];
|
||||
|
@ -56,6 +56,7 @@ enum mlx5_local_lb_selection {
|
||||
int mlx5_nic_vport_query_local_lb(struct mlx5_core_dev *mdev,
|
||||
enum mlx5_local_lb_selection selection,
|
||||
u8 *value);
|
||||
int mlx5_nic_vport_update_local_lb(struct mlx5_core_dev *mdev, bool enable);
|
||||
int mlx5_nic_vport_modify_local_lb(struct mlx5_core_dev *mdev,
|
||||
enum mlx5_local_lb_selection selection,
|
||||
u8 value);
|
||||
|
Loading…
Reference in New Issue
Block a user