[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID:
<DM6PR18MB26029EDFCE2D69803D7CF3A1CDF0A@DM6PR18MB2602.namprd18.prod.outlook.com>
Date: Wed, 13 Sep 2023 04:34:26 +0000
From: Geethasowjanya Akula <gakula@...vell.com>
To: Sebastian Andrzej Siewior <bigeasy@...utronix.de>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
"bpf@...r.kernel.org"
<bpf@...r.kernel.org>
CC: "David S. Miller" <davem@...emloft.net>,
Alexei Starovoitov
<ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
Eric Dumazet
<edumazet@...gle.com>, Jakub Kicinski <kuba@...nel.org>,
Jesper Dangaard
Brouer <hawk@...nel.org>,
John Fastabend <john.fastabend@...il.com>,
Paolo
Abeni <pabeni@...hat.com>, Thomas Gleixner <tglx@...utronix.de>,
Subbaraya
Sundeep Bhatta <sbhatta@...vell.com>,
Sunil Kovvuri Goutham
<sgoutham@...vell.com>,
Hariprasad Kelam <hkelam@...vell.com>
Subject: RE: [EXT] [PATCH net 3/4] octeontx2-pf: Do xdp_do_flush() after
redirects.
Thanks for the patch.
ACK.
> -----Original Message-----
> From: Sebastian Andrzej Siewior <bigeasy@...utronix.de>
> Sent: Friday, September 8, 2023 7:28 PM
> To: netdev@...r.kernel.org; bpf@...r.kernel.org
> Cc: David S. Miller <davem@...emloft.net>; Alexei Starovoitov
> <ast@...nel.org>; Daniel Borkmann <daniel@...earbox.net>; Eric Dumazet
> <edumazet@...gle.com>; Jakub Kicinski <kuba@...nel.org>; Jesper
> Dangaard Brouer <hawk@...nel.org>; John Fastabend
> <john.fastabend@...il.com>; Paolo Abeni <pabeni@...hat.com>; Thomas
> Gleixner <tglx@...utronix.de>; Sebastian Andrzej Siewior
> <bigeasy@...utronix.de>; Geethasowjanya Akula <gakula@...vell.com>;
> Subbaraya Sundeep Bhatta <sbhatta@...vell.com>; Sunil Kovvuri Goutham
> <sgoutham@...vell.com>; Hariprasad Kelam <hkelam@...vell.com>
> Subject: [EXT] [PATCH net 3/4] octeontx2-pf: Do xdp_do_flush() after
> redirects.
>
> External Email
>
> ----------------------------------------------------------------------
> 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@...vell.com>
> Cc: Subbaraya Sundeep <sbhatta@...vell.com>
> Cc: Sunil Goutham <sgoutham@...vell.com>
> Cc: hariprasad <hkelam@...vell.com>
> Fixes: 06059a1a9a4a5 ("octeontx2-pf: Add XDP support to netdev PF")
> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@...utronix.de>
> ---
> .../marvell/octeontx2/nic/otx2_txrx.c | 19 +++++++++++++------
> 1 file changed, 13 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_txrx.c
> b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_txrx.c
> index e369baf115301..6c02eaa460277 100644
> --- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_txrx.c
> +++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_txrx.c
> @@ -29,7 +29,8 @@
> static bool otx2_xdp_rcv_pkt_handler(struct otx2_nic *pfvf,
> struct bpf_prog *prog,
> struct nix_cqe_rx_s *cqe,
> - struct otx2_cq_queue *cq);
> + struct otx2_cq_queue *cq,
> + bool *need_xdp_flush);
>
> static int otx2_nix_cq_op_status(struct otx2_nic *pfvf,
> struct otx2_cq_queue *cq)
> @@ -337,7 +338,7 @@ static bool otx2_check_rcv_errors(struct otx2_nic
> *pfvf, static void otx2_rcv_pkt_handler(struct otx2_nic *pfvf,
> struct napi_struct *napi,
> struct otx2_cq_queue *cq,
> - struct nix_cqe_rx_s *cqe)
> + struct nix_cqe_rx_s *cqe, bool
> *need_xdp_flush)
> {
> struct nix_rx_parse_s *parse = &cqe->parse;
> struct nix_rx_sg_s *sg = &cqe->sg;
> @@ -353,7 +354,7 @@ static void otx2_rcv_pkt_handler(struct otx2_nic
> *pfvf,
> }
>
> if (pfvf->xdp_prog)
> - if (otx2_xdp_rcv_pkt_handler(pfvf, pfvf->xdp_prog, cqe, cq))
> + if (otx2_xdp_rcv_pkt_handler(pfvf, pfvf->xdp_prog, cqe, cq,
> +need_xdp_flush))
> return;
>
> skb = napi_get_frags(napi);
> @@ -388,6 +389,7 @@ static int otx2_rx_napi_handler(struct otx2_nic *pfvf,
> struct napi_struct *napi,
> struct otx2_cq_queue *cq, int budget) {
> + bool need_xdp_flush = false;
> struct nix_cqe_rx_s *cqe;
> int processed_cqe = 0;
>
> @@ -409,13 +411,15 @@ static int otx2_rx_napi_handler(struct otx2_nic
> *pfvf,
> cq->cq_head++;
> cq->cq_head &= (cq->cqe_cnt - 1);
>
> - otx2_rcv_pkt_handler(pfvf, napi, cq, cqe);
> + otx2_rcv_pkt_handler(pfvf, napi, cq, cqe, &need_xdp_flush);
>
> cqe->hdr.cqe_type = NIX_XQE_TYPE_INVALID;
> cqe->sg.seg_addr = 0x00;
> processed_cqe++;
> cq->pend_cqe--;
> }
> + if (need_xdp_flush)
> + xdp_do_flush();
>
> /* Free CQEs to HW */
> otx2_write64(pfvf, NIX_LF_CQ_OP_DOOR,
> @@ -1334,7 +1338,8 @@ bool otx2_xdp_sq_append_pkt(struct otx2_nic
> *pfvf, u64 iova, int len, u16 qidx) static bool
> otx2_xdp_rcv_pkt_handler(struct otx2_nic *pfvf,
> struct bpf_prog *prog,
> struct nix_cqe_rx_s *cqe,
> - struct otx2_cq_queue *cq)
> + struct otx2_cq_queue *cq,
> + bool *need_xdp_flush)
> {
> unsigned char *hard_start, *data;
> int qidx = cq->cq_idx;
> @@ -1371,8 +1376,10 @@ static bool otx2_xdp_rcv_pkt_handler(struct
> otx2_nic *pfvf,
>
> otx2_dma_unmap_page(pfvf, iova, pfvf->rbsize,
> DMA_FROM_DEVICE);
> - if (!err)
> + if (!err) {
> + *need_xdp_flush = true;
> return true;
> + }
> put_page(page);
> break;
> default:
> --
> 2.40.1
Powered by blists - more mailing lists