[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1464188725-42805-21-git-send-email-oulijun@huawei.com>
Date: Wed, 25 May 2016 23:05:23 +0800
From: Lijun Ou <oulijun@...wei.com>
To: <dledford@...hat.com>, <sean.hefty@...el.com>,
<hal.rosenstock@...il.com>, <davem@...emloft.net>,
<jeffrey.t.kirsher@...el.com>, <jiri@...lanox.com>,
<ogerlitz@...lanox.com>
CC: <linux-rdma@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
<netdev@...r.kernel.org>, <gongyangming@...wei.com>,
<xiaokun@...wei.com>, <tangchaofei@...wei.com>,
<oulijun@...wei.com>, <haifeng.wei@...wei.com>,
<yisen.zhuang@...wei.com>, <yankejian@...wei.com>,
<charles.chenxin@...wei.com>, <linuxarm@...wei.com>
Subject: [PATCH v8 20/22] IB/hns: Add operation for getting immutable port
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 <xavier.huwei@...wei.com>
Signed-off-by: Lijun Ou <oulijun@...wei.com>
---
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 9286b07..8355763 100644
--- a/drivers/infiniband/hw/hns/hns_roce_main.c
+++ b/drivers/infiniband/hw/hns/hns_roce_main.c
@@ -572,6 +572,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;
+}
+
void hns_roce_unregister_device(struct hns_roce_dev *hr_dev)
{
struct hns_roce_ib_iboe *iboe = &hr_dev->iboe;
@@ -657,6 +676,9 @@ 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
Powered by blists - more mailing lists