Skip to content

Commit 9da5294

Browse files
Tariq ToukanSaeed Mahameed
authored andcommitted
net/mlx5e: Remove redundant page argument in mlx5e_xdp_handle()
Remove the page parameter, it can be derived from the xdp_buff member of mlx5e_xdp_buff. Signed-off-by: Tariq Toukan <[email protected]> Reviewed-by: Dragos Tatulea <[email protected]> Signed-off-by: Saeed Mahameed <[email protected]>
1 parent bfc63c9 commit 9da5294

File tree

4 files changed

+9
-11
lines changed

4 files changed

+9
-11
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ const struct xdp_metadata_ops mlx5e_xdp_metadata_ops = {
186186
};
187187

188188
/* returns true if packet was consumed by xdp */
189-
bool mlx5e_xdp_handle(struct mlx5e_rq *rq, struct page *page,
189+
bool mlx5e_xdp_handle(struct mlx5e_rq *rq,
190190
struct bpf_prog *prog, struct mlx5e_xdp_buff *mxbuf)
191191
{
192192
struct xdp_buff *xdp = &mxbuf->xdp;
@@ -210,7 +210,7 @@ bool mlx5e_xdp_handle(struct mlx5e_rq *rq, struct page *page,
210210
__set_bit(MLX5E_RQ_FLAG_XDP_XMIT, rq->flags);
211211
__set_bit(MLX5E_RQ_FLAG_XDP_REDIRECT, rq->flags);
212212
if (xdp->rxq->mem.type != MEM_TYPE_XSK_BUFF_POOL)
213-
mlx5e_page_dma_unmap(rq, page);
213+
mlx5e_page_dma_unmap(rq, virt_to_page(xdp->data));
214214
rq->stats->xdp_redirect++;
215215
return true;
216216
default:

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ struct mlx5e_xdp_buff {
5252

5353
struct mlx5e_xsk_param;
5454
int mlx5e_xdp_max_mtu(struct mlx5e_params *params, struct mlx5e_xsk_param *xsk);
55-
bool mlx5e_xdp_handle(struct mlx5e_rq *rq, struct page *page,
55+
bool mlx5e_xdp_handle(struct mlx5e_rq *rq,
5656
struct bpf_prog *prog, struct mlx5e_xdp_buff *mlctx);
5757
void mlx5e_xdp_mpwqe_complete(struct mlx5e_xdpsq *sq);
5858
bool mlx5e_poll_xdpsq_cq(struct mlx5e_cq *cq);

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ struct sk_buff *mlx5e_xsk_skb_from_cqe_mpwrq_linear(struct mlx5e_rq *rq,
289289
*/
290290

291291
prog = rcu_dereference(rq->xdp_prog);
292-
if (likely(prog && mlx5e_xdp_handle(rq, NULL, prog, mxbuf))) {
292+
if (likely(prog && mlx5e_xdp_handle(rq, prog, mxbuf))) {
293293
if (likely(__test_and_clear_bit(MLX5E_RQ_FLAG_XDP_XMIT, rq->flags)))
294294
__set_bit(page_idx, wi->xdp_xmit_bitmap); /* non-atomic */
295295
return NULL; /* page/packet was consumed by XDP */
@@ -323,7 +323,7 @@ struct sk_buff *mlx5e_xsk_skb_from_cqe_linear(struct mlx5e_rq *rq,
323323
net_prefetch(mxbuf->xdp.data);
324324

325325
prog = rcu_dereference(rq->xdp_prog);
326-
if (likely(prog && mlx5e_xdp_handle(rq, NULL, prog, mxbuf)))
326+
if (likely(prog && mlx5e_xdp_handle(rq, prog, mxbuf)))
327327
return NULL; /* page/packet was consumed by XDP */
328328

329329
/* XDP_PASS: copy the data from the UMEM to a new SKB. The frame reuse

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

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1610,7 +1610,7 @@ mlx5e_skb_from_cqe_linear(struct mlx5e_rq *rq, struct mlx5e_wqe_frag_info *wi,
16101610

16111611
net_prefetchw(va); /* xdp_frame data area */
16121612
mlx5e_fill_mxbuf(rq, cqe, va, rx_headroom, cqe_bcnt, &mxbuf);
1613-
if (mlx5e_xdp_handle(rq, au->page, prog, &mxbuf))
1613+
if (mlx5e_xdp_handle(rq, prog, &mxbuf))
16141614
return NULL; /* page/packet was consumed by XDP */
16151615

16161616
rx_headroom = mxbuf.xdp.data - mxbuf.xdp.data_hard_start;
@@ -1698,10 +1698,8 @@ mlx5e_skb_from_cqe_nonlinear(struct mlx5e_rq *rq, struct mlx5e_wqe_frag_info *wi
16981698
wi++;
16991699
}
17001700

1701-
au = head_wi->au;
1702-
17031701
prog = rcu_dereference(rq->xdp_prog);
1704-
if (prog && mlx5e_xdp_handle(rq, au->page, prog, &mxbuf)) {
1702+
if (prog && mlx5e_xdp_handle(rq, prog, &mxbuf)) {
17051703
if (test_bit(MLX5E_RQ_FLAG_XDP_XMIT, rq->flags)) {
17061704
int i;
17071705

@@ -1718,7 +1716,7 @@ mlx5e_skb_from_cqe_nonlinear(struct mlx5e_rq *rq, struct mlx5e_wqe_frag_info *wi
17181716
if (unlikely(!skb))
17191717
return NULL;
17201718

1721-
page_ref_inc(au->page);
1719+
page_ref_inc(head_wi->au->page);
17221720

17231721
if (unlikely(xdp_buff_has_frags(&mxbuf.xdp))) {
17241722
int i;
@@ -2013,7 +2011,7 @@ mlx5e_skb_from_cqe_mpwrq_linear(struct mlx5e_rq *rq, struct mlx5e_mpw_info *wi,
20132011

20142012
net_prefetchw(va); /* xdp_frame data area */
20152013
mlx5e_fill_mxbuf(rq, cqe, va, rx_headroom, cqe_bcnt, &mxbuf);
2016-
if (mlx5e_xdp_handle(rq, au->page, prog, &mxbuf)) {
2014+
if (mlx5e_xdp_handle(rq, prog, &mxbuf)) {
20172015
if (__test_and_clear_bit(MLX5E_RQ_FLAG_XDP_XMIT, rq->flags))
20182016
__set_bit(page_idx, wi->xdp_xmit_bitmap); /* non-atomic */
20192017
return NULL; /* page/packet was consumed by XDP */

0 commit comments

Comments
 (0)