2019-04-04 08:51:13 +00:00
|
|
|
# SPDX-License-Identifier: BSD-3-Clause
|
|
|
|
# Copyright(c) 2019 Intel Corporation
|
|
|
|
|
2020-12-22 00:45:11 +00:00
|
|
|
if is_windows
|
2021-04-20 10:22:25 +00:00
|
|
|
build = false
|
|
|
|
reason = 'not supported on Windows'
|
|
|
|
subdir_done()
|
2020-12-22 00:45:11 +00:00
|
|
|
endif
|
|
|
|
|
2019-04-04 08:51:13 +00:00
|
|
|
sources = files('rte_eth_af_xdp.c')
|
|
|
|
|
2022-10-06 06:26:50 +00:00
|
|
|
libxdp_ver = '>=1.2.2'
|
|
|
|
xdp_dep = dependency('libxdp', version : libxdp_ver, required: false, method: 'pkg-config')
|
2021-01-18 14:29:57 +00:00
|
|
|
bpf_dep = dependency('libbpf', required: false, method: 'pkg-config')
|
2019-04-04 08:51:13 +00:00
|
|
|
if not bpf_dep.found()
|
2021-04-20 10:22:25 +00:00
|
|
|
bpf_dep = cc.find_library('bpf', required: false)
|
2019-04-04 08:51:13 +00:00
|
|
|
endif
|
|
|
|
|
2022-01-28 09:50:29 +00:00
|
|
|
if cc.has_header('linux/if_xdp.h')
|
|
|
|
if xdp_dep.found() and cc.has_header('xdp/xsk.h')
|
2022-10-06 06:26:49 +00:00
|
|
|
cflags += ['-DRTE_NET_AF_XDP_LIBXDP']
|
|
|
|
ext_deps += xdp_dep
|
2022-01-28 09:50:29 +00:00
|
|
|
if bpf_dep.found() and cc.has_header('bpf/bpf.h')
|
|
|
|
ext_deps += bpf_dep
|
|
|
|
else
|
|
|
|
build = false
|
|
|
|
reason = 'missing dependency, libbpf'
|
|
|
|
endif
|
|
|
|
elif bpf_dep.found() and cc.has_header('bpf/xsk.h') and cc.has_header('bpf/bpf.h')
|
|
|
|
# libxdp not found. Rely solely on libbpf for xsk functionality
|
|
|
|
# which is only available in versions <= v0.6.0.
|
|
|
|
bpf_ver_dep = dependency('libbpf', version : '<=0.6.0',
|
|
|
|
required: false, method: 'pkg-config')
|
|
|
|
if bpf_ver_dep.found()
|
|
|
|
ext_deps += bpf_dep
|
|
|
|
else
|
|
|
|
build = false
|
2022-10-06 06:26:50 +00:00
|
|
|
reason = 'missing dependency, "libxdp ' + libxdp_ver + '" or "libbpf <= v0.6.0"'
|
2022-01-28 09:50:29 +00:00
|
|
|
endif
|
|
|
|
else
|
|
|
|
build = false
|
2022-10-06 06:26:50 +00:00
|
|
|
reason = 'missing dependency, "libxdp ' + libxdp_ver + '" and "libbpf"'
|
2021-04-20 10:22:25 +00:00
|
|
|
endif
|
2019-04-04 08:51:13 +00:00
|
|
|
else
|
2021-04-20 10:22:25 +00:00
|
|
|
build = false
|
2022-01-28 09:50:29 +00:00
|
|
|
reason = 'missing header, "linux/if_xdp.h"'
|
2019-04-04 08:51:13 +00:00
|
|
|
endif
|
2022-10-06 06:26:51 +00:00
|
|
|
|
|
|
|
if build
|
|
|
|
xsk_check_prefix = '''
|
|
|
|
#ifdef RTE_NET_AF_XDP_LIBXDP
|
|
|
|
#include <xdp/xsk.h>
|
|
|
|
#else
|
|
|
|
#include <bpf/xsk.h>
|
|
|
|
#endif
|
|
|
|
'''
|
|
|
|
|
|
|
|
if cc.has_function('xsk_socket__create_shared', prefix : xsk_check_prefix,
|
|
|
|
dependencies : ext_deps)
|
|
|
|
cflags += ['-DRTE_NET_AF_XDP_SHARED_UMEM']
|
|
|
|
endif
|
2022-10-06 06:26:52 +00:00
|
|
|
if cc.has_function('bpf_object__next_program',
|
|
|
|
prefix : '#include <bpf/libbpf.h>',
|
|
|
|
dependencies : bpf_dep)
|
|
|
|
cflags += ['-DRTE_NET_AF_XDP_LIBBPF_OBJ_OPEN']
|
|
|
|
endif
|
2022-10-06 06:26:54 +00:00
|
|
|
if cc.has_function('bpf_xdp_attach',
|
|
|
|
prefix : '#include <bpf/libbpf.h>',
|
|
|
|
dependencies : bpf_dep)
|
|
|
|
cflags += ['-DRTE_NET_AF_XDP_LIBBPF_XDP_ATTACH']
|
|
|
|
endif
|
2022-10-06 06:26:51 +00:00
|
|
|
endif
|
2022-10-07 21:02:11 +00:00
|
|
|
|
|
|
|
pmd_supports_disable_iova_as_pa = true
|