DPDK
18.05.1
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;
43
size_t
size
;
44
size_t
buf_size
;
46
};
47
51
#define RTE_BPF_ARG_PTR_TYPE(x) ((x) & RTE_BPF_ARG_PTR)
52
56
enum
rte_bpf_xtype
{
57
RTE_BPF_XTYPE_FUNC
,
58
RTE_BPF_XTYPE_VAR
,
59
RTE_BPF_XTYPE_NUM
60
};
61
65
struct
rte_bpf_xsym
{
66
const
char
*
name
;
67
enum
rte_bpf_xtype
type
;
68
union
{
69
uint64_t (*func)(uint64_t, uint64_t, uint64_t,
70
uint64_t, uint64_t);
71
void
*var;
72
};
73
};
74
78
struct
rte_bpf_prm
{
79
const
struct
ebpf_insn *
ins
;
80
uint32_t
nb_ins
;
81
const
struct
rte_bpf_xsym
*
xsym
;
83
uint32_t
nb_xsym
;
84
struct
rte_bpf_arg
prog_arg
;
85
};
86
90
struct
rte_bpf_jit
{
91
uint64_t (*
func
)(
void
*);
92
size_t
sz
;
93
};
94
95
struct
rte_bpf;
96
103
void
__rte_experimental
104
rte_bpf_destroy
(
struct
rte_bpf *bpf);
105
118
struct
rte_bpf * __rte_experimental
119
rte_bpf_load
(
const
struct
rte_bpf_prm
*prm);
120
138
struct
rte_bpf * __rte_experimental
139
rte_bpf_elf_load
(
const
struct
rte_bpf_prm
*prm,
const
char
*fname,
140
const
char
*sname);
151
uint64_t __rte_experimental
152
rte_bpf_exec
(
const
struct
rte_bpf *bpf,
void
*ctx);
153
168
uint32_t __rte_experimental
169
rte_bpf_exec_burst
(
const
struct
rte_bpf *bpf,
void
*ctx[], uint64_t rc[],
170
uint32_t num);
171
183
int
__rte_experimental
184
rte_bpf_get_jit
(
const
struct
rte_bpf *bpf,
struct
rte_bpf_jit
*jit);
185
186
#ifdef __cplusplus
187
}
188
#endif
189
190
#endif
/* _RTE_BPF_H_ */
Generated by
1.8.1.2