Commit 7ba5dd0e authored by Junxian Huang's avatar Junxian Huang Committed by Chengchang Tang
Browse files

RDMA/hns: Don't query *except on hip10*

driver inclusion
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/IBD4ID



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

Commit 1470b68f ("RDMA/hns: Fix print after query hw id failed.")
was meant to avoid error printing when HNS_ROCE_OPC_QUERY_HW_ID cmd
is not supported, that is, when CMD_NOT_EXIST error is returned by FW.

But the checking condition is incorrect. Now all errors printings of
HNS_ROCE_OPC_QUERY_HW_ID, even if the error code is not CMD_NOT_EXIST,
will be ignored.

This cmd is for stars mode and cnp priority setting. Since this two
features are supported only by HIP10, don't send this cmd
on other platform.

Fixes: 1470b68f ("RDMA/hns: Fix print after query hw id failed.")
Fixes: 867e1e95 ("RDMA/hns: Support query HW ID from user space.")
Signed-off-by: default avatarJunxian Huang <huangjunxian6@hisilicon.com>
Signed-off-by: default avatarXinghai Cen <cenxinghai@h-partners.com>
parent 52545931
Loading
Loading
Loading
Loading
+6 −10
Original line number Diff line number Diff line
@@ -1451,8 +1451,6 @@ static int __hns_roce_cmq_send(struct hns_roce_dev *hr_dev,
			if (likely(desc_ret == CMD_EXEC_SUCCESS))
				continue;

			if (desc->opcode != cpu_to_le16(HNS_ROCE_OPC_QUERY_HW_ID) &&
			    desc_ret != CMD_NOT_EXIST)
			dev_err_ratelimited(hr_dev->dev,
					    "Cmdq IO error, opcode = 0x%x, return = 0x%x.\n",
					    desc->opcode, desc_ret);
@@ -1593,16 +1591,14 @@ static void hns_roce_cmq_query_hw_id(struct hns_roce_dev *hr_dev)
	struct hns_roce_cmq_desc desc;
	int ret;

	if (hr_dev->is_vf)
	if (hr_dev->is_vf || hr_dev->pci_dev->revision <= PCI_REVISION_ID_HIP09)
		goto invalid_val;

	hns_roce_cmq_setup_basic_desc(&desc, HNS_ROCE_OPC_QUERY_HW_ID, true);
	ret = hns_roce_cmq_send(hr_dev, &desc, 1);
	if (ret) {
		if (desc.retval != cpu_to_le16(CMD_NOT_EXIST))
		ibdev_warn(&hr_dev->ib_dev,
			   "failed to query hw id, ret = %d.\n", ret);

		goto invalid_val;
	}