From: Yixing Liu liuyixing1@huawei.com
driver inclusion category: Bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/I61FED
-----------------------------------------------------------
When it is roce v1, if the traffic_class value exceeds 63, the following error will appear: modify qp to 2 state failed(22) Failed to create AH
This is because the driver intercepts the over-spec value in set dscp, and there is no need to obtain dscp for roce v1, so the driver does not intercept v1.
Fixes: 11ef2ec6aa7c ("RDMA/hns: Support DSCP of userspace") Signed-off-by: Yixing Liu liuyixing1@huawei.com Reviewed-by: Yangyang Li liyangyang20@huawei.com Reviewed-by: Yue Haibing yuehaibing@huawei.com Signed-off-by: Zheng Zengkai zhengzengkai@huawei.com --- drivers/infiniband/hw/hns/hns_roce_ah.c | 9 ++++++--- drivers/infiniband/hw/hns/hns_roce_hw_v2.c | 3 ++- 2 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/drivers/infiniband/hw/hns/hns_roce_ah.c b/drivers/infiniband/hw/hns/hns_roce_ah.c index cea402b28c44..975f58d9b8f0 100644 --- a/drivers/infiniband/hw/hns/hns_roce_ah.c +++ b/drivers/infiniband/hw/hns/hns_roce_ah.c @@ -61,8 +61,8 @@ int hns_roce_create_ah(struct ib_ah *ibah, struct rdma_ah_init_attr *init_attr, struct hns_roce_dev *hr_dev = to_hr_dev(ibah->device); struct hns_roce_ib_create_ah_resp resp = {}; struct hns_roce_ah *ah = to_hr_ah(ibah); - u8 priority; - u8 tc_mode; + u8 priority = 0; + u8 tc_mode = 0; int ret;
if (hr_dev->pci_dev->revision == PCI_REVISION_ID_HIP08 && udata) @@ -81,7 +81,10 @@ int hns_roce_create_ah(struct ib_ah *ibah, struct rdma_ah_init_attr *init_attr,
ret = hr_dev->hw->get_dscp(hr_dev, get_tclass(grh), &tc_mode, &priority); - if (ret && ret != -EOPNOTSUPP) + if (ret == -EOPNOTSUPP) + ret = 0; + + if (ret && grh->sgid_attr->gid_type == IB_GID_TYPE_ROCE_UDP_ENCAP) return ret;
if (tc_mode == HNAE3_TC_MAP_MODE_DSCP && diff --git a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c index 4fb82685cf54..12f124a1de04 100644 --- a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c +++ b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c @@ -5038,7 +5038,8 @@ static int hns_roce_set_sl(struct ib_qp *ibqp,
ret = hns_roce_hw_v2_get_dscp(hr_dev, get_tclass(&attr->ah_attr.grh), &hr_qp->tc_mode, &hr_qp->priority); - if (ret && ret != -EOPNOTSUPP) { + if (ret && ret != -EOPNOTSUPP && + grh->sgid_attr->gid_type == IB_GID_TYPE_ROCE_UDP_ENCAP) { ibdev_err(ibdev, "failed to get dscp, ret = %d.\n", ret); return ret; }