Re: [PATCH net-next v1 11/11] eth: fbnic: Support AF_XDP page pool zero copy
From: Björn Töpel
Date: Tue Nov 17 2026 - 12:14:17 EST
Dimitri Daskalakis <dimitri.daskalakis1@xxxxxxxxx> writes:
> On 11/10/26 2:20 AM, Björn Töpel wrote:
>> Header and payload rings share one provider page pool, so refills even
>> them out, and a short pool does not starve one of them. Payload
>> buffers start at chunk offset 0, and the UMEM headroom rules require
>> headroom only in the first buffer. A chunk is one 4 KiB device page,
>> also with larger kernel pages, so rings fed by the provider post one
>> descriptor per chunk.
>>
> [...]
>> qt->sub0.page_pool = pp;
>> + fbnic_bdq_set_page_size(&qt->sub0, xsk ? rx_page_size : PAGE_SIZE);
>> qt->hdr_max = 0;
>> if (!page_pool_supports_frag(pp))
>> - qt->hdr_max = fbnic_whole_hdr_max(FBNIC_RX_HROOM);
>> + qt->hdr_max = fbnic_whole_hdr_max(qt->rx_hroom);
>> if (netif_rxq_has_unreadable_mp(fbn->netdev, rxq_idx)) {
>> pp_params.order = get_order(rx_page_size);
>> pp_params.max_len = rx_page_size;
>> pp_params.flags |= PP_FLAG_ALLOW_UNREADABLE_NETMEM;
>> pp_params.dma_dir = DMA_FROM_DEVICE;
>>
>> + pp = page_pool_create(&pp_params);
>> + if (IS_ERR(pp))
>> + goto err_destroy_sub0;
>> + } else if (xsk && !xsk_pool_uses_sg(xsk)) {
>> + pp_params.flags &= ~PP_FLAG_MEM_PROVIDER;
>> + pp_params.rx_roles = 0;
>> + pp_params.max_len = PAGE_SIZE;
>> + rx_page_size = PAGE_SIZE;
>> +
>> pp = page_pool_create(&pp_params);
>> if (IS_ERR(pp))
>> goto err_destroy_sub0;
>
> Maybe I'm misunderstanding, but why is it necessary to create a new page pool for
> sub1 if !sg? All frames should be sent to sub0, and the buffers in sub1 should sit idle.
(BTW, the reply to your other mail didn't show up on lore for some
reason, but I hope you got it! If not, holler!)
You're right, it is not needed. I'll fix this in the next version. Every
frame fits in one chunk on the header ring, and the device drops bigger
frames. With SG, both rings share one pool.
I first tried sharing the pool for non-SG too. But then up to 255 chunks
sit unused in the payload ring :P
Björn