Skip to content

Commit c293ac9

Browse files
Tariq ToukanSaeed Mahameed
authored andcommitted
net/mlx5e: Refactor build channel params
Take the CQ params into their respective RQ/SQ params. Split the params build of the different ICOSQs (sync and async), as they require different init values. Signed-off-by: Tariq Toukan <[email protected]> Reviewed-by: Maxim Mikityanskiy <[email protected]> Signed-off-by: Saeed Mahameed <[email protected]>
1 parent 8d94b59 commit c293ac9

File tree

3 files changed

+29
-29
lines changed

3 files changed

+29
-29
lines changed

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

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,33 +11,33 @@ struct mlx5e_xsk_param {
1111
u16 chunk_size;
1212
};
1313

14+
struct mlx5e_cq_param {
15+
u32 cqc[MLX5_ST_SZ_DW(cqc)];
16+
struct mlx5_wq_param wq;
17+
u16 eq_ix;
18+
u8 cq_period_mode;
19+
};
20+
1421
struct mlx5e_rq_param {
22+
struct mlx5e_cq_param cqp;
1523
u32 rqc[MLX5_ST_SZ_DW(rqc)];
1624
struct mlx5_wq_param wq;
1725
struct mlx5e_rq_frags_info frags_info;
1826
};
1927

2028
struct mlx5e_sq_param {
29+
struct mlx5e_cq_param cqp;
2130
u32 sqc[MLX5_ST_SZ_DW(sqc)];
2231
struct mlx5_wq_param wq;
2332
bool is_mpw;
2433
};
2534

26-
struct mlx5e_cq_param {
27-
u32 cqc[MLX5_ST_SZ_DW(cqc)];
28-
struct mlx5_wq_param wq;
29-
u16 eq_ix;
30-
u8 cq_period_mode;
31-
};
32-
3335
struct mlx5e_channel_param {
3436
struct mlx5e_rq_param rq;
35-
struct mlx5e_sq_param sq;
37+
struct mlx5e_sq_param txq_sq;
3638
struct mlx5e_sq_param xdp_sq;
3739
struct mlx5e_sq_param icosq;
38-
struct mlx5e_cq_param rx_cq;
39-
struct mlx5e_cq_param tx_cq;
40-
struct mlx5e_cq_param icosq_cq;
40+
struct mlx5e_sq_param async_icosq;
4141
};
4242

