[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <Z4qXxaOm1iih4xWl@lzaremba-mobl.ger.corp.intel.com>
Date: Fri, 17 Jan 2025 18:47:49 +0100
From: Larysa Zaremba <larysa.zaremba@...el.com>
To: Suman Ghosh <sumang@...vell.com>
CC: <horms@...nel.org>, <sgoutham@...vell.com>, <gakula@...vell.com>,
<sbhatta@...vell.com>, <hkelam@...vell.com>, <davem@...emloft.net>,
<edumazet@...gle.com>, <kuba@...nel.org>, <pabeni@...hat.com>,
<netdev@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
<lcherian@...vell.com>, <jerinj@...vell.com>, <john.fastabend@...il.com>,
<bbhushan2@...vell.com>, <hawk@...nel.org>, <andrew+netdev@...n.ch>,
<ast@...nel.org>, <daniel@...earbox.net>, <bpf@...r.kernel.org>
Subject: Re: [net-next PATCH v4 1/6] octeontx2-pf: Don't unmap page pool
buffer
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@...vell.com>
> Signed-off-by: Suman Ghosh <sumang@...vell.com>
> ---
> .../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;
[...]
Powered by blists - more mailing lists