提交 4ea3364f 编写于 作者: G Guangbin Huang 提交者: Zheng Zengkai

net: hns3: disable firmware compatible features when uninstall PF

mainline inclusion
from mainline-v5.15-rc4
commit 0178839c
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I4I7P7
CVE: NA

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=0178839ccca3

----------------------------------------------------------------------

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: ed8fb4b2 ("net: hns3: add link change event report")
Signed-off-by: NGuangbin Huang <huangguangbin2@huawei.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
Reviewed-by: NYongxin Li <liyongxin1@huawei.com>
Signed-off-by: NJunxin Chen <chenjunxin1@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 1bcaa27b
...@@ -467,7 +467,7 @@ int hclge_cmd_queue_init(struct hclge_dev *hdev) ...@@ -467,7 +467,7 @@ int hclge_cmd_queue_init(struct hclge_dev *hdev)
return ret; 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_firmware_compat_cmd *req;
struct hclge_desc desc; struct hclge_desc desc;
...@@ -475,13 +475,16 @@ static int hclge_firmware_compat_config(struct hclge_dev *hdev) ...@@ -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); 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_LINK_EVENT_REPORT_EN_B, 1);
hnae3_set_bit(compat, HCLGE_NCSI_ERROR_REPORT_EN_B, 1); hnae3_set_bit(compat, HCLGE_NCSI_ERROR_REPORT_EN_B, 1);
if (hnae3_dev_phy_imp_supported(hdev)) if (hnae3_dev_phy_imp_supported(hdev))
hnae3_set_bit(compat, HCLGE_PHY_IMP_EN_B, 1); hnae3_set_bit(compat, HCLGE_PHY_IMP_EN_B, 1);
req->compat = cpu_to_le32(compat);
req->compat = cpu_to_le32(compat);
}
return hclge_cmd_send(&hdev->hw, &desc, 1); return hclge_cmd_send(&hdev->hw, &desc, 1);
} }
...@@ -538,7 +541,7 @@ int hclge_cmd_init(struct hclge_dev *hdev) ...@@ -538,7 +541,7 @@ int hclge_cmd_init(struct hclge_dev *hdev)
/* ask the firmware to enable some features, driver can work without /* ask the firmware to enable some features, driver can work without
* it. * it.
*/ */
ret = hclge_firmware_compat_config(hdev); ret = hclge_firmware_compat_config(hdev, true);
if (ret) if (ret)
dev_warn(&hdev->pdev->dev, dev_warn(&hdev->pdev->dev,
"Firmware compatible features not enabled(%d).\n", "Firmware compatible features not enabled(%d).\n",
...@@ -568,6 +571,8 @@ static void hclge_cmd_uninit_regs(struct hclge_hw *hw) ...@@ -568,6 +571,8 @@ static void hclge_cmd_uninit_regs(struct hclge_hw *hw)
void hclge_cmd_uninit(struct hclge_dev *hdev) void hclge_cmd_uninit(struct hclge_dev *hdev)
{ {
hclge_firmware_compat_config(hdev, false);
set_bit(HCLGE_STATE_CMD_DISABLE, &hdev->state); set_bit(HCLGE_STATE_CMD_DISABLE, &hdev->state);
/* wait to ensure that the firmware completes the possible left /* wait to ensure that the firmware completes the possible left
* over commands. * over commands.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册