]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
net: hns3: Add nic state check before calling netif_tx_wake_queue
authorJian Shen <shenjian15@huawei.com>
Fri, 21 Sep 2018 15:41:43 +0000 (16:41 +0100)
committerKleber Sacilotto de Souza <kleber.souza@canonical.com>
Mon, 14 Jan 2019 09:28:55 +0000 (09:28 +0000)
BugLink: https://bugs.launchpad.net/bugs/1810457
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: 424eb834a9be ("net: hns3: Unified HNS3 {VF|PF} Ethernet Driver for hip08 SoC")
Signed-off-by: Jian Shen <shenjian15@huawei.com>
Signed-off-by: Peng Li <lipeng321@huawei.com>
Signed-off-by: Salil Mehta <salil.mehta@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 7a8101109dd37837f587cd56f3111d4fc17a07f5)
Signed-off-by: dann frazier <dann.frazier@canonical.com>
Acked-by: Stefan Bader <stefan.bader@canonical.com>
Acked-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
drivers/net/ethernet/hisilicon/hns3/hns3_enet.c

index fcc2219b56f6eb8c3d797af2ee73f90188c5c588..b40d885aa758be06d8e14eabca95eea4289a982d 100644 (file)
@@ -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)
 {
        struct net_device *netdev = ring->tqp->handle->kinfo.netdev;
+       struct hns3_nic_priv *priv = netdev_priv(netdev);
        struct netdev_queue *dev_queue;
        int bytes, pkts;
        int head;
@@ -2018,7 +2019,8 @@ void hns3_clean_tx_ring(struct hns3_enet_ring *ring)
                 * sees the new next_to_clean.
                 */
                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);
                        ring->stats.restart_queue++;
                }