xref: /dpdk/lib/bpf/bpf_stub.c (revision d029f35384d0844e9aeb5dbc46fbe1b063d649f7)
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2018-2021 Intel Corporation
3  */
4 
5 #include "bpf_impl.h"
6 #include <rte_errno.h>
7 
8 /**
9  * Contains stubs for unimplemented public API functions
10  */
11 
12 #ifndef RTE_LIBRTE_BPF_ELF
13 struct rte_bpf *
14 rte_bpf_elf_load(const struct rte_bpf_prm *prm, const char *fname,
15 	const char *sname)
16 {
17 	if (prm == NULL || fname == NULL || sname == NULL) {
18 		rte_errno = EINVAL;
19 		return NULL;
20 	}
21 
22 	RTE_BPF_LOG_LINE(ERR, "%s() is not supported, rebuild with libelf installed",
23 		__func__);
24 	rte_errno = ENOTSUP;
25 	return NULL;
26 }
27 #endif
28 
29 #ifndef RTE_HAS_LIBPCAP
30 struct rte_bpf_prm *
31 rte_bpf_convert(const struct bpf_program *prog)
32 {
33 	if (prog == NULL) {
34 		rte_errno = EINVAL;
35 		return NULL;
36 	}
37 
38 	RTE_BPF_LOG_LINE(ERR, "%s() is not supported, rebuild with libpcap installed",
39 		__func__);
40 	rte_errno = ENOTSUP;
41 	return NULL;
42 }
43 #endif
44