RE: [EXTERNAL] Re: [net-next PATCH v4 1/6] octeontx2-pf: Don't unmap page pool buffer
From: Suman Ghosh
Date: Thu Jan 23 2025 - 04:18:15 EST
>
>Overall, the change makes sense. However, it would be better to consider
>using
>xdp_return_frame when handling the packets XDP_REDIRECTed from another
>interface, you can look up its implementation to see how much more cases
>it
>handles.
[Suman] Okay, we will check that and update in patch 5. I Will submit v5 once net-next is open again
>
>Also, a question below.
>
>> Signed-off-by: Geetha sowjanya <gakula@xxxxxxxxxxx>
>> Signed-off-by: Suman Ghosh <sumang@xxxxxxxxxxx>
>> ---
>> .../marvell/octeontx2/nic/otx2_common.h | 4 +-
>> .../ethernet/marvell/octeontx2/nic/otx2_pf.c | 8 +++-
>> .../marvell/octeontx2/nic/otx2_txrx.c | 43 +++++++++++++-----
>-
>> .../marvell/octeontx2/nic/otx2_txrx.h | 1 +
>> 4 files changed, 41 insertions(+), 15 deletions(-)
>>
>
>[...]
>
>> diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_txrx.c
>b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_txrx.c
>> index 224cef938927..2859f397f99e 100644
>> --- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_txrx.c
>> +++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_txrx.c
>> @@ -101,14 +101,20 @@ static void otx2_xdp_snd_pkt_handler(struct
>otx2_nic *pfvf,
>> struct nix_send_comp_s *snd_comp = &cqe->comp;
>> struct sg_list *sg;
>> struct page *page;
>> - u64 pa;
>> + u64 pa, iova;
>>
>> sg = &sq->sg[snd_comp->sqe_id];
>>
>> - pa = otx2_iova_to_phys(pfvf->iommu_domain, sg->dma_addr[0]);
>> - otx2_dma_unmap_page(pfvf, sg->dma_addr[0],
>> - sg->size[0], DMA_TO_DEVICE);
>> + iova = sg->dma_addr[0] - OTX2_HEAD_ROOM;
>> + pa = otx2_iova_to_phys(pfvf->iommu_domain, iova);
>
>Why change the address calculation? I would like the answer to be in the
>commit
>message.
[Suman] Ack, will submit v5 once net-next is open again.
>
>> page = virt_to_page(phys_to_virt(pa));
>> + if (sg->flags & XDP_REDIRECT)
>> + otx2_dma_unmap_page(pfvf, sg->dma_addr[0], sg->size[0],
>DMA_TO_DEVICE);
>> +
>> + if (page->pp) {
>> + page_pool_recycle_direct(page->pp, page);
>> + return;
>> + }
>> put_page(page);
>> }
>>
>> @@ -1360,7 +1366,7 @@ void otx2_free_pending_sqe(struct otx2_nic
>*pfvf)
>> }
>>
>> static void otx2_xdp_sqe_add_sg(struct otx2_snd_queue *sq, u64
>dma_addr,
>> - int len, int *offset)
>> + int len, int *offset, u16 flags)
>> {
>> struct nix_sqe_sg_s *sg = NULL;
>> u64 *iova = NULL;
>
>[...]