Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) ================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2) bpftool-map
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3) ================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4) -------------------------------------------------------------------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5) tool for inspection and simple manipulation of eBPF maps
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6) -------------------------------------------------------------------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8) :Manual section: 8
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10) SYNOPSIS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11) ========
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13) 	**bpftool** [*OPTIONS*] **map** *COMMAND*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15) 	*OPTIONS* := { { **-j** | **--json** } [{ **-p** | **--pretty** }] | { **-f** | **--bpffs** } }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17) 	*COMMANDS* :=
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18) 	{ **show** | **list** | **create** | **dump** | **update** | **lookup** | **getnext**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19) 	| **delete** | **pin** | **help** }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21) MAP COMMANDS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22) =============
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24) |	**bpftool** **map** { **show** | **list** }   [*MAP*]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25) |	**bpftool** **map create**     *FILE* **type** *TYPE* **key** *KEY_SIZE* **value** *VALUE_SIZE* \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26) |		**entries** *MAX_ENTRIES* **name** *NAME* [**flags** *FLAGS*] [**inner_map** *MAP*] \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) |		[**dev** *NAME*]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28) |	**bpftool** **map dump**       *MAP*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) |	**bpftool** **map update**     *MAP* [**key** *DATA*] [**value** *VALUE*] [*UPDATE_FLAGS*]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30) |	**bpftool** **map lookup**     *MAP* [**key** *DATA*]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) |	**bpftool** **map getnext**    *MAP* [**key** *DATA*]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) |	**bpftool** **map delete**     *MAP*  **key** *DATA*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) |	**bpftool** **map pin**        *MAP*  *FILE*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) |	**bpftool** **map event_pipe** *MAP* [**cpu** *N* **index** *M*]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) |	**bpftool** **map peek**       *MAP*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) |	**bpftool** **map push**       *MAP* **value** *VALUE*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) |	**bpftool** **map pop**        *MAP*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) |	**bpftool** **map enqueue**    *MAP* **value** *VALUE*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) |	**bpftool** **map dequeue**    *MAP*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) |	**bpftool** **map freeze**     *MAP*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) |	**bpftool** **map help**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) |	*MAP* := { **id** *MAP_ID* | **pinned** *FILE* | **name** *MAP_NAME* }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) |	*DATA* := { [**hex**] *BYTES* }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) |	*PROG* := { **id** *PROG_ID* | **pinned** *FILE* | **tag** *PROG_TAG* | **name** *PROG_NAME* }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) |	*VALUE* := { *DATA* | *MAP* | *PROG* }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) |	*UPDATE_FLAGS* := { **any** | **exist** | **noexist** }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) |	*TYPE* := { **hash** | **array** | **prog_array** | **perf_event_array** | **percpu_hash**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) |		| **percpu_array** | **stack_trace** | **cgroup_array** | **lru_hash**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) |		| **lru_percpu_hash** | **lpm_trie** | **array_of_maps** | **hash_of_maps**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) |		| **devmap** | **devmap_hash** | **sockmap** | **cpumap** | **xskmap** | **sockhash**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) |		| **cgroup_storage** | **reuseport_sockarray** | **percpu_cgroup_storage**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) |		| **queue** | **stack** | **sk_storage** | **struct_ops** | **ringbuf** | **inode_storage** }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) DESCRIPTION
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) ===========
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) 	**bpftool map { show | list }**   [*MAP*]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) 		  Show information about loaded maps.  If *MAP* is specified
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) 		  show information only about given maps, otherwise list all
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) 		  maps currently loaded on the system.  In case of **name**,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) 		  *MAP* may match several maps which will all be shown.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) 		  Output will start with map ID followed by map type and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) 		  zero or more named attributes (depending on kernel version).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) 		  Since Linux 5.8 bpftool is able to discover information about
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) 		  processes that hold open file descriptors (FDs) against BPF
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) 		  maps. On such kernels bpftool will automatically emit this
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) 		  information as well.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) 	**bpftool map create** *FILE* **type** *TYPE* **key** *KEY_SIZE* **value** *VALUE_SIZE*  **entries** *MAX_ENTRIES* **name** *NAME* [**flags** *FLAGS*] [**inner_map** *MAP*] [**dev** *NAME*]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) 		  Create a new map with given parameters and pin it to *bpffs*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) 		  as *FILE*.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) 		  *FLAGS* should be an integer which is the combination of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) 		  desired flags, e.g. 1024 for **BPF_F_MMAPABLE** (see bpf.h
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) 		  UAPI header for existing flags).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) 		  To create maps of type array-of-maps or hash-of-maps, the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) 		  **inner_map** keyword must be used to pass an inner map. The
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) 		  kernel needs it to collect metadata related to the inner maps
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) 		  that the new map will work with.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) 		  Keyword **dev** expects a network interface name, and is used
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) 		  to request hardware offload for the map.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) 	**bpftool map dump**    *MAP*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) 		  Dump all entries in a given *MAP*.  In case of **name**,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) 		  *MAP* may match several maps which will all be dumped.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) 	**bpftool map update**  *MAP* [**key** *DATA*] [**value** *VALUE*] [*UPDATE_FLAGS*]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) 		  Update map entry for a given *KEY*.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) 		  *UPDATE_FLAGS* can be one of: **any** update existing entry
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) 		  or add if doesn't exit; **exist** update only if entry already
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) 		  exists; **noexist** update only if entry doesn't exist.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) 		  If the **hex** keyword is provided in front of the bytes
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) 		  sequence, the bytes are parsed as hexadecimal values, even if
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) 		  no "0x" prefix is added. If the keyword is not provided, then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) 		  the bytes are parsed as decimal values, unless a "0x" prefix
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) 		  (for hexadecimal) or a "0" prefix (for octal) is provided.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) 	**bpftool map lookup**  *MAP* [**key** *DATA*]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) 		  Lookup **key** in the map.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) 	**bpftool map getnext** *MAP* [**key** *DATA*]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) 		  Get next key.  If *key* is not specified, get first key.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) 	**bpftool map delete**  *MAP*  **key** *DATA*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) 		  Remove entry from the map.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) 	**bpftool map pin**     *MAP*  *FILE*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) 		  Pin map *MAP* as *FILE*.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) 		  Note: *FILE* must be located in *bpffs* mount. It must not
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) 		  contain a dot character ('.'), which is reserved for future
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) 		  extensions of *bpffs*.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) 	**bpftool** **map event_pipe** *MAP* [**cpu** *N* **index** *M*]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) 		  Read events from a **BPF_MAP_TYPE_PERF_EVENT_ARRAY** map.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) 		  Install perf rings into a perf event array map and dump
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) 		  output of any **bpf_perf_event_output**\ () call in the kernel.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) 		  By default read the number of CPUs on the system and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) 		  install perf ring for each CPU in the corresponding index
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) 		  in the array.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) 		  If **cpu** and **index** are specified, install perf ring
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) 		  for given **cpu** at **index** in the array (single ring).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) 		  Note that installing a perf ring into an array will silently
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) 		  replace any existing ring.  Any other application will stop
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) 		  receiving events if it installed its rings earlier.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) 	**bpftool map peek**  *MAP*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) 		  Peek next value in the queue or stack.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) 	**bpftool map push**  *MAP* **value** *VALUE*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) 		  Push *VALUE* onto the stack.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) 	**bpftool map pop**  *MAP*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) 		  Pop and print value from the stack.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) 	**bpftool map enqueue**  *MAP* **value** *VALUE*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) 		  Enqueue *VALUE* into the queue.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) 	**bpftool map dequeue**  *MAP*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) 		  Dequeue and print value from the queue.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) 	**bpftool map freeze**  *MAP*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) 		  Freeze the map as read-only from user space. Entries from a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) 		  frozen map can not longer be updated or deleted with the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) 		  **bpf**\ () system call. This operation is not reversible,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) 		  and the map remains immutable from user space until its
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) 		  destruction. However, read and write permissions for BPF
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) 		  programs to the map remain unchanged.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) 	**bpftool map help**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) 		  Print short help message.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) OPTIONS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) =======
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) 	.. include:: common_options.rst
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) 	-f, --bpffs
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) 		  Show file names of pinned maps.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) 	-n, --nomount
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) 		  Do not automatically attempt to mount any virtual file system
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) 		  (such as tracefs or BPF virtual file system) when necessary.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) EXAMPLES
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) ========
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) **# bpftool map show**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) ::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179)   10: hash  name some_map  flags 0x0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180)         key 4B  value 8B  max_entries 2048  memlock 167936B
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181)         pids systemd(1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) The following three commands are equivalent:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) | **# bpftool map update id 10 key hex   20   c4   b7   00 value hex   0f   ff   ff   ab   01   02   03   4c**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) | **# bpftool map update id 10 key     0x20 0xc4 0xb7 0x00 value     0x0f 0xff 0xff 0xab 0x01 0x02 0x03 0x4c**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) | **# bpftool map update id 10 key       32  196  183    0 value       15  255  255  171    1    2    3   76**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) **# bpftool map lookup id 10 key 0 1 2 3**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) ::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194)   key: 00 01 02 03 value: 00 01 02 03 04 05 06 07
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) **# bpftool map dump id 10**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) ::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201)   key: 00 01 02 03  value: 00 01 02 03 04 05 06 07
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202)   key: 0d 00 07 00  value: 02 00 00 00 01 02 03 04
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203)   Found 2 elements
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) **# bpftool map getnext id 10 key 0 1 2 3**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) ::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209)   key:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210)   00 01 02 03
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211)   next key:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212)   0d 00 07 00
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) | **# mount -t bpf none /sys/fs/bpf/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) | **# bpftool map pin id 10 /sys/fs/bpf/map**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) | **# bpftool map del pinned /sys/fs/bpf/map key 13 00 07 00**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) Note that map update can also be used in order to change the program references
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) hold by a program array map. This can be used, for example, to change the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) programs used for tail-call jumps at runtime, without having to reload the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) entry-point program. Below is an example for this use case: we load a program
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) defining a prog array map, and with a main function that contains a tail call
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) to other programs that can be used either to "process" packets or to "debug"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) processing. Note that the prog array map MUST be pinned into the BPF virtual
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) file system for the map update to work successfully, as kernel flushes prog
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) array maps when they have no more references from user space (and the update
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) would be lost as soon as bpftool exits).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) | **# bpftool prog loadall tail_calls.o /sys/fs/bpf/foo type xdp**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) | **# bpftool prog --bpffs**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) ::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236)   545: xdp  name main_func  tag 674b4b5597193dc3  gpl
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237)           loaded_at 2018-12-12T15:02:58+0000  uid 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238)           xlated 240B  jited 257B  memlock 4096B  map_ids 294
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239)           pinned /sys/fs/bpf/foo/xdp
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240)   546: xdp  name bpf_func_process  tag e369a529024751fc  gpl
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241)           loaded_at 2018-12-12T15:02:58+0000  uid 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242)           xlated 200B  jited 164B  memlock 4096B
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243)           pinned /sys/fs/bpf/foo/process
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244)   547: xdp  name bpf_func_debug  tag 0b597868bc7f0976  gpl
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245)           loaded_at 2018-12-12T15:02:58+0000  uid 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246)           xlated 200B  jited 164B  memlock 4096B
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247)           pinned /sys/fs/bpf/foo/debug
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) **# bpftool map**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) ::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253)   294: prog_array  name jmp_table  flags 0x0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254)           key 4B  value 4B  max_entries 1  memlock 4096B
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255)           owner_prog_type xdp  owner jited
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258) | **# bpftool map pin id 294 /sys/fs/bpf/bar**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259) | **# bpftool map dump pinned /sys/fs/bpf/bar**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261) ::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263)   Found 0 elements
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266) | **# bpftool map update pinned /sys/fs/bpf/bar key 0 0 0 0 value pinned /sys/fs/bpf/foo/debug**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267) | **# bpftool map dump pinned /sys/fs/bpf/bar**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269) ::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271)   key: 00 00 00 00  value: 22 02 00 00
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272)   Found 1 element