Björn Töpel <bjorn.topel@xxxxxxxxx> writes: > From: Björn Töpel <bjorn.topel@xxxxxxxxx> > > In commit 43e74c0267a3 ("bpf_xdp_redirect_map: Perform map lookup in > eBPF helper") the bpf_redirect_map() helper learned to do map lookup, > which means that the explicit lookup in the XDP program for AF_XDP is > not needed. > > This commit removes the map lookup, which simplifies the BPF code and > improves the performance for the "rx_drop" [1] scenario with ~4%. Nice, 4% is pretty good! I wonder if the program needs to be backwards-compatible (with pre-5.3 kernels), though? You can do that by something like this: ret = bpf_redirect_map(&xsks_map, index, XDP_PASS); if (ret > 0) return ret; if (bpf_map_lookup_elem(&xsks_map, &index)) return bpf_redirect_map(&xsks_map, index, 0); return XDP_PASS; This works because bpf_redirect_map() prior to 43e74c0267a3 will return XDP_ABORTED on a non-0 flags value. -Toke