]> git.baikalelectronics.ru Git - kernel.git/commit
xdp: Add devmap_hash map type for looking up devices by hashed index
authorToke Høiland-Jørgensen <toke@redhat.com>
Fri, 26 Jul 2019 16:06:55 +0000 (18:06 +0200)
committerAlexei Starovoitov <ast@kernel.org>
Mon, 29 Jul 2019 20:50:48 +0000 (13:50 -0700)
commit2673494e004953db4c4d54474697efe78cef1648
tree770905d84a709ad9407b82d445d4a88343f3c9c6
parenta8c0e5aea746f5ad83ceb30af7854eb62aceda4e
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>
include/linux/bpf.h
include/linux/bpf_types.h
include/trace/events/xdp.h
include/uapi/linux/bpf.h
kernel/bpf/devmap.c
kernel/bpf/verifier.c
net/core/filter.c