Skip to content

bpf: Network Resource Manager (NRM)

brakmo netdev 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest9 patches 19 repliesIn review
  2. v19 patches 16 repliesSuperseded

Changes in v2 from the cover letter

* bpf_tcp_enter_cwr can only be called from a cgroup skb egress BPF program (otherwise load or attach will fail) where we already hold the sk lock. Also only applies for ESTABLISHED state.
* bpf_skb_ecn_set_ce uses INET_ECN_set_ce()
* bpf_tcp_check_probe_timer now uses tcp_reset_xmit_timer. Can only be used by egress cgroup skb programs.
* removed load_cg_skb user program.
* nrm bpf egress program checks packet header in skb to determine ECN value. Now also works for ECN enabled UDP packets. Using ECN_ defines instead of integers.
* NRM script test program now uses bpftool instead of load_cg_skb

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/9bpf: Remove const from get_func_protodrivers/media/rc/bpf-lirc.c include/linux/bpf.h kernel/bpf/cgroup.c +2 more+23 -230 replies
2/9bpf: Add bpf helper bpf_tcp_enter_cwrinclude/linux/bpf.h include/linux/filter.h include/uapi/linux/bpf.h +3 more+52 -27 replies
3/9bpf: Test bpf_tcp_enter_cwr in test_verifiertools/testing/selftests/bpf/verifier/sock.c+33 -00 replies
4/9bpf: add bpf helper bpf_skb_ecn_set_ceinclude/uapi/linux/bpf.h net/core/filter.c+23 -14 replies
5/9bpf: Add bpf helper bpf_tcp_check_probe_timerinclude/uapi/linux/bpf.h net/core/filter.c+43 -10 replies
6/9bpf: sync bpf.h to tools and update bpf_helpers.htools/include/uapi/linux/bpf.h tools/testing/selftests/bpf/bpf_helpers.h+32 -10 replies
7/9bpf: Sample NRM BPF program to limit egress bwsamples/bpf/Makefile samples/bpf/nrm.h samples/bpf/nrm_kern.h +1 more+360 -00 replies
8/9bpf: User program for testing NRMsamples/bpf/Makefile samples/bpf/nrm.c+443 -00 replies
9/9bpf: NRM test scriptsamples/bpf/do_nrm_test.sh+437 -00 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

Cover letter [PATCH v2 bpf-next 0/9] bpf: Network Resource Manager (NRM)

Network Resource Manager is a framework for limiting the bandwidth used by v2 cgroups. It consists of 4 BPF helpers and a sample BPF program to limit egress bandwdith as well as a sample user program and script to simplify NRM testing.

The sample NRM BPF program is not meant to be production quality, it is provided as proof of concept. A lot more information, including sample runs in some cases, are provided in the commit messages of the individual patches.

Two more BPF programs, one to limit ingress and one that limits egress and uses fq's Earliest Departure Time feature (EDT), will be provided in an upcomming patchset.

Changes from v1 to v2:
* bpf_tcp_enter_cwr can only be called from a cgroup skb egress BPF program (otherwise load or attach will fail) where we already hold the sk lock. Also only applies for ESTABLISHED state.
* bpf_skb_ecn_set_ce uses INET_ECN_set_ce()
* bpf_tcp_check_probe_timer now uses tcp_reset_xmit_timer. Can only be used by egress cgroup skb programs.
* removed load_cg_skb user program.
* nrm bpf egress program checks packet header in skb to determine ECN value. Now also works for ECN enabled UDP packets. Using ECN_ defines instead of integers.
* NRM script test program now uses bpftool instead of load_cg_skb

Martin KaFai Lau (2):
bpf: Remove const from get_func_proto
bpf: Add bpf helper bpf_tcp_enter_cwr

brakmo (7):
bpf: Test bpf_tcp_enter_cwr in test_verifier
bpf: add bpf helper bpf_skb_ecn_set_ce
bpf: Add bpf helper bpf_tcp_check_probe_timer
bpf: sync bpf.h to tools and update bpf_helpers.h
bpf: Sample NRM BPF program to limit egress bw
bpf: User program for testing NRM
bpf: NRM test script

 drivers/media/rc/bpf-lirc.c                 |   2 +-
 include/linux/bpf.h                         |   3 +-
 include/linux/filter.h                      |   3 +-
 include/uapi/linux/bpf.h                    |  27 +-
 kernel/bpf/cgroup.c                         |   2 +-
 kernel/bpf/syscall.c                        |  12 +
 kernel/bpf/verifier.c                       |   4 +
 kernel/trace/bpf_trace.c                    |  10 +-
 net/core/filter.c                           | 101 ++++-
 samples/bpf/Makefile                        |   5 +
 samples/bpf/do_nrm_test.sh                  | 437 +++++++++++++++++++
 samples/bpf/nrm.c                           | 440 ++++++++++++++++++++
 samples/bpf/nrm.h                           |  31 ++
 samples/bpf/nrm_kern.h                      | 137 ++++++
 samples/bpf/nrm_out_kern.c                  | 190 +++++++++
 tools/include/uapi/linux/bpf.h              |  27 +-
 tools/testing/selftests/bpf/bpf_helpers.h   |   6 +
 tools/testing/selftests/bpf/verifier/sock.c |  33 ++
 18 files changed, 1444 insertions(+), 26 deletions(-)
 create mode 100755 samples/bpf/do_nrm_test.sh
 create mode 100644 samples/bpf/nrm.c
 create mode 100644 samples/bpf/nrm.h
 create mode 100644 samples/bpf/nrm_kern.h
 create mode 100644 samples/bpf/nrm_out_kern.c
Signature · 1 line
2.17.1