P4C
The P4 Compiler
Loading...
Searching...
No Matches
ebpf_registry.h
1/*
2Copyright 2018 VMware, Inc.
3
4Licensed under the Apache License, Version 2.0 (the "License");
5you may not use this file except in compliance with the License.
6You may obtain a copy of the License at
7
8 http://www.apache.org/licenses/LICENSE-2.0
9
10Unless required by applicable law or agreed to in writing, software
11distributed under the License is distributed on an "AS IS" BASIS,
12WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13See the License for the specific language governing permissions and
14limitations under the License.
15*/
16
21#ifndef BACKENDS_EBPF_RUNTIME_EBPF_REGISTRY_H_
22#define BACKENDS_EBPF_RUNTIME_EBPF_REGISTRY_H_
23
24#include "ebpf_map.h"
25
26#define MAX_TABLE_NAME_LENGTH 256 // maximum length of the table name
27
36struct bpf_table {
37 char *name; // table name longer than VAR_SIZE is not accessed
38 unsigned int type; // currently only hashmap is supported
39 unsigned int key_size; // size of the key structure
40 unsigned int value_size; // size of the value structure
41 unsigned int max_entries; // Maximum of possible entries
42 struct bpf_map *bpf_map; // Pointer to the actual hash map
43};
44
49int registry_add(struct bpf_table *tbl);
50
55int registry_delete_tbl(const char *name);
56
61void registry_delete();
62
67struct bpf_table *registry_lookup_table(const char *name);
68
73struct bpf_table *registry_lookup_table_id(int tbl_id);
74
79int registry_get_id(const char *name);
80
87int registry_update_table(const char *name, void *key, void *value, unsigned long long flags);
88
95int registry_update_table_id(int tbl_id, void *key, void *value, unsigned long long flags);
96
104int registry_delete_table_elem(const char *name, void *key);
105
113int registry_delete_table_elem_id(int tbl_id, void *key);
114
122void *registry_lookup_table_elem(const char *name, void *key);
123
131void *registry_lookup_table_elem_id(int tbl_id, void *key);
132
133#endif // BACKENDS_EBPF_RUNTIME_EBPF_REGISTRY_H_
Definition ebpf_map.h:25
A helper structure used to describe attributes.
Definition ebpf_registry.h:36