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