From patchwork Fri Sep 21 15:41:43 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Salil Mehta X-Patchwork-Id: 147294 Delivered-To: patch@linaro.org Received: by 2002:a2e:1648:0:0:0:0:0 with SMTP id 8-v6csp970979ljw; Fri, 21 Sep 2018 08:43:16 -0700 (PDT) X-Google-Smtp-Source: ANB0VdboxgkduuGA2Hceg6EDyIASKuMCJNYV5eoiH0LyWLpK6bXZfVXye5LbuFY91nCk2mA5Vkzb X-Received: by 2002:a65:5286:: with SMTP id y6-v6mr40572234pgp.65.1537544596080; Fri, 21 Sep 2018 08:43:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537544596; cv=none; d=google.com; s=arc-20160816; b=ZZFmt9Eqa45Oq7EDHS78I0pECjYsRAW+x7sdH+OzAsolu8d6VvPTia2x4Wp+HX7Jmx 5JYURVMvXAZNbS83jBTuQynKCophUH2fsiiXyYBe8nAAeiqkv5+PgBllmxb2vlh4eBj3 LNwT2RXhsUmWbHi43Cik6PlVXLLtAVa0Z/H58LfTskmHogkNUUnOCVMF9QbeSeC9yRhG 1JNe5OrJerJCPZGT+utxgusMGv+EeymajwHuFc8aqAlrtQrZVxIz5mQuvykNaWkRgG7X XyCvU+nTxMY3Y4w01dgDRSIZdGhBb/4Vl6PJGuqhiQP1Wo5AGZYLjlASLLrZlv7Fm3TV JAYQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=wIUnKLULZleBXCMzplZpJpkherUKCJQb3HA60BH8MJ4=; b=udynIqIZicUmvEf+MV1bWZjWium/7Am5PHzMc6X/BQRjl9a6E+UnkmY1S3f68AiHtR VwLyADLEhs7oWoaer6ZFtvOE83Js68SvjaY9fjlnmwRnG63nXorLHEwQk8BTNPHhIbSX cBEaLUo434kv2uMd+tXEkv7VOVbDFNj+UO6wXJXUkS4ralVDgY1yfHHC4Y6xpFRz/EFD rkZmVgTbsUN+LvfK5FYczL2+m2FnIHhbZiuZwBCQFLseOmG4xuSZimWZjWQzBAGwRes2 nxd3FGz1O9tkycGqffr2W7oaPBdvm5nZjW8ePVMbXObyVYMMYKejv98MXMUP1PFQbLAu NI1A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a75-v6si27696644pfc.106.2018.09.21.08.43.15; Fri, 21 Sep 2018 08:43:16 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390735AbeIUVcj (ORCPT + 32 others); Fri, 21 Sep 2018 17:32:39 -0400 Received: from szxga07-in.huawei.com ([45.249.212.35]:43037 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2390678AbeIUVci (ORCPT ); Fri, 21 Sep 2018 17:32:38 -0400 Received: from DGGEMS401-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 1C1662E23F5D8; Fri, 21 Sep 2018 23:43:08 +0800 (CST) Received: from S00293818-DELL1.china.huawei.com (10.202.226.54) by DGGEMS401-HUB.china.huawei.com (10.3.19.201) with Microsoft SMTP Server id 14.3.399.0; Fri, 21 Sep 2018 23:42:59 +0800 From: Salil Mehta To: CC: , , , , , , , Jian Shen Subject: [PATCH net-next 07/12] net: hns3: Add nic state check before calling netif_tx_wake_queue Date: Fri, 21 Sep 2018 16:41:43 +0100 Message-ID: <20180921154148.26756-8-salil.mehta@huawei.com> X-Mailer: git-send-email 2.8.3 In-Reply-To: <20180921154148.26756-1-salil.mehta@huawei.com> References: <20180921154148.26756-1-salil.mehta@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.202.226.54] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jian Shen 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 Signed-off-by: Peng Li Signed-off-by: Salil Mehta --- drivers/net/ethernet/hisilicon/hns3/hns3_enet.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) -- 2.7.4 diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c index fc27f3f..73b42d3 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c @@ -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++; }