P4C
The P4 Compiler
Loading...
Searching...
No Matches
ebpf_registry.h
1/*
2 * Copyright 2018 VMware, Inc.
3 * SPDX-FileCopyrightText: 2018 VMware, Inc.
4 *
5 * SPDX-License-Identifier: Apache-2.0
6 */
7
12#ifndef BACKENDS_EBPF_RUNTIME_EBPF_REGISTRY_H_
13#define BACKENDS_EBPF_RUNTIME_EBPF_REGISTRY_H_
14
15#include "ebpf_map.h"
16
17#define MAX_TABLE_NAME_LENGTH 256 // maximum length of the table name
18
27struct bpf_table {
28 char *name; // table name longer than VAR_SIZE is not accessed
29 unsigned int type; // currently only hashmap is supported
30 unsigned int key_size; // size of the key structure
31 unsigned int value_size; // size of the value structure
32 unsigned int max_entries; // Maximum of possible entries
33 struct bpf_map *bpf_map; // Pointer to the actual hash map
34};
35
40int registry_add(struct bpf_table *tbl);
41
46int registry_delete_tbl(const char *name);
47
52void registry_delete();
53
58struct bpf_table *registry_lookup_table(const char *name);
59
64struct bpf_table *registry_lookup_table_id(int tbl_id);
65
70int registry_get_id(const char *name);
71
78int registry_update_table(const char *name, void *key, void *value, unsigned long long flags);
79
86int registry_update_table_id(int tbl_id, void *key, void *value, unsigned long long flags);
87
95int registry_delete_table_elem(const char *name, void *key);
96
104int registry_delete_table_elem_id(int tbl_id, void *key);
105
113void *registry_lookup_table_elem(const char *name, void *key);
114
122void *registry_lookup_table_elem_id(int tbl_id, void *key);
123
124#endif // BACKENDS_EBPF_RUNTIME_EBPF_REGISTRY_H_
A helper structure used to describe attributes.
Definition ebpf_registry.h:27