]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
net: hibmcge: support for statistics of reset failures
authorJijie Shao <shaojijie@huawei.com>
Wed, 23 Jul 2025 07:48:26 +0000 (15:48 +0800)
committerJakub Kicinski <kuba@kernel.org>
Fri, 25 Jul 2025 18:01:53 +0000 (11:01 -0700)
Add a statistical item to count the number of reset failures.
This statistical item can be queried using ethtool -S or
reported through diagnose information.

Signed-off-by: Jijie Shao <shaojijie@huawei.com>
Link: https://patch.msgid.link/20250723074826.2756135-1-shaojijie@huawei.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/hisilicon/hibmcge/hbg_common.h
drivers/net/ethernet/hisilicon/hibmcge/hbg_diagnose.c
drivers/net/ethernet/hisilicon/hibmcge/hbg_err.c
drivers/net/ethernet/hisilicon/hibmcge/hbg_ethtool.c

index 7725cb0c5c8a44fdc956e88e598e2dceb3378aaa..ea09a09c451b789d919b5b9c0c814404b3abbf29 100644 (file)
@@ -258,6 +258,7 @@ struct hbg_stats {
        u64 tx_dma_err_cnt;
 
        u64 np_link_fail_cnt;
+       u64 reset_fail_cnt;
 };
 
 struct hbg_priv {
index f23fb5920c3cca352976d0becda76c3fecb0f9b0..c0ce74cf7382090b14cf8d84c9191ae1742af2e8 100644 (file)
@@ -156,6 +156,7 @@ static const struct hbg_push_stats_info hbg_push_stats_list[] = {
        HBG_PUSH_STATS_I(tx_drop_cnt, 84),
        HBG_PUSH_STATS_I(tx_excessive_length_drop_cnt, 85),
        HBG_PUSH_STATS_I(tx_dma_err_cnt, 86),
+       HBG_PUSH_STATS_I(reset_fail_cnt, 87),
 };
 
 static int hbg_push_msg_send(struct hbg_priv *priv,
index ff3295b60a69a81260cd4ebeb90a3addf7fd2568..503cfbfb4a8aeacfd45857d9e8c04e8f3512e562 100644 (file)
@@ -68,6 +68,7 @@ static int hbg_reset_prepare(struct hbg_priv *priv, enum hbg_reset_type type)
        clear_bit(HBG_NIC_STATE_RESET_FAIL, &priv->state);
        ret = hbg_hw_event_notify(priv, HBG_HW_EVENT_RESET);
        if (ret) {
+               priv->stats.reset_fail_cnt++;
                set_bit(HBG_NIC_STATE_RESET_FAIL, &priv->state);
                clear_bit(HBG_NIC_STATE_RESETTING, &priv->state);
        }
@@ -88,6 +89,7 @@ static int hbg_reset_done(struct hbg_priv *priv, enum hbg_reset_type type)
        clear_bit(HBG_NIC_STATE_RESETTING, &priv->state);
        ret = hbg_rebuild(priv);
        if (ret) {
+               priv->stats.reset_fail_cnt++;
                set_bit(HBG_NIC_STATE_RESET_FAIL, &priv->state);
                dev_err(&priv->pdev->dev, "failed to rebuild after reset\n");
                return ret;
index 55520053270a5ce33161d818b77fb8812bd40678..1d62ff913737cd22a3fc49285d1884325d5496fa 100644 (file)
@@ -84,6 +84,7 @@ static const struct hbg_ethtool_stats hbg_ethtool_stats_info[] = {
                        HBG_REG_TX_EXCESSIVE_LENGTH_DROP_ADDR),
        HBG_STATS_I(tx_dma_err_cnt),
        HBG_STATS_I(tx_timeout_cnt),
+       HBG_STATS_I(reset_fail_cnt),
 };
 
 static const struct hbg_ethtool_stats hbg_ethtool_rmon_stats_info[] = {