DPDK
19.02.0
Main Page
Related Pages
Data Structures
Files
Examples
File List
Globals
lib
librte_bpf
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
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_PTR_STACK,
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
RTE_BPF_XTYPE_NUM
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
__rte_experimental
117
rte_bpf_destroy
(
struct
rte_bpf *bpf);
118
131
struct
rte_bpf * __rte_experimental
132
rte_bpf_load
(
const
struct
rte_bpf_prm
*prm);
133
151
struct
rte_bpf * __rte_experimental
152
rte_bpf_elf_load
(
const
struct
rte_bpf_prm
*prm,
const
char
*fname,
153
const
char
*sname);
164
uint64_t __rte_experimental
165
rte_bpf_exec
(
const
struct
rte_bpf *bpf,
void
*ctx);
166
181
uint32_t __rte_experimental
182
rte_bpf_exec_burst
(
const
struct
rte_bpf *bpf,
void
*ctx[], uint64_t rc[],
183
uint32_t num);
184
196
int
__rte_experimental
197
rte_bpf_get_jit
(
const
struct
rte_bpf *bpf,
struct
rte_bpf_jit
*jit);
198
199
#ifdef __cplusplus
200
}
201
#endif
202
203
#endif
/* _RTE_BPF_H_ */
Generated by
1.8.1.2