Currently, bpf_sockops programs have been using bpf_load_hdr_opt() to parse the tcp header option. It will be useful to allow other bpf prog types to have a similar way of handling tcp hdr options. This series adds XDP support for bpf_load_hdr_opt(). At a high level, these patches are: 1/3 patch - Add functionality for xdp bpf_load_hdr_opt in net/core. 2/3 patch - Rename existing test_tcp_hdr_options to test_sockops_tcp_hdr_options. 3/3 patch - Add tests for xdp bpf_load_hdr_opt (test_xdp_tcp_hdr_options). v1 -> v2: * 1/3 - Change "(flags & 0xffffffffffff)" to (flags & ((1ULL << BPF_LOAD_HDR_OPT_TCP_OFFSET_SHIFT) - 1)) * 3/3 - Skip check_opt_out on failures * 3/3 - Change CHECKs to ASSERTs Joanne Koong (3): bpf/xdp: Add bpf_load_hdr_opt support for xdp bpf/selftests: Rename test_tcp_hdr_options to test_sockops_tcp_hdr_options bpf/selftests: Add xdp bpf_load_tcp_hdr_options tests include/uapi/linux/bpf.h | 26 ++- net/core/filter.c | 88 ++++++-- tools/include/uapi/linux/bpf.h | 26 ++- ...dr_options.c => sockops_tcp_hdr_options.c} | 18 +- .../bpf/prog_tests/xdp_tcp_hdr_options.c | 144 +++++++++++++ ....c => test_sockops_misc_tcp_hdr_options.c} | 0 ...tions.c => test_sockops_tcp_hdr_options.c} | 0 .../bpf/progs/test_xdp_tcp_hdr_options.c | 198 ++++++++++++++++++ 8 files changed, 454 insertions(+), 46 deletions(-) rename tools/testing/selftests/bpf/prog_tests/{tcp_hdr_options.c => sockops_tcp_hdr_options.c} (96%) create mode 100644 tools/testing/selftests/bpf/prog_tests/xdp_tcp_hdr_options.c rename tools/testing/selftests/bpf/progs/{test_misc_tcp_hdr_options.c => test_sockops_misc_tcp_hdr_options.c} (100%) rename tools/testing/selftests/bpf/progs/{test_tcp_hdr_options.c => test_sockops_tcp_hdr_options.c} (100%) create mode 100644 tools/testing/selftests/bpf/progs/test_xdp_tcp_hdr_options.c -- 2.30.2