When I try to attach a BPF program in XDP offload mode, I get Invalid argument. I get the same error if attach through code or by using bpftool. Here's how I'm attaching using netlink:
err = netlink.LinkSetXdpFdWithFlags(link, objects.CollectIpsProg.FD(), 8)
And from using bpftool:
# bpftool prog loadall collect_ips.o /sys/fs/bpf/collect_ips type xdp
# bpftool net attach xdpoffload id 106 dev public
Error: interface xdpoffload attach failed: Invalid argument
I don't have any issues loading the program in driver mode, where 4 is passed to LinkSetXdpFdWithFlags.
My NIC, Mellanox MT28800 Family [ConnectX-5 Ex], should support HW offload.
My main XDP program makes calls to two different tail programs. I use BPF_MAP_TYPE_RINGBUF, BPF_MAP_TYPE_PROG_ARRAY, and BPF_MAP_TYPE_ARRAY.