Lines Matching +full:key +full:- +full:code
1 .. SPDX-License-Identifier: GPL-2.0-only
9 - ``BPF_MAP_TYPE_LPM_TRIE`` was introduced in kernel version 4.11
19 of 8, in the range from 8 to 2048. The key used for lookup and update
23 - For IPv4 addresses the data length is 4 bytes
24 - For IPv6 addresses the data length is 16 bytes
36 ----------
41 .. code-block:: c
43 void *bpf_map_lookup_elem(struct bpf_map *map, const void *key)
47 value associated with the longest matching ``key``, or ``NULL`` if no
50 The ``key`` should have ``prefixlen`` set to ``max_prefixlen`` when
58 .. code-block:: c
60 long bpf_map_update_elem(struct bpf_map *map, const void *key, const void *value, u64 flags)
75 .. code-block:: c
77 long bpf_map_delete_elem(struct bpf_map *map, const void *key)
84 ---------
92 .. code-block:: c
97 libbpf's ``bpf_map_get_next_key()`` function. The first key can be
99 ``NULL``. Subsequent calls will fetch the next key that follows the
100 current key. ``bpf_map_get_next_key()`` returns ``0`` on success,
101 ``-ENOENT`` if ``cur_key`` is the last key in the trie, or negative
112 of LPM trie usage from userspace. The code snippets below demonstrate
116 ----------
118 The following BPF code snippet shows how to declare a new LPM trie for IPv4
121 .. code-block:: c
133 __type(key, struct ipv4_lpm_key);
139 The following BPF code snippet shows how to lookup by IPv4 address:
141 .. code-block:: c
145 struct ipv4_lpm_key key = {
150 return bpf_map_lookup_elem(&ipv4_lpm_map, &key);
154 ---------
159 .. code-block:: c
174 .. code-block:: c
193 /* Use key and value here */