netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH bpf v2 0/3] bpf: Rework bpf_redirect_neigh() to allow supplying nexthop from caller
@ 2020-10-20 10:51 Toke Høiland-Jørgensen
  2020-10-20 10:51 ` [PATCH bpf v2 1/3] bpf_redirect_neigh: Support supplying the nexthop as a helper parameter Toke Høiland-Jørgensen
                   ` (2 more replies)
  0 siblings, 3 replies; 19+ messages in thread
From: Toke Høiland-Jørgensen @ 2020-10-20 10:51 UTC (permalink / raw)
  To: Daniel Borkmann; +Cc: David Ahern, netdev, bpf

Based on previous discussion[0], we determined that it would be beneficial to
rework bpf_redirect_neigh() so the caller can supply the nexthop information
(e.g., from a previous call to bpf_fib_lookup()). This way, the two helpers can
be combined without incurring a second FIB lookup to find the nexthop, and
bpf_fib_lookup() becomes usable even if no nexthop entry currently exists.

This patch (and accompanying selftest update) accomplishes this by way of an
optional paramter to bpf_redirect_neigh(). This series is against the -bpf tree,
since we need to change this call signature before it becomes API. As a
companion change, it also adds a flag to bpf_fib_lookup() that will make it skip
the neighbour lookup, for cases where the caller knows it is likely for fail
anyway, and wants to go straight to bpf_redirect_neigh().

[0] https://lore.kernel.org/bpf/393e17fc-d187-3a8d-2f0d-a627c7c63fca@iogearbox.net/

Changelog:

v2:
- Add 'unused' member to fill hole in bpf_redir_neigh struct (David Ahern)
- Fix compilation with INET/INET6 disabled - properly this time (kbot)
- Add back the BPF_FIB_LOOKUP_SKIP_NEIGH flag as new patch 2 (Daniel)

v1:
- Rebase on -bpf tree
- Fix compilation with INET/INET6 disabled (kbot)
- Keep v4/v6 signatures similar, use internal flag (Daniel)
- Use a separate selftest BPF program instead of modifying existing one (Daniel)
- Fix a few style nits (David Ahern)

---

Toke Høiland-Jørgensen (3):
      bpf_redirect_neigh: Support supplying the nexthop as a helper parameter
      bpf_fib_lookup: optionally skip neighbour lookup
      selftests: Update test_tc_redirect.sh to use the modified bpf_redirect_neigh()


 include/uapi/linux/bpf.h                      |  10 +-
 net/core/filter.c                             |  16 +-
 tools/include/uapi/linux/bpf.h                |  10 +-
 .../selftests/bpf/progs/test_tc_neigh.c       |   5 +-
 .../selftests/bpf/progs/test_tc_neigh_fib.c   | 153 ++++++++++++++++++
 .../testing/selftests/bpf/test_tc_redirect.sh |  18 ++-
 6 files changed, 197 insertions(+), 15 deletions(-)
 create mode 100644 tools/testing/selftests/bpf/progs/test_tc_neigh_fib.c


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

end of thread, other threads:[~2020-10-20 19:47 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-20 10:51 [PATCH bpf v2 0/3] bpf: Rework bpf_redirect_neigh() to allow supplying nexthop from caller Toke Høiland-Jørgensen
2020-10-20 10:51 ` [PATCH bpf v2 1/3] bpf_redirect_neigh: Support supplying the nexthop as a helper parameter Toke Høiland-Jørgensen
2020-10-20 15:08   ` Daniel Borkmann
2020-10-20 18:08     ` Toke Høiland-Jørgensen
2020-10-20 16:30   ` Jakub Kicinski
2020-10-20 18:08     ` Toke Høiland-Jørgensen
2020-10-20 19:01       ` Jakub Kicinski
2020-10-20 19:47         ` Daniel Borkmann
2020-10-20 18:12     ` David Ahern
2020-10-20 18:56       ` Jakub Kicinski
2020-10-20 16:34   ` Jakub Kicinski
2020-10-20 18:03     ` Toke Høiland-Jørgensen
2020-10-20 18:14       ` David Ahern
2020-10-20 18:50         ` Jakub Kicinski
2020-10-20 10:51 ` [PATCH bpf v2 2/3] bpf_fib_lookup: optionally skip neighbour lookup Toke Høiland-Jørgensen
2020-10-20 13:49   ` David Ahern
2020-10-20 15:04     ` Daniel Borkmann
2020-10-20 18:10       ` Toke Høiland-Jørgensen
2020-10-20 10:51 ` [PATCH bpf v2 3/3] selftests: Update test_tc_redirect.sh to use the modified bpf_redirect_neigh() Toke Høiland-Jørgensen

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).