All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH mptcp-next 0/3] cleanups for bpf sched selftests
@ 2022-06-06  9:37 Geliang Tang
  2022-06-06  9:37 ` [PATCH mptcp-next 1/3] Squash to "selftests/bpf: Add bpf_first test" Geliang Tang
                   ` (4 more replies)
  0 siblings, 5 replies; 7+ messages in thread
From: Geliang Tang @ 2022-06-06  9:37 UTC (permalink / raw)
  To: mptcp; +Cc: Geliang Tang

do some cleanups for bpf sched selftests:
 - add one more veth net device.
 - use '10.0.1.1' to send data instead of use default '127.0.0.1'.
 - add a new helper has_bytes_sent().
 - update commit logs.

Geliang Tang (3):
  Squash to "selftests/bpf: Add bpf_first test"
  Squash to "selftests/bpf: Add bpf_bkup test"
  Squash to "selftests/bpf: Add bpf_rr test"

 .../testing/selftests/bpf/prog_tests/mptcp.c  | 63 ++++++++++++-------
 1 file changed, 41 insertions(+), 22 deletions(-)

-- 
2.34.1


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH mptcp-next 1/3] Squash to "selftests/bpf: Add bpf_first test"
  2022-06-06  9:37 [PATCH mptcp-next 0/3] cleanups for bpf sched selftests Geliang Tang
@ 2022-06-06  9:37 ` Geliang Tang
  2022-06-06  9:37 ` [PATCH mptcp-next 2/3] Squash to "selftests/bpf: Add bpf_bkup test" Geliang Tang
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: Geliang Tang @ 2022-06-06  9:37 UTC (permalink / raw)
  To: mptcp; +Cc: Geliang Tang

Please update the commit log:

'''
This patch expends the MPTCP test base to support MPTCP packet scheduler
tests. Add the bpf_first scheduler test in it.

In the new helper sched_init(), add two veth net devices to simulate the
multiple addresses case. Use 'ip mptcp endpoint' command to add the new
endpoint ADDR_2 to PM netlink. Use sysctl to set net.mptcp.scheduler to
use the given sched.

Invoke start_mptcp_server() to start the server on ADDR_1, and invoke
connect_to_fd() to connect with the server from the client. Then invoke
send_data() to send data.

Some code in send_data() is from prog_tests/bpf_tcp_ca.c.

Use the new helper has_bytes_sent() to check the bytes_sent filed of 'ss'
output after send_data() to make sure no data has been sent on ADDR_2.
All data has been sent on the first subflow.

Invoke the new helper sched_cleanup() to set back net.mptcp.scheduler to
default, flush all mptcp endpoints, and delete the veth net devices.
'''

Signed-off-by: Geliang Tang <geliang.tang@suse.com>
---
 .../testing/selftests/bpf/prog_tests/mptcp.c  | 41 ++++++++++++++-----
 1 file changed, 31 insertions(+), 10 deletions(-)

diff --git a/tools/testing/selftests/bpf/prog_tests/mptcp.c b/tools/testing/selftests/bpf/prog_tests/mptcp.c
index 1ecc8a2b76b6..3122279d0b9d 100644
--- a/tools/testing/selftests/bpf/prog_tests/mptcp.c
+++ b/tools/testing/selftests/bpf/prog_tests/mptcp.c
@@ -14,6 +14,9 @@
 #define TCP_CA_NAME_MAX	16
 #endif
 
+#define ADDR_1	"10.0.1.1"
+#define ADDR_2	"10.0.1.2"
+
 struct mptcp_storage {
 	__u32 invoked;
 	__u32 is_mptcp;
@@ -252,20 +255,39 @@ static void send_data(int lfd, int fd)
 	      PTR_ERR(thread_ret));
 }
 
-static void add_veth(void)
+static void sched_init(char *flags, char *sched)
 {
-	system("ip link add veth1 type veth");
-	system("ip addr add 10.0.1.1/24 dev veth1");
+	char cmd[64];
+
+	system("ip link add veth1 type veth peer name veth2");
+	snprintf(cmd, sizeof(cmd), "ip addr add %s/24 dev veth1", ADDR_1);
+	system(cmd);
 	system("ip link set veth1 up");
+	snprintf(cmd, sizeof(cmd), "ip addr add %s/24 dev veth2", ADDR_2);
+	system(cmd);
+	system("ip link set veth2 up");
+
+	snprintf(cmd, sizeof(cmd), "ip mptcp endpoint add %s %s", ADDR_2, flags);
+	system(cmd);
+	snprintf(cmd, sizeof(cmd), "sysctl -qw net.mptcp.scheduler=%s", sched);
+	system(cmd);
 }
 
-static void cleanup(void)
+static void sched_cleanup(void)
 {
 	system("sysctl -qw net.mptcp.scheduler=default");
 	system("ip mptcp endpoint flush");
 	system("ip link del veth1");
 }
 
+static int has_bytes_sent(char *addr)
+{
+	char cmd[64];
+
+	snprintf(cmd, sizeof(cmd), "ss -it dst %s | grep -q 'bytes_sent:'", addr);
+	return system(cmd);
+}
+
 static void test_first(void)
 {
 	struct mptcp_bpf_first *first_skel;
@@ -282,18 +304,17 @@ static void test_first(void)
 		return;
 	}
 
-	add_veth();
-	system("ip mptcp endpoint add 10.0.1.1 subflow");
-	system("sysctl -qw net.mptcp.scheduler=bpf_first");
-	server_fd = start_mptcp_server(AF_INET, NULL, 0, 0);
+	sched_init("subflow", "bpf_first");
+	server_fd = start_mptcp_server(AF_INET, ADDR_1, 0, 0);
 	client_fd = connect_to_fd(server_fd, 0);
 
 	send_data(server_fd, client_fd);
-	ASSERT_GT(system("ss -MOenita | grep '10.0.1.1' | grep 'bytes_sent:'"), 0, "ss");
+	ASSERT_OK(has_bytes_sent(ADDR_1), "has_bytes_sent addr_1");
+	ASSERT_GT(has_bytes_sent(ADDR_2), 0, "has_bytes_sent addr_2");
 
 	close(client_fd);
 	close(server_fd);
-	cleanup();
+	sched_cleanup();
 	bpf_link__destroy(link);
 	mptcp_bpf_first__destroy(first_skel);
 }
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH mptcp-next 2/3] Squash to "selftests/bpf: Add bpf_bkup test"
  2022-06-06  9:37 [PATCH mptcp-next 0/3] cleanups for bpf sched selftests Geliang Tang
  2022-06-06  9:37 ` [PATCH mptcp-next 1/3] Squash to "selftests/bpf: Add bpf_first test" Geliang Tang
@ 2022-06-06  9:37 ` Geliang Tang
  2022-06-06  9:37 ` [PATCH mptcp-next 3/3] Squash to "selftests/bpf: Add bpf_rr test" Geliang Tang
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: Geliang Tang @ 2022-06-06  9:37 UTC (permalink / raw)
  To: mptcp; +Cc: Geliang Tang

Please update the commit log:

'''
This patch adds the backup BPF MPTCP scheduler test: test_bkup(). Use
sysctl to set net.mptcp.scheduler to use this sched. Add two veth net
devices to simulate the multiple addresses case. Use 'ip mptcp endpoint'
command to add the new endpoint ADDR_2 to PM netlink with backup flag.
Send data, check bytes_sent of 'ss' output, and do some cleanups.
'''

Signed-off-by: Geliang Tang <geliang.tang@suse.com>
---
 tools/testing/selftests/bpf/prog_tests/mptcp.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/tools/testing/selftests/bpf/prog_tests/mptcp.c b/tools/testing/selftests/bpf/prog_tests/mptcp.c
index 3122279d0b9d..0fc446c20d72 100644
--- a/tools/testing/selftests/bpf/prog_tests/mptcp.c
+++ b/tools/testing/selftests/bpf/prog_tests/mptcp.c
@@ -335,18 +335,17 @@ static void test_bkup(void)
 		return;
 	}
 
-	add_veth();
-	system("ip mptcp endpoint add 10.0.1.1 subflow backup");
-	system("sysctl -qw net.mptcp.scheduler=bpf_bkup");
-	server_fd = start_mptcp_server(AF_INET, NULL, 0, 0);
+	sched_init("subflow backup", "bpf_bkup");
+	server_fd = start_mptcp_server(AF_INET, ADDR_1, 0, 0);
 	client_fd = connect_to_fd(server_fd, 0);
 
 	send_data(server_fd, client_fd);
-	ASSERT_GT(system("ss -MOenita | grep '10.0.1.1' | grep 'bytes_sent:'"), 0, "ss");
+	ASSERT_OK(has_bytes_sent(ADDR_1), "has_bytes_sent addr_1");
+	ASSERT_GT(has_bytes_sent(ADDR_2), 0, "has_bytes_sent addr_2");
 
 	close(client_fd);
 	close(server_fd);
-	cleanup();
+	sched_cleanup();
 	bpf_link__destroy(link);
 	mptcp_bpf_bkup__destroy(bkup_skel);
 }
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH mptcp-next 3/3] Squash to "selftests/bpf: Add bpf_rr test"
  2022-06-06  9:37 [PATCH mptcp-next 0/3] cleanups for bpf sched selftests Geliang Tang
  2022-06-06  9:37 ` [PATCH mptcp-next 1/3] Squash to "selftests/bpf: Add bpf_first test" Geliang Tang
  2022-06-06  9:37 ` [PATCH mptcp-next 2/3] Squash to "selftests/bpf: Add bpf_bkup test" Geliang Tang
@ 2022-06-06  9:37 ` Geliang Tang
  2022-06-06 11:25   ` Squash to "selftests/bpf: Add bpf_rr test": Tests Results MPTCP CI
  2022-06-06 23:40 ` [PATCH mptcp-next 0/3] cleanups for bpf sched selftests Mat Martineau
  2022-06-07 12:51 ` Matthieu Baerts
  4 siblings, 1 reply; 7+ messages in thread
From: Geliang Tang @ 2022-06-06  9:37 UTC (permalink / raw)
  To: mptcp; +Cc: Geliang Tang

Please update the commit log:

'''
This patch adds the round-robin BPF MPTCP scheduler test: test_rr(). Use
sysctl to set net.mptcp.scheduler to use this sched. Add two veth net
devices to simulate the multiple addresses case. Use 'ip mptcp endpoint'
command to add the new endpoint ADDR_2 to PM netlink. Send data and check
bytes_sent of 'ss' output after it to make sure the data has been sent on
both net devices.
'''

Signed-off-by: Geliang Tang <geliang.tang@suse.com>
---
 tools/testing/selftests/bpf/prog_tests/mptcp.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/tools/testing/selftests/bpf/prog_tests/mptcp.c b/tools/testing/selftests/bpf/prog_tests/mptcp.c
index 0fc446c20d72..8b2fe1004323 100644
--- a/tools/testing/selftests/bpf/prog_tests/mptcp.c
+++ b/tools/testing/selftests/bpf/prog_tests/mptcp.c
@@ -366,18 +366,17 @@ static void test_rr(void)
 		return;
 	}
 
-	add_veth();
-	system("ip mptcp endpoint add 10.0.1.1 subflow");
-	system("sysctl -qw net.mptcp.scheduler=bpf_rr");
-	server_fd = start_mptcp_server(AF_INET, NULL, 0, 0);
+	sched_init("subflow", "bpf_rr");
+	server_fd = start_mptcp_server(AF_INET, ADDR_1, 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");
+	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);
-	cleanup();
+	sched_cleanup();
 	bpf_link__destroy(link);
 	mptcp_bpf_rr__destroy(rr_skel);
 }
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: Squash to "selftests/bpf: Add bpf_rr test": Tests Results
  2022-06-06  9:37 ` [PATCH mptcp-next 3/3] Squash to "selftests/bpf: Add bpf_rr test" Geliang Tang
