Re: [RFC v2 17/24] eth: bnxt: adjust the fill level of agg queues with larger buffers

From: Pavel Begunkov
Date: Fri Aug 08 2025 - 17:04:25 EST


On 8/8/25 19:03, Stanislav Fomichev wrote:
On 08/08, Pavel Begunkov wrote:
...>> static int bnxt_alloc_rx_page_pool(struct bnxt *bp,
struct bnxt_rx_ring_info *rxr,
int numa_node)
{
- const unsigned int agg_size_fac = PAGE_SIZE / BNXT_RX_PAGE_SIZE;
+ const unsigned int agg_size_fac = rxr->rx_page_size / BNXT_RX_PAGE_SIZE;
const unsigned int rx_size_fac = PAGE_SIZE / SZ_4K;
struct page_pool_params pp = { 0 };
struct page_pool *pool;
- pp.pool_size = bp->rx_agg_ring_size / agg_size_fac;

[..]

+ WARN_ON_ONCE(agg_size_fac == 0);

nit: do we need to make this if (WARN_ON_ONCE(...)) agg_size_fac = 1?
Otherwise you're gonna divide by zero on the next line. Or properly
return some EINVAL instead?
I can add it to be safe, but fwiw it shouldn't happen either way


+
+ pp.pool_size = bnxt_rx_agg_ring_fill_level(bp, rxr) / agg_size_fac;

--
Pavel Begunkov