Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp1924623ybk; Thu, 21 May 2020 19:52:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzN2UoC54+bAWVBAz/7V/UZrktv03eLV26HuChrYwiaXUDpe1jytTQeuIgq2tTDtxo4Vx6x X-Received: by 2002:aa7:d0d9:: with SMTP id u25mr1263012edo.377.1590115979787; Thu, 21 May 2020 19:52:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590115979; cv=none; d=google.com; s=arc-20160816; b=DWVY2WouImGk+NVfcr5xi5AUwwdX8JB8ay6owOCmMd7YXj4YgkwyCKTnHGHrmaOXJQ ZnVzaWs+hDPgFSdl5zSZrqJJ53CqTFwyIoSeyrn8jZgKILhQaaNHRXgSp522xadn/AP3 hCZdELAEzXSkQFgpTkOxfAMO1GcUzKCjYifbLfttOZt7MvVPFBuT71x6LdR7mRO+f3m0 welYBJ9NTGqsJe6glfSnyKYqUL6YXH0NRNQa/fLuLblnRjca2p1WKKva78YiOddm7xo8 pDVNegO2G2MMAOIPN5vkvqzSrOnG1emIx5YhK9E+mQa96NhRiICYI3+KcNZ/2C5jILCJ kUZQ== 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=upBNI/6g6ScvJDQoxB/a+sk59+SU64Alx2H26Y+bU8A=; b=09mHDkc/gO3jpzpE1UOp511rwCeNf84OFD6BnuO0Hd4gvvznkZagdDQLkywVBzGRJD vr6ZYqqBTgSzrDzxHHumlAL/p+Xl/rGH9NAVniv54mviUTCxbBMn+QI1ZHyyVfiBRpkg Lk31Ha7h2t5YVx60OOik37b5ePVVB7J7yct7tjDZ6r0hwDlYTJ4PnfagpnDYycgcWMOf NEJU8BhWkdG4WwOuLMUkvfbIElnW3Rm/adPBuMuqqNZS1GxTCvRWngLdlLHa/cxrHYLf yu3Qg0mnHZFlFQQGXvwY2QKzoChlcBFWv8Ov4k4z/DH5Fw1/si2J/tu9fPkeJNYNIoWu UAhw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gh22si4051029ejb.532.2020.05.21.19.52.37; Thu, 21 May 2020 19:52:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728108AbgEVCvR (ORCPT + 99 others); Thu, 21 May 2020 22:51:17 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:4886 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727975AbgEVCvQ (ORCPT ); Thu, 21 May 2020 22:51:16 -0400 Received: from DGGEMS406-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id B6794C78E3C994C4A5F8; Fri, 22 May 2020 10:51:11 +0800 (CST) Received: from localhost.localdomain (10.69.192.56) by DGGEMS406-HUB.china.huawei.com (10.3.19.206) with Microsoft SMTP Server id 14.3.487.0; Fri, 22 May 2020 10:51:02 +0800 From: Huazhong Tan To: CC: , , , , , , Guangbin Huang , Huazhong Tan Subject: [PATCH net-next 2/5] net: hns3: add a resetting check in hclgevf_init_nic_client_instance() Date: Fri, 22 May 2020 10:49:43 +0800 Message-ID: <1590115786-9940-3-git-send-email-tanhuazhong@huawei.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1590115786-9940-1-git-send-email-tanhuazhong@huawei.com> References: <1590115786-9940-1-git-send-email-tanhuazhong@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.69.192.56] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Guangbin Huang To prevent from initializing VF NIC client in reset handling state, this patch adds resetting check in hclgevf_init_nic_client_instance(). Signed-off-by: Guangbin Huang Signed-off-by: Huazhong Tan --- drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c index 32341dc..59fcb80 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c @@ -2713,6 +2713,7 @@ static int hclgevf_init_nic_client_instance(struct hnae3_ae_dev *ae_dev, struct hnae3_client *client) { struct hclgevf_dev *hdev = ae_dev->priv; + int rst_cnt = hdev->rst_stats.rst_cnt; int ret; ret = client->ops->init_instance(&hdev->nic); @@ -2720,6 +2721,14 @@ static int hclgevf_init_nic_client_instance(struct hnae3_ae_dev *ae_dev, return ret; set_bit(HCLGEVF_STATE_NIC_REGISTERED, &hdev->state); + if (test_bit(HCLGEVF_STATE_RST_HANDLING, &hdev->state) || + rst_cnt != hdev->rst_stats.rst_cnt) { + clear_bit(HCLGEVF_STATE_NIC_REGISTERED, &hdev->state); + + client->ops->uninit_instance(&hdev->nic, 0); + return -EBUSY; + } + hnae3_set_client_init_flag(client, ae_dev, 1); if (netif_msg_drv(&hdev->nic)) -- 2.7.4