> On Tue, 28 Nov 2023 18:29:20 +0100 Lorenzo Bianconi wrote: > > @Jakub: iirc we were discussing something similar for veth [0]. > > Here pskb_expand_head() reallocates skb paged data (skb_shinfo()->frags[]) > > just if the skb is cloned and if it is zero-copied [1] while in skb_cow_data() > > we always reallocate the paged area if skb_shinfo()->nr_frags is set [2]. > > Since the eBPF program can theoretically modify paged data, I would say we > > should do the same we did for veth even here, right? > > Yes, don't we allow writes to fragments in XDP based on the assumption > that it runs on Rx so that paged data must not be zero copy? > bpf_xdp_store_bytes() doesn't seem to have any checks which would > stop it from writing fragments, as far as I can see. do you mean in the skb use-case we could write to fragments (without copying them) if the skb is not cloned and the paged area is not 'zero-copied'? With respect to this patch it would mean we can rely on pskb_expand_head() to reallocate the skb and to covert it to a xdp_buff and we do not need to explicitly reallocate fragments as we currently do for veth in veth_convert_skb_to_xdp_buff() [0]. Is my understanding correct or am I missing something? Regards, Lorenzo [0] https://elixir.bootlin.com/linux/v6.6.2/source/drivers/net/veth.c#L738 > > I don't see how we can ever correctly support this form of mbuf for veth > or generic XDP :(
Attachment:
signature.asc
Description: PGP signature