aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation
diff options
context:
space:
mode:
Diffstat (limited to 'Documentation')
-rw-r--r--Documentation/networking/filter.txt39
1 files changed, 39 insertions, 0 deletions
diff --git a/Documentation/networking/filter.txt b/Documentation/networking/filter.txt
index 014e0319a5c4..4a01d71785e9 100644
--- a/Documentation/networking/filter.txt
+++ b/Documentation/networking/filter.txt
@@ -1001,6 +1001,45 @@ instruction that loads 64-bit immediate value into a dst_reg.
1001Classic BPF has similar instruction: BPF_LD | BPF_W | BPF_IMM which loads 1001Classic BPF has similar instruction: BPF_LD | BPF_W | BPF_IMM which loads
100232-bit immediate value into a register. 100232-bit immediate value into a register.
1003 1003
1004eBPF maps
1005---------
1006'maps' is a generic storage of different types for sharing data between kernel
1007and userspace.
1008
1009The maps are accessed from user space via BPF syscall, which has commands:
1010- create a map with given type and attributes
1011 map_fd = bpf(BPF_MAP_CREATE, union bpf_attr *attr, u32 size)
1012 using attr->map_type, attr->key_size, attr->value_size, attr->max_entries
1013 returns process-local file descriptor or negative error
1014
1015- lookup key in a given map
1016 err = bpf(BPF_MAP_LOOKUP_ELEM, union bpf_attr *attr, u32 size)
1017 using attr->map_fd, attr->key, attr->value
1018 returns zero and stores found elem into value or negative error
1019
1020- create or update key/value pair in a given map
1021 err = bpf(BPF_MAP_UPDATE_ELEM, union bpf_attr *attr, u32 size)
1022 using attr->map_fd, attr->key, attr->value
1023 returns zero or negative error
1024
1025- find and delete element by key in a given map
1026 err = bpf(BPF_MAP_DELETE_ELEM, union bpf_attr *attr, u32 size)
1027 using attr->map_fd, attr->key
1028
1029- to delete map: close(fd)
1030 Exiting process will delete maps automatically
1031
1032userspace programs use this syscall to create/access maps that eBPF programs
1033are concurrently updating.
1034
1035maps can have different types: hash, array, bloom filter, radix-tree, etc.
1036
1037The map is defined by:
1038 . type
1039 . max number of elements
1040 . key size in bytes
1041 . value size in bytes
1042
1004Testing 1043Testing
1005------- 1044-------
1006 1045