Subject: [net-next 09/15] net/mlx5e: RX, Log error when page_pool size is too large

From: Saeed Mahameed <[email-masked]>
Date: Tue, 6 Jun 2023 00:12:13 -0700

From: Dragos Tatulea <[email-masked]>

The page_pool error message is a bit cryptic when the
requested size is too large. Add a message on the driver
side to display how many pages were actually requested.

Signed-off-by: Dragos Tatulea <[email-masked]>
Reviewed-by: Tariq Toukan <[email-masked]>
Signed-off-by: Saeed Mahameed <[email-masked]>
---
 drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
index a7c526ee5024..579eb8cd928e 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
@@ -849,6 +849,9 @@ static int mlx5e_alloc_rq(struct mlx5e_params *params,
 		rq->page_pool = page_pool_create(&pp_params);
 		if (IS_ERR(rq->page_pool)) {
 			err = PTR_ERR(rq->page_pool);
+			if (err == -E2BIG)
+				mlx5_core_err(mdev, "requested page_pool size is too large: %u",
+					      pp_params.pool_size);
 			rq->page_pool = NULL;
 			goto err_free_by_rq_type;
 		}
-- 
2.40.1