OSDN Git Service

bpf, xdp: Make bpf_redirect_map() a map operation
authorBjörn Töpel <bjorn.topel@intel.com>
Mon, 8 Mar 2021 11:29:06 +0000 (12:29 +0100)
committerDaniel Borkmann <daniel@iogearbox.net>
Wed, 10 Mar 2021 00:06:34 +0000 (01:06 +0100)
commite6a4750ffe9d701c4d55212b14b615e63571d235
tree0e807fb18dde8e4d6c7eb0495f25be9183bfdb2c
parent11d39cfeecfc9d92a5faa2a55c228e796478e0cb
bpf, xdp: Make bpf_redirect_map() a map operation

Currently the bpf_redirect_map() implementation dispatches to the
correct map-lookup function via a switch-statement. To avoid the
dispatching, this change adds bpf_redirect_map() as a map
operation. Each map provides its bpf_redirect_map() version, and
correct function is automatically selected by the BPF verifier.

A nice side-effect of the code movement is that the map lookup
functions are now local to the map implementation files, which removes
one additional function call.

Signed-off-by: Björn Töpel <bjorn.topel@intel.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Jesper Dangaard Brouer <brouer@redhat.com>
Acked-by: Toke Høiland-Jørgensen <toke@redhat.com>
Link: https://lore.kernel.org/bpf/20210308112907.559576-2-bjorn.topel@gmail.com
include/linux/bpf.h
include/linux/filter.h
include/net/xdp_sock.h
kernel/bpf/cpumap.c
kernel/bpf/devmap.c
kernel/bpf/verifier.c
net/core/filter.c
net/xdp/xskmap.c