DPDK 25.03.0-rc0
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_common.h>
20#include <rte_mbuf.h>
21#include <bpf_def.h>
22
23#ifdef __cplusplus
24extern "C" {
25#endif
26
36};
37
42 enum rte_bpf_arg_type type;
47 size_t size;
48 size_t buf_size;
50};
51
55#define RTE_BPF_ARG_PTR_TYPE(x) ((x) & RTE_BPF_ARG_PTR)
56
63};
64
69 const char *name;
71 union {
72 struct {
73 uint64_t (*val)(uint64_t, uint64_t, uint64_t,
74 uint64_t, uint64_t);
75 uint32_t nb_args;
76 struct rte_bpf_arg args[EBPF_FUNC_MAX_ARGS];
79 } func;
80 struct {
81 void *val;
83 } var;
84 };
85};
86
91 const struct ebpf_insn *ins;
92 uint32_t nb_ins;
93 const struct rte_bpf_xsym *xsym;
95 uint32_t nb_xsym;
97};
98
103 uint64_t (*func)(void *);
104 size_t sz;
105};
106
107struct rte_bpf;
108
115void
116rte_bpf_destroy(struct rte_bpf *bpf);
117
130struct rte_bpf *
131rte_bpf_load(const struct rte_bpf_prm *prm);
132
153struct rte_bpf *
154rte_bpf_elf_load(const struct rte_bpf_prm *prm, const char *fname,
155 const char *sname);
166uint64_t
167rte_bpf_exec(const struct rte_bpf *bpf, void *ctx);
168
183uint32_t
184rte_bpf_exec_burst(const struct rte_bpf *bpf, void *ctx[], uint64_t rc[],
185 uint32_t num);
186
198int
199rte_bpf_get_jit(const struct rte_bpf *bpf, struct rte_bpf_jit *jit);
200
211void
212rte_bpf_dump(FILE *f, const struct ebpf_insn *buf, uint32_t len);
213
214struct bpf_program;
215
230struct rte_bpf_prm *
231rte_bpf_convert(const struct bpf_program *prog);
232
233#ifdef __cplusplus
234}
235#endif
236
237#endif /* _RTE_BPF_H_ */
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:60
@ RTE_BPF_XTYPE_VAR
Definition: rte_bpf.h:62
@ RTE_BPF_XTYPE_FUNC
Definition: rte_bpf.h:61
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)
void rte_bpf_dump(FILE *f, const struct ebpf_insn *buf, uint32_t len)
rte_bpf_arg_type
Definition: rte_bpf.h:30
@ RTE_BPF_ARG_UNDEF
Definition: rte_bpf.h:31
@ RTE_BPF_ARG_PTR_MBUF
Definition: rte_bpf.h:34
@ RTE_BPF_ARG_PTR
Definition: rte_bpf.h:33
@ RTE_BPF_ARG_RAW
Definition: rte_bpf.h:32
@ RTE_BPF_ARG_RESERVED
Definition: rte_bpf.h:35
struct rte_bpf_prm * rte_bpf_convert(const struct bpf_program *prog)
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:47
size_t buf_size
Definition: rte_bpf.h:48
uint64_t(* func)(void *)
Definition: rte_bpf.h:103
size_t sz
Definition: rte_bpf.h:104
struct rte_bpf_arg prog_arg
Definition: rte_bpf.h:96
const struct rte_bpf_xsym * xsym
Definition: rte_bpf.h:93
uint32_t nb_ins
Definition: rte_bpf.h:92
const struct ebpf_insn * ins
Definition: rte_bpf.h:91
uint32_t nb_xsym
Definition: rte_bpf.h:95
struct rte_bpf_arg ret
Definition: rte_bpf.h:78
struct rte_bpf_xsym::@64::@67 var
const char * name
Definition: rte_bpf.h:69
enum rte_bpf_xtype type
Definition: rte_bpf.h:70
void * val
Definition: rte_bpf.h:81
struct rte_bpf_arg args[EBPF_FUNC_MAX_ARGS]
Definition: rte_bpf.h:76
struct rte_bpf_arg desc
Definition: rte_bpf.h:82