Skip to content

Commit

Permalink
Squash to "selftests/bpf: Add bpf_rr scheduler & test"
Browse files Browse the repository at this point in the history
After squashing into this change, the patch "selftests/bpf: Add bpf_rr
test" can be merged into the patch "selftests/bpf: Add bpf_rr scheduler"
appending the following lines into commit log:

'''
Using MPTCP_SCHED_TEST macro to add a new test for this bpf_rr
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_rr scheduler & test".

Signed-off-by: Geliang Tang <[email protected]>
  • Loading branch information
Geliang Tang authored and intel-lab-lkp committed Apr 10, 2024
1 parent 8f2df5d commit c7e21d1
Show file tree
Hide file tree
Showing 2 changed files with 3 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 @@ -532,41 +532,7 @@ skel_destroy: \

MPTCP_SCHED_TEST(first, WITH_DATA, WITHOUT_DATA);
MPTCP_SCHED_TEST(bkup, WITH_DATA, WITHOUT_DATA);

static void test_rr(void)
{
struct mptcp_bpf_rr *rr_skel;
int server_fd, client_fd;
struct nstoken *nstoken;
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;
}

nstoken = sched_init("subflow", "bpf_rr");
if (!ASSERT_OK_PTR(nstoken, "sched_init:bpf_rr"))
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_rr");
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_rr__destroy(rr_skel);
}
MPTCP_SCHED_TEST(rr, WITH_DATA, WITH_DATA);

static void test_red(void)
{
Expand Down Expand Up @@ -651,8 +617,7 @@ void test_mptcp(void)
RUN_MPTCP_TEST(default);
RUN_MPTCP_TEST(first);
RUN_MPTCP_TEST(bkup);
if (test__start_subtest("rr"))
test_rr();
RUN_MPTCP_TEST(rr);
if (test__start_subtest("red"))
test_red();
if (test__start_subtest("burst"))
Expand Down
1 change: 1 addition & 0 deletions tools/testing/selftests/bpf/progs/mptcp_bpf_rr.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// SPDX-License-Identifier: GPL-2.0
/* Copyright (c) 2022, SUSE. */
/* Copyright (c) 2024, Kylin Software */

#include <linux/bpf.h>
#include "bpf_tcp_helpers.h"
Expand Down

0 comments on commit c7e21d1

Please sign in to comment.