All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mat Martineau <martineau@kernel.org>
To: Matthieu Baerts <matttbe@kernel.org>,
	 "David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	 Jakub Kicinski <kuba@kernel.org>,
	Paolo Abeni <pabeni@redhat.com>,
	 Geliang Tang <geliang.tang@suse.com>,
	 Kishen Maloor <kishen.maloor@intel.com>
Cc: netdev@vger.kernel.org, mptcp@lists.linux.dev,
	 Mat Martineau <martineau@kernel.org>,
	stable@vger.kernel.org
Subject: [PATCH net-next 02/10] selftests: mptcp: fix wait_rm_addr/sf parameters
Date: Wed, 25 Oct 2023 16:37:03 -0700	[thread overview]
Message-ID: <20231025-send-net-next-20231025-v1-2-db8f25f798eb@kernel.org> (raw)
In-Reply-To: <20231025-send-net-next-20231025-v1-0-db8f25f798eb@kernel.org>

From: Geliang Tang <geliang.tang@suse.com>

The second input parameter of 'wait_rm_addr/sf $1 1' is misused. If it's
1, wait_rm_addr/sf will never break, and will loop ten times, then
'wait_rm_addr/sf' equals to 'sleep 1'. This delay time is too long,
which can sometimes make the tests fail.

A better way to use wait_rm_addr/sf is to use rm_addr/sf_count to obtain
the current value, and then pass into wait_rm_addr/sf.

Fixes: 4369c198e599 ("selftests: mptcp: test userspace pm out of transfer")
Cc: stable@vger.kernel.org
Suggested-by: Matthieu Baerts <matttbe@kernel.org>
Reviewed-by: Matthieu Baerts <matttbe@kernel.org>
Signed-off-by: Geliang Tang <geliang.tang@suse.com>
Signed-off-by: Mat Martineau <martineau@kernel.org>
---
 tools/testing/selftests/net/mptcp/mptcp_join.sh | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testing/selftests/net/mptcp/mptcp_join.sh
index edc569bab4b8..5917a74b749d 100755
--- a/tools/testing/selftests/net/mptcp/mptcp_join.sh
+++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh
@@ -3289,6 +3289,7 @@ userspace_pm_rm_sf_addr_ns1()
 	local addr=$1
 	local id=$2
 	local tk sp da dp
+	local cnt_addr cnt_sf
 
 	tk=$(grep "type:1," "$evts_ns1" |
 	     sed -n 's/.*\(token:\)\([[:digit:]]*\).*$/\2/p;q')
@@ -3298,11 +3299,13 @@ userspace_pm_rm_sf_addr_ns1()
 	     sed -n 's/.*\(daddr6:\)\([0-9a-f:.]*\).*$/\2/p;q')
 	dp=$(grep "type:10" "$evts_ns1" |
 	     sed -n 's/.*\(dport:\)\([[:digit:]]*\).*$/\2/p;q')
+	cnt_addr=$(rm_addr_count ${ns1})
+	cnt_sf=$(rm_sf_count ${ns1})
 	ip netns exec $ns1 ./pm_nl_ctl rem token $tk id $id
 	ip netns exec $ns1 ./pm_nl_ctl dsf lip "::ffff:$addr" \
 				lport $sp rip $da rport $dp token $tk
-	wait_rm_addr $ns1 1
-	wait_rm_sf $ns1 1
+	wait_rm_addr $ns1 "${cnt_addr}"
+	wait_rm_sf $ns1 "${cnt_sf}"
 }
 
 userspace_pm_add_sf()
@@ -3324,17 +3327,20 @@ userspace_pm_rm_sf_addr_ns2()
 	local addr=$1
 	local id=$2
 	local tk da dp sp
+	local cnt_addr cnt_sf
 
 	tk=$(sed -n 's/.*\(token:\)\([[:digit:]]*\).*$/\2/p;q' "$evts_ns2")
 	da=$(sed -n 's/.*\(daddr4:\)\([0-9.]*\).*$/\2/p;q' "$evts_ns2")
 	dp=$(sed -n 's/.*\(dport:\)\([[:digit:]]*\).*$/\2/p;q' "$evts_ns2")
 	sp=$(grep "type:10" "$evts_ns2" |
 	     sed -n 's/.*\(sport:\)\([[:digit:]]*\).*$/\2/p;q')
+	cnt_addr=$(rm_addr_count ${ns2})
+	cnt_sf=$(rm_sf_count ${ns2})
 	ip netns exec $ns2 ./pm_nl_ctl rem token $tk id $id
 	ip netns exec $ns2 ./pm_nl_ctl dsf lip $addr lport $sp \
 				rip $da rport $dp token $tk
-	wait_rm_addr $ns2 1
-	wait_rm_sf $ns2 1
+	wait_rm_addr $ns2 "${cnt_addr}"
+	wait_rm_sf $ns2 "${cnt_sf}"
 }
 
 userspace_tests()

-- 
2.41.0


  parent reply	other threads:[~2023-10-25 23:37 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-25 23:37 [PATCH net-next 00/10] mptcp: Fixes and cleanup for v6.7 Mat Martineau
2023-10-25 23:37 ` [PATCH net-next 01/10] selftests: mptcp: run userspace pm tests slower Mat Martineau
2023-10-25 23:37 ` Mat Martineau [this message]
2023-10-25 23:37 ` [PATCH net-next 03/10] mptcp: userspace pm send RM_ADDR for ID 0 Mat Martineau
2023-10-27  3:26   ` Jakub Kicinski
2023-10-27  7:05     ` Geliang Tang
2023-10-27 15:34     ` Mat Martineau
2023-10-27 15:43       ` Jakub Kicinski
2023-10-27 15:45         ` Mat Martineau
2023-10-27 15:53           ` Jakub Kicinski
2023-10-25 23:37 ` [PATCH net-next 04/10] mptcp: drop useless ssk in pm_subflow_check_next Mat Martineau
2023-10-25 23:37 ` [PATCH net-next 05/10] mptcp: use mptcp_check_fallback helper Mat Martineau
2023-10-25 23:37 ` [PATCH net-next 06/10] mptcp: use mptcp_get_ext helper Mat Martineau
2023-10-25 23:37 ` [PATCH net-next 07/10] mptcp: move sk assignment statement ahead Mat Martineau
2023-10-25 23:37 ` [PATCH net-next 08/10] mptcp: define more local variables sk Mat Martineau
2023-10-25 23:37 ` [PATCH net-next 09/10] selftests: mptcp: sockopt: drop mptcp_connect var Mat Martineau
2023-10-25 23:37 ` [PATCH net-next 10/10] selftests: mptcp: display simult in extra_msg Mat Martineau
2023-10-27 16:20 ` [PATCH net-next 00/10] mptcp: Fixes and cleanup for v6.7 patchwork-bot+netdevbpf

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=20231025-send-net-next-20231025-v1-2-db8f25f798eb@kernel.org \
    --to=martineau@kernel.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=geliang.tang@suse.com \
    --cc=kishen.maloor@intel.com \
    --cc=kuba@kernel.org \
    --cc=matttbe@kernel.org \
    --cc=mptcp@lists.linux.dev \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=stable@vger.kernel.org \
    /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 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.