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
Showing
- include/linux/bpf.h 6 additions, 20 deletionsinclude/linux/bpf.h
- include/linux/filter.h 27 additions, 0 deletionsinclude/linux/filter.h
- include/net/xdp_sock.h 0 additions, 19 deletionsinclude/net/xdp_sock.h
- kernel/bpf/cpumap.c 7 additions, 1 deletionkernel/bpf/cpumap.c
- kernel/bpf/devmap.c 14 additions, 2 deletionskernel/bpf/devmap.c
- kernel/bpf/verifier.c 11 additions, 2 deletionskernel/bpf/verifier.c
- net/core/filter.c 1 addition, 38 deletionsnet/core/filter.c
- net/xdp/xskmap.c 16 additions, 0 deletionsnet/xdp/xskmap.c
Loading
Please register or sign in to comment