xref: /dpdk/lib/bpf/bpf_stub.c (revision 09442498ef736d0a96632cf8b8c15d8ca78a6468)
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(ERR, "%s() is not supported with current config\n"
23 		"rebuild with libelf installed\n",
24 		__func__);
25 	rte_errno = ENOTSUP;
26 	return NULL;
27 }
28 #endif
29 
30 #ifndef RTE_HAS_LIBPCAP
31 struct rte_bpf_prm *
32 rte_bpf_convert(const struct bpf_program *prog)
33 {
34 	if (prog == NULL) {
35 		rte_errno = EINVAL;
36 		return NULL;
37 	}
38 
39 	RTE_BPF_LOG(ERR, "%s() is not supported with current config\n"
40 		"rebuild with libpcap installed\n",
41 		__func__);
42 	rte_errno = ENOTSUP;
43 	return NULL;
44 }
45 #endif
46