Skip to content

Commit 9a31742

Browse files
CCX-Stingraydavem330
authored andcommitted
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: Andy Gospodarek <[email protected]> Acked-by: Tal Gilboa <[email protected]> Acked-by: Saeed Mahameed <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent b9c872f commit 9a31742

File tree

8 files changed

+226
-202
lines changed

8 files changed

+226
-202
lines changed

drivers/net/ethernet/mellanox/mlx5/core/en.h

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -238,8 +238,8 @@ struct mlx5e_params {
238238
u16 num_channels;
239239
u8 num_tc;
240240
bool rx_cqe_compress_def;
241-
struct mlx5e_cq_moder rx_cq_moderation;
242-
struct mlx5e_cq_moder tx_cq_moderation;
241+
struct net_dim_cq_moder rx_cq_moderation;
242+
struct net_dim_cq_moder tx_cq_moderation;
243243
bool lro_en;
244244
u32 lro_wqe_sz;
245245
u16 tx_max_inline;
@@ -249,7 +249,7 @@ struct mlx5e_params {
249249
u32 indirection_rqt[MLX5E_INDIR_RQT_SIZE];
250250
bool vlan_strip_disable;
251251
bool scatter_fcs_en;
252-
bool rx_am_enabled;
252+
bool rx_dim_enabled;
253253
u32 lro_timeout;
254254
u32 pflags;
255255
struct bpf_prog *xdp_prog;
@@ -528,7 +528,7 @@ struct mlx5e_rq {
528528
unsigned long state;
529529
int ix;
530530

531-
struct mlx5e_rx_am am; /* Adaptive Moderation */
531+
struct net_dim dim; /* Dynamic Interrupt Moderation */
532532

533533
/* XDP */
534534
struct bpf_prog *xdp_prog;
@@ -1080,4 +1080,5 @@ void mlx5e_build_nic_params(struct mlx5_core_dev *mdev,
10801080
struct mlx5e_params *params,
10811081
u16 max_channels);
10821082
u8 mlx5e_params_calculate_tx_min_inline(struct mlx5_core_dev *mdev);
1083+
void mlx5e_rx_dim_work(struct work_struct *work);
10831084
#endif /* __MLX5_EN_H__ */

drivers/net/ethernet/mellanox/mlx5/core/en_dim.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,16 +32,16 @@
3232

3333
#include "en.h"
3434

35-
void mlx5e_rx_am_work(struct work_struct *work)
35+
void mlx5e_rx_dim_work(struct work_struct *work)
3636
{
37-
struct mlx5e_rx_am *am = container_of(work, struct mlx5e_rx_am,
38-
work);
39-
struct mlx5e_rq *rq = container_of(am, struct mlx5e_rq, am);
40-
struct mlx5e_cq_moder cur_profile = mlx5e_am_get_profile(am->mode,
41-
am->profile_ix);
37+
struct net_dim *dim = container_of(work, struct net_dim,
38+
work);
39+
struct mlx5e_rq *rq = container_of(dim, struct mlx5e_rq, dim);
40+
struct net_dim_cq_moder cur_profile = net_dim_get_profile(dim->mode,
41+
dim->profile_ix);
4242

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

46-
am->state = MLX5E_AM_START_MEASURE;
46+
dim->state = NET_DIM_START_MEASURE;
4747
}

drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,7 @@ int mlx5e_ethtool_get_coalesce(struct mlx5e_priv *priv,
465465
coal->rx_max_coalesced_frames = priv->channels.params.rx_cq_moderation.pkts;
466466
coal->tx_coalesce_usecs = priv->channels.params.tx_cq_moderation.usec;
467467
coal->tx_max_coalesced_frames = priv->channels.params.tx_cq_moderation.pkts;
468-
coal->use_adaptive_rx_coalesce = priv->channels.params.rx_am_enabled;
468+
coal->use_adaptive_rx_coalesce = priv->channels.params.rx_dim_enabled;
469469

470470
return 0;
471471
}
@@ -519,15 +519,15 @@ int mlx5e_ethtool_set_coalesce(struct mlx5e_priv *priv,
519519
new_channels.params.tx_cq_moderation.pkts = coal->tx_max_coalesced_frames;
520520
new_channels.params.rx_cq_moderation.usec = coal->rx_coalesce_usecs;
521521
new_channels.params.rx_cq_moderation.pkts = coal->rx_max_coalesced_frames;
522-
new_channels.params.rx_am_enabled = !!coal->use_adaptive_rx_coalesce;
522+
new_channels.params.rx_dim_enabled = !!coal->use_adaptive_rx_coalesce;
523523

524524
if (!test_bit(MLX5E_STATE_OPENED, &priv->state)) {
525525
priv->channels.params = new_channels.params;
526526
goto out;
527527
}
528528
/* we are opened */
529529

530-
reset = !!coal->use_adaptive_rx_coalesce != priv->channels.params.rx_am_enabled;
530+
reset = !!coal->use_adaptive_rx_coalesce != priv->channels.params.rx_dim_enabled;
531531
if (!reset) {
532532
mlx5e_set_priv_channels_coalesce(priv, coal);
533533
priv->channels.params = new_channels.params;

drivers/net/ethernet/mellanox/mlx5/core/en_main.c

Lines changed: 29 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -677,8 +677,17 @@ static int mlx5e_alloc_rq(struct mlx5e_channel *c,
677677
wqe->data.lkey = rq->mkey_be;
678678
}
679679

680-
INIT_WORK(&rq->am.work, mlx5e_rx_am_work);
681-
rq->am.mode = params->rx_cq_moderation.cq_period_mode;
680+
INIT_WORK(&rq->dim.work, mlx5e_rx_dim_work);
681+
682+
switch (params->rx_cq_moderation.cq_period_mode) {
683+
case MLX5_CQ_PERIOD_MODE_START_FROM_CQE:
684+
rq->dim.mode = NET_DIM_CQ_PERIOD_MODE_START_FROM_CQE;
685+
break;
686+
case MLX5_CQ_PERIOD_MODE_START_FROM_EQE:
687+
default:
688+
rq->dim.mode = NET_DIM_CQ_PERIOD_MODE_START_FROM_EQE;
689+
}
690+
682691
rq->page_cache.head = 0;
683692
rq->page_cache.tail = 0;
684693

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

928-
if (params->rx_am_enabled)
937+
if (params->rx_dim_enabled)
929938
c->rq.state |= BIT(MLX5E_RQ_STATE_AM);
930939

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

959968
static void mlx5e_close_rq(struct mlx5e_rq *rq)
960969
{
961-
cancel_work_sync(&rq->am.work);
970+
cancel_work_sync(&rq->dim.work);
962971
mlx5e_destroy_rq(rq);
963972
mlx5e_free_rx_descs(rq);
964973
mlx5e_free_rq(rq);
@@ -1571,7 +1580,7 @@ static void mlx5e_destroy_cq(struct mlx5e_cq *cq)
15711580
}
15721581

15731582
static int mlx5e_open_cq(struct mlx5e_channel *c,
1574-
struct mlx5e_cq_moder moder,
1583+
struct net_dim_cq_moder moder,
15751584
struct mlx5e_cq_param *param,
15761585
struct mlx5e_cq *cq)
15771586
{
@@ -1753,7 +1762,7 @@ static int mlx5e_open_channel(struct mlx5e_priv *priv, int ix,
17531762
struct mlx5e_channel_param *cparam,
17541763
struct mlx5e_channel **cp)
17551764
{
1756-
struct mlx5e_cq_moder icocq_moder = {0, 0};
1765+
struct net_dim_cq_moder icocq_moder = {0, 0};
17571766
struct net_device *netdev = priv->netdev;
17581767
int cpu = mlx5e_get_cpu(priv, ix);
17591768
struct mlx5e_channel *c;
@@ -2005,7 +2014,7 @@ static void mlx5e_build_ico_cq_param(struct mlx5e_priv *priv,
20052014

20062015
mlx5e_build_common_cq_param(priv, param);
20072016

2008-
param->cq_period_mode = MLX5_CQ_PERIOD_MODE_START_FROM_EQE;
2017+
param->cq_period_mode = NET_DIM_CQ_PERIOD_MODE_START_FROM_EQE;
20092018
}
20102019

20112020
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)
40474056
params->rx_cq_moderation.usec =
40484057
MLX5E_PARAMS_DEFAULT_RX_CQ_MODERATION_USEC_FROM_CQE;
40494058

4050-
if (params->rx_am_enabled)
4051-
params->rx_cq_moderation =
4052-
mlx5e_am_get_def_profile(cq_period_mode);
4059+
if (params->rx_dim_enabled) {
4060+
switch (cq_period_mode) {
4061+
case MLX5_CQ_PERIOD_MODE_START_FROM_CQE:
4062+
params->rx_cq_moderation =
4063+
net_dim_get_def_profile(NET_DIM_CQ_PERIOD_MODE_START_FROM_CQE);
4064+
break;
4065+
case MLX5_CQ_PERIOD_MODE_START_FROM_EQE:
4066+
default:
4067+
params->rx_cq_moderation =
4068+
net_dim_get_def_profile(NET_DIM_CQ_PERIOD_MODE_START_FROM_EQE);
4069+
}
4070+
}
40534071

40544072
MLX5E_SET_PFLAG(params, MLX5E_PFLAG_RX_CQE_BASED_MODER,
40554073
params->rx_cq_moderation.cq_period_mode ==
@@ -4111,7 +4129,7 @@ void mlx5e_build_nic_params(struct mlx5_core_dev *mdev,
41114129
cq_period_mode = MLX5_CAP_GEN(mdev, cq_period_start_from_cqe) ?
41124130
MLX5_CQ_PERIOD_MODE_START_FROM_CQE :
41134131
MLX5_CQ_PERIOD_MODE_START_FROM_EQE;
4114-
params->rx_am_enabled = MLX5_CAP_GEN(mdev, cq_moderation);
4132+
params->rx_dim_enabled = MLX5_CAP_GEN(mdev, cq_moderation);
41154133
mlx5e_set_rx_cq_mode_params(params, cq_period_mode);
41164134
mlx5e_set_tx_cq_mode_params(params, cq_period_mode);
41174135

drivers/net/ethernet/mellanox/mlx5/core/en_rep.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -884,7 +884,7 @@ static void mlx5e_build_rep_params(struct mlx5_core_dev *mdev,
884884
params->rq_wq_type = MLX5_WQ_TYPE_LINKED_LIST;
885885
params->log_rq_size = MLX5E_PARAMS_MINIMUM_LOG_RQ_SIZE;
886886

887-
params->rx_am_enabled = MLX5_CAP_GEN(mdev, cq_moderation);
887+
params->rx_dim_enabled = MLX5_CAP_GEN(mdev, cq_moderation);
888888
mlx5e_set_rx_cq_mode_params(params, cq_period_mode);
889889

890890
params->tx_max_inline = mlx5e_get_max_inline_cap(mdev);

drivers/net/ethernet/mellanox/mlx5/core/en_txrx.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,10 +79,10 @@ int mlx5e_napi_poll(struct napi_struct *napi, int budget)
7979
mlx5e_cq_arm(&c->sq[i].cq);
8080

8181
if (MLX5E_TEST_BIT(c->rq.state, MLX5E_RQ_STATE_AM))
82-
mlx5e_rx_am(&c->rq.am,
83-
c->rq.cq.event_ctr,
84-
c->rq.stats.packets,
85-
c->rq.stats.bytes);
82+
net_dim(&c->rq.dim,
83+
c->rq.cq.event_ctr,
84+
c->rq.stats.packets,
85+
c->rq.stats.bytes);
8686

8787
mlx5e_cq_arm(&c->rq.cq);
8888
mlx5e_cq_arm(&c->icosq.cq);

0 commit comments

Comments
 (0)