libbpf: remove dependency on barrier.h in xsk.h
authorMagnus Karlsson <magnus.karlsson@intel.com>
Tue, 16 Apr 2019 12:58:11 +0000 (14:58 +0200)
committerAlexei Starovoitov <ast@kernel.org>
Wed, 17 Apr 2019 03:13:10 +0000 (20:13 -0700)
commitb7e3a28019c92ffe1f55de278c5641de33b6259a
tree5182b3b6a640803c871995f07040247bd3d6f4b0
parenta06d729646e87afc5ce06e539aecf762cc26c6e3
libbpf: remove dependency on barrier.h in xsk.h

The use of smp_rmb() and smp_wmb() creates a Linux header dependency
on barrier.h that is unnecessary in most parts. This patch implements
the two small defines that are needed from barrier.h. As a bonus, the
new implementations are faster than the default ones as they default
to sfence and lfence for x86, while we only need a compiler barrier in
our case. Just as it is when the same ring access code is compiled in
the kernel.

Fixes: 1cad07884239 ("libbpf: add support for using AF_XDP sockets")
Signed-off-by: Magnus Karlsson <magnus.karlsson@intel.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
tools/lib/bpf/libbpf_util.h
tools/lib/bpf/xsk.h