Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1474653

[PATCH for-next 07/10] IB/hns: Change the logic for allocating uar registers

From Salil Mehta <salil.mehta@huawei.com>
Newsgroups linux.kernel
Subject [PATCH for-next 07/10] IB/hns: Change the logic for allocating uar registers
Date 2016-09-01 23:30 +0200
Message-ID <scHIC-79t-29@gated-at.bofh.it> (permalink)
References <scHIB-79t-15@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: Lijun Ou <oulijun@huawei.com>

This patch mainly modifies the logic for allocating uar registers.
In HiP06 SoC, HW has 8 group of uar registers for kernel and
user space application. The uar index is assigned as follows:
    0   ------ for kernel
    1~7 ------ for user space application

Signed-off-by: Lijun Ou <oulijun@huawei.com>
Reviewed-by: Wei Hu <xavier.huwei@huawei.com>
Signed-off-by: Salil Mehta <salil.mehta@huawei.com>
---
 drivers/infiniband/hw/hns/hns_roce_pd.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/infiniband/hw/hns/hns_roce_pd.c b/drivers/infiniband/hw/hns/hns_roce_pd.c
index 16271b5..4109f74 100644
--- a/drivers/infiniband/hw/hns/hns_roce_pd.c
+++ b/drivers/infiniband/hw/hns/hns_roce_pd.c
@@ -117,7 +117,9 @@ int hns_roce_uar_alloc(struct hns_roce_dev *hr_dev, struct hns_roce_uar *uar)
 	if (ret == -1)
 		return -ENOMEM;
 
-	uar->index = (uar->index - 1) % hr_dev->caps.phy_num_uars + 1;
+	if (uar->index > 0)
+		uar->index = (uar->index - 1) %
+			     (hr_dev->caps.phy_num_uars - 1) + 1;
 
 	res = platform_get_resource(hr_dev->pdev, IORESOURCE_MEM, 0);
 	uar->pfn = ((res->start) >> PAGE_SHIFT) + uar->index;
-- 
1.7.9.5

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH for-next 00/10] Add CM(Connection Manager) Support to HNS RoCe Driver Salil Mehta <salil.mehta@huawei.com> - 2016-09-01 23:30 +0200
  [PATCH for-next 10/10] IB/hns: Add node_guid definition to the bindings document Salil Mehta <salil.mehta@huawei.com> - 2016-09-01 23:30 +0200
  [PATCH for-next 01/10] IB/hns: Register HNS RoCE Driver get_netdev() with IB Core Salil Mehta <salil.mehta@huawei.com> - 2016-09-01 23:30 +0200
  [PATCH for-next 07/10] IB/hns: Change the logic for allocating uar registers Salil Mehta <salil.mehta@huawei.com> - 2016-09-01 23:30 +0200
  [PATCH for-next 08/10] IB/hns: Fix the bug of rdma cm connecting on user mode Salil Mehta <salil.mehta@huawei.com> - 2016-09-01 23:30 +0200
  [PATCH for-next 09/10] IB/hns: Fix two bugs for rdma cm connecting Salil Mehta <salil.mehta@huawei.com> - 2016-09-01 23:30 +0200
  [PATCH for-next 04/10] IB/hns: Fix the value of device_cap_flags Salil Mehta <salil.mehta@huawei.com> - 2016-09-01 23:30 +0200
  [PATCH for-next 05/10] IB/hns: Fix two possible bugs for rdma cm Salil Mehta <salil.mehta@huawei.com> - 2016-09-01 23:30 +0200
  [PATCH for-next 06/10] IB/hns: Add phy_port for computing GSI/QPN Salil Mehta <salil.mehta@huawei.com> - 2016-09-01 23:30 +0200

csiph-web