On 11/16/26 23:27, Jakub Kicinski wrote: [...]
> > The question is _why_ you use it. Let's leave the cpumap case aside, > you provided no legitimate reason why having an XDP prog in that case > is a problem. With veth - you are right that attaching XDP causes > problems for pure skb traffic. For veth cases, however, there's no > strong reason to delay the skb allocation. Hence my question. > Why not let the driver allocate the skb if we know that the > redirect target will need to allocate one, anyway. >
The reason is the same for cpumap and veth: we do not just delay the skb allocation, we move it to another CPU. In our RX-pipeline setup, the RX NAPI CPUs are isolated, and we keep their number small. They run the NIC XDP prog (DDoS drop, decap, load balancing), and then XDP_REDIRECT the xdp_frame away. Another CPU allocates the skb and runs the netstack: the cpumap kthread, or the veth NAPI threads. We run veth in threaded NAPI mode in production, and we pin the NAPI threads to CPUs outside the RX set. So an XDP_REDIRECT of an xdp_frame into veth always moves the skb work off the RX CPU. If the driver allocates the skb, the isolated RX CPU does the skb alloc, the receive path, and also the free: TCP and UDP free the skb with skb_attempt_defer_free(), which sends it back to skb->alloc_cpu. Keeping memory allocator work off the RX CPUs is the purpose of redirecting the xdp_frame: - During a DDoS attack, these CPUs must spend their cycles on XDP_DROP. - Page frees from the netstack (for example TCP ACKs that free TX skbs) take the MM zone->lock with IRQs disabled, and stall NAPI behind other CPUs that drain large batches. We see these stalls on RX CPUs in production.
> Since your patches are not a natural / clean extension of the existing > infrastructure - we should step back and make sure the use case is > practically justified.
We found this gap in production testing of our RX-pipeline setup. After the cpumap redirect, the skb on the remote CPU has no RX hash, so GRO cannot spread the flows over its buckets. veth in threaded NAPI mode, which we already run in production, has the same gap. There the lost csum status also makes the netstack verify every checksum in software. In both cases the skb is built from the xdp_frame on a remote CPU, and the RX hash and csum status are lost on the way. On "natural extension": this adds infrastructure that XDP is missing. An XDP prog can change the packet (decap, VLAN), but it cannot tell the kernel which HW offload info it changed. You called the stale csum after a decap "a known bug" [1]. The kernel lists the same gap: the "currently missing" comment in __xdp_build_skb_from_frame(), and the "In the future" note in xdp-rx-metadata.rst. The open question is the API, which I answered in [2]. --Jesper [1] https://lore.kernel.org/all/2026…@kernel.org/ [2] https://lore.kernel.org/all/b3e6…@kernel.org/