mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-11 05:17:10 +09:00
octeontx2-pf: Do xdp_do_flush() after redirects.
[ Upstream commit70b2b68926] 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:06059a1a9a("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> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
98ebbdefe4
commit
cae59ae731
@@ -29,7 +29,8 @@
|
|||||||
static bool otx2_xdp_rcv_pkt_handler(struct otx2_nic *pfvf,
|
static bool otx2_xdp_rcv_pkt_handler(struct otx2_nic *pfvf,
|
||||||
struct bpf_prog *prog,
|
struct bpf_prog *prog,
|
||||||
struct nix_cqe_rx_s *cqe,
|
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,
|
static int otx2_nix_cq_op_status(struct otx2_nic *pfvf,
|
||||||
struct otx2_cq_queue *cq)
|
struct otx2_cq_queue *cq)
|
||||||
@@ -340,7 +341,7 @@ static bool otx2_check_rcv_errors(struct otx2_nic *pfvf,
|
|||||||
static void otx2_rcv_pkt_handler(struct otx2_nic *pfvf,
|
static void otx2_rcv_pkt_handler(struct otx2_nic *pfvf,
|
||||||
struct napi_struct *napi,
|
struct napi_struct *napi,
|
||||||
struct otx2_cq_queue *cq,
|
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_parse_s *parse = &cqe->parse;
|
||||||
struct nix_rx_sg_s *sg = &cqe->sg;
|
struct nix_rx_sg_s *sg = &cqe->sg;
|
||||||
@@ -356,7 +357,7 @@ static void otx2_rcv_pkt_handler(struct otx2_nic *pfvf,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (pfvf->xdp_prog)
|
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;
|
return;
|
||||||
|
|
||||||
skb = napi_get_frags(napi);
|
skb = napi_get_frags(napi);
|
||||||
@@ -389,6 +390,7 @@ static int otx2_rx_napi_handler(struct otx2_nic *pfvf,
|
|||||||
struct napi_struct *napi,
|
struct napi_struct *napi,
|
||||||
struct otx2_cq_queue *cq, int budget)
|
struct otx2_cq_queue *cq, int budget)
|
||||||
{
|
{
|
||||||
|
bool need_xdp_flush = false;
|
||||||
struct nix_cqe_rx_s *cqe;
|
struct nix_cqe_rx_s *cqe;
|
||||||
int processed_cqe = 0;
|
int processed_cqe = 0;
|
||||||
|
|
||||||
@@ -410,13 +412,15 @@ process_cqe:
|
|||||||
cq->cq_head++;
|
cq->cq_head++;
|
||||||
cq->cq_head &= (cq->cqe_cnt - 1);
|
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->hdr.cqe_type = NIX_XQE_TYPE_INVALID;
|
||||||
cqe->sg.seg_addr = 0x00;
|
cqe->sg.seg_addr = 0x00;
|
||||||
processed_cqe++;
|
processed_cqe++;
|
||||||
cq->pend_cqe--;
|
cq->pend_cqe--;
|
||||||
}
|
}
|
||||||
|
if (need_xdp_flush)
|
||||||
|
xdp_do_flush();
|
||||||
|
|
||||||
/* Free CQEs to HW */
|
/* Free CQEs to HW */
|
||||||
otx2_write64(pfvf, NIX_LF_CQ_OP_DOOR,
|
otx2_write64(pfvf, NIX_LF_CQ_OP_DOOR,
|
||||||
@@ -1323,7 +1327,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,
|
static bool otx2_xdp_rcv_pkt_handler(struct otx2_nic *pfvf,
|
||||||
struct bpf_prog *prog,
|
struct bpf_prog *prog,
|
||||||
struct nix_cqe_rx_s *cqe,
|
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;
|
unsigned char *hard_start, *data;
|
||||||
int qidx = cq->cq_idx;
|
int qidx = cq->cq_idx;
|
||||||
@@ -1360,8 +1365,10 @@ static bool otx2_xdp_rcv_pkt_handler(struct otx2_nic *pfvf,
|
|||||||
|
|
||||||
otx2_dma_unmap_page(pfvf, iova, pfvf->rbsize,
|
otx2_dma_unmap_page(pfvf, iova, pfvf->rbsize,
|
||||||
DMA_FROM_DEVICE);
|
DMA_FROM_DEVICE);
|
||||||
if (!err)
|
if (!err) {
|
||||||
|
*need_xdp_flush = true;
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
put_page(page);
|
put_page(page);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|||||||
Reference in New Issue
Block a user