1 |
From 285b85d5d0675959eac2eb80ca7f8c55bcaf470e Mon Sep 17 00:00:00 2001 |
2 |
From: Jian Shen <shenjian15@huawei.com> |
3 |
Date: Fri, 21 Sep 2018 16:41:43 +0100 |
4 |
Subject: [PATCH 049/145] net: hns3: Add nic state check before calling |
5 |
netif_tx_wake_queue |
6 |
|
7 |
[ Upstream commit 7a8101109dd37837f587cd56f3111d4fc17a07f5 ] |
8 |
|
9 |
When nic down, it firstly calls netif_tx_stop_all_queues(), then calls |
10 |
napi_disable(). But napi_disable() will wait current napi_poll finish, |
11 |
it may call netif_tx_wake_queue(). This patch fixes it by add nic state |
12 |
checking. |
13 |
|
14 |
Fixes: 424eb834a9be ("net: hns3: Unified HNS3 {VF|PF} Ethernet Driver for hip08 SoC") |
15 |
Signed-off-by: Jian Shen <shenjian15@huawei.com> |
16 |
Signed-off-by: Peng Li <lipeng321@huawei.com> |
17 |
Signed-off-by: Salil Mehta <salil.mehta@huawei.com> |
18 |
Signed-off-by: David S. Miller <davem@davemloft.net> |
19 |
Signed-off-by: Sasha Levin <sashal@kernel.org> |
20 |
--- |
21 |
drivers/net/ethernet/hisilicon/hns3/hns3_enet.c | 4 +++- |
22 |
1 file changed, 3 insertions(+), 1 deletion(-) |
23 |
|
24 |
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c |
25 |
index 955c4ab18b03..b7b2f8254ce1 100644 |
26 |
--- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c |
27 |
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c |
28 |
@@ -1915,6 +1915,7 @@ static int is_valid_clean_head(struct hns3_enet_ring *ring, int h) |
29 |
bool hns3_clean_tx_ring(struct hns3_enet_ring *ring, int budget) |
30 |
{ |
31 |
struct net_device *netdev = ring->tqp->handle->kinfo.netdev; |
32 |
+ struct hns3_nic_priv *priv = netdev_priv(netdev); |
33 |
struct netdev_queue *dev_queue; |
34 |
int bytes, pkts; |
35 |
int head; |
36 |
@@ -1961,7 +1962,8 @@ bool hns3_clean_tx_ring(struct hns3_enet_ring *ring, int budget) |
37 |
* sees the new next_to_clean. |
38 |
*/ |
39 |
smp_mb(); |
40 |
- if (netif_tx_queue_stopped(dev_queue)) { |
41 |
+ if (netif_tx_queue_stopped(dev_queue) && |
42 |
+ !test_bit(HNS3_NIC_STATE_DOWN, &priv->state)) { |
43 |
netif_tx_wake_queue(dev_queue); |
44 |
ring->stats.restart_queue++; |
45 |
} |
46 |
-- |
47 |
2.19.1 |
48 |
|