Re: [PATCH net-next v1 01/11] net: Get skb fragment addresses through netmem

From: Björn Töpel

Date: Thu Nov 12 2026 - 09:07:46 EST


saeed bishara <saeed.bishara.os@xxxxxxxxx> writes:

> On Tue, Nov 10, 2026 at 12:27 PM Björn Töpel <bjorn@xxxxxxxxxx> wrote:
>>
>> skb_frag_address() goes through struct page, so a net_iov never has an
>> address. Only unreadable memory should lack one: XDP and BPF read
>> fragments through this helper, and AF_XDP UMEM will back readable
>> net_iovs. netmem_address() also returns NULL, not a bogus pointer, for
>> an unmapped highmem page.
> Does this mean that skb_frag_address_safe() is practically identical
> to skb_frag_address()? I assume highmem page is the only case where
> non niov page isn't mapped.

Yes to both. With this patch they're the same, so I'll have
skb_frag_address_safe() call skb_frag_address() instead of keeping a
copy. Its callers can move over separately.

>> *
>> - * Returns: the address of the data within @frag. The page must already
>> - * be mapped.
>> + * Returns: the address of the data within @frag, or %NULL if the CPU cannot
>> + * read it.
> "CPU cannot read" isn't accurate, I assume that in iouring case the
> buffer is mapped to userspace.

I'll use the netmem.rst term: "%NULL for unreadable netmem or an
unmapped highmem page". Same for netmem_address() in patch 4 and
MP_CAP_READABLE in patch 2.


Björn