DPDK 22.11.5
rte_bpf.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2018 Intel Corporation
3 */
4
5#ifndef _RTE_BPF_H_
6#define _RTE_BPF_H_
7
19#include <rte_compat.h>
20#include <rte_common.h>
21#include <rte_mbuf.h>
22#include <bpf_def.h>
23
24#ifdef __cplusplus
25extern "C" {
26#endif
27
37};
38
43 enum rte_bpf_arg_type type;
48 size_t size;
49 size_t buf_size;
51};
52
56#define RTE_BPF_ARG_PTR_TYPE(x) ((x) & RTE_BPF_ARG_PTR)
57
64};
65
70 const char *name;
72 union {
73 struct {
74 uint64_t (*val)(uint64_t, uint64_t, uint64_t,
75 uint64_t, uint64_t);
76 uint32_t nb_args;
77 struct rte_bpf_arg args[EBPF_FUNC_MAX_ARGS];
80 } func;
81 struct {
82 void *val;
84 } var;
85 };
86};
87
92 const struct ebpf_insn *ins;
93 uint32_t nb_ins;
94 const struct rte_bpf_xsym *xsym;
96 uint32_t nb_xsym;
98};
99
104 uint64_t (*func)(void *);
105 size_t sz;
106};
107
108struct rte_bpf;
109
116void
117rte_bpf_destroy(struct rte_bpf *bpf);
118
131struct rte_bpf *
132rte_bpf_load(const struct rte_bpf_prm *prm);
133
154struct rte_bpf *
155rte_bpf_elf_load(const struct rte_bpf_prm *prm, const char *fname,
156 const char *sname);
167uint64_t
168rte_bpf_exec(const struct rte_bpf *bpf, void *ctx);
169
184uint32_t
185rte_bpf_exec_burst(const struct rte_bpf *bpf, void *ctx[], uint64_t rc[],
186 uint32_t num);
187
199int
200rte_bpf_get_jit(const struct rte_bpf *bpf, struct rte_bpf_jit *jit);
201
212__rte_experimental
213void
214rte_bpf_dump(FILE *f, const struct ebpf_insn *buf, uint32_t len);
215
216struct bpf_program;
217
232__rte_experimental
233struct rte_bpf_prm *
234rte_bpf_convert(const struct bpf_program *prog);
235
236#ifdef __cplusplus
237}
238#endif
239
240#endif /* _RTE_BPF_H_ */
__rte_experimental struct rte_bpf_prm * rte_bpf_convert(const struct bpf_program *prog)
uint64_t rte_bpf_exec(const struct rte_bpf *bpf, void *ctx)
int rte_bpf_get_jit(const struct rte_bpf *bpf, struct rte_bpf_jit *jit)
rte_bpf_xtype
Definition: rte_bpf.h:61
@ RTE_BPF_XTYPE_VAR
Definition: rte_bpf.h:63
@ RTE_BPF_XTYPE_FUNC
Definition: rte_bpf.h:62
struct rte_bpf * rte_bpf_elf_load(const struct rte_bpf_prm *prm, const char *fname, const char *sname)
struct rte_bpf * rte_bpf_load(const struct rte_bpf_prm *prm)
__rte_experimental void rte_bpf_dump(FILE *f, const struct ebpf_insn *buf, uint32_t len)
rte_bpf_arg_type
Definition: rte_bpf.h:31
@ RTE_BPF_ARG_UNDEF
Definition: rte_bpf.h:32
@ RTE_BPF_ARG_PTR_MBUF
Definition: rte_bpf.h:35
@ RTE_BPF_ARG_PTR
Definition: rte_bpf.h:34
@ RTE_BPF_ARG_RAW
Definition: rte_bpf.h:33
@ RTE_BPF_ARG_RESERVED
Definition: rte_bpf.h:36
uint32_t rte_bpf_exec_burst(const struct rte_bpf *bpf, void *ctx[], uint64_t rc[], uint32_t num)
void rte_bpf_destroy(struct rte_bpf *bpf)
size_t size
Definition: rte_bpf.h:48
size_t buf_size
Definition: rte_bpf.h:49
uint64_t(* func)(void *)
Definition: rte_bpf.h:104
size_t sz
Definition: rte_bpf.h:105
struct rte_bpf_arg prog_arg
Definition: rte_bpf.h:97
const struct rte_bpf_xsym * xsym
Definition: rte_bpf.h:94
uint32_t nb_ins
Definition: rte_bpf.h:93
const struct ebpf_insn * ins
Definition: rte_bpf.h:92
uint32_t nb_xsym
Definition: rte_bpf.h:96
struct rte_bpf_arg ret
Definition: rte_bpf.h:79
const char * name
Definition: rte_bpf.h:70
enum rte_bpf_xtype type
Definition: rte_bpf.h:71
void * val
Definition: rte_bpf.h:82
struct rte_bpf_arg args[EBPF_FUNC_MAX_ARGS]
Definition: rte_bpf.h:77
struct rte_bpf_arg desc
Definition: rte_bpf.h:83
struct rte_bpf_xsym::@41::@44 var