bpf: add devmap, a map for storing net device references
authorJohn Fastabend <john.fastabend@gmail.com>
Mon, 17 Jul 2017 16:28:56 +0000 (09:28 -0700)
committerDavid S. Miller <davem@davemloft.net>
Mon, 17 Jul 2017 16:48:06 +0000 (09:48 -0700)
commit546ac1ffb70d25b56c1126940e5ec639c4dd7413
treeee72376133d162b6bacd60cc6c061458a76be88c
parent5acaee0a8964c9bab7775ab8bedcd1f66a2a1011
bpf: add devmap, a map for storing net device references

Device map (devmap) is a BPF map, primarily useful for networking
applications, that uses a key to lookup a reference to a netdevice.

The map provides a clean way for BPF programs to build virtual port
to physical port maps. Additionally, it provides a scoping function
for the redirect action itself allowing multiple optimizations. Future
patches will leverage the map to provide batching at the XDP layer.

Another optimization/feature, that is not yet implemented, would be
to support multiple netdevices per key to support efficient multicast
and broadcast support.

Signed-off-by: John Fastabend <john.fastabend@gmail.com>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Jesper Dangaard Brouer <brouer@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/linux/bpf_types.h
include/uapi/linux/bpf.h
kernel/bpf/Makefile
kernel/bpf/devmap.c [new file with mode: 0644]
kernel/bpf/verifier.c
tools/testing/selftests/bpf/test_maps.c