Article View: linux.kernel.netdev
Article #5092[PATCH net-next v2 0/2] net: dsa: qca8k: report port statistics from the MIB
From: Stanislaw Pal
Date: Mon, 19 Oct 2026 19:11
Date: Mon, 19 Oct 2026 19:11
53 lines
13174 bytes
13174 bytes
qca8k has no .get_stats64, so a user port's netdev counts only what crosses the CPU port; traffic the switch forwards in hardware never shows up. Patch 2 reports the port counters from the switch MIB through a delayed work, as ar9331 and rtl8365mb do. Patch 1 makes register access safe for such a reader outside rtnl first. Changes in v2: - patch 1 is new: the regmap was created without locking while it formats register and value in its shared work_buf, and an autocast and qca8k_conduit_change() took the MIB and management mutexes in opposite orders (netdev AI review) - read the MIB with one autocast request for all ports when the management path is up, register reads only as the fallback, only for ports with link (Christian) - index ar8327_mib[] by an enum instead of a second table of offsets, share the register reads with qca8k_get_ethtool_stats() (Christian) - MIB instead of STATS in the names, interval define in qca8k.h, one spinlock for the cached counters (Christian) - stop the work on shutdown and suspend, init it in probe; keep the user port's tstats if the MIB did not come up; read the high word of a 64-bit counter around the low one and drop a 64-bit sample that goes backwards; take the FCS off the byte counters (netdev AI review) On the FCS: on the CPU port of the B3000, with an 802.1Q tag on the link, the maximum-size frames (1518 bytes without the FCS) land in RxMaxByte, so the size buckets count the FCS; the CPU port's RxGoodByte also matches the conduit GMAC's MMC octet counter byte for byte. Please correct me if the byte counters are documented otherwise. Tested on a GL-B3000 (QCA8337, CPU port 0), three 15 s uploads over the WAN port per case: with register reads the wan netdev's TX bytes were TxByte less 4 bytes per frame within 0.004%; with the qca tagger, where every read is an autocast, the counters followed TxByte within 0.002% (measured before the FCS change). With lockdep, a tagger change and three conduit down/up cycles with the autocast work running and ethtool -S in a loop gave no report. v1: https://lore.kernel.org/netdev/20261018153658.209999-1-kuncy7@gmail.com/ Stanislaw Pal (2): net: dsa: qca8k: serialize register access net: dsa: qca8k: report port statistics from the MIB drivers/net/dsa/qca/qca8k-8xxx.c | 194 ++++++++++++++++++++++++++--- drivers/net/dsa/qca/qca8k-common.c | 137 ++++++++++++-------- drivers/net/dsa/qca/qca8k.h | 72 ++++++++++- 3 files changed, 332 insertions(+), 71 deletions(-) base-commit: d1241cdbbcf7bfac3e53482b2054504628f9f047 -- 2.43.0
Technical Details
Message-ID:
<20261019191137.307514-1-kuncy7@gmail.com>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-348789-linux-kernel-netdev=dewy.ruShow Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-348789-linux-kernel-netdev=dewy.ru
From: kuncy7@gmail.com (Stanislaw Pal)
Newsgroups: linux.kernel.netdev
Subject: [PATCH net-next v2 0/2] net: dsa: qca8k: report port statistics from the MIB
Date: Mon, 19 Oct 2026 21:11:35 +0200
Organization: Usenet Network
Message-ID: <20261019191137.307514-1-kuncy7@gmail.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
logging-data="3692905"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:Vf6VpRLd4KxtktEih88uNsqyjRo= sha256:Pm5gJHWAb/NdmByRqQXcuymw5FkC+cmlnfr/29NEaEM=
sha1:1pquu4N2ell/fz8Bza7uhn1850k= sha256:viQaATmXx/DmpnKRB6n/Y21VTYEeDQlPgi9Ye/tJ6ns=
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 77BBD110ADE; Mon, 19 Oct 2026 22:13:23 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -2.048
X-Spam-Status: No, score=-2.048 tagged_above=-9999 required=6.31
tests=[DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
DKIM_VALID_AU=-0.1, FORGED_GMAIL_RCVD=1,
FREEMAIL_FORGED_FROMDOMAIN=0.001, FREEMAIL_FROM=0.001,
HEADER_FROM_DIFFERENT_DOMAINS=0.25, 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=gmail.com
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 7V_mXQeIrp4q;
Mon, 19 Oct 2026 22:13:18 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-348789-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN>
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=gmail.com
X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114])
by mail.dewy.ru (Postfix) with ESMTPS id 60B72110ABC; Mon, 19 Oct 2026 22:13:10 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
by tor.lore.kernel.org (Postfix) with ESMTP id 02FE23745A; Mon, 19 Oct 2026 19:11:47 +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=1792437106;
b=dOdaYA42PcIckcZWNirYaDdUZJIL3korJzUA3RxJ+pSPUUC5+c6uPwAKVsOJ8naIFSKA
ff2C4H8VerKoVxuZxZmfI6cRbj0AsmY0f905PTyPFw3kaixwv/s7N5tOZpaGV+mGX6TGs
p7fNVt3kBLBYLsJ05jJZwitszHzWz1IGNaetfrYNddF564tUO3sS6HPj+L0nCHxuC6qwN
RFv1pSFHKdeKtR2WYySMB6qxpdo2JYoL0L5D3qc0acfQFlzwqI2hOGu7RX3Whee1OqfHu
+CZXXlVoM8dX53q1PRAHWvVbRvH4oHP9+2LXp1ATknAas5GmcO5bpbr+09xYKlqh44g==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1792437106;
h=X-Original-To:Received:DMARC-Filter:Received:DKIM-Signature:
X-Google-DKIM-Signature:X-Forwarded-Encrypted:X-Gm-Message-State:
X-Gm-Gg:X-Received:Received:From:To:Cc:Subject:Date:Message-ID:
X-Mailer:X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe:
List-Unsubscribe:List-Owner:Precedence:MIME-Version:
Content-Transfer-Encoding;
bh=bfu/wzBZOsGQROFqB89zmnlzWOzuKkO4kCy6zSciy6s=;
b=ZW7ol7STxs1Jk6y76EQiO7JYFQ87duwE4ZbQyB00XJT9DewKJ34K3PlaiDjy/q97TXBE
ez9WH1Aqjmew9dqDVvYVyDAh3/6Oe7NfHvMLcCKwM1/bYFKV6KqXjXHdczpmVub5DeteB
jcdSeVejZzlwgzqBIjprFx2O47G25tKIitwF50HJaronCbCmiOpjDW68dZD4FoIHPToy1
rzVMY/dqE2yh/cVkSyUus5t1xpV3EzGP+DftmMoxnCs6fFKpsNzC4GLtT5hLWm2PUDgAm
ey+bmgEPP3VflAnjF7lF4oiApb2Di4sQfeaiBp3r9yit45g0h7r9hxHnP4XXPuCZWhA==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org;
dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20251104 header.b=XpDAIt6e;
dmarc=pass header.from=gmail.com;
spf=pass smtp.mailfrom=gmail.com;
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 3FDC9606A325;
Mon, 19 Oct 2026 19:11:46 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key, unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20251104 header.b=XpDAIt6e
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.221.48
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
t=1792437105;
b=W5+erGNLk/2vsPUo9yYDPWPOpitikQt7kYyc5dwjuMztu7dxxzwxbzlslKXStWWSyId1
g3WUroH9lHgWwZwqt1/JK0laU7gElcJnn8Kc2SRc/V8YE05kJS0kqmO0qOAIkI5uCiAR5
5rBBwBCtvZtrNEAJBJ6w4vdP7hFO/ibwBJBVAV2dEAkz3u8yYdstUkttQA96grd41iEbP
koL/a3he29n1QIk6WLl5PfdR7Psd53RP16mfFxbZAtqimdGbVCQgp39d9NJJQuK8AfT2Y
w0myFoeuWo56fpraWmyCQjajQlKVFkYw0Fk9yCb740zg+2c5ri9F1fAkUDkikUBoZVA==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1792437105;
h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature:
X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received:
From:To:Cc:Subject:Date:Message-ID:X-Mailer:MIME-Version:
Content-Transfer-Encoding;
bh=bfu/wzBZOsGQROFqB89zmnlzWOzuKkO4kCy6zSciy6s=;
b=5hHb1Zl7S0GRlafWeVFTj8z/1tn4GhoLOnZAzYE6D7hUd9L6iYU9o4gj2QeT74V5/JLG
l+KGVRPRFkn6QLPPEtU+zqCA91WtBZeCe40qcjDK+qc7ljby/mrEPrSi3+EBmtAkDkSD/
l038qx5fJv8CX/OPVeVUWagxe0tKnFIIXDLBCmyxT1CYlsRMyztO5zBM3FIdd1aK4NDoL
/g4kzq3MigvGG1ZvSHpYdJzLXKWhN4pSLNNKH0bjLlSV3pbDzds9wUWEizlj8BWFCH6/t
ZUzr6mU4GAR57SCPRXud+ntRZgNN8Fv+RCKhs0haWugm2jsCw1Eu1SEBGZDJe4Tz0Ug==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org;
dmarc=pass header.from=gmail.com;
spf=pass smtp.mailfrom=gmail.com;
dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20251104 header.b=XpDAIt6e;
arc=none smtp.remote-ip=209.85.221.48
X-Received: from mail-wr1-f48.google.com (mail-wr1-f48.google.com [209.85.221.48])
(using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)
key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256)
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 12850606A31D
for <netdev@vger.kernel.org>; Mon, 19 Oct 2026 19:11:44 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 12850606A31D
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
X-Received: by mail-wr1-f48.google.com with SMTP id ffacd0b85a97d-48e09aa5264so1480594f8f.2
for <netdev@vger.kernel.org>; Mon, 19 Oct 2026 12:11:44 -0700 (PDT)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20251104; t=1792437103; x=1793041903; darn=vger.kernel.org;
h=content-transfer-encoding:mime-version:message-id:date:subject:cc
:to:from:from:to:cc:subject:date:message-id:reply-to:content-type;
bh=bfu/wzBZOsGQROFqB89zmnlzWOzuKkO4kCy6zSciy6s=;
b=XpDAIt6eUfJWGLow8UDURl/6Vo2Cj3WZD4dJyjI6jcLAY2cV0oAkJoN3+5XBj9gNX1
bvhVIG6VCbvbxn0F+dn0iM4i6+Z+++ACygE+HDoruySjNvgLSbwvda/qkoA4zalO/EjU
cYrR9/MgMPbJpii+jtpOxmirXSZ0F9fJmiA4i87+FLWHUteIQ5KSn0FZSXwDGuh8+9wJ
639xTApG7UnoshmRPEgZ0PlwdmMliDp8bOZL7XQ/KbbIgCJg/ixhB4TRfC1RWsaJ6L4D
c0AEdFXDYAIZ0Emz8O+KX6ycttalJ8+/yBPXLw7VNj8OlboIyRKI1dtWV74masGXelMF
q4gQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20260707; t=1792437103; x=1793041903;
h=content-transfer-encoding:mime-version:message-id:date:subject:cc
:to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date
:message-id:reply-to:content-type;
bh=bfu/wzBZOsGQROFqB89zmnlzWOzuKkO4kCy6zSciy6s=;
b=beLrmeoPKG1V3HvTCZhlaze3r9IxcM6cMDnij6GbSde+vZKVKR2D1QRX+kJ6xKAdaG
fBjRA/LHAJbV+/GMLlH5qlOg7pKaNq7yVj39h//+tuYpIhJIriRjhNBEy7xynOWhgR4q
20Ub3v9plIesRqyr5mO7M2P6zwmI8azPxdEVtgljXgF9b2R0b2SR+KxNKIY/suOP1DbY
jshrRTEsgbX3c2fdh9MoByxBcCn9mlOX/M59amejJTg85lfeJPm3NwInPZFoifILOV6/
zqlSCL5twdR+q2WqqxGQXvgQoPyuPaoVNlz0C+puC+uaP/EOuOOBPqEtflxhDVln0tJh
0m5w==
X-Forwarded-Encrypted: i=1; AKwUvBxhNn7Yfs0paxuBomU7175WBaCf37MqQ2LqgXA6kk8W57Zs9eEbtXfKcrakZSE3pbyHT+cHwkg=@vger.kernel.org
X-Gm-Message-State: AFq9FYIau0IXAfHNtxC97zZVYouEVAY/RnftnxxiAfZ5dCYLxOuQetT5
Cz+tIdE+QPpLDn38S2a96vxOZtqn6M0nKqp1z1pkz9lILsVGeoKUWhzQ
X-Gm-Gg: AYBFou36TMVl6a907zgxI8w9lz3DAtKf6RElMBlLsmW0sZ9No+xz8R9/TwkYG8NrI7u
C89dBkr9ESWh46oMfNS3mj/ByUSPL6AzU6UEdXQbC6udYaC4v/0vKCZAS6kGGaH0j81mu5t3G7g
7ldRLSxMxM5I+PN387HkpS4PKfsINhJfDsX1M2d2epH8V2k7JBSBOvnf0Jkwx7p4gLy7MJwNhye
E+fbCqgdeQV5MUdEacPSIgMoUWRGUqKf72W9Za2YJCdIHkItrMRpqwrgzrLJb8k4WdjG78PIvYL
plwjDT05/hiTvEU4Ha8XSxClFvZ0tnrkIOehnCNmQYBsG9ApK3igDeTsYnrgxB6aahHFROPGMEB
aonursDta5yznBaAupmBUmh7ka3HkU+5tivTD+Lrv3UJnHDxzYcRJneNvmGvpI7QPwFL2mE5Axj
lAwswNptRnpDjrMmUVoXXDsIvuxdlqKB/rmeB2IxrnZYCOwF8IndwrNpgHwSZ0bQebUeKR22GtH
lMiYbmtSidS6dAkLICf
X-Received: by 2002:adf:e19a:0:b0:48e:6f:a9c1 with SMTP id ffacd0b85a97d-48e07fa6ffamr18010548f8f.54.1792437103154;
Mon, 19 Oct 2026 12:11:43 -0700 (PDT)
X-Received: from VivoBook-ASUS-X712UA-M712UA.lan ([2a00:f44:cd2:abb8:fed9:8342:c367:f022])
by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-48e1d818c89sm804977f8f.32.2026.10.19.12.11.41
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Mon, 19 Oct 2026 12:11:42 -0700 (PDT)
X-Cc: "David S . Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@kernel.org>,
Jakub Kicinski <kuba@kernel.org>,
Paolo Abeni <pabeni@redhat.com>,
netdev@vger.kernel.org,
linux-kernel@vger.kernel.org
X-Mailer: git-send-email 2.43.0
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