Skip to content

Commit 1d6c3e0

Browse files
Jijie Shaokuba-moo
authored andcommitted
net: hibmcge: fix the incorrect np_link fail state issue.
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: e030663 ("net: hibmcge: Add support for mac link exception handling feature") Signed-off-by: Jijie Shao <[email protected]> Reviewed-by: Simon Horman <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 4e4ac53 commit 1d6c3e0

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

drivers/net/ethernet/hisilicon/hibmcge/hbg_debugfs.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ static int hbg_dbg_nic_state(struct seq_file *s, void *unused)
106106
{
107107
struct net_device *netdev = dev_get_drvdata(s->private);
108108
struct hbg_priv *priv = netdev_priv(netdev);
109+
bool np_link_fail;
109110

110111
seq_printf(s, "event handling state: %s\n",
111112
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)
117118
reset_type_str[priv->reset_type]);
118119
seq_printf(s, "need reset state: %s\n",
119120
state_str_true_false(priv, HBG_NIC_STATE_NEED_RESET));
120-
seq_printf(s, "np_link fail state: %s\n",
121-
state_str_true_false(priv, HBG_NIC_STATE_NP_LINK_FAIL));
121+
122+
np_link_fail = !hbg_reg_read_field(priv, HBG_REG_AN_NEG_STATE_ADDR,
123+
HBG_REG_AN_NEG_STATE_NP_LINK_OK_B);
124+
seq_printf(s, "np_link fail state: %s\n", str_true_false(np_link_fail));
122125

123126
return 0;
124127
}

0 commit comments

Comments
 (0)