MPTCP Archive mirror
 help / color / mirror / Atom feed
From: Geliang Tang <geliang@kernel.org>
To: mptcp@lists.linux.dev
Cc: Geliang Tang <tanggeliang@kylinos.cn>
Subject: [PATCH mptcp-next] selftests: mptcp: iperf mptcp tests
Date: Tue, 12 Mar 2024 09:23:57 +0800	[thread overview]
Message-ID: <8f95589ded2c77edbc5086a808703c63b4641e60.1710206580.git.tanggeliang@kylinos.cn> (raw)

From: Geliang Tang <tanggeliang@kylinos.cn>

MPTCPv1 protocol support has been added in iperf3 recently. This patch
add some tests for iperf3 to demonstrate the advantages of MPTCP over
TCP in latency or packet loss situations.

Note:

Does 'delay 1' in below command mean 'delay 1ms'? I'm not sure.
> tc -n $ns2 qdisc add dev ns2eth1 root netem rate 1mbit delay 1

Should this test be put in a standalone test script or just like in this
patch, as a subtest of mptcp_join.sh?

Signed-off-by: Geliang Tang <tanggeliang@kylinos.cn>
---
 .../testing/selftests/net/mptcp/mptcp_join.sh | 54 ++++++++++++++++++-
 .../testing/selftests/net/mptcp/mptcp_lib.sh  |  6 +++
 2 files changed, 59 insertions(+), 1 deletion(-)

diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testing/selftests/net/mptcp/mptcp_join.sh
index 1052b85d8170..f2279bfa27c3 100755
--- a/tools/testing/selftests/net/mptcp/mptcp_join.sh
+++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh
@@ -141,7 +141,7 @@ init() {
 
 	mptcp_lib_check_mptcp
 	mptcp_lib_check_kallsyms
-	mptcp_lib_check_tools ip ss "${iptables}" "${ip6tables}"
+	mptcp_lib_check_tools ip ss "${iptables}" "${ip6tables}" iperf
 
 	sin=$(mktemp)
 	sout=$(mktemp)
@@ -3570,6 +3570,57 @@ endpoint_tests()
 	fi
 }
 
+iperf_tests()
+{
+	if reset "iperf tcp test, delay 1"; then
+		tc -n $ns2 qdisc add dev ns2eth1 root netem rate 1mbit delay 1
+		ip netns exec $ns1 iperf3 -s &
+		local tests_pid=$!
+		sleep 1
+		ip netns exec $ns2 iperf3 -c 10.0.1.1
+		mptcp_lib_kill_wait $tests_pid
+		chk_join_nr 0 0 0
+	fi
+
+	if reset "iperf mptcp test, delay 1"; then
+		tc -n $ns2 qdisc add dev ns2eth1 root netem rate 1mbit delay 1
+		pm_nl_set_limits $ns1 8 8
+		pm_nl_set_limits $ns2 8 8
+		pm_nl_add_endpoint $ns2 10.0.2.2 dev ns2eth2 flags subflow
+		pm_nl_add_endpoint $ns2 10.0.3.2 dev ns2eth3 flags subflow
+		ip netns exec $ns1 iperf3 -m -s &
+		local tests_pid=$!
+		sleep 1
+		ip netns exec $ns2 iperf3 -m -c 10.0.1.1
+		mptcp_lib_kill_wait $tests_pid
+		chk_join_nr 2 2 2
+	fi
+
+	if reset "iperf tcp test, loss 1%"; then
+		tc -n $ns2 qdisc add dev ns2eth1 root netem rate 1mbit loss 1%
+		ip netns exec $ns1 iperf3 -s &
+		local tests_pid=$!
+		sleep 1
+		ip netns exec $ns2 iperf3 -c 10.0.1.1
+		mptcp_lib_kill_wait $tests_pid
+		chk_join_nr 0 0 0
+	fi
+
+	if reset "iperf mptcp test, loss %1"; then
+		tc -n $ns2 qdisc add dev ns2eth1 root netem rate 1mbit loss 1%
+		pm_nl_set_limits $ns1 8 8
+		pm_nl_set_limits $ns2 8 8
+		pm_nl_add_endpoint $ns2 10.0.2.2 dev ns2eth2 flags subflow
+		pm_nl_add_endpoint $ns2 10.0.3.2 dev ns2eth3 flags subflow
+		ip netns exec $ns1 iperf3 -m -s &
+		local tests_pid=$!
+		sleep 1
+		ip netns exec $ns2 iperf3 -m -c 10.0.1.1
+		mptcp_lib_kill_wait $tests_pid
+		chk_join_nr 2 2 2
+	fi
+}
+
 # [$1: error message]
 usage()
 {
@@ -3618,6 +3669,7 @@ all_tests_sorted=(
 	F@fail_tests
 	u@userspace_tests
 	I@endpoint_tests
+	t@iperf_tests
 )
 
 all_tests_args=""
diff --git a/tools/testing/selftests/net/mptcp/mptcp_lib.sh b/tools/testing/selftests/net/mptcp/mptcp_lib.sh
index d395692fac0d..8def187c1ef7 100644
--- a/tools/testing/selftests/net/mptcp/mptcp_lib.sh
+++ b/tools/testing/selftests/net/mptcp/mptcp_lib.sh
@@ -402,6 +402,12 @@ mptcp_lib_check_tools() {
 				exit ${KSFT_SKIP}
 			fi
 			;;
+		"iperf"*)
+			if ! iperf3 -h | grep -q multipath; then
+				mptcp_lib_pr_skip "iperf tool does not support MPTCP"
+				exit ${KSFT_SKIP}
+			fi
+			;;
 		*)
 			mptcp_lib_pr_fail "Internal error: unsupported tool: ${tool}"
 			exit ${KSFT_FAIL}
-- 
2.40.1


             reply	other threads:[~2024-03-12  1:24 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-12  1:23 Geliang Tang [this message]
2024-03-12 11:01 ` [PATCH mptcp-next] selftests: mptcp: iperf mptcp tests Matthieu Baerts

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=8f95589ded2c77edbc5086a808703c63b4641e60.1710206580.git.tanggeliang@kylinos.cn \
    --to=geliang@kernel.org \
    --cc=mptcp@lists.linux.dev \
    --cc=tanggeliang@kylinos.cn \
    /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 read-only IMAP folder(s) and NNTP newsgroup(s).