Netdev List
 help / color / mirror / Atom feed
From: Usama Arif <usama.arif@linux.dev>
To: michael.chan@broadcom.com, pavan.chebbi@broadcom.com,
	kuba@kernel.org, asml.silence@gmail.com, andrew+netdev@lunn.ch,
	davem@davemloft.net, edumazet@kernel.org, pabeni@redhat.com,
	bjorn@kernel.org, netdev@vger.kernel.org
Cc: Usama Arif <usama.arif@linux.dev>
Subject: [PATCH v2] eth: bnxt: fix the agg page pool recycle ring size
Date: Thu, 26 Nov 2026 10:25:20 -0800	[thread overview]
Message-ID: <20261126182520.3301627-1-usama.arif@linux.dev> (raw)

Commit f7dbedba6312 ("eth: bnxt: take page size into account for page
pool recycling rings") sized the recycle ring of the agg page pool in
pages, dividing the agg ring size by the number of agg buffers per page.
Commit c55bf90a2112 ("eth: bnxt: adjust the fill level of agg queues
with larger buffers") changed the divisor to rx_page_size /
BNXT_RX_PAGE_SIZE, which is wrong in two cases:

- On 64K-page kernels rx_page_size can only be 32K, so the divisor is
  1, although each 64K page holds two agg buffers. With 1024 RX
  descriptors the agg ring posts 2048 buffers in 1024 pages, while the
  recycle ring can cache 2048 pages, or 128 MiB per RX queue.

- When a memory provider sets rx_page_size above PAGE_SIZE, each buffer
  is its own allocation and the fill level is already divided by
  rx_page_size / BNXT_RX_PAGE_SIZE. Dividing again gives a 4K kernel
  with 16K buffers a 256-entry ring for 1024 posted buffers.

Divide the fill level by the number of buffers per allocation,
max(PAGE_SIZE, rx_page_size) / rx_page_size. Nothing changes for
kernels with pages of 32K or less that use the default buffer size.

On a 64K arm64 host with a BCM57508 (32 queues, 1024 RX descriptors), a
TCP receiver that drained its sockets every 1.5 s left about 1.8 GiB
less memory in the agg page pools after the fix, 64 MiB per busy queue.
This NIC's firmware lacks the VNIC RE_FLUSH capability bnxt needs for
the queue API, so memory providers could not be bound. Instead, a
test-only patch forcing rx_page_size to 16K and 32K on one queue of a
4K kernel showed the ring going from 256 and 64 entries to 1024 and
512, matching the buffers posted.

Fixes: c55bf90a2112 ("eth: bnxt: adjust the fill level of agg queues with larger buffers")
Suggested-by: Björn Töpel <bjorn@kernel.org>
Signed-off-by: Usama Arif <usama.arif@linux.dev>
Reviewed-by: Björn Töpel <bjorn@kernel.org>
---
 drivers/net/ethernet/broadcom/bnxt/bnxt.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
index 52606db3f7b4a8..85ce4b2e297ecb 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
@@ -3948,7 +3948,8 @@ static int bnxt_alloc_rx_page_pool(struct bnxt *bp,
 				   struct bnxt_rx_ring_info *rxr,
 				   int numa_node)
 {
-	unsigned int agg_size_fac = rxr->rx_page_size / BNXT_RX_PAGE_SIZE;
+	unsigned int agg_size_fac = max(PAGE_SIZE, rxr->rx_page_size) /
+				    rxr->rx_page_size;
 	const unsigned int rx_size_fac = PAGE_SIZE / SZ_4K;
 	struct page_pool_params pp = { 0 };
 	struct page_pool *pool;
-- 
2.53.1-Meta


                 reply	other threads:[~2026-11-26 18:25 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20261126182520.3301627-1-usama.arif@linux.dev \
    --to=usama.arif@linux.dev \
    --cc=andrew+netdev@lunn.ch \
    --cc=asml.silence@gmail.com \
    --cc=bjorn@kernel.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=kuba@kernel.org \
    --cc=michael.chan@broadcom.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=pavan.chebbi@broadcom.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