On Mon, 16 Nov 2026 23:55:42 +0000 Tianyi Gao wrote:
> On Mon, 16 Nov 2026 14:27:10 -0800 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.  
> 
> Sorry for not being clear enough.
> 
> On the setup we want to build: an XDP program on the NIC does the
> decap for all traffic. The services run in namespaces, so the packets
> must be delivered into them. Some services attach their own XDP
> program to the veth, and some do not. The host does not control the
> service's program.

The host doesn't have to control the program, just know whether the
program will be attached, and therefore whether to use TC or XDP.

> For a veth with a program, the skb path has the problems you mention,
> so the host uses XDP_REDIRECT. For a veth without a program, we want
> to use XDP_REDIRECT too, so that the host delivers to every namespace
> in the same way.
> 
> In a minimal benchmark, pktgen sends UDP, and perf stat counts the
> cycles on the RX CPU. bpf_redirect_peer() from tc costs 3% more
> cycles per packet than XDP_REDIRECT with the checksum status kept
> (mlx5, one extra __netif_receive_skb_core()). So one XDP_REDIRECT path
> for all namespaces is both simpler and cheaper.

That's noise.

> > 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.  
> 
> Maybe I am missing something here. XDP_REDIRECT into a veth works
> without an XDP program on the veth. To me, it is natural that the RX
> metadata also reaches the skb on that path, without attaching an extra
> XDP program.

Sure, nobody is arguing whether in an ideal world the metadata would 
be magically available everywhere.

Inventing a new way of storing metadata (either in this set or Alexei's
simpler proposal) doesn't integrate naturally with HW drivers.
And duplicates the information. Fast packet processing at HW drivers is
the primary use case for XDP, we should keep that front of mind when
designing.

You want to cross from XDP realm to skb realm, after frame left the
scope of the original driver, and with no BPF involvement.
These constraints are unreasonable, and leave only clumsy and
inflexible solution on the table.

Reply via email to