Skip to contentSkip to conversation

cleanups for endpoint_init

PATCH In review Geliang Tang 2 participants 5 messages Sep 13, 2024 – Sep 14, 2024

Subsystems (4)
lore
Share & tools
lore

Geliang Tang

author reviewer
#0 lore raw

cover cleanups for endpoint_init

From: Geliang Tang <[email protected]>

Patch 1 adds a new parameter "subflows" for endpoint_init() to make it more flexible.

I'm not sure if patch 1 should be as a squash-to patch for "selftests/bpf: Add mptcp subflow subtest" which is under review.

Geliang Tang (2):
selftests/bpf: More subflows for endpoint_init Squash to "selftests/bpf: Add bpf scheduler test"

 .../testing/selftests/bpf/prog_tests/mptcp.c  | 27 ++++++++++++++++---
 1 file changed, 23 insertions(+), 4 deletions(-)
Signature · 1 line
2.43.0
author reviewer
#1 lore raw

PATCH 1/2 selftests/bpf: More subflows for endpoint_init

From: Geliang Tang <[email protected]>

This patch adds two more test addresses ADDR_3 and ADDR_4, and adds a new parameter "subflows" for endpoint_init() to control how many subflows are used for the tests. This makes it more flexible.

Update the parameters of endpoint_init() in test_subflow().

---
 .../testing/selftests/bpf/prog_tests/mptcp.c  | 25 ++++++++++++++++---
 1 file changed, 22 insertions(+), 3 deletions(-)
tools/testing/selftests/bpf/prog_tests/mptcp.c +22 -3
index a3e68bc6afa3..b5fdb6dc36e0 100644
@@ -20,6 +20,8 @@
 #define NS_TEST "mptcp_ns"
 #define ADDR_1	"10.0.1.1"
 #define ADDR_2	"10.0.1.2"
+#define ADDR_3	"10.0.1.3"
+#define ADDR_4	"10.0.1.4"
 #define PORT_1	10001
 #define WITH_DATA	true
 #define WITHOUT_DATA	false
@@ -351,19 +353,36 @@ static void test_mptcpify(void)
 	close(cgroup_fd);
 }
 
-static int endpoint_init(char *flags)
+static int endpoint_init(char *flags, int subflows)
 {
+	if (subflows > 4)
+		goto fail;
+
 	SYS(fail, "ip -net %s link add veth1 type veth peer name veth2", NS_TEST);
 	SYS(fail, "ip -net %s addr add %s/24 dev veth1", NS_TEST, ADDR_1);
 	SYS(fail, "ip -net %s link set dev veth1 up", NS_TEST);
 	SYS(fail, "ip -net %s addr add %s/24 dev veth2", NS_TEST, ADDR_2);
 	SYS(fail, "ip -net %s link set dev veth2 up", NS_TEST);
-	if (SYS_NOFAIL("ip -net %s mptcp endpoint add %s %s", NS_TEST, ADDR_2, flags)) {
+
+	SYS(fail, "ip -net %s link add veth3 type veth peer name veth4", NS_TEST);
+	SYS(fail, "ip -net %s addr add %s/24 dev veth3", NS_TEST, ADDR_3);
+	SYS(fail, "ip -net %s link set dev veth3 up", NS_TEST);
+	SYS(fail, "ip -net %s addr add %s/24 dev veth4", NS_TEST, ADDR_4);
+	SYS(fail, "ip -net %s link set dev veth4 up", NS_TEST);
+
+	if (SYS_NOFAIL("ip -net %s mptcp limits set subflows 4", NS_TEST)) {
 		printf("'ip mptcp' not supported, skip this test.\n");
 		test__skip();
 		goto fail;
 	}
 
+	if (subflows > 1)
+		SYS_NOFAIL("ip -net %s mptcp endpoint add %s %s", NS_TEST, ADDR_2, flags);
+	if (subflows > 2)
+		SYS_NOFAIL("ip -net %s mptcp endpoint add %s %s", NS_TEST, ADDR_3, flags);
+	if (subflows > 3)
+		SYS_NOFAIL("ip -net %s mptcp endpoint add %s %s", NS_TEST, ADDR_4, flags);
+
 	return 0;
 fail:
 	return -1;
@@ -452,7 +471,7 @@ static void test_subflow(void)
 	if (!ASSERT_OK_PTR(nstoken, "create_netns: mptcp_subflow"))
 		goto skel_destroy;
 
-	if (endpoint_init("subflow") < 0)
+	if (endpoint_init("subflow", 2) < 0)
 		goto close_netns;
 
 	link = bpf_program__attach_cgroup(skel->progs._getsockopt_subflow,
Signature · 1 line
2.43.0
author reviewer
#2 lore raw

PATCH 2/2 Squash to "selftests/bpf: Add bpf scheduler test"

In reply to Geliang Tang

From: Geliang Tang <[email protected]>

Update endpoint_init() in sched_init().

---
 tools/testing/selftests/bpf/prog_tests/mptcp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/bpf/prog_tests/mptcp.c +1 -1
index b5fdb6dc36e0..11ab16a88369 100644
@@ -498,7 +498,7 @@ static struct nstoken *sched_init(char *flags, char *sched)
 	if (!ASSERT_OK_PTR(nstoken, "create_netns"))
 		return NULL;
 
-	if (endpoint_init("subflow") < 0)
+	if (endpoint_init("subflow", 2) < 0)
 		goto fail;
 
 	SYS(fail, "ip netns exec %s sysctl -qw net.mptcp.scheduler=%s", NS_TEST, sched);
Signature · 1 line
2.43.0
#3 lore raw
In reply to Geliang Tang

Hi Geliang,

Thank you for your modifications, that's great!

Our CI did some validations and here is its report:

- KVM Validation: normal: Success! ✅
- KVM Validation: debug: Success! ✅
- KVM Validation: btf (only bpftest_all): Success! ✅
- Task: https://github.com/multipath-tcp/mptcp_net-next/actions/runs/10846366992

Initiator: Patchew Applier
Commits: https://github.com/multipath-tcp/mptcp_net-next/commits/cef5e8c262b8
Patchwork: https://patchwork.kernel.org/project/mptcp/list/?series=890053

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-normal

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 (NGI0 Core)

author reviewer
#4 lore raw
In reply to Geliang Tang

Superseded.

Quoted 8 lines · Geliang Tang

From: Geliang Tang <[email protected]>

Patch 1 adds a new parameter "subflows" for endpoint_init() to make it
more flexible.

I'm not sure if patch 1 should be as a squash-to patch for "selftests/bpf: Add mptcp subflow subtest" which is under review.

Move into "fixes for "new MPTCP subflow subtest" v6".

Quoted 9 lines

Geliang Tang (2):
  selftests/bpf: More subflows for endpoint_init Squash to "selftests/bpf: Add bpf scheduler test"

 .../testing/selftests/bpf/prog_tests/mptcp.c  | 27 ++++++++++++++++- --

 1 file changed, 23 insertions(+), 4 deletions(-)