Hello, This set contains fixes for libbpf's AF_XDP support. For patches 1-3 please have a look at commit messages, 4th patch needs a bit more discussion.
Patch 4 tries to address the issue of dangling xsksocks in case when there were many instances of those running on a particular interface and one of them got removed. The case is that we don't keep an information about how many entries are currently used in eBPF maps, so there's a need for having an external counter, or we could just be traversing the map via bpf_map_get_next_key/bpf_map_lookup_elem syscall combination, but IMHO that's a no-go since the maps used in libbpf's xsk get preallocated entries. The count of entries is equal to number of HW queues present on a working interface, which means many unnecessary operations as CPUs are getting more and more cores and normally NICs are allocating HW queue per CPU core. For xsk counter we could have for example additional entry in qidconf_map, but that map is removed in Jonathan's patches, so that's not an option. The resolution I gave a shot is to have a pinned map with a single entry. Further reasoning is included in commit message of fourth patch. Thanks! Maciej Fijalkowski (4): libbpf: fill the AF_XDP fill queue before bind() call libbpf: check for channels.max_{t,r}x in xsk_get_max_queues libbpf: move xdp program removal to libbpf libbpf: don't remove eBPF resources when other xsks are present samples/bpf/xdpsock_user.c | 48 ++++-------------- tools/lib/bpf/xsk.c | 124 +++++++++++++++++++++++++++++++++++++++------ tools/lib/bpf/xsk.h | 1 + 3 files changed, 120 insertions(+), 53 deletions(-) -- 2.16.1