Commit 7a810110 authored by Jian Shen's avatar Jian Shen Committed by David S. Miller

net: hns3: Add nic state check before calling netif_tx_wake_queue

When nic down, it firstly calls netif_tx_stop_all_queues(), then calls
napi_disable(). But napi_disable() will wait current napi_poll finish,
it may call netif_tx_wake_queue(). This patch fixes it by add nic state
checking.

Fixes: 424eb834 ("net: hns3: Unified HNS3 {VF|PF} Ethernet Driver for hip08 SoC")
Signed-off-by: default avatarJian Shen <shenjian15@huawei.com>
Signed-off-by: default avatarPeng Li <lipeng321@huawei.com>
Signed-off-by: default avatarSalil Mehta <salil.mehta@huawei.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent fa7a4bd5
...@@ -1973,6 +1973,7 @@ static int is_valid_clean_head(struct hns3_enet_ring *ring, int h) ...@@ -1973,6 +1973,7 @@ static int is_valid_clean_head(struct hns3_enet_ring *ring, int h)
void hns3_clean_tx_ring(struct hns3_enet_ring *ring) void hns3_clean_tx_ring(struct hns3_enet_ring *ring)
{ {
struct net_device *netdev = ring->tqp->handle->kinfo.netdev; struct net_device *netdev = ring->tqp->handle->kinfo.netdev;
struct hns3_nic_priv *priv = netdev_priv(netdev);
struct netdev_queue *dev_queue; struct netdev_queue *dev_queue;
int bytes, pkts; int bytes, pkts;
int head; int head;
...@@ -2018,7 +2019,8 @@ void hns3_clean_tx_ring(struct hns3_enet_ring *ring) ...@@ -2018,7 +2019,8 @@ void hns3_clean_tx_ring(struct hns3_enet_ring *ring)
* sees the new next_to_clean. * sees the new next_to_clean.
*/ */
smp_mb(); smp_mb();
if (netif_tx_queue_stopped(dev_queue)) { if (netif_tx_queue_stopped(dev_queue) &&
!test_bit(HNS3_NIC_STATE_DOWN, &priv->state)) {
netif_tx_wake_queue(dev_queue); netif_tx_wake_queue(dev_queue);
ring->stats.restart_queue++; ring->stats.restart_queue++;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment