| From f8dfd0d473537f0cefbf195760f9d3dfec34d317 Mon Sep 17 00:00:00 2001 |
| From: Sirong Wang <wangsirong@huawei.com> |
| Date: Fri, 1 Nov 2019 10:33:29 +0800 |
| Subject: [PATCH] RDMA/hns: Correct the value of HNS_ROCE_HEM_CHUNK_LEN |
| |
| commit 531eb45b3da4267fc2a64233ba256c8ffb02edd2 upstream. |
| |
| Size of pointer to buf field of struct hns_roce_hem_chunk should be |
| considered when calculating HNS_ROCE_HEM_CHUNK_LEN, or sg table size will |
| be larger than expected when allocating hem. |
| |
| Fixes: 9a4435375cd1 ("IB/hns: Add driver files for hns RoCE driver") |
| Link: https://lore.kernel.org/r/1572575610-52530-2-git-send-email-liweihang@hisilicon.com |
| Signed-off-by: Sirong Wang <wangsirong@huawei.com> |
| Signed-off-by: Weihang Li <liweihang@hisilicon.com> |
| Signed-off-by: Jason Gunthorpe <jgg@mellanox.com> |
| Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com> |
| |
| diff --git a/drivers/infiniband/hw/hns/hns_roce_hem.h b/drivers/infiniband/hw/hns/hns_roce_hem.h |
| index d9d668992e49..3ca163c7f513 100644 |
| --- a/drivers/infiniband/hw/hns/hns_roce_hem.h |
| +++ b/drivers/infiniband/hw/hns/hns_roce_hem.h |
| @@ -59,7 +59,7 @@ enum { |
| |
| #define HNS_ROCE_HEM_CHUNK_LEN \ |
| ((256 - sizeof(struct list_head) - 2 * sizeof(int)) / \ |
| - (sizeof(struct scatterlist))) |
| + (sizeof(struct scatterlist) + sizeof(void *))) |
| |
| #define check_whether_bt_num_3(type, hop_num) \ |
| (type < HEM_TYPE_MTT && hop_num == 2) |
| -- |
| 2.7.4 |
| |