Received: by 2002:ac0:98c7:0:0:0:0:0 with SMTP id g7-v6csp177345imd; Wed, 31 Oct 2018 16:52:38 -0700 (PDT) X-Google-Smtp-Source: AJdET5cSdOvfyXxuYAdoJTOwn5cVtbL/SONn1b5c0IP+nWZ00nE9iDfL87HdBzZH/ewhoK1mwgBL X-Received: by 2002:a17:902:7146:: with SMTP id u6-v6mr5237000plm.322.1541029958343; Wed, 31 Oct 2018 16:52:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1541029958; cv=none; d=google.com; s=arc-20160816; b=cV0FnIlVpOD3eTrH5sji8RsBQuk019u5CkJd99l51qa77tofQbDEKUD16+xSh64j/O sOLvKX1+whS9eGZtF0V1ispk6z6/JIdwXhNQfLCy28iRt3+pjAvw03aAtkvCfY8pbISX B99eyAEdWn9tek4FAq7XZZWfySGdRGGRe6xjoeW/TNA7HE7fvXvY67Apmdt8+3F++Ea0 MIVT7AeQp4BKaOTLJj2YsEvEV4w+oPoGpTJyKBumXv0ATVcPoHjnJ3FXSr1IotzbYMxM 0v0MD9kpI4LWIu7zD1gmV5CMNyHu46TX6Vz6qdN0+a/cM5FI7XGpJ0iR1RHQbG4LYmue oJTw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=mWnh34zxeenOBDOAGaewr5UaT9NiUs7MyakUMwWlK3Y=; b=EXk3rdcEBTexVRCgQyNACRUPmTp3uzCmQC+tTkCvWGbdR/bP12RW3Ex7hQRu0Ymi1Y YwBUrXn3/TdpqRIkFRsoxvEZfAxcOzqOcrtu0QU3O6JPaFunMZmsaRKXCzLeYdQoWBQI 5HgDIsrede1U8QGYBoFvVup4PG7VcZyJX/YYnjs/O1zEIyyc3dysOXyxxqVFLJPBqqeN 17uNt1BVsd3voIIThHLljD9Erko5rO9dyqndM4y3DZd2BlfSbjY3vYqMcxv8HgeXHgYw DE5eTE8RYyPY+f2ey2cFU7iu7K0WKQk+KgjJ8Us0W2I1ckXrEMbQLTEwYmWpZDQ25IP6 fjjA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=0MBlkp7l; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p3-v6si6155197pff.272.2018.10.31.16.52.23; Wed, 31 Oct 2018 16:52:38 -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; dkim=pass header.i=@kernel.org header.s=default header.b=0MBlkp7l; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728184AbeKAIGk (ORCPT + 99 others); Thu, 1 Nov 2018 04:06:40 -0400 Received: from mail.kernel.org ([198.145.29.99]:53676 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728163AbeKAIGi (ORCPT ); Thu, 1 Nov 2018 04:06:38 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 0630B20838; Wed, 31 Oct 2018 23:06:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1541027187; bh=bogQ2OPasVtxpZlxeHE3LLGq5X4oWhJUFJbQ2bmGGcA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0MBlkp7ll5l+sAq6vzp8C4EjR/xhuwGALvGEAOYkCoHqSqJMAeiZJYhFLLYB1qYRG CqFemfirooi4nvagLvVYIN9+ADqij6oVHj5ajqOygCrN/oZgraWQay6IVK8UGGR4OJ ieNV+8LRWuvPglmX4IAEaFmnn5KxMWqQeUxyUsW0= From: Sasha Levin To: stable@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Jian Shen , Peng Li , Salil Mehta , "David S . Miller" , Sasha Levin Subject: [PATCH AUTOSEL 4.19 050/146] net: hns3: Add nic state check before calling netif_tx_wake_queue Date: Wed, 31 Oct 2018 19:04:05 -0400 Message-Id: <20181031230541.28822-50-sashal@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181031230541.28822-1-sashal@kernel.org> References: <20181031230541.28822-1-sashal@kernel.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jian Shen [ Upstream commit 7a8101109dd37837f587cd56f3111d4fc17a07f5 ] 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 Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/ethernet/hisilicon/hns3/hns3_enet.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c index 955c4ab18b03..b7b2f8254ce1 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c @@ -1915,6 +1915,7 @@ static int is_valid_clean_head(struct hns3_enet_ring *ring, int h) bool hns3_clean_tx_ring(struct hns3_enet_ring *ring, int budget) { 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; @@ -1961,7 +1962,8 @@ bool hns3_clean_tx_ring(struct hns3_enet_ring *ring, int budget) * 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++; } -- 2.17.1