From a081320a5952099f70427e64d6689397004133e6 Mon Sep 17 00:00:00 2001 From: Geliang Tang Date: Wed, 10 Apr 2024 10:05:24 +0800 Subject: [PATCH] Squash to "selftests/bpf: Add bpf_burst scheduler & test" After squashing into this change, the patch "selftests/bpf: Add bpf_burst test" can be merged into the patch "selftests/bpf: Add bpf_burst scheduler" appending the following lines into commit log: ''' Using MPTCP_SCHED_TEST macro to add a new test for this bpf_burst scheduler, the arguments "1 1" means data has been sent on both net devices. Run this test by RUN_MPTCP_TEST macro. ''' And update the subject to "selftests/bpf: Add bpf_burst scheduler & test". Signed-off-by: Geliang Tang --- .../testing/selftests/bpf/prog_tests/mptcp.c | 39 +------------------ .../selftests/bpf/progs/mptcp_bpf_burst.c | 1 + 2 files changed, 3 insertions(+), 37 deletions(-) diff --git a/tools/testing/selftests/bpf/prog_tests/mptcp.c b/tools/testing/selftests/bpf/prog_tests/mptcp.c index 527cccd96ba56c..9a9964e41cba2c 100644 --- a/tools/testing/selftests/bpf/prog_tests/mptcp.c +++ b/tools/testing/selftests/bpf/prog_tests/mptcp.c @@ -534,41 +534,7 @@ MPTCP_SCHED_TEST(first, WITH_DATA, WITHOUT_DATA); MPTCP_SCHED_TEST(bkup, WITH_DATA, WITHOUT_DATA); MPTCP_SCHED_TEST(rr, WITH_DATA, WITH_DATA); MPTCP_SCHED_TEST(red, WITH_DATA, WITH_DATA); - -static void test_burst(void) -{ - struct mptcp_bpf_burst *burst_skel; - int server_fd, client_fd; - struct nstoken *nstoken; - struct bpf_link *link; - - burst_skel = mptcp_bpf_burst__open_and_load(); - if (!ASSERT_OK_PTR(burst_skel, "bpf_burst__open_and_load")) - return; - - link = bpf_map__attach_struct_ops(burst_skel->maps.burst); - if (!ASSERT_OK_PTR(link, "bpf_map__attach_struct_ops")) { - mptcp_bpf_burst__destroy(burst_skel); - return; - } - - nstoken = sched_init("subflow", "bpf_burst"); - if (!ASSERT_OK_PTR(nstoken, "sched_init:bpf_burst")) - 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_burst"); - 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_burst__destroy(burst_skel); -} +MPTCP_SCHED_TEST(burst, WITH_DATA, WITH_DATA); #define RUN_MPTCP_TEST(suffix) \ do { \ @@ -585,6 +551,5 @@ void test_mptcp(void) RUN_MPTCP_TEST(bkup); RUN_MPTCP_TEST(rr); RUN_MPTCP_TEST(red); - if (test__start_subtest("burst")) - test_burst(); + RUN_MPTCP_TEST(burst); } diff --git a/tools/testing/selftests/bpf/progs/mptcp_bpf_burst.c b/tools/testing/selftests/bpf/progs/mptcp_bpf_burst.c index b3c8115648667f..6b79267562f1c8 100644 --- a/tools/testing/selftests/bpf/progs/mptcp_bpf_burst.c +++ b/tools/testing/selftests/bpf/progs/mptcp_bpf_burst.c @@ -1,5 +1,6 @@ // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2023, SUSE. */ +/* Copyright (c) 2024, Kylin Software */ #include #include