All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH mptcp-next 0/2] userspace pm remove id 0 subflow & address
@ 2023-09-16 12:05 Geliang Tang
  2023-09-16 12:05 ` [PATCH mptcp-next 1/2] Squash to "selftests: mptcp: userspace pm remove id 0 subflow" Geliang Tang
  2023-09-16 12:05 ` [PATCH mptcp-next 2/2] selftests: mptcp: add chk_subflows_total helper Geliang Tang
  0 siblings, 2 replies; 3+ messages in thread
From: Geliang Tang @ 2023-09-16 12:05 UTC (permalink / raw)
  To: mptcp; +Cc: Geliang Tang

Patches for "userspace pm remove id 0 subflow & address" v10.

Geliang Tang (2):
  Squash to "selftests: mptcp: userspace pm remove id 0 subflow"
  selftests: mptcp: add chk_subflows_total helper

 tools/testing/selftests/net/mptcp/mptcp_join.sh | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

-- 
2.35.3


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

* [PATCH mptcp-next 1/2] Squash to "selftests: mptcp: userspace pm remove id 0 subflow"
  2023-09-16 12:05 [PATCH mptcp-next 0/2] userspace pm remove id 0 subflow & address Geliang Tang
@ 2023-09-16 12:05 ` Geliang Tang
  2023-09-16 12:05 ` [PATCH mptcp-next 2/2] selftests: mptcp: add chk_subflows_total helper Geliang Tang
  1 sibling, 0 replies; 3+ messages in thread
From: Geliang Tang @ 2023-09-16 12:05 UTC (permalink / raw)
  To: mptcp; +Cc: Geliang Tang

Please update the commit log:

'''
This patch adds a selftest for userpsace PM to remove id 0 subflow. Use
userspace_pm_add_sf() to add a subflow, and pass initial ip address to
userspace_pm_rm_sf() to remove id 0 subflow.

When closing the initial subflow in __mptcp_close_ssk(), dispose_it is
false, then tcp_disconnect is invoked. This will send a MP_RST to close
a subflow on the peer too. So chk_rst_nr() is added in this test, and
chk_all_subflows after closing the initial subflow is '1 1', not '2 1'.
'''

Signed-off-by: Geliang Tang <geliang.tang@suse.com>
---
 .../testing/selftests/net/mptcp/mptcp_join.sh | 33 +------------------
 1 file changed, 1 insertion(+), 32 deletions(-)

diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testing/selftests/net/mptcp/mptcp_join.sh
index b65a468e1ec5..9ffc8e061502 100755
--- a/tools/testing/selftests/net/mptcp/mptcp_join.sh
+++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh
@@ -1771,7 +1771,7 @@ chk_mptcp_info()
 	local cnt2
 	local dump_stats
 
-	print_check "mptcp_info ${info1:0:14}=$exp1:$exp2"
+	print_check "mptcp_info ${info1:0:8}=$exp1:$exp2"
 
 	cnt1=$(ss -N $ns1 -inmHM | mptcp_lib_get_info_value "$info1" "$info1")
 	cnt2=$(ss -N $ns2 -inmHM | mptcp_lib_get_info_value "$info2" "$info2")
@@ -1792,37 +1792,6 @@ chk_mptcp_info()
 	fi
 }
 
