[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20181009162817.4635-14-kamalheib1@gmail.com>
Date: Tue, 9 Oct 2018 19:28:12 +0300
From: Kamal Heib <kamalheib1@...il.com>
To: Doug Ledford <dledford@...hat.com>, Jason Gunthorpe <jgg@...pe.ca>
Cc: linux-kernel@...r.kernel.org, kamalheib1@...il.com
Subject: [PATCH rdma-next 13/18] RDMA/qedr: Initialize ib_device_ops struct
Initialize ib_device_ops with the supported operations.
Signed-off-by: Kamal Heib <kamalheib1@...il.com>
---
drivers/infiniband/hw/qedr/main.c | 52 +++++++++++++++++++++++++++++++++++++++
1 file changed, 52 insertions(+)
diff --git a/drivers/infiniband/hw/qedr/main.c b/drivers/infiniband/hw/qedr/main.c
index cd7b8b39a129..ae7b28e4a475 100644
--- a/drivers/infiniband/hw/qedr/main.c
+++ b/drivers/infiniband/hw/qedr/main.c
@@ -133,12 +133,18 @@ static int qedr_iw_port_immutable(struct ib_device *ibdev, u8 port_num,
return 0;
}
+static struct ib_device_ops qedr_iw_dev_ops = {
+ .query_gid = qedr_iw_query_gid,
+ .get_port_immutable = qedr_iw_port_immutable,
+};
+
static int qedr_iw_register_device(struct qedr_dev *dev)
{
dev->ibdev.node_type = RDMA_NODE_RNIC;
dev->ibdev.query_gid = qedr_iw_query_gid;
dev->ibdev.get_port_immutable = qedr_iw_port_immutable;
+ ib_set_device_ops(&dev->ibdev, &qedr_iw_dev_ops);
dev->ibdev.iwcm = kzalloc(sizeof(*dev->ibdev.iwcm), GFP_KERNEL);
if (!dev->ibdev.iwcm)
@@ -159,13 +165,57 @@ static int qedr_iw_register_device(struct qedr_dev *dev)
return 0;
}
+static struct ib_device_ops qedr_roce_dev_ops = {
+ .get_port_immutable = qedr_roce_port_immutable,
+};
+
static void qedr_roce_register_device(struct qedr_dev *dev)
{
dev->ibdev.node_type = RDMA_NODE_IB_CA;
dev->ibdev.get_port_immutable = qedr_roce_port_immutable;
+ ib_set_device_ops(&dev->ibdev, &qedr_roce_dev_ops);
}
+static struct ib_device_ops qedr_dev_ops = {
+ .query_device = qedr_query_device,
+ .query_port = qedr_query_port,
+ .modify_port = qedr_modify_port,
+ .alloc_ucontext = qedr_alloc_ucontext,
+ .dealloc_ucontext = qedr_dealloc_ucontext,
+ .mmap = qedr_mmap,
+ .alloc_pd = qedr_alloc_pd,
+ .dealloc_pd = qedr_dealloc_pd,
+ .create_cq = qedr_create_cq,
+ .destroy_cq = qedr_destroy_cq,
+ .resize_cq = qedr_resize_cq,
+ .req_notify_cq = qedr_arm_cq,
+ .create_qp = qedr_create_qp,
+ .modify_qp = qedr_modify_qp,
+ .query_qp = qedr_query_qp,
+ .destroy_qp = qedr_destroy_qp,
+ .create_srq = qedr_create_srq,
+ .destroy_srq = qedr_destroy_srq,
+ .modify_srq = qedr_modify_srq,
+ .query_srq = qedr_query_srq,
+ .post_srq_recv = qedr_post_srq_recv,
+ .query_pkey = qedr_query_pkey,
+ .create_ah = qedr_create_ah,
+ .destroy_ah = qedr_destroy_ah,
+ .get_dma_mr = qedr_get_dma_mr,
+ .dereg_mr = qedr_dereg_mr,
+ .reg_user_mr = qedr_reg_user_mr,
+ .alloc_mr = qedr_alloc_mr,
+ .map_mr_sg = qedr_map_mr_sg,
+ .poll_cq = qedr_poll_cq,
+ .post_send = qedr_post_send,
+ .post_recv = qedr_post_recv,
+ .process_mad = qedr_process_mad,
+ .get_netdev = qedr_get_netdev,
+ .get_link_layer = qedr_link_layer,
+ .get_dev_fw_str = qedr_get_dev_fw_str,
+};
+
static int qedr_register_device(struct qedr_dev *dev)
{
int rc;
@@ -261,6 +311,8 @@ static int qedr_register_device(struct qedr_dev *dev)
dev->ibdev.get_link_layer = qedr_link_layer;
dev->ibdev.get_dev_fw_str = qedr_get_dev_fw_str;
+ ib_set_device_ops(&dev->ibdev, &qedr_dev_ops);
+
dev->ibdev.driver_id = RDMA_DRIVER_QEDR;
return ib_register_device(&dev->ibdev, "qedr%d", NULL);
}
--
2.14.4
Powered by blists - more mailing lists