diff mbox series

[rdma-next,16/18] RDMA/vmw_pvrdma: Initialize ib_device_ops struct

Message ID 20181009184547.5907-17-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/vmw_pvrdma/pvrdma_main.c | 46 ++++++++++++++++++++++++++
 1 file changed, 46 insertions(+)
diff mbox series

Patch

diff --git a/drivers/infiniband/hw/vmw_pvrdma/pvrdma_main.c b/drivers/infiniband/hw/vmw_pvrdma/pvrdma_main.c
index c1e31985b11c..25d494ce2d7d 100644
--- a/drivers/infiniband/hw/vmw_pvrdma/pvrdma_main.c
+++ b/drivers/infiniband/hw/vmw_pvrdma/pvrdma_main.c
@@ -157,6 +157,49 @@  static struct net_device *pvrdma_get_netdev(struct ib_device *ibdev,
 	return netdev;
 }
 
+static struct ib_device_ops pvrdma_dev_ops = {
+	.query_device		= pvrdma_query_device,
+	.query_port		= pvrdma_query_port,
+	.query_gid		= pvrdma_query_gid,
+	.query_pkey		= pvrdma_query_pkey,
+	.modify_port		= pvrdma_modify_port,
+	.alloc_ucontext		= pvrdma_alloc_ucontext,
+	.dealloc_ucontext	= pvrdma_dealloc_ucontext,
+	.mmap			= pvrdma_mmap,
+	.alloc_pd		= pvrdma_alloc_pd,
+	.dealloc_pd		= pvrdma_dealloc_pd,
+	.create_ah		= pvrdma_create_ah,
+	.destroy_ah		= pvrdma_destroy_ah,
+	.create_qp		= pvrdma_create_qp,
+	.modify_qp		= pvrdma_modify_qp,
+	.query_qp		= pvrdma_query_qp,
+	.destroy_qp		= pvrdma_destroy_qp,
+	.post_send		= pvrdma_post_send,
+	.post_recv		= pvrdma_post_recv,
+	.create_cq		= pvrdma_create_cq,
+	.destroy_cq		= pvrdma_destroy_cq,
+	.poll_cq		= pvrdma_poll_cq,
+	.req_notify_cq		= pvrdma_req_notify_cq,
+	.get_dma_mr		= pvrdma_get_dma_mr,
+	.reg_user_mr		= pvrdma_reg_user_mr,
+	.dereg_mr		= pvrdma_dereg_mr,
+	.alloc_mr		= pvrdma_alloc_mr,
+	.map_mr_sg		= pvrdma_map_mr_sg,
+	.add_gid		= pvrdma_add_gid,
+	.del_gid		= pvrdma_del_gid,
+	.get_netdev		= pvrdma_get_netdev,
+	.get_port_immutable	= pvrdma_port_immutable,
+	.get_link_layer		= pvrdma_port_link_layer,
+	.get_dev_fw_str		= pvrdma_get_fw_ver_str,
+};
+
+static struct ib_device_ops pvrdma_dev_srq_ops = {
+	.create_srq		= pvrdma_create_srq,
+	.modify_srq		= pvrdma_modify_srq,
+	.query_srq		= pvrdma_query_srq,
+	.destroy_srq		= pvrdma_destroy_srq,
+};
+
 static int pvrdma_register_device(struct pvrdma_dev *dev)
 {
 	int ret = -1;
@@ -228,6 +271,8 @@  static int pvrdma_register_device(struct pvrdma_dev *dev)
 	dev->ib_dev.get_link_layer = pvrdma_port_link_layer;
 	dev->ib_dev.get_dev_fw_str = pvrdma_get_fw_ver_str;
 
+	ib_set_device_ops(&dev->ib_dev, &pvrdma_dev_ops);
+
 	mutex_init(&dev->port_mutex);
 	spin_lock_init(&dev->desc_lock);
 
@@ -256,6 +301,7 @@  static int pvrdma_register_device(struct pvrdma_dev *dev)
 		dev->ib_dev.modify_srq = pvrdma_modify_srq;
 		dev->ib_dev.query_srq = pvrdma_query_srq;
 		dev->ib_dev.destroy_srq = pvrdma_destroy_srq;
+		ib_set_device_ops(&dev->ib_dev, &pvrdma_dev_srq_ops);
 
 		dev->srq_tbl = kcalloc(dev->dsr->caps.max_srq,
 				       sizeof(struct pvrdma_srq *),