mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Tariq Toukan <tariqt@nvidia.com>
To: Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Andrew Lunn <andrew+netdev@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>
Cc: Saeed Mahameed <saeedm@nvidia.com>,
	Tariq Toukan <tariqt@nvidia.com>,
	"Mark Bloch" <mbloch@nvidia.com>,
	Leon Romanovsky <leon@kernel.org>,
	"Jesper Dangaard Brouer" <hawk@kernel.org>,
	Ilias Apalodimas <ilias.apalodimas@linaro.org>,
	<netdev@vger.kernel.org>, <linux-rdma@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>, Gal Pressman <gal@nvidia.com>,
	Dragos Tatulea <dtatulea@nvidia.com>
Subject: [PATCH net-next 1/2] net: page_pool: Expose internal limit
Date: Mon, 22 Sep 2025 12:18:34 +0300	[thread overview]
Message-ID: <1758532715-820422-2-git-send-email-tariqt@nvidia.com> (raw)
In-Reply-To: <1758532715-820422-1-git-send-email-tariqt@nvidia.com>

From: Dragos Tatulea <dtatulea@nvidia.com>

page_pool_init() has a check for pool_size < 32K. But page_pool users
have no access to this limit so there is no way to trim the pool_size in
advance. The E2BIG error doesn't help much for retry as the driver has
to guess the next size and retry.

This patch exposes this limit to in the page_pool header.

Signed-off-by: Dragos Tatulea <dtatulea@nvidia.com>
Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
---
 include/net/page_pool/types.h | 2 ++
 net/core/page_pool.c          | 2 +-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/include/net/page_pool/types.h b/include/net/page_pool/types.h
index 1509a536cb85..22aee9a65a26 100644
--- a/include/net/page_pool/types.h
+++ b/include/net/page_pool/types.h
@@ -163,6 +163,8 @@ struct pp_memory_provider_params {
 	const struct memory_provider_ops *mp_ops;
 };
 
+#define PAGE_POOL_SIZE_LIMIT 32768
+
 struct page_pool {
 	struct page_pool_params_fast p;
 
diff --git a/net/core/page_pool.c b/net/core/page_pool.c
index 36a98f2bcac3..1f0fdfb02f08 100644
--- a/net/core/page_pool.c
+++ b/net/core/page_pool.c
@@ -214,7 +214,7 @@ static int page_pool_init(struct page_pool *pool,
 		ring_qsize = pool->p.pool_size;
 
 	/* Sanity limit mem that can be pinned down */
-	if (ring_qsize > 32768)
+	if (ring_qsize > PAGE_POOL_SIZE_LIMIT)
 		return -E2BIG;
 
 	/* DMA direction is either DMA_FROM_DEVICE or DMA_BIDIRECTIONAL.
-- 
2.31.1


  reply	other threads:[~2025-09-22  9:19 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-22  9:18 [PATCH net-next 0/2] net: page_pool: Expose size limit Tariq Toukan
2025-09-22  9:18 ` Tariq Toukan [this message]
2025-10-24  9:11   ` [PATCH net-next 1/2] net: page_pool: Expose internal limit Ilias Apalodimas
2025-09-22  9:18 ` [PATCH net-next 2/2] net/mlx5e: Clamp page_pool size to max Tariq Toukan
2025-09-23 13:10   ` Simon Horman
2025-09-23 14:23   ` Jakub Kicinski
2025-09-23 15:12     ` Dragos Tatulea
2025-09-23 15:23       ` Jakub Kicinski
2025-09-24  0:23         ` Jakub Kicinski
2025-09-25 10:25           ` Dragos Tatulea
2025-09-25 15:03             ` Jakub Kicinski
2025-09-22 10:04 ` [PATCH net-next 0/2] net: page_pool: Expose size limit Dawid Osuchowski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1758532715-820422-2-git-send-email-tariqt@nvidia.com \
    --to=tariqt@nvidia.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=dtatulea@nvidia.com \
    --cc=edumazet@google.com \
    --cc=gal@nvidia.com \
    --cc=hawk@kernel.org \
    --cc=ilias.apalodimas@linaro.org \
    --cc=kuba@kernel.org \
    --cc=leon@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=mbloch@nvidia.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=saeedm@nvidia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®