diff options
author | Toke Høiland-Jørgensen <toke@redhat.com> | 2019-07-26 12:06:55 -0400 |
---|---|---|
committer | Alexei Starovoitov <ast@kernel.org> | 2019-07-29 16:50:48 -0400 |
commit | 6f9d451ab1a33728adb72d7ff66a7b374d665176 (patch) | |
tree | 770905d84a709ad9407b82d445d4a88343f3c9c6 /include/uapi/linux/bpf.h | |
parent | fca16e51078e8e5c0af839426b3d2dcd2bede135 (diff) |
xdp: Add devmap_hash map type for looking up devices by hashed index
A common pattern when using xdp_redirect_map() is to create a device map
where the lookup key is simply ifindex. Because device maps are arrays,
this leaves holes in the map, and the map has to be sized to fit the
largest ifindex, regardless of how many devices actually are actually
needed in the map.
This patch adds a second type of device map where the key is looked up
using a hashmap, instead of being used as an array index. This allows maps
to be densely packed, so they can be smaller.
Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
Acked-by: Yonghong Song <yhs@fb.com>
Acked-by: Jesper Dangaard Brouer <brouer@redhat.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'include/uapi/linux/bpf.h')
-rw-r--r-- | include/uapi/linux/bpf.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h index e985f07a98ed..6bbef0c7f585 100644 --- a/include/uapi/linux/bpf.h +++ b/include/uapi/linux/bpf.h | |||
@@ -134,6 +134,7 @@ enum bpf_map_type { | |||
134 | BPF_MAP_TYPE_QUEUE, | 134 | BPF_MAP_TYPE_QUEUE, |
135 | BPF_MAP_TYPE_STACK, | 135 | BPF_MAP_TYPE_STACK, |
136 | BPF_MAP_TYPE_SK_STORAGE, | 136 | BPF_MAP_TYPE_SK_STORAGE, |
137 | BPF_MAP_TYPE_DEVMAP_HASH, | ||
137 | }; | 138 | }; |
138 | 139 | ||
139 | /* Note that tracing related programs such as | 140 | /* Note that tracing related programs such as |