Received: by 2002:a25:ef43:0:0:0:0:0 with SMTP id w3csp414981ybm; Tue, 26 May 2020 21:30:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzL55f51ZqFPVI42SibegByfPQ83Rci5hBuX1X1Q4DzvqBt206QGgQb5XtqOSukjKfXZlwd X-Received: by 2002:a1c:7f44:: with SMTP id a65mr2420175wmd.53.1590553808691; Tue, 26 May 2020 21:30:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590553808; cv=none; d=google.com; s=arc-20160816; b=Yr92JiQdMPsDPC5k7ICXeVV7fazF2OV5RuFTzJg2RwdC2lfWg+3ofJxhpKl8sTit1r Npu27t8LRsiwcVyjdXt5PY3BA41oRZBChxwIBfCSOebT05ICq4Ktk13XceM0byVnePWy I/hInEpDXIqUgRTtDX64o3Ij6jEE17qu91jM/xlR7soNw/F2eBe8toXc/af5wgB98eBe uMuX5dNf96WS8t1oTaN0/zJZ/ZbiTdbozWUduOdYSq2zi0TpqeOy25K16GMZ5S9aXpYZ jTIKhGFsJ+hsCxvoupVs33Tqkr6tgqt1/JFyH0PY41bXNve69PKYwl+2HggyccRZkgTk uFjw== 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=BsWZStugjYOHBN3hjy7DTGBg/+rVSKVmyfc57B+1c7EYcxX2sp9EhApYKRSDT/7Axy uRRYMIWdIJ2AZFS/u0UHHs4UE0l2nU9smKwz0d2CIbt3FOVDsMA1XE1s5m6cpshinYr+ 7yLu3bjbk/d/GDnPmzifdkclxTyiHcVpNYBePbHq54PVjzAwwYUvZ3YMJJ70sRxOjJHM MSzQ7GX6A1YM18p8K4OQuTgdyqDosdyXcbfFANkva6MefkzgwKgACbRahnfCjEi6pfbE lvxSHeVfPjmhRE+LAJz5Wr8JBofXcTlHv2hjuG6YDppDKgD2vY+21vIEoQRjrpCwzOlv qIHQ== 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 u18si985417edf.273.2020.05.26.21.29.45; Tue, 26 May 2020 21:30:08 -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 S1727833AbgE0BAo (ORCPT + 99 others); Tue, 26 May 2020 21:00:44 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:5340 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727809AbgE0BAn (ORCPT ); Tue, 26 May 2020 21:00:43 -0400 Received: from DGGEMS409-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id CC9355B34488991F8AFE; Wed, 27 May 2020 09:00:41 +0800 (CST) Received: from localhost.localdomain (10.69.192.56) by DGGEMS409-HUB.china.huawei.com (10.3.19.209) with Microsoft SMTP Server id 14.3.487.0; Wed, 27 May 2020 09:00:33 +0800 From: Huazhong Tan To: CC: , , , , , , Guangbin Huang , Huazhong Tan Subject: [PATCH V2 net-next 1/4] net: hns3: add a resetting check in hclgevf_init_nic_client_instance() Date: Wed, 27 May 2020 08:59:14 +0800 Message-ID: <1590541157-6803-2-git-send-email-tanhuazhong@huawei.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1590541157-6803-1-git-send-email-tanhuazhong@huawei.com> References: <1590541157-6803-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