From: Junxian Huang huangjunxian6@hisilicon.com
driver inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/IBD4ID
--------------------------------------------------------------------------
Commit 1470b68f21c3 ("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: 1470b68f21c3 ("RDMA/hns: Fix print after query hw id failed.") Fixes: 867e1e95fe12 ("RDMA/hns: Support query HW ID from user space.") Signed-off-by: Junxian Huang huangjunxian6@hisilicon.com Signed-off-by: Xinghai Cen cenxinghai@h-partners.com --- drivers/infiniband/hw/hns/hns_roce_hw_v2.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-)
diff --git a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c index 13da17c913de..80f275243cfd 100644 --- a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c +++ b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c @@ -1451,11 +1451,9 @@ 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); + dev_err_ratelimited(hr_dev->dev, + "Cmdq IO error, opcode = 0x%x, return = 0x%x.\n", + desc->opcode, desc_ret); ret = hns_roce_cmd_err_convert_errno(desc_ret); } } else { @@ -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); - + ibdev_warn(&hr_dev->ib_dev, + "failed to query hw id, ret = %d.\n", ret); goto invalid_val; }