On Thu, Feb 06, 2025 at 02:20:29PM +0530, Suman Ghosh wrote: > xdp_return_frames() will help to free the xdp frames and their > associated pages back to page pool. > > Signed-off-by: Geetha sowjanya <gakula@xxxxxxxxxxx> > Signed-off-by: Suman Ghosh <sumang@xxxxxxxxxxx> > diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_txrx.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_txrx.c > index 224cef938927..d46f05993d3f 100644 > --- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_txrx.c > +++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_txrx.c > @@ -96,20 +96,22 @@ static unsigned int frag_num(unsigned int i) > > 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. > + 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, ...