Skip to content

Commit

Permalink
net: hns: Bugfix for Tx timeout handling in hns driver
Browse files Browse the repository at this point in the history
When hns port type is not debug mode, netif_tx_disable is called
when there is a tx timeout, which requires system reboot to return
to normal state. This patch fix this problem by resetting the net
dev.

Fixes: b5996f1 ("net: add Hisilicon Network Subsystem basic ethernet support")
Signed-off-by: Lin Yun Sheng <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
Lin Yun Sheng authored and davem330 committed Jul 12, 2017
1 parent 2e3d232 commit 76b825a
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions drivers/net/ethernet/hisilicon/hns/hns_enet.c
Original file line number Diff line number Diff line change
Expand Up @@ -1378,13 +1378,20 @@ void hns_nic_net_reset(struct net_device *ndev)
void hns_nic_net_reinit(struct net_device *netdev)
{
struct hns_nic_priv *priv = netdev_priv(netdev);
enum hnae_port_type type = priv->ae_handle->port_type;

netif_trans_update(priv->netdev);
while (test_and_set_bit(NIC_STATE_REINITING, &priv->state))
usleep_range(1000, 2000);

hns_nic_net_down(netdev);
hns_nic_net_reset(netdev);

/* Only do hns_nic_net_reset in debug mode
* because of hardware limitation.
*/
if (type == HNAE_PORT_DEBUG)
hns_nic_net_reset(netdev);

(void)hns_nic_net_up(netdev);
clear_bit(NIC_STATE_REINITING, &priv->state);
}
Expand Down Expand Up @@ -1997,13 +2004,8 @@ static void hns_nic_reset_subtask(struct hns_nic_priv *priv)
rtnl_lock();
/* put off any impending NetWatchDogTimeout */
netif_trans_update(priv->netdev);
hns_nic_net_reinit(priv->netdev);

if (type == HNAE_PORT_DEBUG) {
hns_nic_net_reinit(priv->netdev);
} else {
netif_carrier_off(priv->netdev);
netif_tx_disable(priv->netdev);
}
rtnl_unlock();
}

Expand Down

0 comments on commit 76b825a

Please sign in to comment.