Re: [net-next PATCH v4 1/6] octeontx2-pf: Don't unmap page pool buffer

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

 



On Fri, Jan 17, 2025 at 12:41:11AM +0530, Suman Ghosh wrote:
> When xdp buffers are from page pool do not dma unmap
> the buffers. DMA map/unmap are handled by the page_pool
> APIs.
>

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.

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.

>  	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;

[...]




[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