Y Song <ys114...@gmail.com> writes: > On Fri, Jul 5, 2019 at 11:14 AM Toke Høiland-Jørgensen <t...@redhat.com> > wrote: >> >> From: Toke Høiland-Jørgensen <t...@redhat.com> >> >> 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 <t...@redhat.com> >> --- >> include/linux/bpf.h | 7 + >> include/linux/bpf_types.h | 1 >> include/trace/events/xdp.h | 3 >> include/uapi/linux/bpf.h | 7 + >> kernel/bpf/devmap.c | 192 >> +++++++++++++++++++++++++++++++ >> kernel/bpf/verifier.c | 2 >> net/core/filter.c | 9 + >> tools/bpf/bpftool/map.c | 1 >> tools/include/uapi/linux/bpf.h | 7 + >> tools/lib/bpf/libbpf_probes.c | 1 >> tools/testing/selftests/bpf/test_maps.c | 16 +++ >> 11 files changed, 237 insertions(+), 9 deletions(-) > > Could you break this patch into multiple commits for easy backporting > and easy syncing to libbpf repo? > For example, you can break it into 4 patches: > . kernel patch > . sync uapi bpf.h > . tools/lib/bpf/libbpf_probes.c > . other tools changes.
Sure, I'll send a v2. -Toke