Re: [net-next PATCH v5 1/6] octeontx2-pf: use xdp_return_frame() to free xdp buffers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Feb 10, 2025 at 04:25:43PM +0000, Simon Horman wrote:
> 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.

I now see that page and pa are removed in patch 6/6, although iova
is left behind. I think it would be best to move the cleanup forward
to this patch.

> 
> > +	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,
> 
> ...
> 




[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux