diff --git a/tools/testing/selftests/bpf/prog_tests/mptcp.c b/tools/testing/selftests/bpf/prog_tests/mptcp.c index f3c73cd2c7860..1ecc8a2b76b63 100644 --- a/tools/testing/selftests/bpf/prog_tests/mptcp.c +++ b/tools/testing/selftests/bpf/prog_tests/mptcp.c @@ -8,6 +8,7 @@ #include "mptcp_sock.skel.h" #include "mptcp_bpf_first.skel.h" #include "mptcp_bpf_bkup.skel.h" +#include "mptcp_bpf_rr.skel.h" #ifndef TCP_CA_NAME_MAX #define TCP_CA_NAME_MAX 16 @@ -329,6 +330,38 @@ static void test_bkup(void) mptcp_bpf_bkup__destroy(bkup_skel); } +static void test_rr(void) +{ + struct mptcp_bpf_rr *rr_skel; + int server_fd, client_fd; + struct bpf_link *link; + + rr_skel = mptcp_bpf_rr__open_and_load(); + if (!ASSERT_OK_PTR(rr_skel, "bpf_rr__open_and_load")) + return; + + link = bpf_map__attach_struct_ops(rr_skel->maps.rr); + if (!ASSERT_OK_PTR(link, "bpf_map__attach_struct_ops")) { + mptcp_bpf_rr__destroy(rr_skel); + return; + } + + add_veth(); + system("ip mptcp endpoint add 10.0.1.1 subflow"); + system("sysctl -qw net.mptcp.scheduler=bpf_rr"); + server_fd = start_mptcp_server(AF_INET, NULL, 0, 0); + client_fd = connect_to_fd(server_fd, 0); + + send_data(server_fd, client_fd); + ASSERT_OK(system("ss -MOenita | grep '10.0.1.1' | grep -q 'bytes_sent:'"), "ss"); + + close(client_fd); + close(server_fd); + cleanup(); + bpf_link__destroy(link); + mptcp_bpf_rr__destroy(rr_skel); +} + void test_mptcp(void) { if (test__start_subtest("base")) @@ -337,4 +370,6 @@ void test_mptcp(void) test_first(); if (test__start_subtest("bkup")) test_bkup(); + if (test__start_subtest("rr")) + test_rr(); }