summaryrefslogtreecommitdiff
path: root/Documentation/bpf/map_array.rst
diff options
context:
space:
mode:
authorDonald Hunter <donald.hunter@gmail.com>2022-11-22 17:39:33 +0300
committerDaniel Borkmann <daniel@iogearbox.net>2022-11-24 03:05:04 +0300
commit539886a32a6a4601241d928dc8b776b052c04ed0 (patch)
tree8fdf2de8f0c6dcd04be2d6b2f222136e5d48d740 /Documentation/bpf/map_array.rst
parent8e898aaa733eca61393fc036c8a4b5834fee5dd3 (diff)
downloadlinux-539886a32a6a4601241d928dc8b776b052c04ed0.tar.xz
docs/bpf: Fix sphinx warnings in BPF map docs
Fix duplicate C declaration warnings when using sphinx >= 3.1. Reported-by: Akira Yokosawa <akiyks@gmail.com> Signed-off-by: Donald Hunter <donald.hunter@gmail.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Reviewed-by: Akira Yokosawa <akiyks@gmail.com> Link: https://lore.kernel.org/bpf/ed4dac84-1b12-5c58-e4de-93ab9ac67c09@gmail.com Link: https://lore.kernel.org/bpf/20221122143933.91321-1-donald.hunter@gmail.com
Diffstat (limited to 'Documentation/bpf/map_array.rst')
-rw-r--r--Documentation/bpf/map_array.rst20
1 files changed, 16 insertions, 4 deletions
diff --git a/Documentation/bpf/map_array.rst b/Documentation/bpf/map_array.rst
index 97bb80333254..f2f51a53e8ae 100644
--- a/Documentation/bpf/map_array.rst
+++ b/Documentation/bpf/map_array.rst
@@ -32,7 +32,11 @@ Usage
Kernel BPF
----------
-.. c:function::
+bpf_map_lookup_elem()
+~~~~~~~~~~~~~~~~~~~~~
+
+.. code-block:: c
+
void *bpf_map_lookup_elem(struct bpf_map *map, const void *key)
Array elements can be retrieved using the ``bpf_map_lookup_elem()`` helper.
@@ -40,7 +44,11 @@ This helper returns a pointer into the array element, so to avoid data races
with userspace reading the value, the user must use primitives like
``__sync_fetch_and_add()`` when updating the value in-place.
-.. c:function::
+bpf_map_update_elem()
+~~~~~~~~~~~~~~~~~~~~~
+
+.. code-block:: c
+
long bpf_map_update_elem(struct bpf_map *map, const void *key, const void *value, u64 flags)
Array elements can be updated using the ``bpf_map_update_elem()`` helper.
@@ -53,7 +61,7 @@ To clear an array element, you may use ``bpf_map_update_elem()`` to insert a
zero value to that index.
Per CPU Array
-~~~~~~~~~~~~~
+-------------
Values stored in ``BPF_MAP_TYPE_ARRAY`` can be accessed by multiple programs
across different CPUs. To restrict storage to a single CPU, you may use a
@@ -63,7 +71,11 @@ When using a ``BPF_MAP_TYPE_PERCPU_ARRAY`` the ``bpf_map_update_elem()`` and
``bpf_map_lookup_elem()`` helpers automatically access the slot for the current
CPU.
-.. c:function::
+bpf_map_lookup_percpu_elem()
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+.. code-block:: c
+
void *bpf_map_lookup_percpu_elem(struct bpf_map *map, const void *key, u32 cpu)
The ``bpf_map_lookup_percpu_elem()`` helper can be used to lookup the array