Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp447211pxb; Wed, 29 Sep 2021 02:42:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzK4SOIXW1xFT7xEkVzeIKBiHYK2tBIYXOINnLobR6G4WxiIrIz3Yt5m87IuI/8uHE+coxY X-Received: by 2002:a17:902:d505:b0:13e:b49:9d8d with SMTP id b5-20020a170902d50500b0013e0b499d8dmr9467735plg.22.1632908552510; Wed, 29 Sep 2021 02:42:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632908552; cv=none; d=google.com; s=arc-20160816; b=zLVeutL+bQeMT2jZX+etnCWx5Mkjf0H4C4DaegX7S3lcWAWrGqyCPZDAbGo6dAaRZw EvqDRGcaI6SPO/XoNqVmzFriYGeRI7V0UW8MzclPV5HkxP9wX0kWAeqq7ZaE8ZECYZy3 Bn8xJ/jrGZigh5ddLPv3pMqnU6WY66DjVHrLB9NiuN4z8N9nQ6OqxKQOyRMH0KZG7kFv afcuOENaBLF7f9TVIGy4mdsSpLVO1Uq1FVKir1xMYr/frXHopvffx6tghjWmqlYMY1sZ j+JuEPdIXsGncux35pPVCyvtdn254u2Ub56gk2xp3joaAQOJRwXffPZD/HfClq9iVn9n gsaw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=kekUh7z59nrO19/mLoiokiu13QO1UTVSvoYumoFG+RI=; b=JG7ber7nqJbfeULBI1ovk8MQKPXbVO6KQHpeBvYpf781dNmimKN0PitFJJWPen8l+x JJX89lhxApT/kex9bLobhNn+baMjhY8ib3IXvWciLzMCcPbD/iq/Mt8FfLa9Q/i9pDxj GeTgejMZtgqg0w+whqMIb92yFmhaVgFEwbGWh9a7XeXRkPS76/24NP+2tpyylXWZ3kq2 sVONgFnv/mO7k7djI+CFqxxe+EWKAstwoRznxJbRzwUsdAHkcG8WWJcIl4E85AXKDC8o hTjX/0JxknRhGwclSuaecJLpz4pvyVCopLtcryO1LLdQtE5ArUHPc1XioemOpgLPB5SL R2hA== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ng10si1528587pjb.60.2021.09.29.02.42.18; Wed, 29 Sep 2021 02:42:32 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245294AbhI2JmP (ORCPT + 99 others); Wed, 29 Sep 2021 05:42:15 -0400 Received: from szxga08-in.huawei.com ([45.249.212.255]:24123 "EHLO szxga08-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245103AbhI2Jlw (ORCPT ); Wed, 29 Sep 2021 05:41:52 -0400 Received: from dggemv703-chm.china.huawei.com (unknown [172.30.72.56]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4HKBCH1sxgz1DHPd; Wed, 29 Sep 2021 17:38:51 +0800 (CST) Received: from kwepemm600016.china.huawei.com (7.193.23.20) by dggemv703-chm.china.huawei.com (10.3.19.46) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.8; Wed, 29 Sep 2021 17:40:10 +0800 Received: from localhost.localdomain (10.67.165.24) by kwepemm600016.china.huawei.com (7.193.23.20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.8; Wed, 29 Sep 2021 17:40:09 +0800 From: Guangbin Huang To: , CC: , , , Subject: [PATCH net 8/8] net: hns3: disable firmware compatible features when uninstall PF Date: Wed, 29 Sep 2021 17:35:56 +0800 Message-ID: <20210929093556.9146-9-huangguangbin2@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210929093556.9146-1-huangguangbin2@huawei.com> References: <20210929093556.9146-1-huangguangbin2@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.67.165.24] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To kwepemm600016.china.huawei.com (7.193.23.20) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Currently, the firmware compatible features are enabled in PF driver initialization process, but they are not disabled in PF driver deinitialization process and firmware keeps these features in enabled status. In this case, if load an old PF driver (for example, in VM) which not support the firmware compatible features, firmware will still send mailbox message to PF when link status changed and PF will print "un-supported mailbox message, code = 201". To fix this problem, disable these firmware compatible features in PF driver deinitialization process. Fixes: ed8fb4b262ae ("net: hns3: add link change event report") Signed-off-by: Guangbin Huang --- .../hisilicon/hns3/hns3pf/hclge_cmd.c | 21 ++++++++++++------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.c index ac9b69513332..9c2eeaa82294 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.c @@ -467,7 +467,7 @@ int hclge_cmd_queue_init(struct hclge_dev *hdev) return ret; } -static int hclge_firmware_compat_config(struct hclge_dev *hdev) +static int hclge_firmware_compat_config(struct hclge_dev *hdev, bool en) { struct hclge_firmware_compat_cmd *req; struct hclge_desc desc; @@ -475,13 +475,16 @@ static int hclge_firmware_compat_config(struct hclge_dev *hdev) hclge_cmd_setup_basic_desc(&desc, HCLGE_OPC_IMP_COMPAT_CFG, false); - req = (struct hclge_firmware_compat_cmd *)desc.data; + if (en) { + req = (struct hclge_firmware_compat_cmd *)desc.data; - hnae3_set_bit(compat, HCLGE_LINK_EVENT_REPORT_EN_B, 1); - hnae3_set_bit(compat, HCLGE_NCSI_ERROR_REPORT_EN_B, 1); - if (hnae3_dev_phy_imp_supported(hdev)) - hnae3_set_bit(compat, HCLGE_PHY_IMP_EN_B, 1); - req->compat = cpu_to_le32(compat); + hnae3_set_bit(compat, HCLGE_LINK_EVENT_REPORT_EN_B, 1); + hnae3_set_bit(compat, HCLGE_NCSI_ERROR_REPORT_EN_B, 1); + if (hnae3_dev_phy_imp_supported(hdev)) + hnae3_set_bit(compat, HCLGE_PHY_IMP_EN_B, 1); + + req->compat = cpu_to_le32(compat); + } return hclge_cmd_send(&hdev->hw, &desc, 1); } @@ -538,7 +541,7 @@ int hclge_cmd_init(struct hclge_dev *hdev) /* ask the firmware to enable some features, driver can work without * it. */ - ret = hclge_firmware_compat_config(hdev); + ret = hclge_firmware_compat_config(hdev, true); if (ret) dev_warn(&hdev->pdev->dev, "Firmware compatible features not enabled(%d).\n", @@ -568,6 +571,8 @@ static void hclge_cmd_uninit_regs(struct hclge_hw *hw) void hclge_cmd_uninit(struct hclge_dev *hdev) { + hclge_firmware_compat_config(hdev, false); + set_bit(HCLGE_STATE_CMD_DISABLE, &hdev->state); /* wait to ensure that the firmware completes the possible left * over commands. -- 2.33.0