-# $1: subflows in ns1 ; $2: subflows in ns2
-# number of all subflows, including the initial subflow.
-chk_subflows_total()
-{
-	local cnt1
-	local cnt2
-	local info="subflows_total"
-
-	if [ $(ss -N $ns1 -inmHM | mptcp_lib_get_info_value $info $info) ]; then
-		chk_mptcp_info $info $1 $info $2
-		return
-	fi
-
-	print_check "$info $1:$2"
-
-	cnt1=$(ss -N $ns1 -ti | grep -c tcp-ulp-mptcp)
-	cnt2=$(ss -N $ns2 -ti | grep -c tcp-ulp-mptcp)
-
-	if [ "$1" != "$cnt1" ] || [ "$2" != "$cnt2" ]; then
-		fail_test "got subflows $cnt1:$cnt2 expected $1:$2"
-		dump_stats=1
-	else
-		print_ok
-	fi
-
-	if [ "$dump_stats" = 1 ]; then
-		ss -N $ns1 -ti
-		ss -N $ns2 -ti
-	fi
-}
-
 chk_link_usage()
 {
 	local ns=$1
-- 
2.35.3


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

* [PATCH mptcp-next 2/2] selftests: mptcp: add chk_subflows_total helper
  2023-09-16 12:05 [PATCH mptcp-next 0/2] userspace pm remove id 0 subflow & address Geliang Tang
  2023-09-16 12:05 ` [PATCH mptcp-next 1/2] Squash to "selftests: mptcp: userspace pm remove id 0 subflow" Geliang Tang
@ 2023-09-16 12:05 ` Geliang Tang
  1 sibling, 0 replies; 3+ messages in thread
From: Geliang Tang @ 2023-09-16 12:05 UTC (permalink / raw)
  To: mptcp; +Cc: Geliang Tang

This patch adds a new helper chk_subflows_total(), in it use the newly
added counter mptcpi_subflows_total to get the "correct" amount of
subflows, including the initial one. To be compatible with old 'ss'
version without this counter, get the total subflows using this 'ss'
command:

        ss -ti | grep -c tcp-ulp-mptcp.

Note:

This patch should be inserted between the commit
        mptcp: add mptcpi_subflows_total counter
and the commit
        selftests: mptcp: add evts_get_info helper

Signed-off-by: Geliang Tang <geliang.tang@suse.com>
---
 .../testing/selftests/net/mptcp/mptcp_join.sh | 37 ++++++++++++++++++-
 1 file changed, 36 insertions(+), 1 deletion(-)

diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testing/selftests/net/mptcp/mptcp_join.sh
index 9ffc8e061502..46a95ff77222 100755
--- a/tools/testing/selftests/net/mptcp/mptcp_join.sh
+++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh
@@ -1771,7 +1771,7 @@ chk_mptcp_info()
 	local cnt2
 	local dump_stats
 
-	print_check "mptcp_info ${info1:0:8}=$exp1:$exp2"
+	print_check "mptcp_info ${info1:0:15}=$exp1:$exp2"
 
 	cnt1=$(ss -N $ns1 -inmHM | mptcp_lib_get_info_value "$info1" "$info1")
 	cnt2=$(ss -N $ns2 -inmHM | mptcp_lib_get_info_value "$info2" "$info2")
@@ -1792,6 +1792,37 @@ chk_mptcp_info()
 	fi
 }
 
+# $1: subflows in ns1 ; $2: subflows in ns2
+# number of all subflows, including the initial subflow.
+chk_subflows_total()
+{
+	local cnt1
+	local cnt2
+	local info="subflows_total"
+
+	if [ $(ss -N $ns1 -inmHM | mptcp_lib_get_info_value $info $info) ]; then
+		chk_mptcp_info $info $1 $info $2
+		return
+	fi
+
+	print_check "$info $1:$2"
+
+	cnt1=$(ss -N $ns1 -ti | grep -c tcp-ulp-mptcp)
+	cnt2=$(ss -N $ns2 -ti | grep -c tcp-ulp-mptcp)
+
+	if [ "$1" != "$cnt1" ] || [ "$2" != "$cnt2" ]; then
+		fail_test "got subflows $cnt1:$cnt2 expected $1:$2"
+		dump_stats=1
+	else
+		print_ok
+	fi
+
+	if [ "$dump_stats" = 1 ]; then
+		ss -N $ns1 -ti
+		ss -N $ns2 -ti
+	fi
+}
+
 chk_link_usage()
 {
 	local ns=$1
@@ -3195,11 +3226,13 @@ userspace_tests()
 		chk_join_nr 1 1 1
 		chk_add_nr 1 1
 		chk_mptcp_info subflows 1 subflows 1
+		chk_subflows_total 2 2
 		chk_mptcp_info add_addr_signal 1 add_addr_accepted 1
 		userspace_pm_rm_addr $ns1 10
 		userspace_pm_rm_sf $ns1 "::ffff:10.0.2.1" $SUB_ESTABLISHED
 		chk_rm_nr 1 1 invert
 		chk_mptcp_info subflows 0 subflows 0
+		chk_subflows_total 1 1
 		mptcp_lib_evts_kill
 		wait $tests_pid
 	fi
@@ -3216,10 +3249,12 @@ userspace_tests()
 		userspace_pm_add_sf $ns2 10.0.3.2 20
 		chk_join_nr 1 1 1
 		chk_mptcp_info subflows 1 subflows 1
+		chk_subflows_total 2 2
 		userspace_pm_rm_addr $ns2 20
 		userspace_pm_rm_sf $ns2 10.0.3.2 $SUB_ESTABLISHED
 		chk_rm_nr 1 1
 		chk_mptcp_info subflows 0 subflows 0
+		chk_subflows_total 1 1
 		mptcp_lib_evts_kill
 		wait $tests_pid
 	fi
-- 
2.35.3


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

end of thread, other threads:[~2023-09-16 12:05 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-09-16 12:05 [PATCH mptcp-next 0/2] userspace pm remove id 0 subflow & address Geliang Tang
2023-09-16 12:05 ` [PATCH mptcp-next 1/2] Squash to "selftests: mptcp: userspace pm remove id 0 subflow" Geliang Tang
2023-09-16 12:05 ` [PATCH mptcp-next 2/2] selftests: mptcp: add chk_subflows_total helper Geliang Tang

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.