Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
B
bcc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
bcc
Commits
e69f7646
Commit
e69f7646
authored
Dec 01, 2016
by
Huapeng Zhou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bcc: add lru_hash and lru_percpu_hash map types
parent
e85aa7f9
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
0 deletions
+23
-0
src/cc/compat/linux/bpf.h
src/cc/compat/linux/bpf.h
+9
-0
src/cc/compat/linux/virtual_bpf.h
src/cc/compat/linux/virtual_bpf.h
+10
-0
src/cc/frontends/clang/b_frontend_action.cc
src/cc/frontends/clang/b_frontend_action.cc
+4
-0
No files found.
src/cc/compat/linux/bpf.h
View file @
e69f7646
...
...
@@ -85,6 +85,8 @@ enum bpf_map_type {
BPF_MAP_TYPE_PERCPU_ARRAY
,
BPF_MAP_TYPE_STACK_TRACE
,
BPF_MAP_TYPE_CGROUP_ARRAY
,
BPF_MAP_TYPE_LRU_HASH
,
BPF_MAP_TYPE_LRU_PERCPU_HASH
,
};
enum
bpf_prog_type
{
...
...
@@ -106,6 +108,13 @@ enum bpf_prog_type {
#define BPF_EXIST 2
/* update existing element */
#define BPF_F_NO_PREALLOC (1U << 0)
/* Instead of having one common LRU list in the
* BPF_MAP_TYPE_LRU_[PERCPU_]HASH map, use a percpu LRU list
* which can scale and perform better.
* Note, the LRU nodes (including free nodes) cannot be moved
* across different LRU lists.
*/
#define BPF_F_NO_COMMON_LRU (1U << 1)
union
bpf_attr
{
struct
{
/* anonymous struct used by BPF_MAP_CREATE command */
...
...
src/cc/compat/linux/virtual_bpf.h
View file @
e69f7646
...
...
@@ -86,6 +86,8 @@ enum bpf_map_type {
BPF_MAP_TYPE_PERCPU_ARRAY,
BPF_MAP_TYPE_STACK_TRACE,
BPF_MAP_TYPE_CGROUP_ARRAY,
BPF_MAP_TYPE_LRU_HASH,
BPF_MAP_TYPE_LRU_PERCPU_HASH,
};
enum bpf_prog_type {
...
...
@@ -96,6 +98,7 @@ enum bpf_prog_type {
BPF_PROG_TYPE_SCHED_ACT,
BPF_PROG_TYPE_TRACEPOINT,
BPF_PROG_TYPE_XDP,
BPF_PROG_TYPE_PERF_EVENT,
};
#define BPF_PSEUDO_MAP_FD 1
...
...
@@ -106,6 +109,13 @@ enum bpf_prog_type {
#define BPF_EXIST 2 /* update existing element */
#define BPF_F_NO_PREALLOC (1U << 0)
/* Instead of having one common LRU list in the
* BPF_MAP_TYPE_LRU_[PERCPU_]HASH map, use a percpu LRU list
* which can scale and perform better.
* Note, the LRU nodes (including free nodes) cannot be moved
* across different LRU lists.
*/
#define BPF_F_NO_COMMON_LRU (1U << 1)
union bpf_attr {
struct { /* anonymous struct used by BPF_MAP_CREATE command */
...
...
src/cc/frontends/clang/b_frontend_action.cc
View file @
e69f7646
...
...
@@ -639,6 +639,10 @@ bool BTypeVisitor::VisitVarDecl(VarDecl *Decl) {
map_type
=
BPF_MAP_TYPE_PERCPU_HASH
;
}
else
if
(
A
->
getName
()
==
"maps/percpu_array"
)
{
map_type
=
BPF_MAP_TYPE_PERCPU_ARRAY
;
}
else
if
(
A
->
getName
()
==
"maps/lru_hash"
)
{
map_type
=
BPF_MAP_TYPE_LRU_HASH
;
}
else
if
(
A
->
getName
()
==
"maps/lru_percpu_hash"
)
{
map_type
=
BPF_MAP_TYPE_LRU_PERCPU_HASH
;
}
else
if
(
A
->
getName
()
==
"maps/histogram"
)
{
if
(
table
.
key_desc
==
"
\"
int
\"
"
)
map_type
=
BPF_MAP_TYPE_ARRAY
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment