net/af_xdp: move XDP library presence flag setting

RTE_NET_AF_XDP_LIBXDP is a conditional to include xdp/xsk.h and should
be set as soon as we know that the header is present.
RTE_NET_AF_XDP_SHARED_UMEM is one of conditions to use
xsk_socket__create_shared().
Both do not depend on libbpf and bpf/bpf.h presence.

Since else branch below returns error, there is no functional changes,
just style which will help on further rework.

Signed-off-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Reviewed-by: Ferruh Yigit <ferruh.yigit@xilinx.com>
This commit is contained in:
Andrew Rybchenko 2022-10-06 09:26:49 +03:00 committed by Ferruh Yigit
parent 0bf99a02cc
commit 50b855fc47

View File

@ -17,10 +17,10 @@ endif
if cc.has_header('linux/if_xdp.h')
if xdp_dep.found() and cc.has_header('xdp/xsk.h')
cflags += ['-DRTE_NET_AF_XDP_LIBXDP']
cflags += ['-DRTE_NET_AF_XDP_SHARED_UMEM']
ext_deps += xdp_dep
if bpf_dep.found() and cc.has_header('bpf/bpf.h')
cflags += ['-DRTE_NET_AF_XDP_LIBXDP']
cflags += ['-DRTE_NET_AF_XDP_SHARED_UMEM']
ext_deps += xdp_dep
ext_deps += bpf_dep
bpf_ver_dep = dependency('libbpf', version : '>=0.7.0',
required: false, method: 'pkg-config')