From nobody Fri May 10 12:32:22 2024 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0CD7A20F6 for ; Fri, 14 Apr 2023 14:19:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1681481993; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=9ag1mAGYjhrlWyvWTevlmjs+54lmxLLdELPP/sacQQI=; b=fATCRVKZd1s79eQQUA2pCFyqldLlJx+xaDf4cFfaVXomye60zo3n9mKFJyXKHHXFsya6ko zobxquIWOICdLgePEUeywFsbUq+y4kMGKJk+6BxiY6LJ5lY1nA++Os2wVA35jaliVpMs4E pJ0JCLpiMNSO6V1sE9w3tioSoxQcmSQ= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-583-swLp2O32Oq-0Cs_eOsBdBA-1; Fri, 14 Apr 2023 10:19:51 -0400 X-MC-Unique: swLp2O32Oq-0Cs_eOsBdBA-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 7A86088FA4C for ; Fri, 14 Apr 2023 14:19:39 +0000 (UTC) Received: from gerbillo.redhat.com (unknown [10.39.194.98]) by smtp.corp.redhat.com (Postfix) with ESMTP id D35952166B2B for ; Fri, 14 Apr 2023 14:19:38 +0000 (UTC) From: Paolo Abeni To: mptcp@lists.linux.dev Subject: [PATCH v2 mptcp-next 1/3] mptcp: introduces more address related mibs Date: Fri, 14 Apr 2023 16:19:32 +0200 Message-Id: <57449d46a6d254446a227aa22597dd0837dfe331.1681481877.git.pabeni@redhat.com> In-Reply-To: References: Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8"; x-default="true" Currently we don't track explicitly a few events related to address management suboption handling; this patch adds new mibs for ADD_ADDR and RM_ADDR options tx and for missed tx events due to internal storage exahustion. The self-tests must be updated to properly handle different mibs with the same/shared prefix. Additionally removes a couple of warning tracking the loss event. Closes: https://github.com/multipath-tcp/mptcp_net-next/issues/378 Signed-off-by: Paolo Abeni --- net/mptcp/mib.c | 6 ++++++ net/mptcp/mib.h | 18 ++++++++++++++++++ net/mptcp/options.c | 5 ++++- net/mptcp/pm.c | 6 ++++-- .../testing/selftests/net/mptcp/mptcp_join.sh | 4 ++-- 5 files changed, 34 insertions(+), 5 deletions(-) diff --git a/net/mptcp/mib.c b/net/mptcp/mib.c index 0dac2863c6e1..a0990c365a2e 100644 --- a/net/mptcp/mib.c +++ b/net/mptcp/mib.c @@ -34,7 +34,11 @@ static const struct snmp_mib mptcp_snmp_list[] =3D { SNMP_MIB_ITEM("NoDSSInWindow", MPTCP_MIB_NODSSWINDOW), SNMP_MIB_ITEM("DuplicateData", MPTCP_MIB_DUPDATA), SNMP_MIB_ITEM("AddAddr", MPTCP_MIB_ADDADDR), + SNMP_MIB_ITEM("AddAddrTx", MPTCP_MIB_ADDADDRTX), + SNMP_MIB_ITEM("AddAddrTxDrop", MPTCP_MIB_ADDADDRTXDROP), SNMP_MIB_ITEM("EchoAdd", MPTCP_MIB_ECHOADD), + SNMP_MIB_ITEM("EchoAddTx", MPTCP_MIB_ECHOADDTX), + SNMP_MIB_ITEM("EchoAddTxDrop", MPTCP_MIB_ECHOADDTXDROP), SNMP_MIB_ITEM("PortAdd", MPTCP_MIB_PORTADD), SNMP_MIB_ITEM("AddAddrDrop", MPTCP_MIB_ADDADDRDROP), SNMP_MIB_ITEM("MPJoinPortSynRx", MPTCP_MIB_JOINPORTSYNRX), @@ -44,6 +48,8 @@ static const struct snmp_mib mptcp_snmp_list[] =3D { SNMP_MIB_ITEM("MismatchPortAckRx", MPTCP_MIB_MISMATCHPORTACKRX), SNMP_MIB_ITEM("RmAddr", MPTCP_MIB_RMADDR), SNMP_MIB_ITEM("RmAddrDrop", MPTCP_MIB_RMADDRDROP), + SNMP_MIB_ITEM("RmAddrTx", MPTCP_MIB_RMADDRTX), + SNMP_MIB_ITEM("RmAddrTxDrop", MPTCP_MIB_RMADDRTXDROP), SNMP_MIB_ITEM("RmSubflow", MPTCP_MIB_RMSUBFLOW), SNMP_MIB_ITEM("MPPrioTx", MPTCP_MIB_MPPRIOTX), SNMP_MIB_ITEM("MPPrioRx", MPTCP_MIB_MPPRIORX), diff --git a/net/mptcp/mib.h b/net/mptcp/mib.h index 2be3596374f4..cae71d947252 100644 --- a/net/mptcp/mib.h +++ b/net/mptcp/mib.h @@ -27,7 +27,15 @@ enum linux_mptcp_mib_field { MPTCP_MIB_NODSSWINDOW, /* Segments not in MPTCP windows */ MPTCP_MIB_DUPDATA, /* Segments discarded due to duplicate DSS */ MPTCP_MIB_ADDADDR, /* Received ADD_ADDR with echo-flag=3D0 */ + MPTCP_MIB_ADDADDRTX, /* Sent ADD_ADDR with echo-flag=3D0 */ + MPTCP_MIB_ADDADDRTXDROP, /* ADD_ADDR with echo-flag=3D0 not send due to + * resource exhaustion + */ MPTCP_MIB_ECHOADD, /* Received ADD_ADDR with echo-flag=3D1 */ + MPTCP_MIB_ECHOADDTX, /* Send ADD_ADDR with echo-flag=3D1 */ + MPTCP_MIB_ECHOADDTXDROP, /* ADD_ADDR with echo-flag=3D1 not send due + * to resource exhaustion + */ MPTCP_MIB_PORTADD, /* Received ADD_ADDR with a port-number */ MPTCP_MIB_ADDADDRDROP, /* Dropped incoming ADD_ADDR */ MPTCP_MIB_JOINPORTSYNRX, /* Received a SYN MP_JOIN with a different port-= number */ @@ -37,6 +45,8 @@ enum linux_mptcp_mib_field { MPTCP_MIB_MISMATCHPORTACKRX, /* Received an ACK MP_JOIN with a mismatched= port-number */ MPTCP_MIB_RMADDR, /* Received RM_ADDR */ MPTCP_MIB_RMADDRDROP, /* Dropped incoming RM_ADDR */ + MPTCP_MIB_RMADDRTX, /* Sent RM_ADDR */ + MPTCP_MIB_RMADDRTXDROP, /* RM_ADDR not sent due to resource exhaustion */ MPTCP_MIB_RMSUBFLOW, /* Remove a subflow */ MPTCP_MIB_MPPRIOTX, /* Transmit a MP_PRIO */ MPTCP_MIB_MPPRIORX, /* Received a MP_PRIO */ @@ -63,6 +73,14 @@ struct mptcp_mib { unsigned long mibs[LINUX_MIB_MPTCP_MAX]; }; =20 +static inline void MPTCP_ADD_STATS(struct net *net, + enum linux_mptcp_mib_field field, + int val) +{ + if (likely(net->mib.mptcp_statistics)) + SNMP_ADD_STATS(net->mib.mptcp_statistics, field, val); +} + static inline void MPTCP_INC_STATS(struct net *net, enum linux_mptcp_mib_field field) { diff --git a/net/mptcp/options.c b/net/mptcp/options.c index 19a01b6566f1..8a8083207be4 100644 --- a/net/mptcp/options.c +++ b/net/mptcp/options.c @@ -687,9 +687,12 @@ static bool mptcp_established_options_add_addr(struct = sock *sk, struct sk_buff * } opts->suboptions |=3D OPTION_MPTCP_ADD_ADDR; if (!echo) { + MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_ADDADDRTX); opts->ahmac =3D add_addr_generate_hmac(msk->local_key, msk->remote_key, &opts->addr); + } else { + MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_ECHOADDTX); } pr_debug("addr_id=3D%d, ahmac=3D%llu, echo=3D%d, port=3D%d", opts->addr.id, opts->ahmac, echo, ntohs(opts->addr.port)); @@ -723,7 +726,7 @@ static bool mptcp_established_options_rm_addr(struct so= ck *sk, =20 for (i =3D 0; i < opts->rm_list.nr; i++) pr_debug("rm_list_ids[%d]=3D%d", i, opts->rm_list.ids[i]); - + MPTCP_ADD_STATS(sock_net(sk), MPTCP_MIB_RMADDRTX, opts->rm_list.nr); return true; } =20 diff --git a/net/mptcp/pm.c b/net/mptcp/pm.c index 4ed4d29d9c11..7539137719ef 100644 --- a/net/mptcp/pm.c +++ b/net/mptcp/pm.c @@ -26,7 +26,8 @@ int mptcp_pm_announce_addr(struct mptcp_sock *msk, =20 if (add_addr & (echo ? BIT(MPTCP_ADD_ADDR_ECHO) : BIT(MPTCP_ADD_ADDR_SIGNAL))) { - pr_warn("addr_signal error, add_addr=3D%d, echo=3D%d", add_addr, echo); + MPTCP_INC_STATS(sock_net((struct sock *)msk), + echo ? MPTCP_MIB_ECHOADDTXDROP : MPTCP_MIB_ADDADDRTXDROP); return -EINVAL; } =20 @@ -48,7 +49,8 @@ int mptcp_pm_remove_addr(struct mptcp_sock *msk, const st= ruct mptcp_rm_list *rm_ pr_debug("msk=3D%p, rm_list_nr=3D%d", msk, rm_list->nr); =20 if (rm_addr) { - pr_warn("addr_signal error, rm_addr=3D%d", rm_addr); + MPTCP_ADD_STATS(sock_net((struct sock *)msk), + MPTCP_MIB_RMADDRTXDROP, rm_list->nr); return -EINVAL; } =20 diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testin= g/selftests/net/mptcp/mptcp_join.sh index fafd19ec7e1f..095ddd747ffc 100755 --- a/tools/testing/selftests/net/mptcp/mptcp_join.sh +++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh @@ -1486,7 +1486,7 @@ chk_add_nr() fi =20 echo -n " - echo " - count=3D$(ip netns exec $ns1 nstat -as | grep MPTcpExtEchoAdd | awk '{pri= nt $2}') + count=3D$(ip netns exec $ns1 nstat -as MPTcpExtEchoAdd | grep MPTcpExtEch= oAdd | awk '{print $2}') [ -z "$count" ] && count=3D0 if [ "$count" !=3D "$echo_nr" ]; then echo "[fail] got $count ADD_ADDR echo[s] expected $echo_nr" @@ -1608,7 +1608,7 @@ chk_rm_nr() fi =20 printf "%-${nr_blank}s %s" " " "rm " - count=3D$(ip netns exec $addr_ns nstat -as | grep MPTcpExtRmAddr | awk '{= print $2}') + count=3D$(ip netns exec $addr_ns nstat -as MPTcpExtRmAddr | grep MPTcpExt= RmAddr | awk '{print $2}') [ -z "$count" ] && count=3D0 if [ "$count" !=3D "$rm_addr_nr" ]; then echo "[fail] got $count RM_ADDR[s] expected $rm_addr_nr" --=20 2.39.2 From nobody Fri May 10 12:32:22 2024 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C745920F6 for ; Fri, 14 Apr 2023 14:19:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1681481987; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=iqh/N1lADASk/RGUduykfSOLNzo4EIAHw7rz99+56Ho=; b=OowSFPtarLIjeZ7wTMyo58lgVUAx3DG9A7ZmxtaBTatnJj6jZRe2s5cgbLRQ49PTqTQ2wP Y6U9NkHn9VFk4GYRz/KH/qqz0P9I5hoW57ojrYQQM8iyEeEWmoX8ZIqjv2/Csw9NHTG1zy GIglYcs1GihQ6G8Xmu1WWjuo8Mgx2tQ= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-339-yr7mEwO_MousdffzyJIRkw-1; Fri, 14 Apr 2023 10:19:46 -0400 X-MC-Unique: yr7mEwO_MousdffzyJIRkw-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 35F088477DA for ; Fri, 14 Apr 2023 14:19:40 +0000 (UTC) Received: from gerbillo.redhat.com (unknown [10.39.194.98]) by smtp.corp.redhat.com (Postfix) with ESMTP id BA6782166B2A for ; Fri, 14 Apr 2023 14:19:39 +0000 (UTC) From: Paolo Abeni To: mptcp@lists.linux.dev Subject: [PATCH v2 mptcp-next 2/3] selftests: mptcp: add explicit check for new mibs Date: Fri, 14 Apr 2023 16:19:33 +0200 Message-Id: <0ea2ad27bcfb589e1d6e0c00f14a7a3c30a97824.1681481877.git.pabeni@redhat.com> In-Reply-To: References: Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8"; x-default="true" Instead of duplicating the all existing TX check with the TX side, add the new ones on selected test cases. Signed-off-by: Paolo Abeni --- .../testing/selftests/net/mptcp/mptcp_join.sh | 62 +++++++++++++++++++ 1 file changed, 62 insertions(+) diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testin= g/selftests/net/mptcp/mptcp_join.sh index 095ddd747ffc..f6ce10130ded 100755 --- a/tools/testing/selftests/net/mptcp/mptcp_join.sh +++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh @@ -1579,6 +1579,44 @@ chk_add_nr() [ "${dump_stats}" =3D 1 ] && dump_stats } =20 +chk_add_tx_nr() +{ + local add_tx_nr=3D$1 + local echo_tx_nr=3D$2 + local dump_stats + local timeout + local count + + timeout=3D$(ip netns exec $ns1 sysctl -n net.mptcp.add_addr_timeout) + + printf "%-${nr_blank}s %s" " " "add TX" + count=3D$(ip netns exec $ns1 nstat -as MPTcpExtAddAddrTx | grep MPTcpExtA= ddAddrTx | awk '{print $2}') + [ -z "$count" ] && count=3D0 + + # if the test configured a short timeout tolerate greater then expected + # add addrs options, due to retransmissions + if [ "$count" !=3D "$add_tx_nr" ] && { [ "$timeout" -gt 1 ] || [ "$count"= -lt "$add_tx_nr" ]; }; then + echo "[fail] got $count ADD_ADDR[s] TX, expected $add_tx_nr" + fail_test + dump_stats=3D1 + else + echo -n "[ ok ]" + fi + + echo -n " - echo TX " + count=3D$(ip netns exec $ns2 nstat -as MPTcpExtEchoAddTx | grep MPTcpExtE= choAddTx | awk '{print $2}') + [ -z "$count" ] && count=3D0 + if [ "$count" !=3D "$echo_tx_nr" ]; then + echo "[fail] got $count ADD_ADDR echo[s] TX, expected $echo_tx_nr" + fail_test + dump_stats=3D1 + else + echo "[ ok ]" + fi + + [ "${dump_stats}" =3D 1 ] && dump_stats +} + chk_rm_nr() { local rm_addr_nr=3D$1 @@ -1654,6 +1692,26 @@ chk_rm_nr() echo "$extra_msg" } =20 +chk_rm_tx_nr() +{ + local rm_addr_tx_nr=3D$1 + + printf "%-${nr_blank}s %s" " " "rm TX " + count=3D$(ip netns exec $ns2 nstat -as MPTcpExtRmAddrTx | grep MPTcpExtRm= AddrTx | awk '{print $2}') + [ -z "$count" ] && count=3D0 + if [ "$count" !=3D "$rm_addr_tx_nr" ]; then + echo "[fail] got $count RM_ADDR[s] expected $rm_addr_tx_nr" + fail_test + dump_stats=3D1 + else + echo -n "[ ok ]" + fi + + [ "${dump_stats}" =3D 1 ] && dump_stats + + echo "$extra_msg" +} + chk_prio_nr() { local mp_prio_nr_tx=3D$1 @@ -1933,6 +1991,7 @@ signal_address_tests() pm_nl_add_endpoint $ns1 10.0.2.1 flags signal run_tests $ns1 $ns2 10.0.1.1 chk_join_nr 0 0 0 + chk_add_tx_nr 1 1 chk_add_nr 1 1 fi =20 @@ -2114,6 +2173,7 @@ add_addr_timeout_tests() pm_nl_add_endpoint $ns1 10.0.2.1 flags signal run_tests $ns1 $ns2 10.0.1.1 0 0 0 slow chk_join_nr 1 1 1 + chk_add_tx_nr 4 4 chk_add_nr 4 0 fi =20 @@ -2159,6 +2219,7 @@ remove_tests() pm_nl_add_endpoint $ns2 10.0.3.2 flags subflow run_tests $ns1 $ns2 10.0.1.1 0 0 -1 slow chk_join_nr 1 1 1 + chk_rm_tx_nr 1 chk_rm_nr 1 1 fi =20 @@ -2257,6 +2318,7 @@ remove_tests() pm_nl_add_endpoint $ns2 10.0.4.2 flags subflow run_tests $ns1 $ns2 10.0.1.1 0 -8 -8 slow chk_join_nr 3 3 3 + chk_rm_tx_nr 0 chk_rm_nr 0 3 simult fi =20 --=20 2.39.2 From nobody Fri May 10 12:32:22 2024 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 046C920F6 for ; Fri, 14 Apr 2023 14:19:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1681481991; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=v+XK6AM42r3xlyaOWrdGldYO/Vaj23WADZwpmnl2T7M=; b=Iy0FHB6WoD0inkuq9i1MIQ8I5HeiKP9WAheKJXorDvRv8Q/39mQyrLCMytB9oiT8SyWYIz H1pXJsx3Kt6FHiF2yrR7+iZodeVsONA/F1KhkeWKQpIq/IbjXqOl+t7Eso9kHydWXZlblj S5/g7rZsQopBoaaKXJbeQuW/Oc3YwHk= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-78-Ns1pLB4mM1uII6bvRBN2cg-1; Fri, 14 Apr 2023 10:19:48 -0400 X-MC-Unique: Ns1pLB4mM1uII6bvRBN2cg-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id E6743381496E for ; Fri, 14 Apr 2023 14:19:40 +0000 (UTC) Received: from gerbillo.redhat.com (unknown [10.39.194.98]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7B7082166B29 for ; Fri, 14 Apr 2023 14:19:40 +0000 (UTC) From: Paolo Abeni To: mptcp@lists.linux.dev Subject: [PATCH v2 mptcp-next 3/3] selftests: mptcp: centralize stats dumping Date: Fri, 14 Apr 2023 16:19:34 +0200 Message-Id: <291b881c99c9fe75898c0f65a0f6a49c5066a1dd.1681481877.git.pabeni@redhat.com> In-Reply-To: References: Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8"; x-default="true" If a test case fails, the mptcp_join.sh script can dump the netns MIBs multiple times, leading to confusing output. Let's dump such info only once per test-case, when needed. This additionally allow removing some code duplication. Signed-off-by: Paolo Abeni --- .../testing/selftests/net/mptcp/mptcp_join.sh | 66 ++----------------- 1 file changed, 5 insertions(+), 61 deletions(-) diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testin= g/selftests/net/mptcp/mptcp_join.sh index f6ce10130ded..5ae2301407e2 100755 --- a/tools/testing/selftests/net/mptcp/mptcp_join.sh +++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh @@ -30,6 +30,7 @@ evts_ns1=3D"" evts_ns2=3D"" evts_ns1_pid=3D0 evts_ns2_pid=3D0 +stats_dumped=3D0 =20 declare -A all_tests declare -a only_tests_ids @@ -83,6 +84,7 @@ init_partial() fi done =20 + stats_dumped=3D0 check_invert=3D0 validate_checksum=3D$checksum FAILING_LINKS=3D"" @@ -343,6 +345,9 @@ fail_test() { ret=3D1 failed_tests[${TEST_COUNT}]=3D"${TEST_NAME}" + + [ "${stats_dumped}" =3D 0 ] && dump_stats + stats_dumped=3D1 } =20 get_failed_tests_ids() @@ -1114,7 +1119,6 @@ chk_csum_nr() local csum_ns1=3D${1:-0} local csum_ns2=3D${2:-0} local count - local dump_stats local extra_msg=3D"" local allow_multi_errors_ns1=3D0 local allow_multi_errors_ns2=3D0 @@ -1138,7 +1142,6 @@ chk_csum_nr() { [ "$count" -lt $csum_ns1 ] && [ $allow_multi_errors_ns1 -eq 1 ]; }; = then echo "[fail] got $count data checksum error[s] expected $csum_ns1" fail_test - dump_stats=3D1 else echo -n "[ ok ]" fi @@ -1152,11 +1155,9 @@ chk_csum_nr() { [ "$count" -lt $csum_ns2 ] && [ $allow_multi_errors_ns2 -eq 1 ]; }; = then echo "[fail] got $count data checksum error[s] expected $csum_ns2" fail_test - dump_stats=3D1 else echo -n "[ ok ]" fi - [ "${dump_stats}" =3D 1 ] && dump_stats =20 echo "$extra_msg" } @@ -1167,7 +1168,6 @@ chk_fail_nr() local fail_rx=3D$2 local ns_invert=3D${3:-""} local count - local dump_stats local ns_tx=3D$ns1 local ns_rx=3D$ns2 local extra_msg=3D"" @@ -1199,7 +1199,6 @@ chk_fail_nr() { [ "$count" -gt "$fail_tx" ] && [ $allow_tx_lost -eq 1 ]; }; then echo "[fail] got $count MP_FAIL[s] TX expected $fail_tx" fail_test - dump_stats=3D1 else echo -n "[ ok ]" fi @@ -1214,13 +1213,10 @@ chk_fail_nr() { [ "$count" -gt "$fail_rx" ] && [ $allow_rx_lost -eq 1 ]; }; then echo "[fail] got $count MP_FAIL[s] RX expected $fail_rx" fail_test - dump_stats=3D1 else echo -n "[ ok ]" fi =20 - [ "${dump_stats}" =3D 1 ] && dump_stats - echo "$extra_msg" } =20 @@ -1230,7 +1226,6 @@ chk_fclose_nr() local fclose_rx=3D$2 local ns_invert=3D$3 local count - local dump_stats local ns_tx=3D$ns2 local ns_rx=3D$ns1 local extra_msg=3D" " @@ -1248,7 +1243,6 @@ chk_fclose_nr() if [ "$count" !=3D "$fclose_tx" ]; then echo "[fail] got $count MP_FASTCLOSE[s] TX expected $fclose_tx" fail_test - dump_stats=3D1 else echo -n "[ ok ]" fi @@ -1260,13 +1254,10 @@ chk_fclose_nr() if [ "$count" !=3D "$fclose_rx" ]; then echo "[fail] got $count MP_FASTCLOSE[s] RX expected $fclose_rx" fail_test - dump_stats=3D1 else echo -n "[ ok ]" fi =20 - [ "${dump_stats}" =3D 1 ] && dump_stats - echo "$extra_msg" } =20 @@ -1276,7 +1267,6 @@ chk_rst_nr() local rst_rx=3D$2 local ns_invert=3D${3:-""} local count - local dump_stats local ns_tx=3D$ns1 local ns_rx=3D$ns2 local extra_msg=3D"" @@ -1293,7 +1283,6 @@ chk_rst_nr() if [ $count -lt $rst_tx ]; then echo "[fail] got $count MP_RST[s] TX expected $rst_tx" fail_test - dump_stats=3D1 else echo -n "[ ok ]" fi @@ -1304,13 +1293,10 @@ chk_rst_nr() if [ "$count" -lt "$rst_rx" ]; then echo "[fail] got $count MP_RST[s] RX expected $rst_rx" fail_test - dump_stats=3D1 else echo -n "[ ok ]" fi =20 - [ "${dump_stats}" =3D 1 ] && dump_stats - echo "$extra_msg" } =20 @@ -1319,7 +1305,6 @@ chk_infi_nr() local infi_tx=3D$1 local infi_rx=3D$2 local count - local dump_stats =20 printf "%-${nr_blank}s %s" " " "itx" count=3D$(ip netns exec $ns2 nstat -as | grep InfiniteMapTx | awk '{print= $2}') @@ -1327,7 +1312,6 @@ chk_infi_nr() if [ "$count" !=3D "$infi_tx" ]; then echo "[fail] got $count infinite map[s] TX expected $infi_tx" fail_test - dump_stats=3D1 else echo -n "[ ok ]" fi @@ -1338,12 +1322,9 @@ chk_infi_nr() if [ "$count" !=3D "$infi_rx" ]; then echo "[fail] got $count infinite map[s] RX expected $infi_rx" fail_test - dump_stats=3D1 else echo "[ ok ]" fi - - [ "${dump_stats}" =3D 1 ] && dump_stats } =20 chk_join_nr() @@ -1358,7 +1339,6 @@ chk_join_nr() local infi_nr=3D${8:-0} local corrupted_pkts=3D${9:-0} local count - local dump_stats local with_cookie local title=3D"${TEST_NAME}" =20 @@ -1372,7 +1352,6 @@ chk_join_nr() if [ "$count" !=3D "$syn_nr" ]; then echo "[fail] got $count JOIN[s] syn expected $syn_nr" fail_test - dump_stats=3D1 else echo -n "[ ok ]" fi @@ -1390,7 +1369,6 @@ chk_join_nr() else echo "[fail] got $count JOIN[s] synack expected $syn_ack_nr" fail_test - dump_stats=3D1 fi else echo -n "[ ok ]" @@ -1402,11 +1380,9 @@ chk_join_nr() if [ "$count" !=3D "$ack_nr" ]; then echo "[fail] got $count JOIN[s] ack expected $ack_nr" fail_test - dump_stats=3D1 else echo "[ ok ]" fi - [ "${dump_stats}" =3D 1 ] && dump_stats if [ $validate_checksum -eq 1 ]; then chk_csum_nr $csum_ns1 $csum_ns2 chk_fail_nr $fail_nr $fail_nr @@ -1466,7 +1442,6 @@ chk_add_nr() local mis_syn_nr=3D${7:-0} local mis_ack_nr=3D${8:-0} local count - local dump_stats local timeout =20 timeout=3D$(ip netns exec $ns1 sysctl -n net.mptcp.add_addr_timeout) @@ -1480,7 +1455,6 @@ chk_add_nr() if [ "$count" !=3D "$add_nr" ] && { [ "$timeout" -gt 1 ] || [ "$count" -l= t "$add_nr" ]; }; then echo "[fail] got $count ADD_ADDR[s] expected $add_nr" fail_test - dump_stats=3D1 else echo -n "[ ok ]" fi @@ -1491,7 +1465,6 @@ chk_add_nr() if [ "$count" !=3D "$echo_nr" ]; then echo "[fail] got $count ADD_ADDR echo[s] expected $echo_nr" fail_test - dump_stats=3D1 else echo -n "[ ok ]" fi @@ -1503,7 +1476,6 @@ chk_add_nr() if [ "$count" !=3D "$port_nr" ]; then echo "[fail] got $count ADD_ADDR[s] with a port-number expected $port_n= r" fail_test - dump_stats=3D1 else echo "[ ok ]" fi @@ -1516,7 +1488,6 @@ chk_add_nr() echo "[fail] got $count JOIN[s] syn with a different \ port-number expected $syn_nr" fail_test - dump_stats=3D1 else echo -n "[ ok ]" fi @@ -1529,7 +1500,6 @@ chk_add_nr() echo "[fail] got $count JOIN[s] synack with a different \ port-number expected $syn_ack_nr" fail_test - dump_stats=3D1 else echo -n "[ ok ]" fi @@ -1542,7 +1512,6 @@ chk_add_nr() echo "[fail] got $count JOIN[s] ack with a different \ port-number expected $ack_nr" fail_test - dump_stats=3D1 else echo "[ ok ]" fi @@ -1555,7 +1524,6 @@ chk_add_nr() echo "[fail] got $count JOIN[s] syn with a mismatched \ port-number expected $mis_syn_nr" fail_test - dump_stats=3D1 else echo -n "[ ok ]" fi @@ -1568,22 +1536,18 @@ chk_add_nr() echo "[fail] got $count JOIN[s] ack with a mismatched \ port-number expected $mis_ack_nr" fail_test - dump_stats=3D1 else echo "[ ok ]" fi else echo "" fi - - [ "${dump_stats}" =3D 1 ] && dump_stats } =20 chk_add_tx_nr() { local add_tx_nr=3D$1 local echo_tx_nr=3D$2 - local dump_stats local timeout local count =20 @@ -1598,7 +1562,6 @@ chk_add_tx_nr() if [ "$count" !=3D "$add_tx_nr" ] && { [ "$timeout" -gt 1 ] || [ "$count"= -lt "$add_tx_nr" ]; }; then echo "[fail] got $count ADD_ADDR[s] TX, expected $add_tx_nr" fail_test - dump_stats=3D1 else echo -n "[ ok ]" fi @@ -1609,12 +1572,9 @@ chk_add_tx_nr() if [ "$count" !=3D "$echo_tx_nr" ]; then echo "[fail] got $count ADD_ADDR echo[s] TX, expected $echo_tx_nr" fail_test - dump_stats=3D1 else echo "[ ok ]" fi - - [ "${dump_stats}" =3D 1 ] && dump_stats } =20 chk_rm_nr() @@ -1624,7 +1584,6 @@ chk_rm_nr() local invert local simult local count - local dump_stats local addr_ns=3D$ns1 local subflow_ns=3D$ns2 local extra_msg=3D"" @@ -1651,7 +1610,6 @@ chk_rm_nr() if [ "$count" !=3D "$rm_addr_nr" ]; then echo "[fail] got $count RM_ADDR[s] expected $rm_addr_nr" fail_test - dump_stats=3D1 else echo -n "[ ok ]" fi @@ -1675,20 +1633,16 @@ chk_rm_nr() else echo "[fail] got $count RM_SUBFLOW[s] expected in range [$rm_subflow_nr= :$((rm_subflow_nr*2))]" fail_test - dump_stats=3D1 fi return fi if [ "$count" !=3D "$rm_subflow_nr" ]; then echo "[fail] got $count RM_SUBFLOW[s] expected $rm_subflow_nr" fail_test - dump_stats=3D1 else echo -n "[ ok ]" fi =20 - [ "${dump_stats}" =3D 1 ] && dump_stats - echo "$extra_msg" } =20 @@ -1702,13 +1656,10 @@ chk_rm_tx_nr() if [ "$count" !=3D "$rm_addr_tx_nr" ]; then echo "[fail] got $count RM_ADDR[s] expected $rm_addr_tx_nr" fail_test - dump_stats=3D1 else echo -n "[ ok ]" fi =20 - [ "${dump_stats}" =3D 1 ] && dump_stats - echo "$extra_msg" } =20 @@ -1717,7 +1668,6 @@ chk_prio_nr() local mp_prio_nr_tx=3D$1 local mp_prio_nr_rx=3D$2 local count - local dump_stats =20 printf "%-${nr_blank}s %s" " " "ptx" count=3D$(ip netns exec $ns1 nstat -as | grep MPTcpExtMPPrioTx | awk '{pr= int $2}') @@ -1725,7 +1675,6 @@ chk_prio_nr() if [ "$count" !=3D "$mp_prio_nr_tx" ]; then echo "[fail] got $count MP_PRIO[s] TX expected $mp_prio_nr_tx" fail_test - dump_stats=3D1 else echo -n "[ ok ]" fi @@ -1736,12 +1685,9 @@ chk_prio_nr() if [ "$count" !=3D "$mp_prio_nr_rx" ]; then echo "[fail] got $count MP_PRIO[s] RX expected $mp_prio_nr_rx" fail_test - dump_stats=3D1 else echo "[ ok ]" fi - - [ "${dump_stats}" =3D 1 ] && dump_stats } =20 chk_subflow_nr() @@ -1773,7 +1719,6 @@ chk_subflow_nr() ss -N $ns1 -tOni ss -N $ns1 -tOni | grep token ip -n $ns1 mptcp endpoint - dump_stats fi } =20 @@ -1813,7 +1758,6 @@ chk_mptcp_info() if [ "$dump_stats" =3D 1 ]; then ss -N $ns1 -inmHM ss -N $ns2 -inmHM - dump_stats fi } =20 --=20 2.39.2