diff mbox series

[rdma-next,12/18] RDMA/ocrdma: Initialize ib_device_ops struct

Message ID 20181009184547.5907-13-kamalheib1@gmail.com (mailing list archive)
State Superseded
Headers show
Series RDMA: Add support for ib_device_ops | expand

Commit Message

Kamal Heib Oct. 9, 2018, 6:45 p.m. UTC
Initialize ib_device_ops with the supported operations.

Signed-off-by: Kamal Heib <kamalheib1@gmail.com>
---
 drivers/infiniband/hw/ocrdma/ocrdma_main.c | 47 ++++++++++++++++++++++++++++++
 1 file changed, 47 insertions(+)
diff mbox series

Patch

diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_main.c b/drivers/infiniband/hw/ocrdma/ocrdma_main.c
index 4d3c27613351..1ad1c4110bf8 100644
--- a/drivers/infiniband/hw/ocrdma/ocrdma_main.c
+++ b/drivers/infiniband/hw/ocrdma/ocrdma_main.c
@@ -114,6 +114,50 @@  static void get_dev_fw_str(struct ib_device *device, char *str)
 	snprintf(str, IB_FW_VERSION_NAME_MAX, "%s", &dev->attr.fw_ver[0]);
 }
 
+static struct ib_device_ops ocrdma_dev_ops = {
+	.query_device		= ocrdma_query_device,
+	.query_port		= ocrdma_query_port,
+	.modify_port		= ocrdma_modify_port,
+	.get_netdev		= ocrdma_get_netdev,
+	.get_link_layer		= ocrdma_link_layer,
+	.alloc_pd		= ocrdma_alloc_pd,
+	.dealloc_pd		= ocrdma_dealloc_pd,
+	.create_cq		= ocrdma_create_cq,
+	.destroy_cq		= ocrdma_destroy_cq,
+	.resize_cq		= ocrdma_resize_cq,
+	.create_qp		= ocrdma_create_qp,
+	.modify_qp		= ocrdma_modify_qp,
+	.query_qp		= ocrdma_query_qp,
+	.destroy_qp		= ocrdma_destroy_qp,
+	.query_pkey		= ocrdma_query_pkey,
+	.create_ah		= ocrdma_create_ah,
+	.destroy_ah		= ocrdma_destroy_ah,
+	.query_ah		= ocrdma_query_ah,
+	.poll_cq		= ocrdma_poll_cq,
+	.post_send		= ocrdma_post_send,
+	.post_recv		= ocrdma_post_recv,
+	.req_notify_cq		= ocrdma_arm_cq,
+	.get_dma_mr		= ocrdma_get_dma_mr,
+	.dereg_mr		= ocrdma_dereg_mr,
+	.reg_user_mr		= ocrdma_reg_user_mr,
+	.alloc_mr		= ocrdma_alloc_mr,
+	.map_mr_sg		= ocrdma_map_mr_sg,
+	.alloc_ucontext		= ocrdma_alloc_ucontext,
+	.dealloc_ucontext	= ocrdma_dealloc_ucontext,
+	.mmap			= ocrdma_mmap,
+	.process_mad		= ocrdma_process_mad,
+	.get_port_immutable	= ocrdma_port_immutable,
+	.get_dev_fw_str		= get_dev_fw_str,
+};
+
+static struct ib_device_ops ocrdma_dev_srq_ops = {
+	.create_srq		= ocrdma_create_srq,
+	.modify_srq		= ocrdma_modify_srq,
+	.query_srq		= ocrdma_query_srq,
+	.destroy_srq		= ocrdma_destroy_srq,
+	.post_srq_recv		= ocrdma_post_srq_recv,
+};
+
 static int ocrdma_register_device(struct ocrdma_dev *dev)
 {
 	ocrdma_get_guid(dev, (u8 *)&dev->ibdev.node_guid);
@@ -198,6 +242,8 @@  static int ocrdma_register_device(struct ocrdma_dev *dev)
 	dev->ibdev.get_port_immutable = ocrdma_port_immutable;
 	dev->ibdev.get_dev_fw_str     = get_dev_fw_str;
 
+	ib_set_device_ops(&dev->ibdev, &ocrdma_dev_ops);
+
 	if (ocrdma_get_asic_type(dev) == OCRDMA_ASIC_GEN_SKH_R) {
 		dev->ibdev.uverbs_cmd_mask |=
 		     OCRDMA_UVERBS(CREATE_SRQ) |
@@ -211,6 +257,7 @@  static int ocrdma_register_device(struct ocrdma_dev *dev)
 		dev->ibdev.query_srq = ocrdma_query_srq;
 		dev->ibdev.destroy_srq = ocrdma_destroy_srq;
 		dev->ibdev.post_srq_recv = ocrdma_post_srq_recv;
+		ib_set_device_ops(&dev->ibdev, &ocrdma_dev_srq_ops);
 	}
 	dev->ibdev.driver_id = RDMA_DRIVER_OCRDMA;
 	return ib_register_device(&dev->ibdev, "ocrdma%d", NULL);