Commit e63943ab authored by Yixing Liu's avatar Yixing Liu Committed by Zheng Zengkai
Browse files

RDMA/hns: Fix roce v1 traffic_class problem

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: 11ef2ec6 ("RDMA/hns: Support DSCP of userspace")
Signed-off-by: default avatarYixing Liu <liuyixing1@huawei.com>
Reviewed-by: default avatarYangyang Li <liyangyang20@huawei.com>
Reviewed-by: default avatarYue Haibing <yuehaibing@huawei.com>
Signed-off-by: default avatarZheng Zengkai <zhengzengkai@huawei.com>
parent 5b5b38ba
Loading
Loading
Loading
Loading
+6 −3
Original line number Diff line number Diff line
@@ -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 &&
+2 −1
Original line number Diff line number Diff line
@@ -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;
	}