@ 2022-06-06 11:25   ` MPTCP CI
  0 siblings, 0 replies; 7+ messages in thread
From: MPTCP CI @ 2022-06-06 11:25 UTC (permalink / raw)
  To: Geliang Tang; +Cc: mptcp

Hi Geliang,

Thank you for your modifications, that's great!

Our CI did some validations and here is its report:

- KVM Validation: normal:
  - Unstable: 2 failed test(s): selftest_mptcp_join selftest_simult_flows 🔴:
  - Task: https://cirrus-ci.com/task/5696523970281472
  - Summary: https://api.cirrus-ci.com/v1/artifact/task/5696523970281472/summary/summary.txt

- KVM Validation: debug:
  - Unstable: 2 failed test(s): selftest_diag selftest_mptcp_join 🔴:
  - Task: https://cirrus-ci.com/task/5133574016860160
  - Summary: https://api.cirrus-ci.com/v1/artifact/task/5133574016860160/summary/summary.txt

Initiator: Patchew Applier
Commits: https://github.com/multipath-tcp/mptcp_net-next/commits/eabbbe1c8c5e


If there are some issues, you can reproduce them using the same environment as
the one used by the CI thanks to a docker image, e.g.:

    $ cd [kernel source code]
    $ docker run -v "${PWD}:${PWD}:rw" -w "${PWD}" --privileged --rm -it \
        --pull always mptcp/mptcp-upstream-virtme-docker:latest \
        auto-debug

For more details:

    https://github.com/multipath-tcp/mptcp-upstream-virtme-docker


Please note that despite all the efforts that have been already done to have a
stable tests suite when executed on a public CI like here, it is possible some
reported issues are not due to your modifications. Still, do not hesitate to
help us improve that ;-)

Cheers,
MPTCP GH Action bot
Bot operated by Matthieu Baerts (Tessares)

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH mptcp-next 0/3] cleanups for bpf sched selftests
  2022-06-06  9:37 [PATCH mptcp-next 0/3] cleanups for bpf sched selftests Geliang Tang
                   ` (2 preceding siblings ...)
  2022-06-06  9:37 ` [PATCH mptcp-next 3/3] Squash to "selftests/bpf: Add bpf_rr test" Geliang Tang
@ 2022-06-06 23:40 ` Mat Martineau
  2022-06-07 12:51 ` Matthieu Baerts
  4 siblings, 0 replies; 7+ messages in thread
From: Mat Martineau @ 2022-06-06 23:40 UTC (permalink / raw)
  To: Geliang Tang; +Cc: mptcp

On Mon, 6 Jun 2022, Geliang Tang wrote:

> do some cleanups for bpf sched selftests:
> - add one more veth net device.
> - use '10.0.1.1' to send data instead of use default '127.0.0.1'.
> - add a new helper has_bytes_sent().
> - update commit logs.
>
> Geliang Tang (3):
>  Squash to "selftests/bpf: Add bpf_first test"
>  Squash to "selftests/bpf: Add bpf_bkup test"
>  Squash to "selftests/bpf: Add bpf_rr test"
>
> .../testing/selftests/bpf/prog_tests/mptcp.c  | 63 ++++++++++++-------
> 1 file changed, 41 insertions(+), 22 deletions(-)
>

Hi Geliang -

Thanks for these selftest enhancements. These 3 commits are ok to squash.


--
Mat Martineau
Intel

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH mptcp-next 0/3] cleanups for bpf sched selftests
  2022-06-06  9:37 [PATCH mptcp-next 0/3] cleanups for bpf sched selftests Geliang Tang
                   ` (3 preceding siblings ...)
  2022-06-06 23:40 ` [PATCH mptcp-next 0/3] cleanups for bpf sched selftests Mat Martineau
@ 2022-06-07 12:51 ` Matthieu Baerts
  4 siblings, 0 replies; 7+ messages in thread
