* [PATCH v2] eth: bnxt: fix the agg page pool recycle ring size
@ 2026-11-26 18:25 Usama Arif
2026-11-30 20:17 ` Michael Chan
2026-12-02 4:20 ` patchwork-bot+netdevbpf
0 siblings, 2 replies; 3+ messages in thread
From: Usama Arif @ 2026-11-26 18:25 UTC (permalink / raw)
To: michael.chan, pavan.chebbi, kuba, asml.silence, andrew+netdev,
davem, edumazet, pabeni, bjorn, netdev
Cc: Usama Arif
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
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH v2] eth: bnxt: fix the agg page pool recycle ring size
2026-11-26 18:25 [PATCH v2] eth: bnxt: fix the agg page pool recycle ring size Usama Arif
@ 2026-11-30 20:17 ` Michael Chan
2026-12-02 4:20 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: Michael Chan @ 2026-11-30 20:17 UTC (permalink / raw)
To: Usama Arif
Cc: pavan.chebbi, kuba, asml.silence, andrew+netdev, davem, edumazet,
pabeni, bjorn, netdev
[-- Attachment #1: Type: text/plain, Size: 2212 bytes --]
On Thu, Nov 26, 2026 at 10:25 AM Usama Arif <usama.arif@linux.dev> wrote:
>
> 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>
Looks good. Page pool now sized correctly according to the fill level
of the HW rings. Thanks.
Reviewed-by: Michael Chan <michael.chan@broadcom.com>
[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 5469 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH v2] eth: bnxt: fix the agg page pool recycle ring size
2026-11-26 18:25 [PATCH v2] eth: bnxt: fix the agg page pool recycle ring size Usama Arif
2026-11-30 20:17 ` Michael Chan
@ 2026-12-02 4:20 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2026-12-02 4:20 UTC (permalink / raw)
To: Usama Arif
Cc: michael.chan, pavan.chebbi, kuba, asml.silence, andrew+netdev,
davem, edumazet, pabeni, bjorn, netdev
Hello:
This patch was applied to netdev/net.git (main)
by Willem de Bruijn <willemb@google.com>:
On Thu, 26 Nov 2026 10:25:20 -0800 you wrote:
> 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:
>
> [...]
Here is the summary with links:
- [v2] eth: bnxt: fix the agg page pool recycle ring size
https://git.kernel.org/netdev/net/c/28cfc94e29f5
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-12-02 4:20 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-26 18:25 [PATCH v2] eth: bnxt: fix the agg page pool recycle ring size Usama Arif
2026-11-30 20:17 ` Michael Chan
2026-12-02 4:20 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox