lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHS8izNXjGhg2ntH_9rjH8OfbZr8VaU97w6j4uYqK9kkQE+n5g@mail.gmail.com>
Date: Tue, 12 Aug 2025 17:05:04 -0700
From: Mina Almasry <almasrymina@...gle.com>
To: Pavel Begunkov <asml.silence@...il.com>
Cc: netdev@...r.kernel.org, Jakub Kicinski <kuba@...nel.org>, 
	Eric Dumazet <edumazet@...gle.com>, Paolo Abeni <pabeni@...hat.com>, davem@...emloft.net, 
	sdf@...ichev.me, dw@...idwei.uk, Jesper Dangaard Brouer <hawk@...nel.org>, 
	Ilias Apalodimas <ilias.apalodimas@...aro.org>, Byungchul Park <byungchul@...com>
Subject: Re: [RFC net-next v1 4/6] net: convert page pool dma helpers to netmem_desc

On Mon, Aug 11, 2025 at 9:28 AM Pavel Begunkov <asml.silence@...il.com> wrote:
>
> struct netmem_desc has a clearly defined field that keeps dma_addr. Use
> the new type in netmem and page_pool functions and get rid of a bunch of
> now unnecessary accessor helpers.
>
> While doing so, extract a helper for getting a dma address out of a
> netmem desc, which can be used to optimise paths that already know the
> underlying netmem type like memory providers.
>
> Signed-off-by: Pavel Begunkov <asml.silence@...il.com>
> ---
>  include/net/netmem.h            |  5 -----
>  include/net/page_pool/helpers.h | 12 ++++++++++--
>  net/core/netmem_priv.h          |  6 ------
>  net/core/page_pool_priv.h       |  9 +++++----
>  4 files changed, 15 insertions(+), 17 deletions(-)
>
> diff --git a/include/net/netmem.h b/include/net/netmem.h
> index d08797e40a7c..ca6d5d151acc 100644
> --- a/include/net/netmem.h
> +++ b/include/net/netmem.h
> @@ -389,11 +389,6 @@ static inline bool netmem_is_pfmemalloc(netmem_ref netmem)
>         return page_is_pfmemalloc(netmem_to_page(netmem));
>  }
>
> -static inline unsigned long netmem_get_dma_addr(netmem_ref netmem)
> -{
> -       return netmem_to_nmdesc(netmem)->dma_addr;
> -}
> -
>  void get_netmem(netmem_ref netmem);
>  void put_netmem(netmem_ref netmem);
>
> diff --git a/include/net/page_pool/helpers.h b/include/net/page_pool/helpers.h
> index db180626be06..a9774d582933 100644
> --- a/include/net/page_pool/helpers.h
> +++ b/include/net/page_pool/helpers.h
> @@ -425,9 +425,10 @@ static inline void page_pool_free_va(struct page_pool *pool, void *va,
>         page_pool_put_page(pool, virt_to_head_page(va), -1, allow_direct);
>  }
>
> -static inline dma_addr_t page_pool_get_dma_addr_netmem(netmem_ref netmem)
> +static inline dma_addr_t
> +page_pool_get_dma_addr_nmdesc(const struct netmem_desc *nmdesc)
>  {
> -       dma_addr_t ret = netmem_get_dma_addr(netmem);
> +       dma_addr_t ret = nmdesc->dma_addr;
>
>         if (PAGE_POOL_32BIT_ARCH_WITH_64BIT_DMA)
>                 ret <<= PAGE_SHIFT;
> @@ -435,6 +436,13 @@ static inline dma_addr_t page_pool_get_dma_addr_netmem(netmem_ref netmem)
>         return ret;
>  }
>
> +static inline dma_addr_t page_pool_get_dma_addr_netmem(netmem_ref netmem)
> +{
> +       const struct netmem_desc *desc = netmem_to_nmdesc(netmem);
> +
> +       return page_pool_get_dma_addr_nmdesc(desc);
> +}
> +

nit: this wrapper feels very unnecessary. The _nmdesc variant has only
one call site from page_pool_get_dma_addr_netmem. I'd really prefer we
don't have the _nmdesc variant.

But, minor issue, so reviewed-by anyway.

Reviewed-by: Mina Almasry <almasrymina@...gle.com>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