OSDN Git Service

bpf: offload: aggregate offloads per-device
authorJakub Kicinski <jakub.kicinski@netronome.com>
Tue, 17 Jul 2018 17:53:24 +0000 (10:53 -0700)
committerDaniel Borkmann <daniel@iogearbox.net>
Wed, 18 Jul 2018 13:10:34 +0000 (15:10 +0200)
commit9fd7c5559165f4c679b40c5e6ad442955832dfad
tree55761dec5147d7099e785412a1d1046853390fc7
parent09728266b6f99ab57cd4f84f3eead65b7b65dbf7
bpf: offload: aggregate offloads per-device

Currently we have two lists of offloaded objects - programs and maps.
Netdevice unregister notifier scans those lists to orphan objects
associated with device being unregistered.  This puts unnecessary
(even if negligible) burden on all netdev unregister calls in BPF-
-enabled kernel.  The lists of objects may potentially get long
making the linear scan even more problematic.  There haven't been
complaints about this mechanisms so far, but it is suboptimal.

Instead of relying on notifiers, make the few BPF-capable drivers
register explicitly for BPF offloads.  The programs and maps will
now be collected per-device not on a global list, and only scanned
for removal when driver unregisters from BPF offloads.

Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: Quentin Monnet <quentin.monnet@netronome.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
drivers/net/ethernet/netronome/nfp/bpf/main.c
drivers/net/netdevsim/bpf.c
include/linux/bpf.h
kernel/bpf/offload.c