]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
net: hibmcge: fix incorrect statistics update issue
authorJijie Shao <shaojijie@huawei.com>
Sat, 17 May 2025 09:58:27 +0000 (17:58 +0800)
committerJakub Kicinski <kuba@kernel.org>
Wed, 21 May 2025 22:53:51 +0000 (15:53 -0700)
When the user dumps statistics, the hibmcge driver automatically
updates all statistics. If the driver is performing the reset operation,
the error data of 0xFFFFFFFF is updated.

Therefore, if the driver is resetting, the hbg_update_stats_by_info()
needs to return directly.

Fixes: c0bf9bf31e79 ("net: hibmcge: Add support for dump statistics")
Signed-off-by: Jijie Shao <shaojijie@huawei.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/20250517095828.1763126-2-shaojijie@huawei.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/hisilicon/hibmcge/hbg_ethtool.c

index 8f1107b85fbb09cc6101bae2f0313c8fcd823510..55520053270a5ce33161d818b77fb8812bd40678 100644 (file)
@@ -317,6 +317,9 @@ static void hbg_update_stats_by_info(struct hbg_priv *priv,
        const struct hbg_ethtool_stats *stats;
        u32 i;
 
+       if (test_bit(HBG_NIC_STATE_RESETTING, &priv->state))
+               return;
+
        for (i = 0; i < info_len; i++) {
                stats = &info[i];
                if (!stats->reg)