Thread (42 messages) 42 messages, 4 authors, 2016-06-29
STALE3653d
Revisions (9)
  1. v5 [diff vs current]
  2. v6 [diff vs current]
  3. v7 [diff vs current]
  4. v7 [diff vs current]
  5. v8 [diff vs current]
  6. v9 [diff vs current]
  7. v9 [diff vs current]
  8. v10 current
  9. v11 [diff vs current]

[PATCH v10 20/22] IB/hns: Add operation for getting immutable port

From: Lijun Ou <hidden>
Date: 2016-06-16 14:23:41
Also in: linux-rdma, lkml
Subsystem: hisilicon roce driver, infiniband subsystem, the rest · Maintainers: Chengchang Tang, Junxian Huang, Jason Gunthorpe, Leon Romanovsky, Linus Torvalds

This patch added a new verbs that is getting port immutable.
It is added in the 4.5 kernel and latest. It is necessary to
solve the fail questions for registering ib device.

Signed-off-by: Wei Hu <redacted>
Signed-off-by: Lijun Ou <redacted>
---
PATCH v9:
- No change over the PATCH v8

PATCH v8:
- The initial patch
---
---
 drivers/infiniband/hw/hns/hns_roce_main.c | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)
diff --git a/drivers/infiniband/hw/hns/hns_roce_main.c b/drivers/infiniband/hw/hns/hns_roce_main.c
index 3a14c64..27c2650 100644
--- a/drivers/infiniband/hw/hns/hns_roce_main.c
+++ b/drivers/infiniband/hw/hns/hns_roce_main.c
@@ -571,6 +571,25 @@ static int hns_roce_mmap(struct ib_ucontext *context,
 	return 0;
 }
 
+static int hns_roce_port_immutable(struct ib_device *ib_dev, u8 port_num,
+				   struct ib_port_immutable *immutable)
+{
+	struct ib_port_attr attr;
+	int ret;
+
+	ret = hns_roce_query_port(ib_dev, port_num, &attr);
+	if (ret)
+		return ret;
+
+	immutable->pkey_tbl_len = attr.pkey_tbl_len;
+	immutable->gid_tbl_len = attr.gid_tbl_len;
+
+	immutable->core_cap_flags = RDMA_CORE_PORT_IBA_ROCE;
+	immutable->max_mad_size = IB_MGMT_MAD_SIZE;
+
+	return 0;
+}
+
 static void hns_roce_unregister_device(struct hns_roce_dev *hr_dev)
 {
 	struct hns_roce_ib_iboe *iboe = &hr_dev->iboe;
@@ -656,6 +675,9 @@ static int hns_roce_register_device(struct hns_roce_dev *hr_dev)
 	ib_dev->reg_user_mr		= hns_roce_reg_user_mr;
 	ib_dev->dereg_mr		= hns_roce_dereg_mr;
 
+	/* OTHERS */
+	ib_dev->get_port_immutable	= hns_roce_port_immutable;
+
 	ret = ib_register_device(ib_dev, NULL);
 	if (ret) {
 		dev_err(dev, "ib_register_device failed!\n");
-- 
1.9.1
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help