Hi! This set adds support for creating maps on networking devices. BPF is programs+maps, the pure program offload has been around for quite some time, this patchset adds the map part of the equation.
Maps are allocated on the target device from the start. There is no host copy when map is created on the device. Device maps are represented by struct bpf_offloaded_map, regardless of type. Host programs can't access such maps, access is only possible from a program also loaded to the same device and/or via the BPF syscall. Two types of maps are supported - global hash maps and array maps. Offloaded programs are currently only allowed to perform lookups, control plane is responsible for populating the maps. For brevity only infrastructure and basic NFP patches are included. Target device reporting, netdevsim and tests will follow up as well as some further optimizations to the NFP code. Jakub Kicinski (16): bpf: add map_alloc_check callback bpf: array: move checks out of alloc function bpf: hashtab: move attribute validation before allocation bpf: hashtab: move checks out of alloc function bpf: add helper for copying attrs to struct bpf_map bpf: rename bpf_dev_offload -> bpf_prog_offload bpf: offload: factor out netdev checking at allocation time bpf: offload: add map offload infrastructure nfp: hand over to BPF offload app at coarser granularity nfp: bpf: add map data structure nfp: bpf: add basic control channel communication nfp: bpf: implement helpers for FW map ops nfp: bpf: parse function call and map capabilities nfp: bpf: add verification and codegen for map lookups nfp: bpf: add support for reading map memory nfp: bpf: implement bpf map offload drivers/net/ethernet/netronome/nfp/Makefile | 1 + drivers/net/ethernet/netronome/nfp/bpf/cmsg.c | 446 +++++++++++++++++++++ drivers/net/ethernet/netronome/nfp/bpf/fw.h | 103 +++++ drivers/net/ethernet/netronome/nfp/bpf/jit.c | 128 +++++- drivers/net/ethernet/netronome/nfp/bpf/main.c | 65 ++- drivers/net/ethernet/netronome/nfp/bpf/main.h | 100 ++++- drivers/net/ethernet/netronome/nfp/bpf/offload.c | 133 +++++- drivers/net/ethernet/netronome/nfp/bpf/verifier.c | 47 +++ drivers/net/ethernet/netronome/nfp/nfp_app.h | 48 +-- drivers/net/ethernet/netronome/nfp/nfp_net.h | 12 + .../net/ethernet/netronome/nfp/nfp_net_common.c | 17 +- include/linux/bpf.h | 65 ++- include/linux/netdevice.h | 6 + include/uapi/linux/bpf.h | 1 + kernel/bpf/arraymap.c | 47 ++- kernel/bpf/cpumap.c | 8 +- kernel/bpf/devmap.c | 8 +- kernel/bpf/hashtab.c | 103 +++-- kernel/bpf/lpm_trie.c | 7 +- kernel/bpf/offload.c | 225 ++++++++++- kernel/bpf/sockmap.c | 8 +- kernel/bpf/stackmap.c | 6 +- kernel/bpf/syscall.c | 69 +++- kernel/bpf/verifier.c | 7 + tools/include/uapi/linux/bpf.h | 1 + 25 files changed, 1466 insertions(+), 195 deletions(-) create mode 100644 drivers/net/ethernet/netronome/nfp/bpf/cmsg.c -- 2.15.1