Article View: linux.kernel.netdev
Article #18557Re: [PATCH net 4/4] selftests: drv-net: stats: query timestamping stats while down
From: netdev-bot+sashiko
Date: Wed, 18 Nov 2026 14:32
Date: Wed, 18 Nov 2026 14:32
128 lines
12945 bytes
12945 bytes
Thank you for your contribution! Sashiko AI review found 2 potential
issue(s) to consider.
Critical: 0 · High: 0 · Medium: 1 · Low: 1
If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).
- [Medium] The commit message says check_down_ts_stats() should "catch
drivers that crash or reset [timestamping stats] while the interface…
- [Low] In check_down_ts_stats()
(tools/testing/selftests/drivers/net/stats.py), a timestamping counter…
--
selftests: drv-net: stats: query timestamping stats while down
This adds check_down_ts_stats() to the drv-net stats.py selftest. The test
reads the ethtool tsinfo timestamping statistics, brings the interface
down, reads them again, and checks that no counter went backwards.
> diff --git a/tools/testing/selftests/drivers/net/stats.py b/tools/testing/selftests/drivers/net/stats.py
> index b08e4d48b15ce..e61db30b51817 100755
> --- a/tools/testing/selftests/drivers/net/stats.py
> +++ b/tools/testing/selftests/drivers/net/stats.py
> @@ -220,6 +220,28 @@ def check_down(cfg) -> None:
> netfam.qstats_get({"ifindex": cfg.ifindex, "scope": "queue"}, dump=True)
>
>
> +@ksft_disruptive
> +def check_down_ts_stats(cfg) -> None:
> + """Test timestamping stats are not impacted by ifdown"""
> +
> + req = {"header": {"dev-index": cfg.ifindex, "flags": {"stats"}}}
> + try:
> + stats = ethnl.tsinfo_get(req).get("stats")
> + except NlError as e:
> + if e.error == errno.EOPNOTSUPP:
> + raise KsftSkipEx("timestamping not supported by the device") from e
> + raise
> + if not stats:
> + raise KsftSkipEx("timestamping stats not supported by the device")
[Severity: Medium]
Can this test actually detect the reset case that the commit message
describes?
"to catch drivers that crash or reset them while the interface is down"
The baseline is read without first enabling hardware TX timestamping, and
without sending any packets that request a hardware timestamp. The only
source of these counters is the driver's get_ts_stats():
net/ethtool/tsinfo.c:tsinfo_prepare_data() {
...
if (req_base->flags & ETHTOOL_FLAG_STATS) {
ethtool_stats_init((u64 *)&data->stats,
sizeof(data->stats) / sizeof(u64));
if (dev->ethtool_ops->get_ts_stats)
dev->ethtool_ops->get_ts_stats(dev, &data->stats);
}
...
}
In fbnic, ice, idpf, bnxt, wangxun and mlx5, tx-pkts, tx-lost and tx-err
only count TX packets that asked for a hardware timestamp. In a typical
selftest environment the baseline will probably be all zeros.
If the baseline is zero, the ksft_ge(stats2[k], stats[k]) check below
still passes when a driver zeroes its counters in ndo_stop. check_down()
does not have this problem with the same >= pattern, because the qstats
already contain non-zero traffic counts.
The crash-on-query-while-down part does get exercised. Should the test
send some hardware-timestamped TX traffic before reading the baseline, so
that the reset part is covered too?
> +
> + ip(f"link set dev {cfg.dev['ifname']} down")
> + defer(ip, f"link set dev {cfg.dev['ifname']} up")
> +
> + stats2 = ethnl.tsinfo_get(req).get("stats", {})
> + for k in stats:
> + ksft_ge(stats2[k], stats[k], comment=f"{k} went backwards on device down")
[Severity: Low]
What happens here if a counter is in the baseline but missing from the
reply after ifdown?
The {} default only helps when the whole nest is missing. That never
happens here, because tsinfo_fill_reply() always emits the stats nest when
the stats flag is set. What can go missing is individual counters, since
tsinfo_put_stat() leaves out unset values:
net/ethtool/tsinfo.c:tsinfo_put_stat() {
if (val == ETHTOOL_STAT_NOT_SET)
return 0;
...
}
On wangxun ngbe/txgbe, ndo_stop calls wx_ptp_stop(), which sets
wx->ptp_clock to NULL. After that, wx_get_ptp_stats() fills in nothing:
drivers/net/ethernet/wangxun/libwx/wx_ethtool.c:wx_get_ptp_stats() {
...
if (wx->ptp_clock) {
ts_stats->pkts = wx->tx_hwtstamp_pkts;
...
}
}
So stats2 comes back empty and stats2[k] raises KeyError.
ksft_run() still counts this as a failure, and the deferred link up still
runs. However, the output is a Python traceback instead of the "went
backwards on device down" message, and the remaining keys are never
compared.
Would checking k in stats2 (or using stats2.get(k)) with ksft_true() or
ksft_ge() give a clearer failure? The neighbouring check_down() uses the
same qstat2[k] pattern.
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261116202957.3601684-1-dimitri.daskalakis1%40gmail.com
Technical Details
Message-ID:
<179501233564.3136.8246592632106945254@kernel.org>Path:
mbox-mo1.pugleaf.net!news-lax.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-366182-linux-kernel-netdev=dewy.ruReferences:
<20261116202957.3601684-5-dimitri.daskalakis1@gmail.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-366182-linux-kernel-netdev=dewy.ru From: netdev-bot+sashiko@kernel.org Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net 4/4] selftests: drv-net: stats: query timestamping stats while down Date: Wed, 18 Nov 2026 14:32:15 +0000 Organization: Usenet Network Message-ID: <179501233564.3136.8246592632106945254@kernel.org> References: <20261116202957.3601684-5-dimitri.daskalakis1@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="2617471"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:VP8JsM1/7085viG3kVm4vUWGkFQ= sha256:4viwb1fveXpCzcWmDASCH2qrqcuczLDSsHD309FXqHA= sha1:6Iao8WobbVqME4o1Wg+oTu/YEyI= sha256:RiUtnQdjMB1dQcFp0IEyEwmC37fByo5B4i+fdAd6YbQ= List-ID: <netdev.vger.kernel.org> X-Mailpost-Empty-Hdrs: X-Spam-Level X-Received: from localhost (localhost [127.0.0.1]) by mail.dewy.ru (Postfix) with ESMTP id 39F9B1152D1; Wed, 18 Nov 2026 17:32:40 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.401 X-Spam-Status: No, score=-3.401 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key) header.d=kernel.org X-Received: from mail.dewy.ru ([127.0.0.1]) by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id T1T-QaOii66x; Wed, 18 Nov 2026 17:32:34 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-366182-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10]) by mail.dewy.ru (Postfix) with ESMTPS id 4EA321152CE; Wed, 18 Nov 2026 17:32:25 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sea.lore.kernel.org (Postfix) with ESMTP id B5AC03993D; Wed, 18 Nov 2026 14:32:18 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1795012338; b=FzA47LwjJWcOS6jgJyPx/7tZ6i5iVMUNVzcS7lU+NNycTfSPAMOfxKEvj6TfoxoxdPwm gYWvP96pu5K8R7edwdOk5VFH8b60IWQA/RTvmLnK1KXv3c9oJsQYCXa+j+zxrOSBvWKzz 32YEsf3SiVrLvMAkjtZ+aI2M/JAKL0DdgE1NJxrnX8GjKbHNpqMM9t8c3MDboXf7qhlIl QMfeGtTTarNbDL/jLHBI1NkcRW9iRlARtXmYnKak2fMgMX1fIgAoL+4eYV80AWYDYD1oh /AaMIc9VdoEvZtSVZk+o0FtjxfUwHAdWMxLEr6tZos/n9mihElNjom3V4Zw2S7aLcmw== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795012338; h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc: Date:Message-ID:In-Reply-To:References:X-sashiko-severity: Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id: List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner: Precedence:MIME-Version; bh=0gn9wLZ33T3rqOAl4UM4rcJq4VGKZHDzazvoGK9niM8=; b=ImE/KXfVV4wWSKDYLMECUGAZ1L0RiAPsEQbRh60sC7RbXJ7hvluxpEobj8yQQ1HPRoPg ej4NoZmkD3CD60OUhifjGQHwPKJdQdax+1CbnZIzVdgAg/rvxAwl/fL6Pp3/+R966TcOn cywQfbmZ/RF6m5EVFlml81k/NeRdVBK6Lr4Lyi/tvsrZkRKPWc8t+Xu2FSi10RG/G+PI8 jSUC34wYD5dKqADQ0VSl2Q98HD/Mhv5sutDihC2BmkQKIyvCMsL1SznkoBSZ6EqCFATS7 SWeWFaLj7P9MG+McHwLrs8TyABh9QCUHVb/psqaP90YcvmXczUCf1DHhRZ7cXlY6yUQ== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=CeSqWcIP; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 68D35606A32C; Wed, 18 Nov 2026 14:32:18 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=CeSqWcIP X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795012337; b=MMOwbwuxKUYygHWcpM6JL2tNjTwZeMHA1pZnteh8DZM5AL2WcBekARgvlBKGaVia0ROm XOegzKadiK2k4V8fwtYdK9ngZTTi8PRUDToviFTHpAMtmgW7+jxoGYUjfFhr82ZKpDfhm 7GPT18v3WoCjV77PXRsvLbMjNwTQtRwMVqj+1NsVGjsNEozlIYJR2aPcDHOEoYQ0Kap+t MfgKiwy1trfrEPaXInlqf3liC/SWGxLXZ/sl1GJTX0EkSVHT2oFJG1Rr/rBaopLTEeufk aDvoByq8IW5v7KtlH7kHXmYHykbPEKN5/IRKEWZf847WL9XtMLG0gfGjSsl5kIRw+9Q== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795012337; h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID: In-Reply-To:References:X-sashiko-severity:Content-Type: Content-Transfer-Encoding:MIME-Version; bh=0gn9wLZ33T3rqOAl4UM4rcJq4VGKZHDzazvoGK9niM8=; b=GvUgrvbNGbprhS3IKTO/Z4UGGasL6MeBWNtj7yHFLzCPXPKE+ogIJyGuHZbhE2OSoO96 z9p4NAfTRKcKAdm4R1/tA/X4/TzbrhUbOP4PzCAyzXlWeBNNE0ksBDDOh5gPVVHrB/Hw6 UXmczVy38+Vs+M6w3/RaKez4TrX9qmu1JaAA60l/ivmlCsOiAO78IpMoJh0YaH45slQwR HCTT6eekz4NkIL4G9TlVtEYV6FdO84C35KkD6Y9PKhfHt9ikcc1LZMN/094a6lB/QxFQI zvSzM4tj010braf240zpZryXljTwTia3pu/9xlyyM/jRq03q7aoNGAgeYPOv1o40pyQ== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=CeSqWcIP; arc=none smtp.remote-ip=100.103.45.18 X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8AC8C606A336 for <netdev@vger.kernel.org>; Wed, 18 Nov 2026 14:32:17 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1880F1F000C4; Wed, 18 Nov 2026 14:32:16 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1795012337; bh=0gn9wLZ33T3rqOAl4UM4rcJq4VGKZHDzazvoGK9niM8=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=CeSqWcIPq4zz4a/pZ5oXLbjwBLt09tj6Z4yfqgXvYpEEZk4dBg21gXc5nT6cE10KF ewPhbBeltJfUUl3Wgua7g4VYNkHzuqM3cWnFQBLCL3DfdGqDF+9CpRGVvwa0Y5qYC4 q86qy+Ajs6LlVwWQecx2wMciWMI5whbrT8bRmD8xNKmH26dXwKzW0XSwzalxtN6FVx rJ9VY0wq5kx0wlC5BDeHERvAdxEglFbBeftvzTjRph/HjakZd03qpDFwrogx83SAjk 5hYtE2vYbJrtyLnV1uDQve9i8cX+y+7dehtj1DRBm46jpVcqMgQsuySefdHU0lG6wu /16rxocljV6Mw== X-Cc: davem@davemloft.net, alexanderduyck@fb.com, kuba@kernel.org, kernel-team@meta.com, andrew+netdev@lunn.ch, edumazet@kernel.org, pabeni@redhat.com, shuah@kernel.org, hmohsin@meta.com, mike.marciniszyn@gmail.com, sdf@fomichev.me, bobbyeshleman@meta.com, bjorn@kernel.org, leitao@debian.org, horms@kernel.org, almasrymina@google.com, vadim.fedorenko@linux.dev, daskald@meta.com, netdev@vger.kernel.org X-In-Reply-To: <20261116202957.3601684-5-dimitri.daskalakis1@gmail.com> X-sashiko-severity: Medium X-Mailing-List: netdev@vger.kernel.org X-List-Post: <mailto:netdev@vger.kernel.org> X-List-Help: <mailto:netdev+help@vger.kernel.org> X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org> X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org> X-List-Owner: <mailto:netdev+owner@vger.kernel.org> X-Precedence: list