From: Geliang Tang <geliang.tang@suse.com>
To: mptcp@lists.linux.dev
Cc: Geliang Tang <geliang.tang@suse.com>
Subject: [PATCH mptcp-next v3 5/5] selftests/bpf: Add bpf_red test
Date: Sun, 5 Jun 2022 21:29:40 +0800 [thread overview]
Message-ID: <dd9799cf2ef5365fa38bdd10ae831034b91d1d38.1654435294.git.geliang.tang@suse.com> (raw)
In-Reply-To: <cover.1654435294.git.geliang.tang@suse.com>
This patch adds the redundant BPF MPTCP scheduler test. Use sysctl to
set net.mptcp.scheduler to use this sched.
Signed-off-by: Geliang Tang <geliang.tang@suse.com>
---
.../testing/selftests/bpf/prog_tests/mptcp.c | 35 +++++++++++++++++++
1 file changed, 35 insertions(+)
diff --git a/tools/testing/selftests/bpf/prog_tests/mptcp.c b/tools/testing/selftests/bpf/prog_tests/mptcp.c
index 1ecc8a2b76b6..e321cd046368 100644
--- a/tools/testing/selftests/bpf/prog_tests/mptcp.c
+++ b/tools/testing/selftests/bpf/prog_tests/mptcp.c
@@ -9,6 +9,7 @@
#include "mptcp_bpf_first.skel.h"
#include "mptcp_bpf_bkup.skel.h"
#include "mptcp_bpf_rr.skel.h"
+#include "mptcp_bpf_red.skel.h"
#ifndef TCP_CA_NAME_MAX
#define TCP_CA_NAME_MAX 16
@@ -362,6 +363,38 @@ static void test_rr(void)
mptcp_bpf_rr__destroy(rr_skel);
}
+static void test_red(void)
+{
+ struct mptcp_bpf_red *red_skel;
+ int server_fd, client_fd;
+ 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;
+ }
+
+ add_veth();
+ system("ip mptcp endpoint add 10.0.1.1 subflow");
+ system("sysctl -qw net.mptcp.scheduler=bpf_red");
+ 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_red__destroy(red_skel);
+}
+
void test_mptcp(void)
{
if (test__start_subtest("base"))
@@ -372,4 +405,6 @@ void test_mptcp(void)
test_bkup();
if (test__start_subtest("rr"))
test_rr();
+ if (test__start_subtest("red"))
+ test_red();
}
--
2.34.1
next prev parent reply other threads:[~2022-06-05 13:30 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-05 13:29 [PATCH mptcp-next v3 0/5] BPF redundant scheduler Geliang Tang
2022-06-05 13:29 ` [PATCH mptcp-next v3 1/5] Squash to "mptcp: add get_subflow wrappers" Geliang Tang
2022-06-05 13:29 ` [PATCH mptcp-next v3 2/5] mptcp: add __mptcp_sched_get_retrans wrapper Geliang Tang
2022-06-05 13:29 ` [PATCH mptcp-next v3 3/5] mptcp: add mptcp_sched_get_send wrapper Geliang Tang
2022-06-05 13:29 ` [PATCH mptcp-next v3 4/5] selftests/bpf: Add bpf_red scheduler Geliang Tang
2022-06-05 13:29 ` Geliang Tang [this message]
2022-06-05 15:41 ` selftests/bpf: Add bpf_red test: Tests Results MPTCP CI
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=dd9799cf2ef5365fa38bdd10ae831034b91d1d38.1654435294.git.geliang.tang@suse.com \
--to=geliang.tang@suse.com \
--cc=mptcp@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).