Skip to content

Follow-up BPF helper improvements

Daniel Borkmann bpf netdev 6 versions – Applied

Status from this message: This series was applied to bpf/bpf-next.git (refs/heads/master):

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v6 Latest6 patches 5 repliesApplied 6/6
  2. v56 patches 2 repliesSuperseded
  3. v46 patches 3 repliesSuperseded
Earlier versions · 3
VersionPostedPatchesRepliesStatus
v36 patches2 repliesSuperseded
v26 patches4 repliesSuperseded
v16 patches4 repliesSuperseded

Changes in v6 from the cover letter

- Going with Andrii's suggestion to make the misconfigured verifier test more robust, and only probe on -EOPNOTSUPP (Andrii)

Patches in v6 All 6 applied

#Subject and filesSizeRepliesApplied
1/6bpf: improve bpf_redirect_neigh helper descriptioninclude/uapi/linux/bpf.h tools/include/uapi/linux/bpf.h+14 -60 repliesApplied
2/6bpf: add redirect_peer helperdrivers/net/veth.c include/linux/netdevice.h include/uapi/linux/bpf.h +3 more+106 -104 repliesApplied
3/6bpf: allow for map-in-map with dynamic inner array map entriesinclude/linux/bpf.h include/uapi/linux/bpf.h kernel/bpf/arraymap.c +4 more+26 -131 replyApplied
4/6bpf, selftests: add test for different array inner map sizetools/testing/selftests/bpf/prog_tests/btf_map_in_map.c tools/testing/selftests/bpf/progs/test_btf_map_in_map.c+72 -100 repliesApplied
5/6bpf, selftests: make redirect_neigh test more extensibletools/testing/selftests/bpf/progs/test_tc_neigh.c tools/testing/selftests/bpf/test_tc_neigh.sh tools/testing/selftests/bpf/test_tc_redirect.sh+219 -1860 repliesApplied
6/6bpf, selftests: add redirect_peer selftesttools/testing/selftests/bpf/progs/test_tc_peer.c tools/testing/selftests/bpf/test_tc_redirect.sh+61 -90 repliesApplied

Reviews trailers per patch

4 of 6 patches have a Reviewed-by or Acked-by.

PatchDavid AhernYonghong SongAndrii Nakryiko
1/6R-b
2/6
3/6A-b
4/6A-b
5/6A-b
6/6

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 3 reviewers.

Read the v6 thread

Cover letter [PATCH bpf-next v6 0/6] Follow-up BPF helper improvements

This series addresses most of the feedback [0] that was to be followed up from the last series, that is, UAPI helper comment improvements and getting rid of the ifindex obj file hacks in the selftest by using a BPF map instead. The __sk_buff data/data_end pointer work, I'm planning to do in a later round as well as the mem*() BPF improvements we have in Cilium for libbpf. Next, the series adds two features, i) a helper called redirect_peer() to improve latency on netns switch, and ii) to allow map in map with dynamic inner array map sizes. Selftests for each are added as well. For details, please check individual patches, thanks!

[0] https://lore.kernel.org/bpf/[email protected]/

v5 -> v6:
- Going with Andrii's suggestion to make the misconfigured verifier test more robust, and only probe on -EOPNOTSUPP (Andrii)
v4 -> v5:
- Replace cnt == -EOPNOTSUPP check with cnt < 0; I've used < 0 here as I think it's useful to keep the existing cnt == 0 || cnt >= ARRAY_SIZE(insn_buf) for error detection (Andrii)
v3 -> v4:
- Rename new array map flag to BPF_F_INNER_MAP (Alexei)
v2 -> v3:
- Remove tab that slipped into uapi helper desc (Jakub)
- Rework map in map for array to error from map_gen_lookup (Andrii)
v1 -> v2:
- Fixed selftest comment wrt inner1/inner2 value (Yonghong)

Daniel Borkmann (6):
bpf: improve bpf_redirect_neigh helper description
bpf: add redirect_peer helper
bpf: allow for map-in-map with dynamic inner array map entries bpf, selftests: add test for different array inner map size bpf, selftests: make redirect_neigh test more extensible bpf, selftests: add redirect_peer selftest

 drivers/net/veth.c                            |   9 +
 include/linux/bpf.h                           |   2 +-
 include/linux/netdevice.h                     |   4 +
 include/uapi/linux/bpf.h                      |  30 ++-
 kernel/bpf/arraymap.c                         |  17 +-
 kernel/bpf/hashtab.c                          |   6 +-
 kernel/bpf/verifier.c                         |   6 +-
 net/core/dev.c                                |  15 +-
 net/core/filter.c                             |  54 ++++-
 net/xdp/xskmap.c                              |   2 +-
 tools/include/uapi/linux/bpf.h                |  30 ++-
 .../selftests/bpf/prog_tests/btf_map_in_map.c |  39 +++-
 .../selftests/bpf/progs/test_btf_map_in_map.c |  43 ++++
 .../selftests/bpf/progs/test_tc_neigh.c       |  40 ++--
 .../selftests/bpf/progs/test_tc_peer.c        |  45 ++++
 tools/testing/selftests/bpf/test_tc_neigh.sh  | 168 ---------------
 .../testing/selftests/bpf/test_tc_redirect.sh | 204 ++++++++++++++++++
 17 files changed, 489 insertions(+), 225 deletions(-)
 create mode 100644 tools/testing/selftests/bpf/progs/test_tc_peer.c
 delete mode 100755 tools/testing/selftests/bpf/test_tc_neigh.sh
 create mode 100755 tools/testing/selftests/bpf/test_tc_redirect.sh
Signature · 1 line
2.17.1