Re: [PATCH net-next v1 02/11] net: Add memory provider capabilities
From: Björn Töpel
Date: Mon Nov 16 2026 - 09:21:10 EST
Jakub Kicinski <kuba@xxxxxxxxxx> writes:
> On Tue, 10 Nov 2026 11:20:23 +0100 Björn Töpel wrote:
>> diff --git a/include/net/page_pool/memory_provider.h b/include/net/page_pool/memory_provider.h
>> index bceb5f7740e2..4417e54a0f81 100644
>> --- a/include/net/page_pool/memory_provider.h
>> +++ b/include/net/page_pool/memory_provider.h
>> @@ -19,6 +19,18 @@ struct sk_buff;
>> * Per-provider custom logic must be delegated to memory_provider_ops rather
>> * than handled directly in page_pool core code.
>> */
>> +
>> +/**
>> + * enum mp_caps - memory provider capabilities
>> + * @MP_CAP_READABLE: The CPU can access provider memory. It may back header
>> + * page pools, and XDP programs may run on it.
>
> Being readable is the normal state for memory.
> We should be marking mps as unreadable, not as readable?
Fair, I'll flip it. devmem and io_uring zcrx mark themselves unreadable.
The same goes for the other two caps; page memory can be split and kept,
so AF_XDP marks that its buffers can't be.
>> @@ -1070,6 +1095,9 @@ netmem_ref page_pool_alloc_frag_netmem(struct page_pool *pool,
>> unsigned int max_size = PAGE_SIZE << pool->p.order;
>> netmem_ref netmem = pool->frag_page;
>>
>> + if (static_branch_unlikely(&page_pool_mem_providers) &&
>> + WARN_ON_ONCE(!page_pool_supports_frag(pool)))
>> + return 0;
>
> Shouldn't we return a full page if we can't frag?
> Fragmentation breaks up a page into smaller units,
> it should be legal to simply return a full page if
> fragmentation is not supported for the provider.
Yeah, make sense. I'll return the whole buffer at offset 0, instead of
the WARN Stan and I settled on, and page_pool_alloc_netmem() reports the
chunk size for callers that need it for truesize.
Björn