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']
25 bpf_ver_dep = dependency('libbpf', version : '>=0.7.0',
26 required: false, method: 'pkg-config')
27 if bpf_ver_dep.found()
28 cflags += ['-DRTE_NET_AF_XDP_LIBBPF_OBJ_OPEN']
32 reason = 'missing dependency, libbpf'
34 elif bpf_dep.found() and cc.has_header('bpf/xsk.h') and cc.has_header('bpf/bpf.h')
35 # libxdp not found. Rely solely on libbpf for xsk functionality
36 # which is only available in versions <= v0.6.0.
37 bpf_ver_dep = dependency('libbpf', version : '<=0.6.0',
38 required: false, method: 'pkg-config')
39 if bpf_ver_dep.found()
41 bpf_shumem_ver_dep = dependency('libbpf', version : '>=0.2.0',
42 required: false, method: 'pkg-config')
43 if bpf_shumem_ver_dep.found()
44 cflags += ['-DRTE_NET_AF_XDP_SHARED_UMEM']
48 reason = 'missing dependency, "libxdp" or "libbpf <= v0.6.0"'
52 reason = 'missing dependency, "libxdp" and "libbpf"'
56 reason = 'missing header, "linux/if_xdp.h"'