diff options
author | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2022-02-18 22:30:38 +0100 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2022-02-18 22:30:38 +0100 |
commit | 986c6f7c3fc855032f3457a5a1b7fbcc09c375bb (patch) | |
tree | cf5b08b5ae405ae04e0c1c728531972934d3eed0 /Documentation/bpf/maps.rst | |
parent | Input: tsc200x - add axis inversion and swapping support (diff) | |
parent | Linux 5.17-rc4 (diff) | |
download | linux-986c6f7c3fc855032f3457a5a1b7fbcc09c375bb.tar.xz linux-986c6f7c3fc855032f3457a5a1b7fbcc09c375bb.zip |
Merge tag 'v5.17-rc4' into next
Sync up with mainline to get the latest changes in HID subsystem.
Diffstat (limited to 'Documentation/bpf/maps.rst')
-rw-r--r-- | Documentation/bpf/maps.rst | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/Documentation/bpf/maps.rst b/Documentation/bpf/maps.rst new file mode 100644 index 000000000000..f41619e312ac --- /dev/null +++ b/Documentation/bpf/maps.rst @@ -0,0 +1,52 @@ + +========= +eBPF maps +========= + +'maps' is a generic storage of different types for sharing data between kernel +and userspace. + +The maps are accessed from user space via BPF syscall, which has commands: + +- create a map with given type and attributes + ``map_fd = bpf(BPF_MAP_CREATE, union bpf_attr *attr, u32 size)`` + using attr->map_type, attr->key_size, attr->value_size, attr->max_entries + returns process-local file descriptor or negative error + +- lookup key in a given map + ``err = bpf(BPF_MAP_LOOKUP_ELEM, union bpf_attr *attr, u32 size)`` + using attr->map_fd, attr->key, attr->value + returns zero and stores found elem into value or negative error + +- create or update key/value pair in a given map + ``err = bpf(BPF_MAP_UPDATE_ELEM, union bpf_attr *attr, u32 size)`` + using attr->map_fd, attr->key, attr->value + returns zero or negative error + +- find and delete element by key in a given map + ``err = bpf(BPF_MAP_DELETE_ELEM, union bpf_attr *attr, u32 size)`` + using attr->map_fd, attr->key + +- to delete map: close(fd) + Exiting process will delete maps automatically + +userspace programs use this syscall to create/access maps that eBPF programs +are concurrently updating. + +maps can have different types: hash, array, bloom filter, radix-tree, etc. + +The map is defined by: + + - type + - max number of elements + - key size in bytes + - value size in bytes + +Map Types +========= + +.. toctree:: + :maxdepth: 1 + :glob: + + map_*
\ No newline at end of file |