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: Chengchang Tang tangchengchang@huawei.com (cherry picked from commit 582d9481542e6f9faada8b374432f59b5978ce69) Signed-off-by: Juan Zhou zhoujuan51@h-partners.com --- drivers/infiniband/hw/hns/hns_roce_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/infiniband/hw/hns/hns_roce_main.c b/drivers/infiniband/hw/hns/hns_roce_main.c index 9dc50ec62..340ebb2e4 100644 --- a/drivers/infiniband/hw/hns/hns_roce_main.c +++ b/drivers/infiniband/hw/hns/hns_roce_main.c @@ -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)))