Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp6355923ybf; Thu, 5 Mar 2020 18:59:11 -0800 (PST) X-Google-Smtp-Source: ADFU+vu+s7/Odg+9wGEeNZLHIhTiMgBcaQX1UIoLPskU74JQzdbSULpeWjbPCZf9GTUkhWPkvcgQ X-Received: by 2002:a9d:7748:: with SMTP id t8mr827949otl.187.1583463551855; Thu, 05 Mar 2020 18:59:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583463551; cv=none; d=google.com; s=arc-20160816; b=EJBLjse52/expeRY2+ePIQqiOakS/Q1IN34qpWIA07M5PxmM+L0/qxdipavGFPvZMs lWdd+H/2pfGNWmylLhDFm8c6j/qW87Uu/XwRFaP9N3iWM+zWrpgXEmTl8h8O0Wx5AEmu DOx7yU1Cscmw6Y1ol50gly3bOtdWU+VdJJCZ7gJ39KMdl27VB9PkQYAfuzoFPaWUZxjp 2Q4frnBskyXhwqC2AX85rnCYbkzU6c6/sw7jIfLUai1CJ5I0U1nTNjUGwbRUd67r6jKq t2t8Y36A5gJ+l46xtCBRT4Fi+EqMOD6alkhv5fzZ5st3F7R9OrQici+7ZqzZUn7eAtM0 wSiw== 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=D+eO7icPSNuWBWs8yRzDGJfKxR89y8+giEF0wE1bd/c=; b=o4kOQhvcr5Ygvm8CyiINs0Qlh36JEG9nydCSfktGTbbh4D2qsyHmn/3PabuQybeIZt xsr9wxxpTmOI8tFzhWbImTcPaMch7/F3/URu3R6CP841N29of6r/HYSKXhfTww3eKWai Cu61CyGLK1w853yHIPm1HAiV3HalStgC3tXZTfG2E7RAWg5wroO2AhPwxp2+9IXLmbWR lupyC8XqPDwu/zTfm1fpUWF57S9jalpzTlKcgskEXCnTdbkMMj9gcsGa2rmCTmIVg/eX qrQ3aFsOHOy5Wx1KtPPk64IBjih59tPpgxuB1ISsuGv9RtYTmQaUtey6PekWavsr8MOK +/1w== 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 12si557301oti.107.2020.03.05.18.58.59; Thu, 05 Mar 2020 18:59:11 -0800 (PST) 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 S1726351AbgCFC6V (ORCPT + 99 others); Thu, 5 Mar 2020 21:58:21 -0500 Received: from szxga06-in.huawei.com ([45.249.212.32]:38320 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726243AbgCFC6C (ORCPT ); Thu, 5 Mar 2020 21:58:02 -0500 Received: from DGGEMS401-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 66351D6014C0E3BD13FE; Fri, 6 Mar 2020 10:57:58 +0800 (CST) Received: from localhost.localdomain (10.69.192.56) by DGGEMS401-HUB.china.huawei.com (10.3.19.201) with Microsoft SMTP Server id 14.3.439.0; Fri, 6 Mar 2020 10:57:49 +0800 From: Huazhong Tan To: CC: , , , , , , Yonglong Liu , Huazhong Tan Subject: [PATCH net-next 5/9] net: hns3: add a check before PF inform VF to reset Date: Fri, 6 Mar 2020 10:57:14 +0800 Message-ID: <1583463438-60953-6-git-send-email-tanhuazhong@huawei.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1583463438-60953-1-git-send-email-tanhuazhong@huawei.com> References: <1583463438-60953-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: Yonglong Liu When setting VF's MAC from PF, if the VF driver not loaded, the firmware will return error to PF. So PF should check whether VF is alive before sending message to VF when setting VF's MAC. Signed-off-by: Yonglong Liu Signed-off-by: Huazhong Tan --- drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c index 6da55fb3..69e2008 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c @@ -7617,11 +7617,17 @@ static int hclge_set_vf_mac(struct hnae3_handle *handle, int vf, } ether_addr_copy(vport->vf_info.mac, mac_addr); - dev_info(&hdev->pdev->dev, - "MAC of VF %d has been set to %pM, and it will be reinitialized!\n", - vf, mac_addr); - return hclge_inform_reset_assert_to_vf(vport); + if (test_bit(HCLGE_VPORT_STATE_ALIVE, &vport->state)) { + dev_info(&hdev->pdev->dev, + "MAC of VF %d has been set to %pM, and it will be reinitialized!\n", + vf, mac_addr); + return hclge_inform_reset_assert_to_vf(vport); + } + + dev_info(&hdev->pdev->dev, "MAC of VF %d has been set to %pM\n", + vf, mac_addr); + return 0; } static int hclge_add_mgr_tbl(struct hclge_dev *hdev, -- 2.7.4