netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH bpf-next 0/3] xdp: Add devmap_hash map type
@ 2019-07-05 17:56 Toke Høiland-Jørgensen
  2019-07-05 17:56 ` [PATCH bpf-next 1/3] include/bpf.h: Remove map_insert_ctx() stubs Toke Høiland-Jørgensen
                   ` (3 more replies)
  0 siblings, 4 replies; 11+ messages in thread
From: Toke Høiland-Jørgensen @ 2019-07-05 17:56 UTC (permalink / raw)
  To: Daniel Borkmann
  Cc: Alexei Starovoitov, netdev, David Miller, Jesper Dangaard Brouer,
	Jakub Kicinski, Björn Töpel

This series adds a new map type, devmap_hash, that works like the existing
devmap type, but using a hash-based indexing scheme. This is useful for the use
case where a devmap is indexed by ifindex (for instance for use with the routing
table lookup helper). For this use case, the regular devmap needs to be sized
after the maximum ifindex number, not the number of devices in it. A hash-based
indexing scheme makes it possible to size the map after the number of devices it
should contain instead.

This was previously part of my patch series that also turned the regular
bpf_redirect() helper into a map-based one; for this series I just pulled out
the patches that introduced the new map type.

Changelog:

Changes to these patches since the previous series:

- Rebase on top of the other devmap changes (makes this one simpler!)
- Don't enforce key==val, but allow arbitrary indexes.
- Rename the type to devmap_hash to reflect the fact that it's just a hashmap now.

---

Toke Høiland-Jørgensen (3):
      include/bpf.h: Remove map_insert_ctx() stubs
      xdp: Refactor devmap allocation code for reuse
      xdp: Add devmap_hash map type for looking up devices by hashed index


 include/linux/bpf.h                     |   11 -
 include/linux/bpf_types.h               |    1 
 include/trace/events/xdp.h              |    3 
 include/uapi/linux/bpf.h                |    7 -
 kernel/bpf/devmap.c                     |  325 ++++++++++++++++++++++++++-----
 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, 316 insertions(+), 67 deletions(-)


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2019-07-08 16:50 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-05 17:56 [PATCH bpf-next 0/3] xdp: Add devmap_hash map type Toke Høiland-Jørgensen
2019-07-05 17:56 ` [PATCH bpf-next 1/3] include/bpf.h: Remove map_insert_ctx() stubs Toke Høiland-Jørgensen
2019-07-05 17:56 ` [PATCH bpf-next 3/3] xdp: Add devmap_hash map type for looking up devices by hashed index Toke Høiland-Jørgensen
2019-07-05 22:04   ` Y Song
2019-07-06  8:41     ` Toke Høiland-Jørgensen
2019-07-05 17:56 ` [PATCH bpf-next 2/3] xdp: Refactor devmap allocation code for reuse Toke Høiland-Jørgensen
2019-07-08 15:06   ` Jonathan Lemon
2019-07-08 15:19     ` Toke Høiland-Jørgensen
2019-07-08 15:10 ` [PATCH bpf-next 0/3] xdp: Add devmap_hash map type Jonathan Lemon
2019-07-08 15:40   ` Toke Høiland-Jørgensen
2019-07-08 16:50     ` Jonathan Lemon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).