Thread (7 messages) 7 messages, 4 authors, 2021-02-25

[PATCH bpf-next v3 0/2] Optimize bpf_redirect_map()/xdp_do_redirect()

flat view
STALE2073d SUPERSEDED

From: Björn Töpel <hidden>
Date: 2021-02-21 20:11:00
Also in: bpf
Subsystem: bpf [core], bpf [general] (safe dynamic programs and tools), bpf [networking] (tcx & tc bpf, sock_addr), networking [general], the rest, tracing, xdp (express data path), xdp sockets (af_xdp) · Maintainers: Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko, Eduard Zingerman, Kumar Kartikeya Dwivedi, "David S. Miller", Eric Dumazet, Jakub Kicinski, Paolo Abeni, Linus Torvalds, Steven Rostedt, Masami Hiramatsu, Jesper Dangaard Brouer, John Fastabend, Magnus Karlsson, Maciej Fijalkowski

Status: Superseded by v6 (posted 2021-03-08). [go to v6]

Revision v3 (6 revisions archived).

Revisions (6)
  1. v1
  2. v2 [diff against previous]
  3. v3 current [diff against previous]
  4. v4 [diff against previous]
  5. v5 [diff against previous]
  6. v6 [diff against previous]
Hi XDP-folks,

This two patch series contain two optimizations for the
bpf_redirect_map() helper and the xdp_do_redirect() function.

The bpf_redirect_map() optimization is about avoiding the map lookup
dispatching. Instead of having a switch-statement and selecting the
correct lookup function, we let the verifier patch the
bpf_redirect_map() call to a specific lookup function. This way the
run-time lookup is avoided.

The xdp_do_redirect() patch restructures the code, so that the map
pointer indirection can be avoided.

Performance-wise I got 3% improvement for XSKMAP
(sample:xdpsock/rx-drop), and 4% (sample:xdp_redirect_map) on my
machine.

More details in each commit. Changes since the RFC is outlined in each
commit.


Cheers,
Björn


Björn Töpel (2):
  bpf, xdp: per-map bpf_redirect_map functions for XDP
  bpf, xdp: restructure redirect actions

 include/linux/bpf.h        |  21 ++--
 include/linux/filter.h     |  20 +++-
 include/net/xdp_sock.h     |   6 +-
 include/trace/events/xdp.h |  66 +++++++-----
 kernel/bpf/cpumap.c        |   3 +-
 kernel/bpf/devmap.c        |   5 +-
 kernel/bpf/verifier.c      |  17 ++-
 net/core/filter.c          | 216 ++++++++++++++++++-------------------
 net/xdp/xskmap.c           |   1 -
 9 files changed, 195 insertions(+), 160 deletions(-)


base-commit: 7b1e385c9a488de9291eaaa412146d3972e9dec5
-- 
2.27.0
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help