RE: [EXTERNAL] Re: [net-next PATCH v3 1/6] octeontx2-pf: Don't unmap page pool buffer used by XDP

From: Suman Ghosh
Date: Wed Jan 15 2025 - 13:30:49 EST


>> 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.
>
[Suman] Yes, we are thinking about that too, will update in some future patches.
>/P