Add support for configuring local multicast and unicast data traffic loopback

in mlx5en(4) driver via the sysctl interface.

Sponsored by:	Mellanox Technologies
MFC after:	1 week
This commit is contained in:
Hans Petter Selasky 2017-11-10 14:14:54 +00:00
parent bb3616ab20
commit 61fd7ac087
2 changed files with 41 additions and 1 deletions

View File

@ -411,7 +411,9 @@ struct mlx5e_params {
m(+1, u64 modify_tx_dma, "modify_tx_dma", "0: Enable TX 1: Disable TX") \
m(+1, u64 modify_rx_dma, "modify_rx_dma", "0: Enable RX 1: Disable RX") \
m(+1, u64 diag_pci_enable, "diag_pci_enable", "0: Disabled 1: Enabled") \
m(+1, u64 diag_general_enable, "diag_general_enable", "0: Disabled 1: Enabled")
m(+1, u64 diag_general_enable, "diag_general_enable", "0: Disabled 1: Enabled") \
m(+1, u64 mc_local_lb, "mc_local_lb", "0: Local multicast loopback enabled 1: Disabled") \
m(+1, u64 uc_local_lb, "uc_local_lb", "0: Local unicast loopback enabled 1: Disabled")
#define MLX5E_PARAMS_NUM (0 MLX5E_PARAMS(MLX5E_STATS_COUNT))

View File

@ -421,6 +421,30 @@ mlx5e_ethtool_handler(SYSCTL_HANDLER_ARGS)
priv->params_ethtool.diag_general_enable);
break;
case MLX5_PARAM_OFFSET(mc_local_lb):
priv->params_ethtool.mc_local_lb =
priv->params_ethtool.mc_local_lb ? 1 : 0;
if (MLX5_CAP_GEN(priv->mdev, disable_local_lb)) {
error = mlx5_nic_vport_modify_local_lb(priv->mdev,
MLX5_LOCAL_MC_LB, priv->params_ethtool.mc_local_lb);
} else {
error = EOPNOTSUPP;
}
break;
case MLX5_PARAM_OFFSET(uc_local_lb):
priv->params_ethtool.uc_local_lb =
priv->params_ethtool.uc_local_lb ? 1 : 0;
if (MLX5_CAP_GEN(priv->mdev, disable_local_lb)) {
error = mlx5_nic_vport_modify_local_lb(priv->mdev,
MLX5_LOCAL_UC_LB, priv->params_ethtool.uc_local_lb);
} else {
error = EOPNOTSUPP;
}
break;
default:
break;
}
@ -732,6 +756,20 @@ mlx5e_create_ethtool(struct mlx5e_priv *priv)
priv->params_ethtool.cqe_zipping = priv->params.cqe_zipping_en;
mlx5e_ethtool_sync_tx_completion_fact(priv);
/* get default values for local loopback, if any */
if (MLX5_CAP_GEN(priv->mdev, disable_local_lb)) {
int err;
u8 val;
err = mlx5_nic_vport_query_local_lb(priv->mdev, MLX5_LOCAL_MC_LB, &val);
if (err == 0)
priv->params_ethtool.mc_local_lb = val;
err = mlx5_nic_vport_query_local_lb(priv->mdev, MLX5_LOCAL_UC_LB, &val);
if (err == 0)
priv->params_ethtool.uc_local_lb = val;
}
/* create root node */
node = SYSCTL_ADD_NODE(&priv->sysctl_ctx,
SYSCTL_CHILDREN(priv->sysctl_ifnet), OID_AUTO,