Skip to content

Commit b39fe61

Browse files
Maxim MikityanskiySaeed Mahameed
authored andcommitted
net/mlx5e: Rename xmit-related structs to generalize them
As preparation for the upcoming TX MPWQE support for SKBs, rename struct mlx5e_xdp_mpwqe to mlx5e_tx_mpwqe and move it above struct mlx5e_txqsq. This structure will be reused in the regular SQ and in the regular TX data path. Also rename mlx5e_xdp_xmit_data to mlx5e_xmit_data - it will be used in the upcoming TX MPWQE flow. Signed-off-by: Maxim Mikityanskiy <[email protected]> Reviewed-by: Tariq Toukan <[email protected]> Signed-off-by: Saeed Mahameed <[email protected]>
1 parent 530d5ce commit b39fe61

File tree

5 files changed

+26
-26
lines changed

5 files changed

+26
-26
lines changed

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

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,14 @@ enum {
313313
MLX5E_SQ_STATE_PENDING_XSK_TX,
314314
};
315315

316+
struct mlx5e_tx_mpwqe {
317+
/* Current MPWQE session */
318+
struct mlx5e_tx_wqe *wqe;
319+
u8 ds_count;
320+
u8 pkt_count;
321+
u8 inline_on;
322+
};
323+
316324
struct mlx5e_txqsq {
317325
/* data path */
318326

@@ -403,7 +411,7 @@ struct mlx5e_xdp_info {
403411
};
404412
};
405413

