Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp3964147pxb; Mon, 4 Oct 2021 13:51:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxLEhXqDVVaXvCOn/WY57nuwMPxAFIF9oEAZZHmtFF2hkkbKGN3UJAFq5KmiTZkjzOXH31B X-Received: by 2002:a50:d809:: with SMTP id o9mr21166080edj.149.1633380689681; Mon, 04 Oct 2021 13:51:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633380689; cv=none; d=google.com; s=arc-20160816; b=Zr01+0gJqSfWez7eYg3J5cW1RXQswZUWAWX6fJlFrxDWQtfcgqb8RJoqbtRwtf8jo2 uF/qSFyCj/HUXVkGEy2KNV/NGr4tJsM8HGc9PxVDTkYd+LMEi2znz3G/6jEG2owA+OJc 8Pv6dZ2oDEdC4A55DZmd2N+D0uOv8exZRhMVMxlxH0PDKtU1Ik6J62ROka/aM1TiYVU6 mJU/D2Vab4zO/7K7ErCj+ZMz8LOdP9gDZyi7uvsUQbmtpV7hKkg1WNaDK5BWCJ2stfqw aE/6XkJH0wFE3XfTW0vaG7ovGzhzWQKa4UN3vO09oa3R+P+71fcIrUPKDf18gRrehPqc GEqw== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=5oY/wycS5GzvsMmVPnV7ScenS+LyJLvhTHhzDzrcINY=; b=ve9Y1cdhexu16tzWNxPDMmjoXFLTf41ja46AjFpf1bMEyGiJpP5SQUXiDY685Su+v5 dt2Vjk32eu5QXlsvddXulhNjD0BCiUfaGgloGTP/aXpxucdGVe7r+qnAbe+xqrbTiDgZ F4YymtUyS3BvMrW1AdbbnA19jv+NH4IcAtismKYTwj8YQV0PqevdD/fJNJKZVAjtMHbn nNc3E7mOQPi6vhewVSPpDUJjxmGWsuGwe7ZcKjp71BWWYVYjx0iSa0rJMzaX0crFvFfg 3mHIbqScFnB+m88Q+pb8vKACLdX/yEV/to9pIOWWh5h/3XwanhzrYE0WkURojnsmdF4h DSUA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=2KHR56LU; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m9si24521011ejj.143.2021.10.04.13.51.05; Mon, 04 Oct 2021 13:51:29 -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; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=2KHR56LU; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237862AbhJDNl0 (ORCPT + 99 others); Mon, 4 Oct 2021 09:41:26 -0400 Received: from mail.kernel.org ([198.145.29.99]:51040 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237898AbhJDNjr (ORCPT ); Mon, 4 Oct 2021 09:39:47 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 769386324F; Mon, 4 Oct 2021 13:18:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1633353489; bh=NqnKqcJrD8CIMdyshFs5P7HueF5CcLL6BZXUu7We/qE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2KHR56LUY2o2IKeUAEzSDFltbs4y/AKAd5tG8jXvPSs0xWGi/wyqUUgXRwJymKJXe wy1I/m781I7AtjzaZOpmvdNqSs8OH3JnsDExsGYZAeU47Y/ll3BzFLIVANs0wYFXce VOrhuJTxXf09Vmd2+g3mQ7+bCQzcCpdykNikdJlE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Guangbin Huang , "David S. Miller" , Sasha Levin Subject: [PATCH 5.14 131/172] net: hns3: disable firmware compatible features when uninstall PF Date: Mon, 4 Oct 2021 14:53:01 +0200 Message-Id: <20211004125049.193594128@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211004125044.945314266@linuxfoundation.org> References: <20211004125044.945314266@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Guangbin Huang [ Upstream commit 0178839ccca36dee238a57e7f4c3c252f5dbbba6 ] 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 Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- .../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 eb748aa35952..0f0bf3d503bf 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.c @@ -472,7 +472,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; @@ -480,13 +480,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); } @@ -543,7 +546,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", @@ -573,6 +576,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