1 # SPDX-License-Identifier: BSD-3-Clause
2 # Copyright(c) 2019 Intel Corporation
6 reason = 'not supported on Windows'
10 sources = files('rte_eth_af_xdp.c')
12 xdp_dep = dependency('libxdp', version : '>=1.2.2', required: false, method: 'pkg-config')
13 bpf_dep = dependency('libbpf', required: false, method: 'pkg-config')
14 if not bpf_dep.found()
15 bpf_dep = cc.find_library('bpf', required: false)
18 if cc.has_header('linux/if_xdp.h')
19 if xdp_dep.found() and cc.has_header('xdp/xsk.h')
20 if bpf_dep.found() and cc.has_header('bpf/bpf.h')
21 cflags += ['-DRTE_NET_AF_XDP_LIBXDP']
22 cflags += ['-DRTE_NET_AF_XDP_SHARED_UMEM']
27 reason = 'missing dependency, libbpf'
29 elif bpf_dep.found() and cc.has_header('bpf/xsk.h') and cc.has_header('bpf/bpf.h')
30 # libxdp not found. Rely solely on libbpf for xsk functionality
31 # which is only available in versions <= v0.6.0.
32 bpf_ver_dep = dependency('libbpf', version : '<=0.6.0',
33 required: false, method: 'pkg-config')
34 if bpf_ver_dep.found()
36 bpf_shumem_ver_dep = dependency('libbpf', version : '>=0.2.0',
37 required: false, method: 'pkg-config')
38 if bpf_shumem_ver_dep.found()
39 cflags += ['-DRTE_NET_AF_XDP_SHARED_UMEM']
43 reason = 'missing dependency, "libxdp" or "libbpf <= v0.6.0"'
47 reason = 'missing dependency, "libxdp" and "libbpf"'
51 reason = 'missing header, "linux/if_xdp.h"'