Commit 017106ac authored by Chengchang Tang's avatar Chengchang Tang Committed by Juan Zhou
Browse files

RDMA/hns: fix iommu_map_sg() failed when MR bigger than 4G

driver inclusion
category: feature
bugzilla: https://gitee.com/openeuler/kernel/issues/I9FIHP



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

Since the maximum length of the sgl entry is 4G, if MR is greater
than 4G, there is a probability that the sg entry length will
overflow which would lead to a iommu map failure.

Since the largest RoCE packet is 2G, there will be no DMA operation
exceeding 2G at one time. We adjust the DMA max seg size from 4G to
2G to ensure that the length of the sgl entry will not overflow and
flip.

Signed-off-by: default avatarChengchang Tang <tangchengchang@huawei.com>
(cherry picked from commit 582d9481)
Signed-off-by: default avatarJuan Zhou <zhoujuan51@h-partners.com>
parent 7c7ad035
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1016,7 +1016,7 @@ static int hns_roce_register_device(struct hns_roce_dev *hr_dev)
		if (ret)
			return ret;
	}
	dma_set_max_seg_size(dev, UINT_MAX);
	dma_set_max_seg_size(dev, SZ_2G);

	if ((hr_dev->caps.flags & HNS_ROCE_CAP_FLAG_BOND) &&
	    (hr_dev->hw->bond_is_active(hr_dev)))