numam-dpdk/lib/bpf/bpf_stub.c
Konstantin Ananyev 65d9b7c664 bpf: fix convert API when libpcap missing
rte_bpf_convert() implementation depends on libpcap.
Right now it is defined only when this library is installed and
RTE_PORT_PCAP is defined.
Fix that by providing for such case stub rte_bpf_convert()
implementation that will always return an error.
To draw user attention, if proper implementation is disabled,
warning will be thrown at meson configure stage.
Also move stub for another function (rte_bpf_elf_load) into
the same place (bpf_stub.c).

Fixes: 2eccf6afbea9 ("bpf: add function to convert classic BPF to DPDK BPF")

Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
2021-11-04 19:56:20 +01:00

46 lines
905 B
C

/* SPDX-License-Identifier: BSD-3-Clause
* Copyright(c) 2018-2021 Intel Corporation
*/
#include "bpf_impl.h"
#include <rte_errno.h>
/**
* Contains stubs for unimplemented public API functions
*/
#ifndef RTE_LIBRTE_BPF_ELF
struct rte_bpf *
rte_bpf_elf_load(const struct rte_bpf_prm *prm, const char *fname,
const char *sname)
{
if (prm == NULL || fname == NULL || sname == NULL) {
rte_errno = EINVAL;
return NULL;
}
RTE_BPF_LOG(ERR, "%s() is not supported with current config\n"
"rebuild with libelf installed\n",
__func__);
rte_errno = ENOTSUP;
return NULL;
}
#endif
#ifndef RTE_PORT_PCAP
struct rte_bpf_prm *
rte_bpf_convert(const struct bpf_program *prog)
{
if (prog == NULL) {
rte_errno = EINVAL;
return NULL;
}
RTE_BPF_LOG(ERR, "%s() is not supported with current config\n"
"rebuild with libpcap installed\n",
__func__);
rte_errno = ENOTSUP;
return NULL;
}
#endif