From: Dragos Tatulea 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 Signed-off-by: Tariq Toukan --- 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