From: Matthieu Baerts @ 2022-06-07 12:51 UTC (permalink / raw)
  To: Geliang Tang, mptcp

Hi Geliang, Mat,

On 06/06/2022 11:37, Geliang Tang wrote:
> do some cleanups for bpf sched selftests:
>  - add one more veth net device.
>  - use '10.0.1.1' to send data instead of use default '127.0.0.1'.
>  - add a new helper has_bytes_sent().
>  - update commit logs.
> 
> Geliang Tang (3):
>   Squash to "selftests/bpf: Add bpf_first test"
>   Squash to "selftests/bpf: Add bpf_bkup test"
>   Squash to "selftests/bpf: Add bpf_rr test"

Thank you for these patches and reviews!

- 8106c5f35319: "squashed" patch 1/3 in "selftests/bpf: Add bpf_first test"
- 1404767ad7db: tg:msg: import new commit message

- 8c2344d28fb6: "squashed" patch 2/3 in "selftests/bpf: Add bpf_bkup test"
- 65805439dcb2: tg:msg: import new commit message

- 9d020c5e7420: "squashed" patch 3/3 in "selftests/bpf: Add bpf_rr test"
- f1ca39aef385: tg:msg: import new commit message

- Results: 293143ba65b0..c3839c0496a1 (export)


Builds and tests are now in progress:

https://cirrus-ci.com/github/multipath-tcp/mptcp_net-next/export/20220607T125051
https://github.com/multipath-tcp/mptcp_net-next/actions/workflows/build-validation.yml?query=branch:export


Cheers,
Matt
-- 
Tessares | Belgium | Hybrid Access Solutions
www.tessares.net

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2022-06-07 12:51 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-06  9:37 [PATCH mptcp-next 0/3] cleanups for bpf sched selftests Geliang Tang
2022-06-06  9:37 ` [PATCH mptcp-next 1/3] Squash to "selftests/bpf: Add bpf_first test" Geliang Tang
2022-06-06  9:37 ` [PATCH mptcp-next 2/3] Squash to "selftests/bpf: Add bpf_bkup test" Geliang Tang
2022-06-06  9:37 ` [PATCH mptcp-next 3/3] Squash to "selftests/bpf: Add bpf_rr test" Geliang Tang
2022-06-06 11:25   ` Squash to "selftests/bpf: Add bpf_rr test": Tests Results MPTCP CI
2022-06-06 23:40 ` [PATCH mptcp-next 0/3] cleanups for bpf sched selftests Mat Martineau
2022-06-07 12:51 ` Matthieu Baerts

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.