bpf: make bpf_skb_ecn_set_ce callable from BPF_PROG_TYPE_SCHED_ACT
Subsystems (6)
PATCH 1/2 bpf: make bpf_skb_ecn_set_ce callable from BPF_PROG_TYPE_SCHED_ACT
This helper is useful if a bpf tc filter sets skb->tstamp.
Signed-off-by Peter Oskolkov <[email protected]>
--- net/core/filter.c | 2 ++ 1 file changed, 2 insertions(+)
net/core/filter.c +2 -0
@@ -5959,6 +5959,8 @@ tc_cls_act_func_proto(enum bpf_func_id func_id, const struct bpf_prog *prog)return &bpf_skc_lookup_tcp_proto;case BPF_FUNC_tcp_check_syncookie:return &bpf_tcp_check_syncookie_proto; +case BPF_FUNC_skb_ecn_set_ce: +return &bpf_skb_ecn_set_ce_proto;#endif default :return bpf_base_func_proto (func_id);
Signature · 1 line
2.21.0.392.gf8f6787159e-goog
PATCH 2/2 selftests: bpf: tc-bpf flow shaping with EDT
Add a small test that shows how to shape a TCP flow in tc-bpf with EDT and ECN.
Signed-off-by Peter Oskolkov <[email protected]>
--- tools/testing/selftests/bpf/Makefile | 3 +- .../testing/selftests/bpf/progs/test_tc_edt.c | 109 ++++++++++++++++++ tools/testing/selftests/bpf/test_tc_edt.sh | 99 ++++++++++++++++ 3 files changed, 210 insertions(+), 1 deletion(-) create mode 100644 tools/testing/selftests/bpf/progs/test_tc_edt.c create mode 100755 tools/testing/selftests/bpf/test_tc_edt.sh
tools/testing/selftests/bpf/Makefile +2 -1
@@ -53,7 +53,8 @@ TEST_PROGS := test_kmod.sh \ test_xdp_vlan.sh \ test_lwt_ip_encap.sh \ test_tcp_check_syncookie.sh \ - test_tc_tunnel.sh + test_tc_tunnel.sh \ + test_tc_edt.sh TEST_PROGS_EXTENDED := with_addr.sh \ with_tunnels.sh \
tools/testing/selftests/bpf/progs/test_tc_edt.c new file +109 -0
109 lines not on this page · raw message
tools/testing/selftests/bpf/test_tc_edt.sh new file +99 -0
99 lines not on this page · raw message
Signature · 1 line
2.21.0.392.gf8f6787159e-goog
Alexei Starovoitov
AppliedRe: [PATCH bpf-next 2/2] selftests: bpf: tc-bpf flow shaping with EDT
Quoted 4 lines · Peter Oskolkov
Add a small test that shows how to shape a TCP flow in tc-bpf with EDT and ECN.
Signed-off-by Peter Oskolkov <[email protected]>
...
tools/testing/selftests/bpf/test_tc_edt.sh line 75
Quoted 2 lines
tools/testing/selftests/bpf/test_tc_edt.sh new file +2
-0+ip netns exec ${NS_SRC} bash -c "timeout ${TIMEOUT} dd if=/dev/zero \ + bs=1000 count=1000000 > /dev/tcp/${IP_DST}/9000 2>/dev/null"
just noticed this trick here and in lwt. Didn't know bash can do it. Nice!
Applied to bpf-next. thanks!