Toke Høiland-Jørgensen wrote: > From: Toke Høiland-Jørgensen <toke@xxxxxxxxxx> > > Since the bulk queue used by XDP_REDIRECT now lives in struct net_device, > we can re-use the bulking for the non-map version of the bpf_redirect() > helper. This is a simple matter of having xdp_do_redirect_slow() queue the > frame on the bulk queue instead of sending it out with __bpf_tx_xdp(). > > Unfortunately we can't make the bpf_redirect() helper return an error if > the ifindex doesn't exit (as bpf_redirect_map() does), because we don't > have a reference to the network namespace of the ingress device at the time > the helper is called. So we have to leave it as-is and keep the device > lookup in xdp_do_redirect_slow(). > > Since this leaves less reason to have the non-map redirect code in a > separate function, so we get rid of the xdp_do_redirect_slow() function > entirely. This does lose us the tracepoint disambiguation, but fortunately > the xdp_redirect and xdp_redirect_map tracepoints use the same tracepoint > entry structures. This means both can contain a map index, so we can just > amend the tracepoint definitions so we always emit the xdp_redirect(_err) > tracepoints, but with the map ID only populated if a map is present. This > means we retire the xdp_redirect_map(_err) tracepoints entirely, but keep > the definitions around in case someone is still listening for them. > > With this change, the performance of the xdp_redirect sample program goes > from 5Mpps to 8.4Mpps (a 68% increase). > > Signed-off-by: Toke Høiland-Jørgensen <toke@xxxxxxxxxx> Acked-by: John Fastabend <john.fastabend@xxxxxxxxx>