diff --git a/tools/testing/selftests/bpf/prog_tests/mptcp.c b/tools/testing/selftests/bpf/prog_tests/mptcp.c index 492a8b5de64fe5..527cccd96ba56c 100644 --- a/tools/testing/selftests/bpf/prog_tests/mptcp.c +++ b/tools/testing/selftests/bpf/prog_tests/mptcp.c @@ -533,41 +533,7 @@ skel_destroy: \ MPTCP_SCHED_TEST(first, WITH_DATA, WITHOUT_DATA); MPTCP_SCHED_TEST(bkup, WITH_DATA, WITHOUT_DATA); MPTCP_SCHED_TEST(rr, WITH_DATA, WITH_DATA); - -static void test_red(void) -{ - struct mptcp_bpf_red *red_skel; - int server_fd, client_fd; - struct nstoken *nstoken; - struct bpf_link *link; - - red_skel = mptcp_bpf_red__open_and_load(); - if (!ASSERT_OK_PTR(red_skel, "bpf_red__open_and_load")) - return; - - link = bpf_map__attach_struct_ops(red_skel->maps.red); - if (!ASSERT_OK_PTR(link, "bpf_map__attach_struct_ops")) { - mptcp_bpf_red__destroy(red_skel); - return; - } - - nstoken = sched_init("subflow", "bpf_red"); - if (!ASSERT_OK_PTR(nstoken, "sched_init:bpf_red")) - goto fail; - server_fd = start_mptcp_server(AF_INET, ADDR_1, PORT_1, 0); - client_fd = connect_to_fd(server_fd, 0); - - send_data(server_fd, client_fd, "bpf_red"); - ASSERT_OK(has_bytes_sent(ADDR_1), "has_bytes_sent addr 1"); - ASSERT_OK(has_bytes_sent(ADDR_2), "has_bytes_sent addr 2"); - - close(client_fd); - close(server_fd); -fail: - cleanup_netns(nstoken); - bpf_link__destroy(link); - mptcp_bpf_red__destroy(red_skel); -} +MPTCP_SCHED_TEST(red, WITH_DATA, WITH_DATA); static void test_burst(void) { @@ -618,8 +584,7 @@ void test_mptcp(void) RUN_MPTCP_TEST(first); RUN_MPTCP_TEST(bkup); RUN_MPTCP_TEST(rr); - if (test__start_subtest("red")) - test_red(); + RUN_MPTCP_TEST(red); if (test__start_subtest("burst")) test_burst(); } diff --git a/tools/testing/selftests/bpf/progs/mptcp_bpf_red.c b/tools/testing/selftests/bpf/progs/mptcp_bpf_red.c index a3f3e5ca5278f6..62cba8f2d9369c 100644 --- a/tools/testing/selftests/bpf/progs/mptcp_bpf_red.c +++ b/tools/testing/selftests/bpf/progs/mptcp_bpf_red.c @@ -1,5 +1,6 @@ // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2022, SUSE. */ +/* Copyright (c) 2024, Kylin Software */ #include #include "bpf_tcp_helpers.h"