Skip to content

Commit 70b2b68

Browse files
Sebastian Andrzej SiewiorPaolo Abeni
authored andcommitted
octeontx2-pf: Do xdp_do_flush() after redirects.
xdp_do_flush() should be invoked before leaving the NAPI poll function if XDP-redirect has been performed. Invoke xdp_do_flush() before leaving NAPI. Cc: Geetha sowjanya <gakula@marvell.com> Cc: Subbaraya Sundeep <sbhatta@marvell.com> Cc: Sunil Goutham <sgoutham@marvell.com> Cc: hariprasad <hkelam@marvell.com> Fixes: 06059a1 ("octeontx2-pf: Add XDP support to netdev PF") Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Acked-by: Geethasowjanya Akula <gakula@marvell.com> Acked-by: Jesper Dangaard Brouer <hawk@kernel.org> Signed-off-by: Paolo Abeni <pabeni@redhat.com>
1 parent edc0140 commit 70b2b68

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

drivers/net/ethernet/marvell/octeontx2/nic/otx2_txrx.c

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@
2929
static bool otx2_xdp_rcv_pkt_handler(struct otx2_nic *pfvf,
3030
struct bpf_prog *prog,
3131
struct nix_cqe_rx_s *cqe,
32-
struct otx2_cq_queue *cq);
32+
struct otx2_cq_queue *cq,
33+
bool *need_xdp_flush);
3334

3435
static int otx2_nix_cq_op_status(struct otx2_nic *pfvf,
3536
struct otx2_cq_queue *cq)
@@ -337,7 +338,7 @@ static bool otx2_check_rcv_errors(struct otx2_nic *pfvf,
337338
static void otx2_rcv_pkt_handler(struct otx2_nic *pfvf,
338339
struct napi_struct *napi,
339340
struct otx2_cq_queue *cq,
340-
struct nix_cqe_rx_s *cqe)
341+
struct nix_cqe_rx_s *cqe, bool *need_xdp_flush)
341342
{
342343
struct nix_rx_parse_s *parse = &cqe->parse;
343344
struct nix_rx_sg_s *sg = &cqe->sg;
@@ -353,7 +354,7 @@ static void otx2_rcv_pkt_handler(struct otx2_nic *pfvf,
353354
}
354355

355356
if (pfvf->xdp_prog)
356-
if (otx2_xdp_rcv_pkt_handler(pfvf, pfvf->xdp_prog, cqe, cq))
357+
if (otx2_xdp_rcv_pkt_handler(pfvf, pfvf->xdp_prog, cqe, cq, need_xdp_flush))
357358
return;
358359

359360
skb = napi_get_frags(napi);
@@ -388,6 +389,7 @@ static int otx2_rx_napi_handler(struct otx2_nic *pfvf,
388389
struct napi_struct *napi,
389390
struct otx2_cq_queue *cq, int budget)
390391
{
392+
bool need_xdp_flush = false;
391393
struct nix_cqe_rx_s *cqe;
392394
int processed_cqe = 0;
393395

@@ -409,13 +411,15 @@ static int otx2_rx_napi_handler(struct otx2_nic *pfvf,
409411
cq->cq_head++;
410412
cq->cq_head &= (cq->cqe_cnt - 1);
411413

412-
otx2_rcv_pkt_handler(pfvf, napi, cq, cqe);
414+
otx2_rcv_pkt_handler(pfvf, napi, cq, cqe, &need_xdp_flush);
413415

414416
cqe->hdr.cqe_type = NIX_XQE_TYPE_INVALID;
415417
cqe->sg.seg_addr = 0x00;
416418
processed_cqe++;
417419
cq->pend_cqe--;
418420
}
421+
if (need_xdp_flush)
422+
xdp_do_flush();
419423

420424
/* Free CQEs to HW */
421425
otx2_write64(pfvf, NIX_LF_CQ_OP_DOOR,
@@ -1354,7 +1358,8 @@ bool otx2_xdp_sq_append_pkt(struct otx2_nic *pfvf, u64 iova, int len, u16 qidx)
13541358
static bool otx2_xdp_rcv_pkt_handler(struct otx2_nic *pfvf,
13551359
struct bpf_prog *prog,
13561360
struct nix_cqe_rx_s *cqe,
1357-
struct otx2_cq_queue *cq)
1361+
struct otx2_cq_queue *cq,
1362+
bool *need_xdp_flush)
13581363
{
13591364
unsigned char *hard_start, *data;
13601365
int qidx = cq->cq_idx;
@@ -1391,8 +1396,10 @@ static bool otx2_xdp_rcv_pkt_handler(struct otx2_nic *pfvf,
13911396

13921397
otx2_dma_unmap_page(pfvf, iova, pfvf->rbsize,
13931398
DMA_FROM_DEVICE);
1394-
if (!err)
1399+
if (!err) {
1400+
*need_xdp_flush = true;
13951401
return true;
1402+
}
13961403
put_page(page);
13971404
break;
13981405
default:

0 commit comments

Comments
 (0)