[PATCH net-next v5 03/12] page_pool: Add page_pool_dev_alloc_netmems helper

Mark Bloch posted 12 patches 4 months ago
There is a newer version of this series
[PATCH net-next v5 03/12] page_pool: Add page_pool_dev_alloc_netmems helper
Posted by Mark Bloch 4 months ago
From: Dragos Tatulea <dtatulea@nvidia.com>

This is the netmem counterpart of page_pool_dev_alloc_pages() which
uses the default GFP flags for RX.

Signed-off-by: Dragos Tatulea <dtatulea@nvidia.com>
Signed-off-by: Mark Bloch <mbloch@nvidia.com>
---
 include/net/page_pool/helpers.h | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/include/net/page_pool/helpers.h b/include/net/page_pool/helpers.h
index 93f2c31baf9b..773fc65780b5 100644
--- a/include/net/page_pool/helpers.h
+++ b/include/net/page_pool/helpers.h
@@ -153,6 +153,13 @@ static inline netmem_ref page_pool_dev_alloc_netmem(struct page_pool *pool,
 	return page_pool_alloc_netmem(pool, offset, size, gfp);
 }
 
+static inline netmem_ref page_pool_dev_alloc_netmems(struct page_pool *pool)
+{
+	gfp_t gfp = GFP_ATOMIC | __GFP_NOWARN;
+
+	return page_pool_alloc_netmems(pool, gfp);
+}
+
 static inline struct page *page_pool_alloc(struct page_pool *pool,
 					   unsigned int *offset,
 					   unsigned int *size, gfp_t gfp)
-- 
2.34.1
Re: [PATCH net-next v5 03/12] page_pool: Add page_pool_dev_alloc_netmems helper
Posted by Mina Almasry 4 months ago
On Thu, Jun 12, 2025 at 8:52 AM Mark Bloch <mbloch@nvidia.com> wrote:
>
> From: Dragos Tatulea <dtatulea@nvidia.com>
>
> This is the netmem counterpart of page_pool_dev_alloc_pages() which
> uses the default GFP flags for RX.
>
> Signed-off-by: Dragos Tatulea <dtatulea@nvidia.com>
> Signed-off-by: Mark Bloch <mbloch@nvidia.com>

Thank you!

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

-- 
Thanks,
Mina