From: Alexander Zubkov <green@qrator.net>
To: netdev@vger.kernel.org
Cc: Stephen Hemminger <stephen@networkplumber.org>,
Petr Machata <me@pmachata.org>, Ido Schimmel <idosch@nvidia.com>,
Alexander Zubkov <green@qrator.net>
Subject: [PATCH iproute2 v2 0/2] ip: ipstats: Fix statistics split across netlink messages
Date: Tue, 8 Sep 2026 20:12:23 +0200 [thread overview]
Message-ID: <20260908181225.31712-1-green@qrator.net> (raw)
In-Reply-To: <20260830181949.1096-1-green@qrator.net>
The kernel can split the statistics of one interface across several
netlink messages, and "ip stats" formats each of them on its own, so the
interface is shown twice and part of its statistics is lost. Easy to hit
with "group offload subgroup l3_stats" on a box with many netdevices:
109: vlan859: group offload subgroup l3_stats on used on
109: vlan859: group offload subgroup l3_stats
Patch 1 merges such messages before formatting them, patch 2 is an
unrelated cleanup.
What the merge rests on, for whoever touches it next:
- Only the last attribute of one message and the first of the next can
be two halves of one nest.
- A leaf is emitted in one piece, so a leaf attribute seen in both
messages is a layout the kernel does not produce, and the merge is
refused.
- An array is only ever split between two of its elements. Were an
element itself split, the result would not be distinguishable from a
longer array of shorter elements, and no reader could reassemble it.
- At the outer level ipstats_stat_ifla_max[] tells which attributes are
nests. One level in there is no such table, and none is needed: the
children of the two halves are whole either way, whether they are an
array, split only between elements, or attributes indexed by type, of
which there is at most one of each. Appending them is then what the
kernel would have sent unsplit.
- Where the merge does not apply, the two messages are formatted
separately, which is the behaviour this patch set replaces rather
than a new failure mode.
v2:
- Comments and commit messages trimmed, the merge reworked around the
two border attributes that can actually be halves of one nest.
Alexander Zubkov (2):
ip: ipstats: Merge statistics split across several netlink messages
ip: ipstats: Do not hide HW statistics when hw_stats_info is missing
ip/ipstats.c | 266 +++++++++++++++++++++++++++++++++++++++++++++++++--
1 file changed, 258 insertions(+), 8 deletions(-)
--
2.55.0
next prev parent reply other threads:[~2026-09-08 18:19 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-30 18:19 [PATCH iproute2 0/2] ip: ipstats: Fix statistics split across netlink messages Alexander Zubkov
2026-08-30 18:19 ` [PATCH 1/2] ip: ipstats: Merge statistics split across several " Alexander Zubkov
2026-09-01 4:48 ` Stephen Hemminger
2026-09-01 15:10 ` Petr Machata
2026-09-02 19:20 ` Alexander Zubkov
2026-09-08 18:32 ` Alexander Zubkov
2026-08-30 18:19 ` [PATCH 2/2] ip: ipstats: Do not hide HW statistics when hw_stats_info is missing Alexander Zubkov
2026-09-01 15:22 ` Petr Machata
2026-09-01 4:49 ` [PATCH iproute2 0/2] ip: ipstats: Fix statistics split across netlink messages Stephen Hemminger
2026-09-08 18:12 ` Alexander Zubkov [this message]
2026-09-08 18:31 ` [PATCH iproute2 v2 " Stephen Hemminger
2026-09-10 9:20 ` Alexander Zubkov
2026-09-08 18:12 ` [PATCH iproute2 v2 1/2] ip: ipstats: Merge statistics split across several " Alexander Zubkov
2026-09-08 18:12 ` [PATCH iproute2 v2 2/2] ip: ipstats: Do not hide HW statistics when hw_stats_info is missing Alexander Zubkov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260908181225.31712-1-green@qrator.net \
--to=green@qrator.net \
--cc=idosch@nvidia.com \
--cc=me@pmachata.org \
--cc=netdev@vger.kernel.org \
--cc=stephen@networkplumber.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox