Re: [net-next PATCH v3 1/6] octeontx2-pf: Don't unmap page pool buffer used by XDP
From: Paolo Abeni
Date: Tue Jan 14 2025 - 07:44:24 EST
On 1/10/25 10:38 AM, Suman Ghosh wrote:
> diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c
> index e1dde93e8af8..8ba44164736a 100644
> --- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c
> +++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c
> @@ -2701,11 +2701,15 @@ static int otx2_xdp_xmit_tx(struct otx2_nic *pf, struct xdp_frame *xdpf,
> if (dma_mapping_error(pf->dev, dma_addr))
> return -ENOMEM;
>
> - err = otx2_xdp_sq_append_pkt(pf, dma_addr, xdpf->len, qidx);
> + err = otx2_xdp_sq_append_pkt(pf, dma_addr, xdpf->len,
> + qidx, XDP_REDIRECT);
> if (!err) {
> otx2_dma_unmap_page(pf, dma_addr, xdpf->len, DMA_TO_DEVICE);
> page = virt_to_page(xdpf->data);
> - put_page(page);
> + if (page->pp)
> + page_pool_recycle_direct(page->pp, page);
> + else
> + put_page(page);
Side note for a possible follow-up: I guess that if you enable the page
pool usage for all the RX ring, regardless of XDP presence you could
avoid a bunch of conditionals in the fast-path and simplify the code a bit.
/P