Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp213167ybh; Fri, 6 Mar 2020 19:54:13 -0800 (PST) X-Google-Smtp-Source: ADFU+vuxCne/1TynTMu/ocvNivkrqm2cKeWvnpuI4rNr04HuM3WgsgJjpf7l3cfRt7gcqq7IdiCo X-Received: by 2002:a9d:2787:: with SMTP id c7mr5049860otb.314.1583553252978; Fri, 06 Mar 2020 19:54:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583553252; cv=none; d=google.com; s=arc-20160816; b=BzcrtpYk1M6mvlzZBTUl/1eKq34bk0RsW6BdP+MUhiyt5V1NDjnt+jKur81jTC1eqB aKvE2zE0J0Nsmgi1n8sQLC3aKsbZHSYi7twFjCXnU6VqiN8CM1Jh52NYypUzeXFLixNh aWNmjHcFiiYyzFT8bS4oNbB1CtsjR1sCwBnLKW82Z76MkILeYLZ97KljRK178IYdii34 ef8IGxikm58n7TUpaXdUtIiRndaS8KqoTQNnmuYFTahj4Ve9k76i48H7l983G2biheY0 M0WarM9TcmNs0sQ8Y6aXvTKMyQM0N71lpVUgqHQWo4deFt+bjHMFEFULIo2l1G4PbWS0 tKXQ== 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=ZsJfMc/JIWlzNDHXy987YGAUpKN5DgHh1cDQPM3pZJ4753BafnuHFTBaTIlIuTsFwf mGq9rYbnxt+kFWta12gavntCe45QeZOeYms0AJtXtGDzdbAzGbzrEMf+ro+VsfCX3XgY vvusSbxb7D11cBjhKw24RMSkLeCNe68Qy7TqgErXA7qlXt/Y98wDN1LzwTkVa+254XpL Pb423C8c9J5+cyQOMUIXN5XZdFWe/hT5r/XFLFMDqLjqatcLrL1wsqJSPgX8s3BrOxkc rVPaHf6qdF//G+B638tGcFxMDNL56vb3DBpTzAmVqRhuYVv5qtkR0LZOEkFSwGJt03pt DJ4w== 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 l7si2588596otq.9.2020.03.06.19.54.01; Fri, 06 Mar 2020 19:54:12 -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 S1726733AbgCGDwb (ORCPT + 99 others); Fri, 6 Mar 2020 22:52:31 -0500 Received: from szxga06-in.huawei.com ([45.249.212.32]:37150 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726259AbgCGDwb (ORCPT ); Fri, 6 Mar 2020 22:52:31 -0500 Received: from DGGEMS413-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 364323E53C2C99F49407; Sat, 7 Mar 2020 11:52:29 +0800 (CST) Received: from localhost.localdomain (10.69.192.56) by DGGEMS413-HUB.china.huawei.com (10.3.19.213) with Microsoft SMTP Server id 14.3.439.0; Sat, 7 Mar 2020 11:52:19 +0800 From: Huazhong Tan To: CC: , , , , , , Yonglong Liu , Huazhong Tan Subject: [PATCH V2 net-next 5/9] net: hns3: add a check before PF inform VF to reset Date: Sat, 7 Mar 2020 11:42:46 +0800 Message-ID: <1583552570-51203-6-git-send-email-tanhuazhong@huawei.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1583552570-51203-1-git-send-email-tanhuazhong@huawei.com> References: <1583552570-51203-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