]> www.infradead.org Git - users/hch/misc.git/commitdiff
net: hibmcge: fix the incorrect np_link fail state issue.
authorJijie Shao <shaojijie@huawei.com>
Thu, 10 Apr 2025 02:13:25 +0000 (10:13 +0800)
committerJakub Kicinski <kuba@kernel.org>
Sat, 12 Apr 2025 03:17:36 +0000 (20:17 -0700)
In the debugfs file, the driver displays the np_link fail state
based on the HBG_NIC_STATE_NP_LINK_FAIL.

However, HBG_NIC_STATE_NP_LINK_FAIL is cleared in hbg_service_task()
So, this value of np_link fail is always false.

This patch directly reads the related register to display the real state.

Fixes: e0306637e85d ("net: hibmcge: Add support for mac link exception handling feature")
Signed-off-by: Jijie Shao <shaojijie@huawei.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/20250410021327.590362-6-shaojijie@huawei.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/hisilicon/hibmcge/hbg_debugfs.c

index 9c09e48359907df54b03177dd7304c56cb4855c2..01ad82d2f5cc7f1e101b0b5d817c66df22dbb10b 100644 (file)
@@ -106,6 +106,7 @@ static int hbg_dbg_nic_state(struct seq_file *s, void *unused)
 {
        struct net_device *netdev = dev_get_drvdata(s->private);
        struct hbg_priv *priv = netdev_priv(netdev);
+       bool np_link_fail;
 
        seq_printf(s, "event handling state: %s\n",
                   state_str_true_false(priv, HBG_NIC_STATE_EVENT_HANDLING));
@@ -117,8 +118,10 @@ static int hbg_dbg_nic_state(struct seq_file *s, void *unused)
                   reset_type_str[priv->reset_type]);
        seq_printf(s, "need reset state: %s\n",
                   state_str_true_false(priv, HBG_NIC_STATE_NEED_RESET));
-       seq_printf(s, "np_link fail state: %s\n",
-                  state_str_true_false(priv, HBG_NIC_STATE_NP_LINK_FAIL));
+
+       np_link_fail = !hbg_reg_read_field(priv, HBG_REG_AN_NEG_STATE_ADDR,
+                                          HBG_REG_AN_NEG_STATE_NP_LINK_OK_B);
+       seq_printf(s, "np_link fail state: %s\n", str_true_false(np_link_fail));
 
        return 0;
 }