I am fixing the use of TC BPF in DPDK to use libbpf and bpftool. Luca recommended using vmlinux.h to address possible build and CO:RE issues. But it won't work. There are missing pieces such as definitions of IPV6 next header fields (in linux/ipv6.h) and TC actions. Without major hack surgery, not possible to use vmlinux.h instead. Since vmlinux.h defines may things that overlap with other headers. Using: $ /usr/sbin/bpftool -V bpftool v7.3.0 using libbpf v1.3 features: $ uname -r 6.6.15-amd64 The change to BPF program to use vmlinux is: diff --git a/drivers/net/tap/bpf/tap_rss.c b/drivers/net/tap/bpf/tap_rss.c index 888b3bdc24..79f4ee31a1 100644 --- a/drivers/net/tap/bpf/tap_rss.c +++ b/drivers/net/tap/bpf/tap_rss.c @@ -2,12 +2,7 @@ * Copyright 2017 Mellanox Technologies, Ltd */ -#include <linux/in.h> -#include <linux/if_ether.h> -#include <linux/ip.h> -#include <linux/ipv6.h> -#include <linux/pkt_cls.h> -#include <linux/bpf.h> +#include "vmlinux.h" #include <bpf/bpf_helpers.h> #include <bpf/bpf_endian.h> Resulting build failure is: ~/DPDK/tap $ ninja -C build ninja: Entering directory `build' [1/33] Generating drivers/net/tap/bpf/tap_rss.bpf.o with a custom command FAILED: drivers/net/tap/bpf/tap_rss.o /usr/bin/clang -O2 -Wall -Wextra -DTAP_MAX_QUEUES=16 -target bpf -g -c -idirafter /usr/include -idirafter /usr/include/x86_64-linux-gnu ../drivers/net/tap/bpf/tap_rss.c -o drivers/net/tap/bpf/tap_rss.o ../drivers/net/tap/bpf/tap_rss.c:116:8: error: use of undeclared identifier 'IPPROTO_HOPOPTS' case IPPROTO_HOPOPTS: ^ ../drivers/net/tap/bpf/tap_rss.c:117:8: error: use of undeclared identifier 'IPPROTO_ROUTING' case IPPROTO_ROUTING: ^ ../drivers/net/tap/bpf/tap_rss.c:118:8: error: use of undeclared identifier 'IPPROTO_DSTOPTS' case IPPROTO_DSTOPTS: ^ ../drivers/net/tap/bpf/tap_rss.c:126:8: error: use of undeclared identifier 'IPPROTO_FRAGMENT' case IPPROTO_FRAGMENT: ^ ../drivers/net/tap/bpf/tap_rss.c:210:33: error: use of undeclared identifier 'ETH_P_IP' if (skb->protocol == bpf_htons(ETH_P_IP)) ^ ../drivers/net/tap/bpf/tap_rss.c:210:33: error: use of undeclared identifier 'ETH_P_IP' ../drivers/net/tap/bpf/tap_rss.c:210:33: error: use of undeclared identifier 'ETH_P_IP' ../drivers/net/tap/bpf/tap_rss.c:210:33: error: use of undeclared identifier 'ETH_P_IP' ../drivers/net/tap/bpf/tap_rss.c:212:38: error: use of undeclared identifier 'ETH_P_IPV6' else if (skb->protocol == bpf_htons(ETH_P_IPV6)) ^ ../drivers/net/tap/bpf/tap_rss.c:212:38: error: use of undeclared identifier 'ETH_P_IPV6' ../drivers/net/tap/bpf/tap_rss.c:212:38: error: use of undeclared identifier 'ETH_P_IPV6' ../drivers/net/tap/bpf/tap_rss.c:212:38: error: use of undeclared identifier 'ETH_P_IPV6' ../drivers/net/tap/bpf/tap_rss.c:248:10: error: use of undeclared identifier 'TC_ACT_OK' return TC_ACT_OK; ^ ../drivers/net/tap/bpf/tap_rss.c:252:10: error: use of undeclared identifier 'TC_ACT_OK' return TC_ACT_OK; ^ ../drivers/net/tap/bpf/tap_rss.c:256:9: error: use of undeclared identifier 'TC_ACT_PIPE' return TC_ACT_PIPE; ^ 15 errors generated. ninja: build stopped: subcommand failed.