]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
selftests: mptcp: join: userspace: wait for new events
authorMatthieu Baerts (NGI0) <matttbe@kernel.org>
Tue, 3 Feb 2026 18:41:27 +0000 (19:41 +0100)
committerJakub Kicinski <kuba@kernel.org>
Thu, 5 Feb 2026 02:45:34 +0000 (18:45 -0800)
Instead of waiting for a random amount of time (1 second), wait for an
event to be received on the other side.

To do that, when an address is announced (userspace_pm_add_addr), the
ANNOUNCED is expected. When a new subflow is created
(userspace_pm_add_sf), the SUB_ESTABLISHED event is expected.

With this, the tests can finish quicker.

Reviewed-by: Geliang Tang <geliang@kernel.org>
Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Link: https://patch.msgid.link/20260203-net-next-mptcp-misc-feat-6-20-v1-11-31ec8bfc56d1@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
tools/testing/selftests/net/mptcp/mptcp_join.sh

index 6ab568d6b856de78284042252e6ed95bd916e202..4977e6ff17b45aa4da39d37c17dc2658bfdbfd84 100755 (executable)
@@ -3716,7 +3716,6 @@ userspace_pm_add_addr()
        tk=$(mptcp_lib_evts_get_info token "$evts")
 
        ip netns exec $1 ./pm_nl_ctl ann $2 token $tk id $3
-       sleep 1
 }
 
 # $1: ns ; $2: id
@@ -3747,7 +3746,6 @@ userspace_pm_add_sf()
 
        ip netns exec $1 ./pm_nl_ctl csf lip $2 lid $3 \
                                rip $da rport $dp token $tk
-       sleep 1
 }
 
 # $1: ns ; $2: addr $3: event type
@@ -3999,7 +3997,9 @@ userspace_tests()
                local tests_pid=$!
                wait_event ns1 MPTCP_LIB_EVENT_ESTABLISHED 1
                userspace_pm_add_addr $ns1 10.0.2.1 10
+               wait_event ns2 MPTCP_LIB_EVENT_ANNOUNCED 1
                userspace_pm_add_addr $ns1 10.0.3.1 20
+               wait_event ns2 MPTCP_LIB_EVENT_ANNOUNCED 2
                chk_join_nr 2 2 2
                chk_add_nr 2 2
                chk_mptcp_info subflows 2 subflows 2
@@ -4032,6 +4032,7 @@ userspace_tests()
                local tests_pid=$!
                wait_event ns2 MPTCP_LIB_EVENT_ESTABLISHED 1
                userspace_pm_add_sf $ns2 10.0.3.2 20
+               wait_event ns2 MPTCP_LIB_EVENT_SUB_ESTABLISHED 1
                chk_join_nr 1 1 1
                chk_mptcp_info subflows 1 subflows 1
                chk_subflows_total 2 2
@@ -4062,6 +4063,7 @@ userspace_tests()
                chk_mptcp_info subflows 0 subflows 0
                chk_subflows_total 1 1
                userspace_pm_add_sf $ns2 10.0.3.2 0
+               wait_event ns2 MPTCP_LIB_EVENT_SUB_ESTABLISHED 1
                userspace_pm_chk_dump_addr "${ns2}" \
                        "id 0 flags subflow 10.0.3.2" "id 0 subflow"
                chk_join_nr 1 1 1
@@ -4081,6 +4083,7 @@ userspace_tests()
                local tests_pid=$!
                wait_event ns2 MPTCP_LIB_EVENT_ESTABLISHED 1
                userspace_pm_add_sf $ns2 10.0.3.2 20
+               wait_event ns2 MPTCP_LIB_EVENT_SUB_ESTABLISHED 1
                chk_join_nr 1 1 1
                chk_mptcp_info subflows 1 subflows 1
                chk_subflows_total 2 2
@@ -4105,6 +4108,7 @@ userspace_tests()
                local tests_pid=$!
                wait_event ns1 MPTCP_LIB_EVENT_ESTABLISHED 1
                userspace_pm_add_addr $ns1 10.0.2.1 10
+               wait_event ns2 MPTCP_LIB_EVENT_ANNOUNCED 1
                chk_join_nr 1 1 1
                chk_add_nr 1 1
                chk_mptcp_info subflows 1 subflows 1
@@ -4131,6 +4135,7 @@ userspace_tests()
                local tests_pid=$!
                wait_event ns2 MPTCP_LIB_EVENT_ESTABLISHED 1
                userspace_pm_add_sf $ns2 10.0.3.2 20
+               wait_event ns2 MPTCP_LIB_EVENT_SUB_ESTABLISHED 1
                chk_mptcp_info subflows 1 subflows 1
                chk_subflows_total 2 2