Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9a317425 authored by Andy Gospodarek's avatar Andy Gospodarek Committed by David S. Miller
Browse files

net/mlx5e: Change Mellanox references in DIM code



Change all appropriate mlx5_am* and MLX5_AM* references to net_dim and
NET_DIM, respectively, in code that handles dynamic interrupt
moderation.  Also change all references from 'am' to 'dim' when used as
local variables and add generic profile references.

Signed-off-by: default avatarAndy Gospodarek <gospo@broadcom.com>
Acked-by: default avatarTal Gilboa <talgi@mellanox.com>
Acked-by: default avatarSaeed Mahameed <saeedm@mellanox.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent b9c872f2
Loading
Loading
Loading
Loading
+5 −4
Original line number Diff line number Diff line
@@ -238,8 +238,8 @@ struct mlx5e_params {
	u16 num_channels;
	u8  num_tc;
	bool rx_cqe_compress_def;
	struct mlx5e_cq_moder rx_cq_moderation;
	struct mlx5e_cq_moder tx_cq_moderation;
	struct net_dim_cq_moder rx_cq_moderation;
	struct net_dim_cq_moder tx_cq_moderation;
	bool lro_en;
	u32 lro_wqe_sz;
	u16 tx_max_inline;
@@ -249,7 +249,7 @@ struct mlx5e_params {
	u32 indirection_rqt[MLX5E_INDIR_RQT_SIZE];
	bool vlan_strip_disable;
	bool scatter_fcs_en;
	bool rx_am_enabled;
	bool rx_dim_enabled;
	u32 lro_timeout;
	u32 pflags;
	struct bpf_prog *xdp_prog;
@@ -528,7 +528,7 @@ struct mlx5e_rq {
	unsigned long          state;
	int                    ix;

	struct mlx5e_rx_am     am; /* Adaptive Moderation */
	struct net_dim         dim; /* Dynamic Interrupt Moderation */

	/* XDP */
	struct bpf_prog       *xdp_prog;
@@ -1080,4 +1080,5 @@ void mlx5e_build_nic_params(struct mlx5_core_dev *mdev,
			    struct mlx5e_params *params,
			    u16 max_channels);
u8 mlx5e_params_calculate_tx_min_inline(struct mlx5_core_dev *mdev);
void mlx5e_rx_dim_work(struct work_struct *work);
#endif /* __MLX5_EN_H__ */
+7 −7
Original line number Diff line number Diff line
@@ -32,16 +32,16 @@

#include "en.h"

void mlx5e_rx_am_work(struct work_struct *work)
void mlx5e_rx_dim_work(struct work_struct *work)
{
	struct mlx5e_rx_am *am = container_of(work, struct mlx5e_rx_am,
	struct net_dim *dim = container_of(work, struct net_dim,
					   work);
	struct mlx5e_rq *rq = container_of(am, struct mlx5e_rq, am);
	struct mlx5e_cq_moder cur_profile = mlx5e_am_get_profile(am->mode,
								 am->profile_ix);
	struct mlx5e_rq *rq = container_of(dim, struct mlx5e_rq, dim);
	struct net_dim_cq_moder cur_profile = net_dim_get_profile(dim->mode,
								  dim->profile_ix);

	mlx5_core_modify_cq_moderation(rq->mdev, &rq->cq.mcq,
				       cur_profile.usec, cur_profile.pkts);

	am->state = MLX5E_AM_START_MEASURE;
	dim->state = NET_DIM_START_MEASURE;
}
+3 −3
Original line number Diff line number Diff line
@@ -465,7 +465,7 @@ int mlx5e_ethtool_get_coalesce(struct mlx5e_priv *priv,
	coal->rx_max_coalesced_frames = priv->channels.params.rx_cq_moderation.pkts;
	coal->tx_coalesce_usecs       = priv->channels.params.tx_cq_moderation.usec;
	coal->tx_max_coalesced_frames = priv->channels.params.tx_cq_moderation.pkts;
	coal->use_adaptive_rx_coalesce = priv->channels.params.rx_am_enabled;
	coal->use_adaptive_rx_coalesce = priv->channels.params.rx_dim_enabled;

	return 0;
}
@@ -519,7 +519,7 @@ int mlx5e_ethtool_set_coalesce(struct mlx5e_priv *priv,
	new_channels.params.tx_cq_moderation.pkts = coal->tx_max_coalesced_frames;
	new_channels.params.rx_cq_moderation.usec = coal->rx_coalesce_usecs;
	new_channels.params.rx_cq_moderation.pkts = coal->rx_max_coalesced_frames;
	new_channels.params.rx_am_enabled         = !!coal->use_adaptive_rx_coalesce;
	new_channels.params.rx_dim_enabled        = !!coal->use_adaptive_rx_coalesce;

	if (!test_bit(MLX5E_STATE_OPENED, &priv->state)) {
		priv->channels.params = new_channels.params;
@@ -527,7 +527,7 @@ int mlx5e_ethtool_set_coalesce(struct mlx5e_priv *priv,
	}
	/* we are opened */

	reset = !!coal->use_adaptive_rx_coalesce != priv->channels.params.rx_am_enabled;
	reset = !!coal->use_adaptive_rx_coalesce != priv->channels.params.rx_dim_enabled;
	if (!reset) {
		mlx5e_set_priv_channels_coalesce(priv, coal);
		priv->channels.params = new_channels.params;
+29 −11
Original line number Diff line number Diff line
@@ -677,8 +677,17 @@ static int mlx5e_alloc_rq(struct mlx5e_channel *c,
		wqe->data.lkey = rq->mkey_be;
	}

	INIT_WORK(&rq->am.work, mlx5e_rx_am_work);
	rq->am.mode = params->rx_cq_moderation.cq_period_mode;
	INIT_WORK(&rq->dim.work, mlx5e_rx_dim_work);

	switch (params->rx_cq_moderation.cq_period_mode) {
	case MLX5_CQ_PERIOD_MODE_START_FROM_CQE:
		rq->dim.mode = NET_DIM_CQ_PERIOD_MODE_START_FROM_CQE;
		break;
	case MLX5_CQ_PERIOD_MODE_START_FROM_EQE:
	default:
		rq->dim.mode = NET_DIM_CQ_PERIOD_MODE_START_FROM_EQE;
	}

	rq->page_cache.head = 0;
	rq->page_cache.tail = 0;

@@ -925,7 +934,7 @@ static int mlx5e_open_rq(struct mlx5e_channel *c,
	if (err)
		goto err_destroy_rq;

	if (params->rx_am_enabled)
	if (params->rx_dim_enabled)
		c->rq.state |= BIT(MLX5E_RQ_STATE_AM);

	return 0;
@@ -958,7 +967,7 @@ static void mlx5e_deactivate_rq(struct mlx5e_rq *rq)

static void mlx5e_close_rq(struct mlx5e_rq *rq)
{
	cancel_work_sync(&rq->am.work);
	cancel_work_sync(&rq->dim.work);
	mlx5e_destroy_rq(rq);
	mlx5e_free_rx_descs(rq);
	mlx5e_free_rq(rq);
@@ -1571,7 +1580,7 @@ static void mlx5e_destroy_cq(struct mlx5e_cq *cq)
}

static int mlx5e_open_cq(struct mlx5e_channel *c,
			 struct mlx5e_cq_moder moder,
			 struct net_dim_cq_moder moder,
			 struct mlx5e_cq_param *param,
			 struct mlx5e_cq *cq)
{
@@ -1753,7 +1762,7 @@ static int mlx5e_open_channel(struct mlx5e_priv *priv, int ix,
			      struct mlx5e_channel_param *cparam,
			      struct mlx5e_channel **cp)
{
	struct mlx5e_cq_moder icocq_moder = {0, 0};
	struct net_dim_cq_moder icocq_moder = {0, 0};
	struct net_device *netdev = priv->netdev;
	int cpu = mlx5e_get_cpu(priv, ix);
	struct mlx5e_channel *c;
@@ -2005,7 +2014,7 @@ static void mlx5e_build_ico_cq_param(struct mlx5e_priv *priv,

	mlx5e_build_common_cq_param(priv, param);

	param->cq_period_mode = MLX5_CQ_PERIOD_MODE_START_FROM_EQE;
	param->cq_period_mode = NET_DIM_CQ_PERIOD_MODE_START_FROM_EQE;
}

static void mlx5e_build_icosq_param(struct mlx5e_priv *priv,
@@ -4047,9 +4056,18 @@ void mlx5e_set_rx_cq_mode_params(struct mlx5e_params *params, u8 cq_period_mode)
		params->rx_cq_moderation.usec =
			MLX5E_PARAMS_DEFAULT_RX_CQ_MODERATION_USEC_FROM_CQE;

	if (params->rx_am_enabled)
	if (params->rx_dim_enabled) {
		switch (cq_period_mode) {
		case MLX5_CQ_PERIOD_MODE_START_FROM_CQE:
			params->rx_cq_moderation =
			mlx5e_am_get_def_profile(cq_period_mode);
				net_dim_get_def_profile(NET_DIM_CQ_PERIOD_MODE_START_FROM_CQE);
			break;
		case MLX5_CQ_PERIOD_MODE_START_FROM_EQE:
		default:
			params->rx_cq_moderation =
				net_dim_get_def_profile(NET_DIM_CQ_PERIOD_MODE_START_FROM_EQE);
		}
	}

	MLX5E_SET_PFLAG(params, MLX5E_PFLAG_RX_CQE_BASED_MODER,
			params->rx_cq_moderation.cq_period_mode ==
@@ -4111,7 +4129,7 @@ void mlx5e_build_nic_params(struct mlx5_core_dev *mdev,
	cq_period_mode = MLX5_CAP_GEN(mdev, cq_period_start_from_cqe) ?
			MLX5_CQ_PERIOD_MODE_START_FROM_CQE :
			MLX5_CQ_PERIOD_MODE_START_FROM_EQE;
	params->rx_am_enabled = MLX5_CAP_GEN(mdev, cq_moderation);
	params->rx_dim_enabled = MLX5_CAP_GEN(mdev, cq_moderation);
	mlx5e_set_rx_cq_mode_params(params, cq_period_mode);
	mlx5e_set_tx_cq_mode_params(params, cq_period_mode);

+1 −1
Original line number Diff line number Diff line
@@ -884,7 +884,7 @@ static void mlx5e_build_rep_params(struct mlx5_core_dev *mdev,
	params->rq_wq_type  = MLX5_WQ_TYPE_LINKED_LIST;
	params->log_rq_size = MLX5E_PARAMS_MINIMUM_LOG_RQ_SIZE;

	params->rx_am_enabled = MLX5_CAP_GEN(mdev, cq_moderation);
	params->rx_dim_enabled = MLX5_CAP_GEN(mdev, cq_moderation);
	mlx5e_set_rx_cq_mode_params(params, cq_period_mode);

	params->tx_max_inline         = mlx5e_get_max_inline_cap(mdev);
Loading