From nobody Sat Aug 15 20:33:05 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 155F536196E for ; Thu, 13 Aug 2026 10:29:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786616981; cv=none; b=JHzG/cgV0tx1oonTb8trWKEqB+050PoTDcB1IP1SVKnb4XQJ4zTRPCmPHnP08/MeLxJwtKFUH1iY0nC1cpO1RoO+THX3UMIWwVvJZKXK/uAuY2Ga9JjN7VU7DxU1qnc2PEqpYLrWAIRHT/Y2hVghIO8L8oL/2ssqN78u8rMny+0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786616981; c=relaxed/simple; bh=YflyKlQeOB+yHzJvCzRrIZMYXV03AIQUygOhu5Ov1Hk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Bvpj7dACO6nNq+I4dQSOEiqMtmL1AGQEA2xktvPkiWJwpFQYnc1tmHelBmqM2scYbfL5SHGrVcCHMlLFDWFHiPDaP/y4toCMWhDLEngmsXRPSkQgkw6qVJMIDssY99NzvYEgoWb6LGp2pTq+Me1E0kmWq7BI/p8Nyx2v2gQQ0B4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=VGNkJUc+; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="VGNkJUc+" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8B7391F00A3D; Thu, 13 Aug 2026 10:29:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1786616980; bh=y04qYWuBJhf+Yn7ONjNH6AbMoZZrvqQsXPO4+Lf4SGg=; h=From:Date:Subject:References:In-Reply-To:To:Cc; b=VGNkJUc+U5uTytOdPd9Cm8EOXvxWWhTBLaawxlhp5t3XPsDpp0By1aPCT8M4saLe+ MO4G5LZxmJ5aROlGzX9XJiawZYHxk+aLKnuiighJooDvcWgmz8F2hzVdCgTLdRvEcw BVXVK5hXpY+K6HDi8q741j/gLgWAUvDizr5g4SwKAGRVR7fxtFOe3miS8WAfl8yQzC ag0MrXnMbb8wu6KJgzp1y7gAkgQYvMYQYbq0q6yqekWN4Z9sEi88VjUriIGXzjUbkG LQtg3xyk/F/YyLx3qrgjMw1xeJwgOzyRT7+SSb/UjXQS4NIdi7AyotJvFKtDg9A/Ek KRm1ulK886Sbw== From: "Matthieu Baerts (NGI0)" Date: Thu, 13 Aug 2026 12:29:32 +0200 Subject: [PATCH mptcp-net 1/2] selftests: mptcp: lib: dump nstat for the right test Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260813-sft-mptcp-nstat-hist-v1-1-5bb96bae7ef6@kernel.org> References: <20260813-sft-mptcp-nstat-hist-v1-0-5bb96bae7ef6@kernel.org> In-Reply-To: <20260813-sft-mptcp-nstat-hist-v1-0-5bb96bae7ef6@kernel.org> To: MPTCP Linux Cc: "Matthieu Baerts (NGI0)" X-Mailer: b4 0.16.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1750; i=matttbe@kernel.org; h=from:subject:message-id; bh=YflyKlQeOB+yHzJvCzRrIZMYXV03AIQUygOhu5Ov1Hk=; b=owGbwMvMwCVWo/Th0Gd3rumMp9WSGLJq50wQeL9vC6c6R0nSFpMJTzumT5OsYKwysrps6MGp5 DV15ybGjlIWBjEuBlkxRRbptsj8mc+reEu8/Cxg5rAygQxh4OIUgIlc/snIcKN7F8PUP1Olg9Z2 nzZI9AxOLi15UPnKSzEy53yDYvmeBIa/ooysRhdPbX3Sz3fR1ulkxgK2gztltn5aFe21UGu9ze8 wXgA= X-Developer-Key: i=matttbe@kernel.org; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 In case of errors, mptcp_lib_pr_nstat is called to dump the nstat counters, but for some tests, it was dumping the counters for all subtests, not just the current one. That's an issue for tests that don't recreate the netns for each subtest, e.g. mptcp_connect.sh. In this case, 'nstat -a' will look at the absolute counters since the creation of the netns, making debugging harder. Instead, it should dump the counters for the current test, by using the history recorded in /tmp/.nstat if available, and not using '-a' which was dumping the absolute values instead of calculating increments. While at it, rename the previous 'hist' variable to 'cache' as it was used to look at the cache, not the nstat history. Fixes: 658e53141780 ("selftests: mptcp: join: dump stats from history") Signed-off-by: Matthieu Baerts (NGI0) --- tools/testing/selftests/net/mptcp/mptcp_lib.sh | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/tools/testing/selftests/net/mptcp/mptcp_lib.sh b/tools/testing= /selftests/net/mptcp/mptcp_lib.sh index 5ef6033775c8..da1da414c30f 100644 --- a/tools/testing/selftests/net/mptcp/mptcp_lib.sh +++ b/tools/testing/selftests/net/mptcp/mptcp_lib.sh @@ -108,12 +108,14 @@ mptcp_lib_pr_info() { =20 mptcp_lib_pr_nstat() { local ns=3D"${1}" - local hist=3D"/tmp/${ns}.out" + local cache=3D"/tmp/${ns}.out" + local hist=3D"/tmp/${ns}.nstat" =20 - if [ -f "${hist}" ]; then - awk '$2 !=3D 0 { print " "$0 }' "${hist}" + if [ -f "${cache}" ]; then + awk '$2 !=3D 0 { print " "$0 }' "${cache}" else - ip netns exec "${ns}" nstat -as | grep Tcp + NSTAT_HISTORY=3D"${hist}" ip netns exec "${ns}" nstat -s | + grep Tcp fi } =20 --=20 2.53.0 From nobody Sat Aug 15 20:33:05 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 DC5EE353A85 for ; Thu, 13 Aug 2026 10:29:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786616982; cv=none; b=V5WzVfS5/ysCWjuxlEeHFKuivIvcFVzQRBcKBNH5pn4kBntba3ttHyoMo0dRqWqq0fMt5UW9GFJvDcXO4r48Jr6cpBNR1ccBmZWsiTj9ed343qn+8nQlMyznTUI5Z/4t4GYHkFSEQXkgCA8uuVNCE48IQ5BstOQdoYkbhrI1WX8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786616982; c=relaxed/simple; bh=5iI4X2LU3mEAF5l8Ea6EsweY6REaWeaaikl1nppF0JI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=gAbCUMNAZ4eF6xRwVSfINbr4W4FIjIISZxXVnkcJkl4US3F23NezBRMGpQn76IH9mEF/5OMtymO7TM8aZjdZjJHvQXIQ1S54TOXuFQSjHa8ApBMBYA3aTpqU4IF5jZ9vm7ceUr8y2wsN2AVpP2nHxwq/0KYccpsaIs2mA/0NLVs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=XeTiRBFR; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="XeTiRBFR" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5D7C91F00A3A; Thu, 13 Aug 2026 10:29:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1786616980; bh=ZZodWEkPKINW9rjjTljIDWFi27HkeJNzmTfkP2bfIR4=; h=From:Date:Subject:References:In-Reply-To:To:Cc; b=XeTiRBFRi7DPnfkvJ4c8yBDhklv7/03i1lqRDatjCYrodY3hNuUH69e4w7egyHlAr dyrphqett8FkO4qA5/33XfQX8rQqPNEQUkmsQb6JXPfDLhNVicnE7iivofY4ZX4Rfy IsKtA/LqPdupQRUEkhOAkSo913wd22m4WIFVCMLxr9Ujx6SuUewsFxl2arpkEwlNJK 0VR3OE/CZfxQVSLCSdEIPwlXvS16JN0iG/C6+iE5Z/hwW8KHXAebaImAD4LU1i06sw 2NrkSOelZScZji0qXCZQ29U8IAYl2Bq2cIAvVPHMBxVdpPgoN2shZCS2WnmmsA7Sh/ hySf3W+BAWuRg== From: "Matthieu Baerts (NGI0)" Date: Thu, 13 Aug 2026 12:29:33 +0200 Subject: [PATCH mptcp-net 2/2] selftests: mptcp: lib: get counters for the right test Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260813-sft-mptcp-nstat-hist-v1-2-5bb96bae7ef6@kernel.org> References: <20260813-sft-mptcp-nstat-hist-v1-0-5bb96bae7ef6@kernel.org> In-Reply-To: <20260813-sft-mptcp-nstat-hist-v1-0-5bb96bae7ef6@kernel.org> To: MPTCP Linux Cc: "Matthieu Baerts (NGI0)" X-Mailer: b4 0.16.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2353; i=matttbe@kernel.org; h=from:subject:message-id; bh=5iI4X2LU3mEAF5l8Ea6EsweY6REaWeaaikl1nppF0JI=; b=owGbwMvMwCVWo/Th0Gd3rumMp9WSGLJq50zKSarj/8b6T38N27Kni/xDZ5ft0VlX/bxgrdw7h YBqWSvzjlIWBjEuBlkxRRbptsj8mc+reEu8/Cxg5rAygQxh4OIUgIlMbmL473C6/L/Av8IuJVuT Z37ZzGY/FLRmC1rs+79mpty5yJrpZxkZlm2Jdj2Y+1WES2pO4MJ+kS9pPbZ56hINTF/cvqguetD ABQA= X-Developer-Key: i=matttbe@kernel.org; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 When the value for a MIB counter is required, mptcp_lib_get_counter is called. It tries to use the cache, if available. If not it falls back to calling 'nstat' directly by looking at the absolute counters. That's an issue for tests that don't recreate the netns for each subtest. In this case, 'nstat -a' will look at the counters for the netns. Instead, it should look at the increment for the current test, by using the history recorded in /tmp/.nstat, if available, and not using '-a' which was dumping the absolute values. While at it, rename the previous 'hist' variable to 'cache' as it was used to look at the cache, not the nstat history. Fixes: 71388a9f331d ("selftests: mptcp: lib: get counters from nstat histor= y") Signed-off-by: Matthieu Baerts (NGI0) --- tools/testing/selftests/net/mptcp/mptcp_lib.sh | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/tools/testing/selftests/net/mptcp/mptcp_lib.sh b/tools/testing= /selftests/net/mptcp/mptcp_lib.sh index da1da414c30f..b9d14647f401 100644 --- a/tools/testing/selftests/net/mptcp/mptcp_lib.sh +++ b/tools/testing/selftests/net/mptcp/mptcp_lib.sh @@ -416,19 +416,21 @@ mptcp_lib_nstat_get() { } =20 # $1: ns, $2: MIB counter -# Get the counter from the history (mptcp_lib_nstat_{init,get}()) if avail= able. -# If not, get the counter from nstat ignoring any history. +# Get the counter from the cache (mptcp_lib_nstat_{init,get}()) if availab= le. +# If not, get the counter from nstat ignoring any cache, but using the his= tory. mptcp_lib_get_counter() { local ns=3D"${1}" local counter=3D"${2}" - local hist=3D"/tmp/${ns}.out" + local cache=3D"/tmp/${ns}.out" + local hist=3D"/tmp/${ns}.nstat" local count =20 - if [[ -s "${hist}" && "${counter}" =3D=3D *"Tcp"* ]]; then - count=3D$(awk "/^${counter} / {print \$2; exit}" "${hist}") + if [[ -s "${cache}" && "${counter}" =3D=3D *"Tcp"* ]]; then + count=3D$(awk "/^${counter} / {print \$2; exit}" "${cache}") else - count=3D$(ip netns exec "${ns}" nstat -asz "${counter}" | - awk 'NR=3D=3D1 {next} {print $2}') + count=3D$(NSTAT_HISTORY=3D"${hist}" ip netns exec "${ns}" \ + nstat -sz "${counter}" | + awk 'NR=3D=3D1 {next} {print $2}') fi if [ -z "${count}" ]; then mptcp_lib_fail_if_expected_feature "${counter} counter" --=20 2.53.0