OSDN Git Service

Merge branch 'bpf-xdp-redirect'
authorDaniel Borkmann <daniel@iogearbox.net>
Wed, 10 Mar 2021 00:06:34 +0000 (01:06 +0100)
committerDaniel Borkmann <daniel@iogearbox.net>
Wed, 10 Mar 2021 00:07:21 +0000 (01:07 +0100)
commit32f91529e2bdbe0d92edb3ced41dfba4beffa84a
tree2e6ca2aa0d6d1ac694002dd4aff11915473d4118
parent11d39cfeecfc9d92a5faa2a55c228e796478e0cb
parentee75aef23afe6e88497151c127c13ed69f41aaa2
Merge branch 'bpf-xdp-redirect'

Björn Töpel says:

====================
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 bpf_redirect_map() be a map operation,
where each map has its own bpf_redirect_map() implementation. 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 4% improvement for XSKMAP
(sample:xdpsock/rx-drop), and 8% (sample:xdp_redirect_map) on my
machine.

v5->v6:  Removed REDIR enum, and instead use map_id and map_type. (Daniel)
         Applied Daniel's fixups on patch 1. (Daniel)
v4->v5:  Renamed map operation to map_redirect. (Daniel)
v3->v4:  Made bpf_redirect_map() a map operation. (Daniel)
v2->v3:  Fix build when CONFIG_NET is not set. (lkp)
v1->v2:  Removed warning when CONFIG_BPF_SYSCALL was not set. (lkp)
         Cleaned up case-clause in xdp_do_generic_redirect_map(). (Toke)
         Re-added comment. (Toke)
rfc->v1: Use map_id, and remove bpf_clear_redirect_map(). (Toke)
         Get rid of the macro and use __always_inline. (Jesper)
====================

Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>