diff mbox series

[mptcp-next,v4,3/4] Squash to "selftests/bpf: Add bpf scheduler test"

Message ID bc94d4bf1e0295bb15dd91c07d2ba0520e4ca542.1730260715.git.tanggeliang@kylinos.cn (mailing list archive)
State Accepted, archived
Commit ea4672e6e0428eec25c80d562344926367b0a75a
Delegated to: Matthieu Baerts
Headers show
Series add netns helpers | expand

Checks

Context Check Description
matttbe/KVM_Validation__normal success Success! ✅
matttbe/KVM_Validation__debug success Success! ✅
matttbe/KVM_Validation__btf-normal__only_bpftest_all_ success Success! ✅
matttbe/KVM_Validation__btf-debug__only_bpftest_all_ success Success! ✅
matttbe/checkpatch success total: 0 errors, 0 warnings, 0 checks, 47 lines checked
matttbe/shellcheck success MPTCP selftests files have not been modified
matttbe/build success Build and static analysis OK

Commit Message

Geliang Tang Oct. 30, 2024, 4:03 a.m. UTC
From: Geliang Tang <tanggeliang@kylinos.cn>

Use new netns helpers.

Signed-off-by: Geliang Tang <tanggeliang@kylinos.cn>
---
 .../testing/selftests/bpf/prog_tests/mptcp.c  | 20 +++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)
diff mbox series

Patch

diff --git a/tools/testing/selftests/bpf/prog_tests/mptcp.c b/tools/testing/selftests/bpf/prog_tests/mptcp.c
index 238d2f1cd96e..8db1def2e219 100644
--- a/tools/testing/selftests/bpf/prog_tests/mptcp.c
+++ b/tools/testing/selftests/bpf/prog_tests/mptcp.c
@@ -562,12 +562,12 @@  static void test_iters_subflow(void)
 	close(cgroup_fd);
 }
 
-static struct nstoken *sched_init(char *flags, char *sched)
+static struct netns_obj *sched_init(char *flags, char *sched)
 {
-	struct nstoken *nstoken;
+	struct netns_obj *netns;
 
-	nstoken = create_netns();
-	if (!ASSERT_OK_PTR(nstoken, "create_netns"))
+	netns = netns_new(NS_TEST, true);
+	if (!ASSERT_OK_PTR(netns, "netns_new"))
 		return NULL;
 
 	if (endpoint_init("subflow", 2) < 0)
@@ -575,9 +575,9 @@  static struct nstoken *sched_init(char *flags, char *sched)
 
 	SYS(fail, "ip netns exec %s sysctl -qw net.mptcp.scheduler=%s", NS_TEST, sched);
 
-	return nstoken;
+	return netns;
 fail:
-	cleanup_netns(nstoken);
+	netns_free(netns);
 	return NULL;
 }
 
@@ -635,16 +635,16 @@  static void send_data_and_verify(char *sched, bool addr1, bool addr2)
 
 static void test_default(void)
 {
-	struct nstoken *nstoken;
+	struct netns_obj *netns;
 
-	nstoken = sched_init("subflow", "default");
-	if (!nstoken)
+	netns = sched_init("subflow", "default");
+	if (!netns)
 		goto fail;
 
 	send_data_and_verify("default", WITH_DATA, WITH_DATA);
 
 fail:
-	cleanup_netns(nstoken);
+	netns_free(netns);
 }
 
 static void test_bpf_sched(struct bpf_object *obj, char *sched,