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 v3 2/2] ip: ipstats: Do not hide HW statistics when hw_stats_info is missing
Date: Thu, 10 Sep 2026 11:20:57 +0200 [thread overview]
Message-ID: <20260910092057.3980-3-green@qrator.net> (raw)
In-Reply-To: <20260910092057.3980-1-green@qrator.net>
ipstats_show_hw_stats() returns as soon as IFLA_OFFLOAD_XSTATS_HW_S_INFO
is absent, dropping the counters that the message does carry.
__ipstats_show_hw_stats() already copes with a NULL info attribute, so
let it, and skip the record only when neither attribute is present.
Assisted-by: Claude:claude-opus-5
Signed-off-by: Alexander Zubkov <green@qrator.net>
---
v3:
- No change.
v2: https://lore.kernel.org/netdev/20260908181225.31712-1-green@qrator.net/
- Trimmed the commit message.
v1: https://lore.kernel.org/netdev/20260830181949.1096-1-green@qrator.net/
ip/ipstats.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/ip/ipstats.c b/ip/ipstats.c
index 1d44fe47..59cecfe4 100644
--- a/ip/ipstats.c
+++ b/ip/ipstats.c
@@ -472,13 +472,16 @@ static int ipstats_show_hw_stats(struct ipstats_stat_show_attrs *attrs,
int err = 0;
at_hwsi = ipstats_stat_show_get_attr(attrs, group, hw_s_info, &err);
- if (at_hwsi == NULL)
+ if (at_hwsi == NULL && err != 0)
return err;
at_stats = ipstats_stat_show_get_attr(attrs, group, hw_stats, &err);
if (at_stats == NULL && err != 0)
return err;
+ if (at_hwsi == NULL && at_stats == NULL)
+ return 0;
+
return __ipstats_show_hw_stats(at_hwsi, at_stats, idx);
}
--
2.55.0
prev parent reply other threads:[~2026-09-10 9:21 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-10 9:20 [PATCH iproute2 v3 0/2] ip: ipstats: Fix statistics split across netlink messages Alexander Zubkov
2026-09-10 9:20 ` [PATCH iproute2 v3 1/2] ip: ipstats: Merge statistics split across several " Alexander Zubkov
2026-09-10 9:20 ` Alexander Zubkov [this message]
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=20260910092057.3980-3-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