Lines Matching +full:key +full:- +full:code
1 .. SPDX-License-Identifier: GPL-2.0-only
9 - ``BPF_MAP_TYPE_XSKMAP`` was introduced in kernel version 4.18
18 .. code-block:: none
20 +---------------------------------------------------+
21 | xsk A | xsk B | xsk C |<---+ User space
24 +---------------------------------------------------+ |
26 +---------------------------------------------------+ |
28 | | key | xsk | | |
29 | +---------+ +=============+ | |
31 | | | +-------------+ | |
33 | | BPF |-- redirect -->+-------------+-------------+
35 | | | +-------------+ |
38 | +---------+ |
40 +---------------------------------------------------+
54 Both the map key and map value size must be 4 bytes.
60 ----------
63 .. code-block:: c
65 long bpf_redirect_map(struct bpf_map *map, u32 key, u64 flags)
67 Redirect the packet to the endpoint referenced by ``map`` at index ``key``.
78 .. code-block:: c
80 void *bpf_map_lookup_elem(struct bpf_map *map, const void *key)
86 ----------
94 .. code-block:: c
96 int bpf_map_update_elem(int fd, const void *key, const void *value, __u64 flags)
99 helper. The ``key`` parameter is equal to the queue_id of the queue the XSK
107 - BPF_ANY: Create a new element or update an existing element.
108 - BPF_NOEXIST: Create a new element only if it did not exist.
109 - BPF_EXIST: Update an existing element.
113 .. code-block:: c
115 int bpf_map_lookup_elem(int fd, const void *key, void *value)
121 .. code-block:: c
123 int bpf_map_delete_elem(int fd, const void *key)
136 ------
138 The following code snippet shows how to declare a ``BPF_MAP_TYPE_XSKMAP`` called
141 .. code-block:: c
145 __type(key, __u32);
154 __u32 index = ctx->rx_queue_index;
162 ----------
164 The following code snippet shows how to update an XSKMAP with an XSK entry.
166 .. code-block:: c
179 For an example on how create AF_XDP sockets, please see the AF_XDP-example and
180 AF_XDP-forwarding programs in the `bpf-examples`_ directory in the `libxdp`_ repository.
183 - `libxdp-readme`_.
184 - `AF_XDP`_ kernel documentation.
189 .. _libxdp: https://github.com/xdp-project/xdp-tools/tree/master/lib/libxdp
191 .. _bpf-examples: https://github.com/xdp-project/bpf-examples
192 .. _libxdp-readme: https://github.com/xdp-project/xdp-tools/tree/master/lib/libxdp#using-af_xdp-soc…