[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <0eab9112-eedf-4425-9ce9-be0a59191d8d@redhat.com>
Date: Tue, 13 Jan 2026 11:41:27 +0100
From: Paolo Abeni <pabeni@...hat.com>
To: Pavel Begunkov <asml.silence@...il.com>, netdev@...r.kernel.org
Cc: "David S . Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>, Jakub Kicinski <kuba@...nel.org>,
Jonathan Corbet <corbet@....net>, Michael Chan <michael.chan@...adcom.com>,
Pavan Chebbi <pavan.chebbi@...adcom.com>, Andrew Lunn
<andrew+netdev@...n.ch>, Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
Jesper Dangaard Brouer <hawk@...nel.org>,
John Fastabend <john.fastabend@...il.com>,
Joshua Washington <joshwash@...gle.com>,
Harshitha Ramamurthy <hramamurthy@...gle.com>,
Saeed Mahameed <saeedm@...dia.com>, Tariq Toukan <tariqt@...dia.com>,
Mark Bloch <mbloch@...dia.com>, Leon Romanovsky <leon@...nel.org>,
Alexander Duyck <alexanderduyck@...com>,
Ilias Apalodimas <ilias.apalodimas@...aro.org>, Shuah Khan
<shuah@...nel.org>, Willem de Bruijn <willemb@...gle.com>,
Ankit Garg <nktgrg@...gle.com>, Tim Hostetler <thostet@...gle.com>,
Alok Tiwari <alok.a.tiwari@...cle.com>, Ziwei Xiao <ziweixiao@...gle.com>,
John Fraker <jfraker@...gle.com>,
Praveen Kaligineedi <pkaligineedi@...gle.com>,
Mohsin Bashir <mohsin.bashr@...il.com>, Joe Damato <joe@...a.to>,
Mina Almasry <almasrymina@...gle.com>,
Dimitri Daskalakis <dimitri.daskalakis1@...il.com>,
Stanislav Fomichev <sdf@...ichev.me>, Kuniyuki Iwashima <kuniyu@...gle.com>,
Samiullah Khawaja <skhawaja@...gle.com>, Ahmed Zaki <ahmed.zaki@...el.com>,
Alexander Lobakin <aleksander.lobakin@...el.com>, David Wei
<dw@...idwei.uk>, Yue Haibing <yuehaibing@...wei.com>,
Haiyue Wang <haiyuewa@....com>, Jens Axboe <axboe@...nel.dk>,
Simon Horman <horms@...nel.org>, Vishwanath Seshagiri <vishs@...com>,
linux-doc@...r.kernel.org, linux-kernel@...r.kernel.org,
bpf@...r.kernel.org, linux-rdma@...r.kernel.org,
linux-kselftest@...r.kernel.org, dtatulea@...dia.com,
io-uring@...r.kernel.org
Subject: Re: [PATCH net-next v8 6/9] eth: bnxt: adjust the fill level of agg
queues with larger buffers
On 1/13/26 11:27 AM, Paolo Abeni wrote:
> On 1/9/26 12:28 PM, Pavel Begunkov wrote:
>> From: Jakub Kicinski <kuba@...nel.org>
>>
>> The driver tries to provision more agg buffers than header buffers
>> since multiple agg segments can reuse the same header. The calculation
>> / heuristic tries to provide enough pages for 65k of data for each header
>> (or 4 frags per header if the result is too big). This calculation is
>> currently global to the adapter. If we increase the buffer sizes 8x
>> we don't want 8x the amount of memory sitting on the rings.
>> Luckily we don't have to fill the rings completely, adjust
>> the fill level dynamically in case particular queue has buffers
>> larger than the global size.
>>
>> Signed-off-by: Jakub Kicinski <kuba@...nel.org>
>> [pavel: rebase on top of agg_size_fac, assert agg_size_fac]
>> Signed-off-by: Pavel Begunkov <asml.silence@...il.com>
>> ---
>> drivers/net/ethernet/broadcom/bnxt/bnxt.c | 28 +++++++++++++++++++----
>> 1 file changed, 24 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
>> index 8f42885a7c86..137e348d2b9c 100644
>> --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c
>> +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
>> @@ -3816,16 +3816,34 @@ static void bnxt_free_rx_rings(struct bnxt *bp)
>> }
>> }
>>
>> +static int bnxt_rx_agg_ring_fill_level(struct bnxt *bp,
>> + struct bnxt_rx_ring_info *rxr)
>> +{
>> + /* User may have chosen larger than default rx_page_size,
>> + * we keep the ring sizes uniform and also want uniform amount
>> + * of bytes consumed per ring, so cap how much of the rings we fill.
>> + */
>> + int fill_level = bp->rx_agg_ring_size;
>> +
>> + if (rxr->rx_page_size > BNXT_RX_PAGE_SIZE)
>> + fill_level /= rxr->rx_page_size / BNXT_RX_PAGE_SIZE;
>
> According to the check in bnxt_alloc_rx_page_pool() it's theoretically
> possible for `rxr->rx_page_size / BNXT_RX_PAGE_SIZE` being zero. If so
> the above would crash.
>
> Side note: this looks like something AI review could/should catch. The
> fact it didn't makes me think I'm missing something...
I see the next patch rejects too small `rx_page_size` values; so
possibly the better option is to drop the confusing check in
bnxt_alloc_rx_page_pool().
/P
Powered by blists - more mailing lists