On 08/08, Pavel Begunkov wrote:...>> static int bnxt_alloc_rx_page_pool(struct bnxt *bp,
I can add it to be safe, but fwiw it shouldn't happen either waystruct 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?
+
+ pp.pool_size = bnxt_rx_agg_ring_fill_level(bp, rxr) / agg_size_fac;