From: Mat Martineau <mathew.j.martineau@linux.intel.com>
To: Geliang Tang <geliang.tang@suse.com>
Cc: mptcp@lists.linux.dev
Subject: Re: [PATCH mptcp-next v4 8/8] selftests: bpf: add bpf_first test
Date: Tue, 22 Mar 2022 14:33:14 -0700 (PDT) [thread overview]
Message-ID: <22612f2e-64cc-2268-e1dc-6eb766b9d6ec@linux.intel.com> (raw)
In-Reply-To: <11db7ce5a24b7f38ea835e5d286f7531b3a95929.1647942374.git.geliang.tang@suse.com>
On Tue, 22 Mar 2022, Geliang Tang wrote:
> This patch expended the BPF TCP congestion control tests to support
> MPTCP. Add the bpf_first MPTCP sched test in it. Use sysctl to set
> net.mptcp.scheduler to use this sched.
>
> Signed-off-by: Geliang Tang <geliang.tang@suse.com>
This should definitely be set up as a separate test from bpf_tcp_ca. Ok to
copy the CA tests (explain where it was copied from in the commit
message), and then modify for MPTCP scheduler use.
-Mat
> ---
> .../selftests/bpf/prog_tests/bpf_tcp_ca.c | 42 +++++++++++++++++--
> 1 file changed, 38 insertions(+), 4 deletions(-)
>
> diff --git a/tools/testing/selftests/bpf/prog_tests/bpf_tcp_ca.c b/tools/testing/selftests/bpf/prog_tests/bpf_tcp_ca.c
> index 8f7a1cef7d87..979b6e90b372 100644
> --- a/tools/testing/selftests/bpf/prog_tests/bpf_tcp_ca.c
> +++ b/tools/testing/selftests/bpf/prog_tests/bpf_tcp_ca.c
> @@ -9,6 +9,7 @@
> #include "bpf_cubic.skel.h"
> #include "bpf_tcp_nogpl.skel.h"
> #include "bpf_dctcp_release.skel.h"
> +#include "bpf_first.skel.h"
>
> #define min(a, b) ((a) < (b) ? (a) : (b))
>
> @@ -16,6 +17,10 @@
> #define ENOTSUPP 524
> #endif
>
> +#ifndef IPPROTO_MPTCP
> +#define IPPROTO_MPTCP 262
> +#endif
> +
> static const unsigned int total_bytes = 10 * 1024 * 1024;
> static int expected_stg = 0xeB9F;
> static int stop, duration;
> @@ -85,21 +90,26 @@ static void do_test(const char *tcp_ca, const struct bpf_map *sk_stg_map)
> socklen_t addrlen = sizeof(sa6);
> void *thread_ret;
> char batch[1500];
> + int proto = 0;
> int err;
>
> WRITE_ONCE(stop, 0);
>
> - lfd = socket(AF_INET6, SOCK_STREAM, 0);
> + if (!strcmp(tcp_ca, "bpf_first"))
> + proto = IPPROTO_MPTCP;
> +
> + lfd = socket(AF_INET6, SOCK_STREAM, proto);
> if (CHECK(lfd == -1, "socket", "errno:%d\n", errno))
> return;
> - fd = socket(AF_INET6, SOCK_STREAM, 0);
> + fd = socket(AF_INET6, SOCK_STREAM, proto);
> if (CHECK(fd == -1, "socket", "errno:%d\n", errno)) {
> close(lfd);
> return;
> }
>
> - if (settcpca(lfd, tcp_ca) || settcpca(fd, tcp_ca) ||
> - settimeo(lfd, 0) || settimeo(fd, 0))
> + if (!proto &&
> + (settcpca(lfd, tcp_ca) || settcpca(fd, tcp_ca) ||
> + settimeo(lfd, 0) || settimeo(fd, 0)))
> goto done;
>
> /* bind, listen and start server thread to accept */
> @@ -324,6 +334,28 @@ static void test_rel_setsockopt(void)
> bpf_dctcp_release__destroy(rel_skel);
> }
>
> +static void test_first(void)
> +{
> + struct bpf_first *first_skel;
> + struct bpf_link *link;
> +
> + first_skel = bpf_first__open_and_load();
> + if (CHECK(!first_skel, "bpf_first__open_and_load", "failed\n"))
> + return;
> +
> + link = bpf_map__attach_struct_ops(first_skel->maps.first);
> + if (!ASSERT_OK_PTR(link, "bpf_map__attach_struct_ops")) {
> + bpf_first__destroy(first_skel);
> + return;
> + }
> +
> + system("sysctl -q net.mptcp.scheduler=bpf_first");
> + do_test("bpf_first", NULL);
> +
> + bpf_link__destroy(link);
> + bpf_first__destroy(first_skel);
> +}
> +
> void test_bpf_tcp_ca(void)
> {
> if (test__start_subtest("dctcp"))
> @@ -336,4 +368,6 @@ void test_bpf_tcp_ca(void)
> test_dctcp_fallback();
> if (test__start_subtest("rel_setsockopt"))
> test_rel_setsockopt();
> + if (test__start_subtest("first"))
> + test_first();
> }
> --
> 2.34.1
>
>
>
--
Mat Martineau
Intel
next prev parent reply other threads:[~2022-03-22 21:33 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-22 9:52 [PATCH mptcp-next v4 0/8] BPF packet scheduler Geliang Tang
2022-03-22 9:52 ` [PATCH mptcp-next v4 1/8] mptcp: add struct mptcp_sched_ops Geliang Tang
2022-03-22 21:21 ` Mat Martineau
2022-03-22 9:52 ` [PATCH mptcp-next v4 2/8] mptcp: register default scheduler Geliang Tang
2022-03-22 21:26 ` Mat Martineau
2022-03-22 9:52 ` [PATCH mptcp-next v4 3/8] mptcp: add a new sysctl scheduler Geliang Tang
2022-03-22 9:52 ` [PATCH mptcp-next v4 4/8] mptcp: add sched in mptcp_sock Geliang Tang
2022-03-22 9:52 ` [PATCH mptcp-next v4 5/8] mptcp: add mptcp_get_subflow wrapper Geliang Tang
2022-03-22 9:52 ` [PATCH mptcp-next v4 6/8] mptcp: add bpf_mptcp_sched_ops Geliang Tang
2022-03-22 9:52 ` [PATCH mptcp-next v4 7/8] selftests: bpf: add bpf_first scheduler Geliang Tang
2022-03-22 9:52 ` [PATCH mptcp-next v4 8/8] selftests: bpf: add bpf_first test Geliang Tang
2022-03-22 21:33 ` Mat Martineau [this message]
2022-03-22 21:12 ` [PATCH mptcp-next v4 0/8] BPF packet scheduler Mat Martineau
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=22612f2e-64cc-2268-e1dc-6eb766b9d6ec@linux.intel.com \
--to=mathew.j.martineau@linux.intel.com \
--cc=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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.