Skip to content

Commit

Permalink
Squash to "selftests/bpf: Add bpf_burst test"
Browse files Browse the repository at this point in the history
Signed-off-by: Geliang Tang <[email protected]>
  • Loading branch information
Geliang Tang authored and intel-lab-lkp committed Mar 27, 2024
1 parent e5d255b commit f535374
Showing 1 changed file with 2 additions and 37 deletions.
39 changes: 2 additions & 37 deletions tools/testing/selftests/bpf/prog_tests/mptcp.c
Original file line number Diff line number Diff line change
Expand Up @@ -607,41 +607,7 @@ SCHED_TEST(first, 0);
SCHED_TEST(bkup, 0);
SCHED_TEST(rr, 1);
SCHED_TEST(red, 1);

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);
}
SCHED_TEST(burst, 1);

#define RUN_MPTCP_TEST(suffix) \
do { \
Expand All @@ -659,6 +625,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);
}

0 comments on commit f535374

Please sign in to comment.