406-
struct mlx5e_xdp_xmit_data {
414+
struct mlx5e_xmit_data {
407415
dma_addr_t dma_addr;
408416
void *data;
409417
u32 len;
@@ -416,18 +424,10 @@ struct mlx5e_xdp_info_fifo {
416424
u32 mask;
417425
};
418426

419-
struct mlx5e_xdp_mpwqe {
420-
/* Current MPWQE session */
421-
struct mlx5e_tx_wqe *wqe;
422-
u8 ds_count;
423-
u8 pkt_count;
424-
u8 inline_on;
425-
};
426-
427427
struct mlx5e_xdpsq;
428428
typedef int (*mlx5e_fp_xmit_xdp_frame_check)(struct mlx5e_xdpsq *);
429429
typedef bool (*mlx5e_fp_xmit_xdp_frame)(struct mlx5e_xdpsq *,
430-
struct mlx5e_xdp_xmit_data *,
430+
struct mlx5e_xmit_data *,
431431
struct mlx5e_xdp_info *,
432432
int);
433433

@@ -442,7 +442,7 @@ struct mlx5e_xdpsq {
442442
u32 xdpi_fifo_pc ____cacheline_aligned_in_smp;
443443
u16 pc;
444444
struct mlx5_wqe_ctrl_seg *doorbell_cseg;
445-
struct mlx5e_xdp_mpwqe mpwqe;
445+
struct mlx5e_tx_mpwqe mpwqe;
446446

447447
struct mlx5e_cq cq;
448448

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ mlx5e_tx_dma_unmap(struct device *pdev, struct mlx5e_sq_dma *dma)
279279

280280
void mlx5e_sq_xmit_simple(struct mlx5e_txqsq *sq, struct sk_buff *skb, bool xmit_more);
281281

282-
static inline bool mlx5e_tx_mpwqe_is_full(struct mlx5e_xdp_mpwqe *session)
282+
static inline bool mlx5e_tx_mpwqe_is_full(struct mlx5e_tx_mpwqe *session)
283283
{
284284
return session->ds_count == MLX5E_TX_MPW_MAX_NUM_DS;
285285
}

drivers/net/ethernet/mellanox/mlx5/core/en/xdp.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ static inline bool
5959
mlx5e_xmit_xdp_buff(struct mlx5e_xdpsq *sq, struct mlx5e_rq *rq,
6060
struct mlx5e_dma_info *di, struct xdp_buff *xdp)
6161
{
62-
struct mlx5e_xdp_xmit_data xdptxd;
62+
struct mlx5e_xmit_data xdptxd;
6363
struct mlx5e_xdp_info xdpi;
6464
struct xdp_frame *xdpf;
6565
dma_addr_t dma_addr;
@@ -194,7 +194,7 @@ static u16 mlx5e_xdpsq_get_next_pi(struct mlx5e_xdpsq *sq, u16 size)
194194

195195
static void mlx5e_xdp_mpwqe_session_start(struct mlx5e_xdpsq *sq)
196196
{
197-
struct mlx5e_xdp_mpwqe *session = &sq->mpwqe;
197+
struct mlx5e_tx_mpwqe *session = &sq->mpwqe;
198198
struct mlx5e_xdpsq_stats *stats = sq->stats;
199199
struct mlx5e_tx_wqe *wqe;
200200
u16 pi;
@@ -203,7 +203,7 @@ static void mlx5e_xdp_mpwqe_session_start(struct mlx5e_xdpsq *sq)
203203
wqe = MLX5E_TX_FETCH_WQE(sq, pi);
204204
net_prefetchw(wqe->data);
205205

206-
*session = (struct mlx5e_xdp_mpwqe) {
206+
*session = (struct mlx5e_tx_mpwqe) {
207207
.wqe = wqe,
208208
.ds_count = MLX5E_TX_WQE_EMPTY_DS_COUNT,
209209
.pkt_count = 0,
@@ -216,7 +216,7 @@ static void mlx5e_xdp_mpwqe_session_start(struct mlx5e_xdpsq *sq)
216216
void mlx5e_xdp_mpwqe_complete(struct mlx5e_xdpsq *sq)
217217
{
218218
struct mlx5_wq_cyc *wq = &sq->wq;
219-
struct mlx5e_xdp_mpwqe *session = &sq->mpwqe;
219+
struct mlx5e_tx_mpwqe *session = &sq->mpwqe;
220220
struct mlx5_wqe_ctrl_seg *cseg = &session->wqe->ctrl;
221221
u16 ds_count = session->ds_count;
222222
u16 pi = mlx5_wq_cyc_ctr2ix(wq, sq->pc);
@@ -261,10 +261,10 @@ INDIRECT_CALLABLE_SCOPE int mlx5e_xmit_xdp_frame_check_mpwqe(struct mlx5e_xdpsq
261261
}
262262

263263
INDIRECT_CALLABLE_SCOPE bool
264-
mlx5e_xmit_xdp_frame_mpwqe(struct mlx5e_xdpsq *sq, struct mlx5e_xdp_xmit_data *xdptxd,
264+
mlx5e_xmit_xdp_frame_mpwqe(struct mlx5e_xdpsq *sq, struct mlx5e_xmit_data *xdptxd,
265265
struct mlx5e_xdp_info *xdpi, int check_result)
266266
{
267-
struct mlx5e_xdp_mpwqe *session = &sq->mpwqe;
267+
struct mlx5e_tx_mpwqe *session = &sq->mpwqe;
268268
struct mlx5e_xdpsq_stats *stats = sq->stats;
269269

270270
if (unlikely(xdptxd->len > sq->hw_mtu)) {
@@ -308,7 +308,7 @@ INDIRECT_CALLABLE_SCOPE int mlx5e_xmit_xdp_frame_check(struct mlx5e_xdpsq *sq)
308308
}
309309

310310
INDIRECT_CALLABLE_SCOPE bool
311-
mlx5e_xmit_xdp_frame(struct mlx5e_xdpsq *sq, struct mlx5e_xdp_xmit_data *xdptxd,
311+
mlx5e_xmit_xdp_frame(struct mlx5e_xdpsq *sq, struct mlx5e_xmit_data *xdptxd,
312312
struct mlx5e_xdp_info *xdpi, int check_result)
313313
{
314314
struct mlx5_wq_cyc *wq = &sq->wq;
@@ -505,7 +505,7 @@ int mlx5e_xdp_xmit(struct net_device *dev, int n, struct xdp_frame **frames,
505505

506506
for (i = 0; i < n; i++) {
507507
struct xdp_frame *xdpf = frames[i];
508-
struct mlx5e_xdp_xmit_data xdptxd;
508+
struct mlx5e_xmit_data xdptxd;
509509
struct mlx5e_xdp_info xdpi;
510510
bool ret;
511511

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,11 @@ int mlx5e_xdp_xmit(struct net_device *dev, int n, struct xdp_frame **frames,
5858
u32 flags);
5959

6060
INDIRECT_CALLABLE_DECLARE(bool mlx5e_xmit_xdp_frame_mpwqe(struct mlx5e_xdpsq *sq,
61-
struct mlx5e_xdp_xmit_data *xdptxd,
61+
struct mlx5e_xmit_data *xdptxd,
6262
struct mlx5e_xdp_info *xdpi,
6363
int check_result));
6464
INDIRECT_CALLABLE_DECLARE(bool mlx5e_xmit_xdp_frame(struct mlx5e_xdpsq *sq,
65-
struct mlx5e_xdp_xmit_data *xdptxd,
65+
struct mlx5e_xmit_data *xdptxd,
6666
struct mlx5e_xdp_info *xdpi,
6767
int check_result));
6868
INDIRECT_CALLABLE_DECLARE(int mlx5e_xmit_xdp_frame_check_mpwqe(struct mlx5e_xdpsq *sq));
@@ -123,7 +123,7 @@ static inline bool mlx5e_xdp_get_inline_state(struct mlx5e_xdpsq *sq, bool cur)
123123
return cur;
124124
}
125125

126-
static inline bool mlx5e_xdp_mpqwe_is_full(struct mlx5e_xdp_mpwqe *session)
126+
static inline bool mlx5e_xdp_mpqwe_is_full(struct mlx5e_tx_mpwqe *session)
127127
{
128128
if (session->inline_on)
129129
return session->ds_count + MLX5E_XDP_INLINE_WQE_MAX_DS_CNT >
@@ -138,10 +138,10 @@ struct mlx5e_xdp_wqe_info {
138138

139139
static inline void
140140
mlx5e_xdp_mpwqe_add_dseg(struct mlx5e_xdpsq *sq,
141-
struct mlx5e_xdp_xmit_data *xdptxd,
141+
struct mlx5e_xmit_data *xdptxd,
142142
struct mlx5e_xdpsq_stats *stats)
143143
{
144-
struct mlx5e_xdp_mpwqe *session = &sq->mpwqe;
144+
struct mlx5e_tx_mpwqe *session = &sq->mpwqe;
145145
struct mlx5_wqe_data_seg *dseg =
146146
(struct mlx5_wqe_data_seg *)session->wqe + session->ds_count;
147147
u32 dma_len = xdptxd->len;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@ static void mlx5e_xsk_tx_post_err(struct mlx5e_xdpsq *sq,
6767
bool mlx5e_xsk_tx(struct mlx5e_xdpsq *sq, unsigned int budget)
6868
{
6969
struct xsk_buff_pool *pool = sq->xsk_pool;
70+
struct mlx5e_xmit_data xdptxd;
7071
struct mlx5e_xdp_info xdpi;
71-
struct mlx5e_xdp_xmit_data xdptxd;
7272
bool work_done = true;
7373
bool flush = false;
7474

0 commit comments

Comments
 (0)