[PATCH net-next] page_pool: Clamp ring size to 32K

Ratheesh Kannoth
2023-08-07T03:49:53Z

https://lore.kernel.org/netdev/20230804133512.4dbbbc16@kernel.org/T/
Capping the recycle ring to 32k instead of returning the error.

Suggested-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Ratheesh Kannoth <rkannoth@marvell.com>
---
net/core/page_pool.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/core/page_pool.c b/net/core/page_pool.c
index 5d615a169718..404f835a94be 100644
--- a/net/core/page_pool.c
+++ b/net/core/page_pool.c
@@ -182,9 +182,9 @@ static int page_pool_init(struct page_pool *pool,
if (pool->p.pool_size)
ring_qsize = pool->p.pool_size;

- /* Sanity limit mem that can be pinned down */
+ /* Clamp to 32K */
if (ring_qsize > 32768)
- return -E2BIG;
+ ring_qsize = 32768;

/* DMA direction is either DMA_FROM_DEVICE or DMA_BIDIRECTIONAL.
* DMA_BIDIRECTIONAL is for allowing page used for DMA sending,
--
2.25.1