This patchset adds support for passing an xdp_md via ctx_in/ctx_out in bpf_attr for BPF_PROG_TEST_RUN of XDP programs. Patch 1 adds initial support for passing XDP meta data in addition to packet data. Patch 2 adds support for also specifying the ingress interface and rx queue. Patch 3 adds selftests to ensure functionality is correct. Changelog: ---------- v1 -> v2 v1: https://lore.kernel.org/bpf/20210524220555.251473-1-zeffron@xxxxxxxxxxxxx * Fix null pointer dereference with no context * Use the BPF skeleton and replace CHECK with ASSERT macros Zvi Effron (3): bpf: support input xdp_md context in BPF_PROG_TEST_RUN bpf: support specifying ingress via xdp_md context in BPF_PROG_TEST_RUN selftests/bpf: Add test for xdp_md context in BPF_PROG_TEST_RUN include/uapi/linux/bpf.h | 3 - net/bpf/test_run.c | 96 +++++++++++++-- .../bpf/prog_tests/xdp_context_test_run.c | 116 ++++++++++++++++++ .../bpf/progs/test_xdp_context_test_run.c | 20 +++ 4 files changed, 225 insertions(+), 10 deletions(-) create mode 100644 tools/testing/selftests/bpf/prog_tests/xdp_context_test_run.c create mode 100644 tools/testing/selftests/bpf/progs/test_xdp_context_test_run.c base-commit: d6a6a55518c16040a369360255b355b7a2a261de -- 2.31.1