DPDK
25.11.0
Toggle main menu visibility
Loading...
Searching...
No Matches
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
18
19
#include <
rte_common.h
>
20
#include <
rte_mbuf.h
>
21
#include <
rte_malloc.h
>
22
#include <bpf_def.h>
23
24
#ifdef __cplusplus
25
extern
"C"
{
26
#endif
27
31
enum
rte_bpf_arg_type
{
32
RTE_BPF_ARG_UNDEF
,
33
RTE_BPF_ARG_RAW
,
34
RTE_BPF_ARG_PTR
= 0x10,
35
RTE_BPF_ARG_PTR_MBUF
,
36
RTE_BPF_ARG_RESERVED
37
};
38
42
struct
rte_bpf_arg
{
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
61
enum
rte_bpf_xtype
{
62
RTE_BPF_XTYPE_FUNC
,
63
RTE_BPF_XTYPE_VAR
64
};
65
69
struct
rte_bpf_xsym
{
70
const
char
*
name
;
71
enum
rte_bpf_xtype
type
;
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];
79
struct
rte_bpf_arg
ret
;
80
} func;
81
struct
{
82
void
*val;
83
struct
rte_bpf_arg
desc
;
84
}
var
;
85
};
86
};
87
91
struct
rte_bpf_prm
{
92
const
struct
ebpf_insn *
ins
;
93
uint32_t
nb_ins
;
94
const
struct
rte_bpf_xsym
*
xsym
;
96
uint32_t
nb_xsym
;
97
struct
rte_bpf_arg
prog_arg
;
98
};
99
103
struct
rte_bpf_jit
{
104
uint64_t (*
func
)(
void
*);
105
size_t
sz
;
106
};
107
108
struct
rte_bpf;
109
116
void
117
rte_bpf_destroy
(
struct
rte_bpf *bpf);
118
131
struct
rte_bpf *
132
rte_bpf_load
(
const
struct
rte_bpf_prm
*prm)
133
__rte_malloc
__rte_dealloc
(
rte_bpf_destroy
, 1);
134
155
struct
rte_bpf *
156
rte_bpf_elf_load
(
const
struct
rte_bpf_prm
*prm,
const
char
*fname,
157
const
char
*sname)
158
__rte_malloc
__rte_dealloc
(
rte_bpf_destroy
, 1);
159
170
uint64_t
171
rte_bpf_exec
(
const
struct
rte_bpf *bpf,
void
*ctx);
172
187
uint32_t
188
rte_bpf_exec_burst
(
const
struct
rte_bpf *bpf,
void
*ctx[], uint64_t rc[],
189
uint32_t num);
190
202
int
203
rte_bpf_get_jit
(
const
struct
rte_bpf *bpf,
struct
rte_bpf_jit
*jit);
204
215
void
216
rte_bpf_dump
(FILE *f,
const
struct
ebpf_insn *buf, uint32_t len);
217
218
struct
bpf_program;
219
234
struct
rte_bpf_prm
*
235
rte_bpf_convert
(
const
struct
bpf_program *prog)
236
__rte_malloc
__rte_dealloc_free
;
237
238
#ifdef __cplusplus
239
}
240
#endif
241
242
#endif
/* _RTE_BPF_H_ */
rte_bpf_get_jit
int rte_bpf_get_jit(const struct rte_bpf *bpf, struct rte_bpf_jit *jit)
rte_bpf_convert
struct rte_bpf_prm * rte_bpf_convert(const struct bpf_program *prog) __rte_malloc __rte_dealloc_free
rte_bpf_xtype
rte_bpf_xtype
Definition
rte_bpf.h:61
RTE_BPF_XTYPE_VAR
@ RTE_BPF_XTYPE_VAR
Definition
rte_bpf.h:63
RTE_BPF_XTYPE_FUNC
@ RTE_BPF_XTYPE_FUNC
Definition
rte_bpf.h:62
rte_bpf_dump
void rte_bpf_dump(FILE *f, const struct ebpf_insn *buf, uint32_t len)
rte_bpf_arg_type
rte_bpf_arg_type
Definition
rte_bpf.h:31
RTE_BPF_ARG_UNDEF
@ RTE_BPF_ARG_UNDEF
Definition
rte_bpf.h:32
RTE_BPF_ARG_PTR_MBUF
@ RTE_BPF_ARG_PTR_MBUF
Definition
rte_bpf.h:35
RTE_BPF_ARG_PTR
@ RTE_BPF_ARG_PTR
Definition
rte_bpf.h:34
RTE_BPF_ARG_RAW
@ RTE_BPF_ARG_RAW
Definition
rte_bpf.h:33
RTE_BPF_ARG_RESERVED
@ RTE_BPF_ARG_RESERVED
Definition
rte_bpf.h:36
rte_bpf_exec
struct rte_bpf struct rte_bpf uint64_t rte_bpf_exec(const struct rte_bpf *bpf, void *ctx)
rte_bpf_exec_burst
uint32_t rte_bpf_exec_burst(const struct rte_bpf *bpf, void *ctx[], uint64_t rc[], uint32_t num)
rte_bpf_load
struct rte_bpf * rte_bpf_load(const struct rte_bpf_prm *prm) __rte_malloc __rte_dealloc(rte_bpf_destroy
rte_bpf_elf_load
struct rte_bpf struct rte_bpf * rte_bpf_elf_load(const struct rte_bpf_prm *prm, const char *fname, const char *sname) __rte_malloc __rte_dealloc(rte_bpf_destroy
rte_bpf_destroy
void rte_bpf_destroy(struct rte_bpf *bpf)
rte_common.h
__rte_dealloc
#define __rte_dealloc(dealloc, argno)
Definition
rte_common.h:339
__rte_malloc
#define __rte_malloc
Definition
rte_common.h:328
rte_malloc.h
__rte_dealloc_free
#define __rte_dealloc_free
Definition
rte_malloc.h:37
rte_mbuf.h
rte_bpf_arg
Definition
rte_bpf.h:42
rte_bpf_arg::size
size_t size
Definition
rte_bpf.h:48
rte_bpf_arg::buf_size
size_t buf_size
Definition
rte_bpf.h:49
rte_bpf_jit
Definition
rte_bpf.h:103
rte_bpf_jit::func
uint64_t(* func)(void *)
Definition
rte_bpf.h:104
rte_bpf_jit::sz
size_t sz
Definition
rte_bpf.h:105
rte_bpf_prm
Definition
rte_bpf.h:91
rte_bpf_prm::prog_arg
struct rte_bpf_arg prog_arg
Definition
rte_bpf.h:97
rte_bpf_prm::xsym
const struct rte_bpf_xsym * xsym
Definition
rte_bpf.h:94
rte_bpf_prm::nb_ins
uint32_t nb_ins
Definition
rte_bpf.h:93
rte_bpf_prm::ins
const struct ebpf_insn * ins
Definition
rte_bpf.h:92
rte_bpf_prm::nb_xsym
uint32_t nb_xsym
Definition
rte_bpf.h:96
rte_bpf_xsym
Definition
rte_bpf.h:69
rte_bpf_xsym::ret
struct rte_bpf_arg ret
Definition
rte_bpf.h:79
rte_bpf_xsym::name
const char * name
Definition
rte_bpf.h:70
rte_bpf_xsym::type
enum rte_bpf_xtype type
Definition
rte_bpf.h:71
rte_bpf_xsym::args
struct rte_bpf_arg args[EBPF_FUNC_MAX_ARGS]
Definition
rte_bpf.h:77
rte_bpf_xsym::desc
struct rte_bpf_arg desc
Definition
rte_bpf.h:83
rte_bpf_xsym::var
struct rte_bpf_xsym::@053264025022032205007377166372345206106266270177::@001326346123125276362205102302170245071216035222 var
lib
bpf
rte_bpf.h
Generated by
1.17.0