RE: [EXTERNAL] Re: [net-next PATCH v5 1/6] octeontx2-pf: use xdp_return_frame() to free xdp buffers
From: Suman Ghosh
Date: Wed Feb 12 2025 - 01:45:18 EST
>> static void otx2_xdp_snd_pkt_handler(struct otx2_nic *pfvf,
>> struct otx2_snd_queue *sq,
>> - struct nix_cqe_tx_s *cqe)
>> + struct nix_cqe_tx_s *cqe)
>> {
>> 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];
>> + pa = otx2_iova_to_phys(pfvf->iommu_domain, iova);
>> page = virt_to_page(phys_to_virt(pa));
>> - put_page(page);
>
>Hi Suman,
>
>With this patch applied page is assigned but otherwise unused in this
>function. So unless there are some side effects of the above, I think
>page and in turn pa and iova can be removed.
[Suman] ack, will update in v6
>
>> + if (sg->flags & XDP_REDIRECT)
>> + otx2_dma_unmap_page(pfvf, sg->dma_addr[0], sg->size[0],
>DMA_TO_DEVICE);
>> + xdp_return_frame((struct xdp_frame *)sg->skb);
>> + sg->skb = (u64)NULL;
>> }
>>
>> static void otx2_snd_pkt_handler(struct otx2_nic *pfvf,
>
>...