0001
0002 =========
0003 eBPF maps
0004 =========
0005
0006 'maps' is a generic storage of different types for sharing data between kernel
0007 and userspace.
0008
0009 The maps are accessed from user space via BPF syscall, which has commands:
0010
0011 - create a map with given type and attributes
0012 ``map_fd = bpf(BPF_MAP_CREATE, union bpf_attr *attr, u32 size)``
0013 using attr->map_type, attr->key_size, attr->value_size, attr->max_entries
0014 returns process-local file descriptor or negative error
0015
0016 - lookup key in a given map
0017 ``err = bpf(BPF_MAP_LOOKUP_ELEM, union bpf_attr *attr, u32 size)``
0018 using attr->map_fd, attr->key, attr->value
0019 returns zero and stores found elem into value or negative error
0020
0021 - create or update key/value pair in a given map
0022 ``err = bpf(BPF_MAP_UPDATE_ELEM, union bpf_attr *attr, u32 size)``
0023 using attr->map_fd, attr->key, attr->value
0024 returns zero or negative error
0025
0026 - find and delete element by key in a given map
0027 ``err = bpf(BPF_MAP_DELETE_ELEM, union bpf_attr *attr, u32 size)``
0028 using attr->map_fd, attr->key
0029
0030 - to delete map: close(fd)
0031 Exiting process will delete maps automatically
0032
0033 userspace programs use this syscall to create/access maps that eBPF programs
0034 are concurrently updating.
0035
0036 maps can have different types: hash, array, bloom filter, radix-tree, etc.
0037
0038 The map is defined by:
0039
0040 - type
0041 - max number of elements
0042 - key size in bytes
0043 - value size in bytes
0044
0045 Map Types
0046 =========
0047
0048 .. toctree::
0049 :maxdepth: 1
0050 :glob:
0051
0052 map_*