Subject: Re: [PATCH v4 bpf 1/2] xdp: introduce xdp_convert_skb_to_buff()

From: Jakub Kicinski <[email-masked]>
Date: Wed, 29 Oct 2025 16:12:18 -0700

On Wed, 29 Oct 2025 12:26:50 +0100 Maciej Fijalkowski wrote:
> > I still think _all_ frags which may end up here are from the per CPU PP
> > since we CoW the skbs. So:  
> 
> Agree!
> 
> > 
> > 	DEBUG_NET_WARN_ON_ONCE(!skb->pp_recycle);
> > 	xdp->rxq->mem.type = MEM_TYPE_PAGE_POOL;  
> 
> This has to be conditional as it is fine to use this helper for
> MEM_TYPE_PAGE_SHARED, plus the mem type has to be updated per packet.
> 
> > ? It is legal to have pp and non-pp frags in a single skb AFAIK.  
> 
> Ok, but not in this case where data origins from CoW path.

Right.

I guess what I'm saying is that right now we have 4 callers:
 - XDP generic
 - veth
 - devmap 
 - cpumap
these all go thru skb_pp_cow_data() if skb has frags.

You're right that in theory someone can call this function
on a private skb they just constructed (IOW they know they 
don't need to CoW). But IIUC (1) such caller doesn't exist
today; (2) why wouldn't that caller run XDP before allocating
the skb..

So my thinking was to keep this simple for now, used fixed
MEM_TYPE_PAGE_POOL. Add that DEBUG_WARN() and in the kdoc
say that we expect the skbs to have gone thru skb_pp_cow_data().

Worry about conditionals when the odd new user appears.