This work adds a BPF programmable device which can operate in L3 or L2 mode where the BPF program is part of the xmit routine. It's program management is done via bpf_mprog and it comes with BPF link support. For details see patch 1 and following. Thanks! Daniel Borkmann (8): meta, bpf: Add bpf programmable meta device meta, bpf: Add bpf link support for meta device tools: Sync if_link uapi header libbpf: Add link-based API for meta bpftool: Implement link show support for meta bpftool: Extend net dump with meta progs selftests/bpf: Add netlink helper library selftests/bpf: Add selftests for meta MAINTAINERS | 9 + drivers/net/Kconfig | 9 + drivers/net/Makefile | 1 + drivers/net/meta.c | 943 ++++++++++++++++++ include/linux/netdevice.h | 2 + include/net/meta.h | 38 + include/uapi/linux/bpf.h | 13 + include/uapi/linux/if_link.h | 25 + kernel/bpf/syscall.c | 30 +- .../bpf/bpftool/Documentation/bpftool-net.rst | 8 +- tools/bpf/bpftool/link.c | 7 + tools/bpf/bpftool/net.c | 7 +- tools/include/uapi/linux/bpf.h | 13 + tools/include/uapi/linux/if_link.h | 142 +++ tools/lib/bpf/bpf.c | 16 + tools/lib/bpf/bpf.h | 5 + tools/lib/bpf/libbpf.c | 61 +- tools/lib/bpf/libbpf.h | 15 + tools/lib/bpf/libbpf.map | 1 + tools/testing/selftests/bpf/Makefile | 19 +- tools/testing/selftests/bpf/config | 1 + tools/testing/selftests/bpf/netlink_helpers.c | 358 +++++++ tools/testing/selftests/bpf/netlink_helpers.h | 46 + .../selftests/bpf/prog_tests/tc_helpers.h | 4 + .../selftests/bpf/prog_tests/tc_meta.c | 650 ++++++++++++ .../selftests/bpf/progs/test_tc_link.c | 13 + 26 files changed, 2415 insertions(+), 21 deletions(-) create mode 100644 drivers/net/meta.c create mode 100644 include/net/meta.h create mode 100644 tools/testing/selftests/bpf/netlink_helpers.c create mode 100644 tools/testing/selftests/bpf/netlink_helpers.h create mode 100644 tools/testing/selftests/bpf/prog_tests/tc_meta.c -- 2.34.1