4343
static inline bool mlx5e_qid_get_ch_if_in_group(struct mlx5e_params *params,

drivers/net/ethernet/mellanox/mlx5/core/en/xsk/setup.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,6 @@ static void mlx5e_build_xsk_cparam(struct mlx5e_priv *priv,
4141
{
4242
mlx5e_build_rq_param(priv, params, xsk, &cparam->rq);
4343
mlx5e_build_xdpsq_param(priv, params, &cparam->xdp_sq);
44-
mlx5e_build_rx_cq_param(priv, params, xsk, &cparam->rx_cq);
45-
mlx5e_build_tx_cq_param(priv, params, &cparam->tx_cq);
4644
}
4745

4846
int mlx5e_open_xsk(struct mlx5e_priv *priv, struct mlx5e_params *params,
@@ -61,15 +59,15 @@ int mlx5e_open_xsk(struct mlx5e_priv *priv, struct mlx5e_params *params,
6159

6260
mlx5e_build_xsk_cparam(priv, params, xsk, cparam);
6361

64-
err = mlx5e_open_cq(c, params->rx_cq_moderation, &cparam->rx_cq, &c->xskrq.cq);
62+
err = mlx5e_open_cq(c, params->rx_cq_moderation, &cparam->rq.cqp, &c->xskrq.cq);
6563
if (unlikely(err))
6664
goto err_free_cparam;
6765

6866
err = mlx5e_open_rq(c, params, &cparam->rq, xsk, umem, &c->xskrq);
6967
if (unlikely(err))
7068
goto err_close_rx_cq;
7169

72-
err = mlx5e_open_cq(c, params->tx_cq_moderation, &cparam->tx_cq, &c->xsksq.cq);
70+
err = mlx5e_open_cq(c, params->tx_cq_moderation, &cparam->xdp_sq.cqp, &c->xsksq.cq);
7371
if (unlikely(err))
7472
goto err_close_rq;
7573

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

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1675,7 +1675,7 @@ static int mlx5e_open_tx_cqs(struct mlx5e_channel *c,
16751675

16761676
for (tc = 0; tc < c->num_tc; tc++) {
16771677
err = mlx5e_open_cq(c, params->tx_cq_moderation,
1678-
&cparam->tx_cq, &c->sq[tc].cq);
1678+
&cparam->txq_sq.cqp, &c->sq[tc].cq);
16791679
if (err)
16801680
goto err_close_tx_cqs;
16811681
}
@@ -1707,7 +1707,7 @@ static int mlx5e_open_sqs(struct mlx5e_channel *c,
17071707
int txq_ix = c->ix + tc * params->num_channels;
17081708

17091709
err = mlx5e_open_txqsq(c, c->priv->tisn[c->lag_port][tc], txq_ix,
1710-
params, &cparam->sq, &c->sq[tc], tc);
1710+
params, &cparam->txq_sq, &c->sq[tc], tc);
17111711
if (err)
17121712
goto err_close_sqs;
17131713
}
@@ -1817,37 +1817,36 @@ static int mlx5e_open_queues(struct mlx5e_channel *c,
18171817
struct dim_cq_moder icocq_moder = {0, 0};
18181818
int err;
18191819

1820-
err = mlx5e_open_cq(c, icocq_moder, &cparam->icosq_cq, &c->async_icosq.cq);
1820+
err = mlx5e_open_cq(c, icocq_moder, &cparam->icosq.cqp, &c->async_icosq.cq);
18211821
if (err)
18221822
return err;
18231823

1824-
err = mlx5e_open_cq(c, icocq_moder, &cparam->icosq_cq, &c->icosq.cq);
1824+
err = mlx5e_open_cq(c, icocq_moder, &cparam->async_icosq.cqp, &c->icosq.cq);
18251825
if (err)
18261826
goto err_close_async_icosq_cq;
18271827

18281828
err = mlx5e_open_tx_cqs(c, params, cparam);
18291829
if (err)
18301830
goto err_close_icosq_cq;
18311831

1832-
err = mlx5e_open_cq(c, params->tx_cq_moderation, &cparam->tx_cq, &c->xdpsq.cq);
1832+
err = mlx5e_open_cq(c, params->tx_cq_moderation, &cparam->xdp_sq.cqp, &c->xdpsq.cq);
18331833
if (err)
18341834
goto err_close_tx_cqs;
18351835

1836-
err = mlx5e_open_cq(c, params->rx_cq_moderation, &cparam->rx_cq, &c->rq.cq);
1836+
err = mlx5e_open_cq(c, params->rx_cq_moderation, &cparam->rq.cqp, &c->rq.cq);
18371837
if (err)
18381838
goto err_close_xdp_tx_cqs;
18391839

1840-
/* XDP SQ CQ params are same as normal TXQ sq CQ params */
18411840
err = c->xdp ? mlx5e_open_cq(c, params->tx_cq_moderation,
1842-
&cparam->tx_cq, &c->rq_xdpsq.cq) : 0;
1841+
&cparam->xdp_sq.cqp, &c->rq_xdpsq.cq) : 0;
18431842
if (err)
18441843
goto err_close_rx_cq;
18451844

18461845
napi_enable(&c->napi);
18471846

18481847
spin_lock_init(&c->async_icosq_lock);
18491848

1850-
err = mlx5e_open_icosq(c, params, &cparam->icosq, &c->async_icosq);
1849+
err = mlx5e_open_icosq(c, params, &cparam->async_icosq, &c->async_icosq);
18511850
if (err)
18521851
goto err_disable_napi;
18531852

@@ -2158,6 +2157,7 @@ void mlx5e_build_rq_param(struct mlx5e_priv *priv,
21582157
MLX5_SET(rqc, rqc, scatter_fcs, params->scatter_fcs_en);
21592158

21602159
param->wq.buf_numa_node = dev_to_node(mdev->device);
2160+
mlx5e_build_rx_cq_param(priv, params, xsk, &param->cqp);
21612161
}
21622162

21632163
static void mlx5e_build_drop_rq_param(struct mlx5e_priv *priv,
@@ -2200,6 +2200,7 @@ static void mlx5e_build_sq_param(struct mlx5e_priv *priv,
22002200
mlx5e_build_sq_param_common(priv, param);
22012201
MLX5_SET(wq, wq, log_wq_sz, params->log_sq_size);
22022202
MLX5_SET(sqc, sqc, allow_swp, allow_swp);
2203+
mlx5e_build_tx_cq_param(priv, params, &param->cqp);
22032204
}
22042205

22052206
static void mlx5e_build_common_cq_param(struct mlx5e_priv *priv,
@@ -2276,6 +2277,7 @@ void mlx5e_build_icosq_param(struct mlx5e_priv *priv,
22762277

22772278
MLX5_SET(wq, wq, log_wq_sz, log_wq_size);
22782279
MLX5_SET(sqc, sqc, reg_umr, MLX5_CAP_ETH(priv->mdev, reg_umr_sq));
2280+
mlx5e_build_ico_cq_param(priv, log_wq_size, &param->cqp);
22792281
}
22802282

22812283
void mlx5e_build_xdpsq_param(struct mlx5e_priv *priv,
@@ -2288,6 +2290,7 @@ void mlx5e_build_xdpsq_param(struct mlx5e_priv *priv,
22882290
mlx5e_build_sq_param_common(priv, param);
22892291
MLX5_SET(wq, wq, log_wq_sz, params->log_sq_size);
22902292
param->is_mpw = MLX5E_GET_PFLAG(params, MLX5E_PFLAG_XDP_TX_MPWQE);
2293+
mlx5e_build_tx_cq_param(priv, params, &param->cqp);
22912294
}
22922295

22932296
static u8 mlx5e_build_icosq_log_wq_sz(struct mlx5e_params *params,
@@ -2306,18 +2309,17 @@ static void mlx5e_build_channel_param(struct mlx5e_priv *priv,
23062309
struct mlx5e_params *params,
23072310
struct mlx5e_channel_param *cparam)
23082311
{
2309-
u8 icosq_log_wq_sz;
2312+
u8 icosq_log_wq_sz, async_icosq_log_wq_sz;
23102313

23112314
mlx5e_build_rq_param(priv, params, NULL, &cparam->rq);
23122315

23132316
icosq_log_wq_sz = mlx5e_build_icosq_log_wq_sz(params, &cparam->rq);
2317+
async_icosq_log_wq_sz = MLX5E_PARAMS_MINIMUM_LOG_SQ_SIZE;
23142318

2315-
mlx5e_build_sq_param(priv, params, &cparam->sq);
2319+
mlx5e_build_sq_param(priv, params, &cparam->txq_sq);
23162320
mlx5e_build_xdpsq_param(priv, params, &cparam->xdp_sq);
23172321
mlx5e_build_icosq_param(priv, icosq_log_wq_sz, &cparam->icosq);
2318-
mlx5e_build_rx_cq_param(priv, params, NULL, &cparam->rx_cq);
2319-
mlx5e_build_tx_cq_param(priv, params, &cparam->tx_cq);
2320-
mlx5e_build_ico_cq_param(priv, icosq_log_wq_sz, &cparam->icosq_cq);
2322+
mlx5e_build_icosq_param(priv, async_icosq_log_wq_sz, &cparam->async_icosq);
23212323
}
23222324

23232325
int mlx5e_open_channels(struct mlx5e_priv *priv,

0 commit comments

Comments
 (0)