diff mbox series

[rdma-next,02/18] RDMA/bnxt_re: Initialize ib_device_ops struct

Message ID 20181009184547.5907-3-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/bnxt_re/main.c | 45 ++++++++++++++++++++++++++++++++++++
 1 file changed, 45 insertions(+)

Comments

Jason Gunthorpe Oct. 10, 2018, 4:54 p.m. UTC | #1
On Tue, Oct 09, 2018 at 09:45:31PM +0300, Kamal Heib wrote:
> Initialize ib_device_ops with the supported operations.
> 
> Signed-off-by: Kamal Heib <kamalheib1@gmail.com>
>  drivers/infiniband/hw/bnxt_re/main.c | 45 ++++++++++++++++++++++++++++++++++++
>  1 file changed, 45 insertions(+)
> 
> diff --git a/drivers/infiniband/hw/bnxt_re/main.c b/drivers/infiniband/hw/bnxt_re/main.c
> index 73632e5b819f..14cd92bd300f 100644
> +++ b/drivers/infiniband/hw/bnxt_re/main.c
> @@ -572,6 +572,50 @@ static void bnxt_re_unregister_ib(struct bnxt_re_dev *rdev)
>  	ib_unregister_device(&rdev->ibdev);
>  }
>  
> +static struct ib_device_ops bnxt_re_dev_ops = {
> +	.query_device		= bnxt_re_query_device,
> +	.modify_device		= bnxt_re_modify_device,
> +	.query_port		= bnxt_re_query_port,
> +	.get_port_immutable	= bnxt_re_get_port_immutable,
> +	.get_dev_fw_str		= bnxt_re_query_fw_str,
> +	.query_pkey		= bnxt_re_query_pkey,
> +	.get_netdev		= bnxt_re_get_netdev,
> +	.add_gid		= bnxt_re_add_gid,
> +	.del_gid		= bnxt_re_del_gid,
> +	.get_link_layer		= bnxt_re_get_link_layer,
> +	.alloc_pd		= bnxt_re_alloc_pd,
> +	.dealloc_pd		= bnxt_re_dealloc_pd,
> +	.create_ah		= bnxt_re_create_ah,
> +	.modify_ah		= bnxt_re_modify_ah,
> +	.query_ah		= bnxt_re_query_ah,
> +	.destroy_ah		= bnxt_re_destroy_ah,
> +	.create_srq		= bnxt_re_create_srq,
> +	.modify_srq		= bnxt_re_modify_srq,
> +	.query_srq		= bnxt_re_query_srq,
> +	.destroy_srq		= bnxt_re_destroy_srq,
> +	.post_srq_recv		= bnxt_re_post_srq_recv,
> +	.create_qp		= bnxt_re_create_qp,
> +	.modify_qp		= bnxt_re_modify_qp,
> +	.query_qp		= bnxt_re_query_qp,
> +	.destroy_qp		= bnxt_re_destroy_qp,
> +	.post_send		= bnxt_re_post_send,
> +	.post_recv		= bnxt_re_post_recv,
> +	.create_cq		= bnxt_re_create_cq,
> +	.destroy_cq		= bnxt_re_destroy_cq,
> +	.poll_cq		= bnxt_re_poll_cq,
> +	.req_notify_cq		= bnxt_re_req_notify_cq,
> +	.get_dma_mr		= bnxt_re_get_dma_mr,
> +	.dereg_mr		= bnxt_re_dereg_mr,
> +	.alloc_mr		= bnxt_re_alloc_mr,
> +	.map_mr_sg		= bnxt_re_map_mr_sg,
> +	.reg_user_mr		= bnxt_re_reg_user_mr,
> +	.alloc_ucontext		= bnxt_re_alloc_ucontext,
> +	.dealloc_ucontext	= bnxt_re_dealloc_ucontext,
> +	.mmap			= bnxt_re_mmap,
> +	.get_hw_stats		= bnxt_re_ib_get_hw_stats,
> +	.alloc_hw_stats		= bnxt_re_ib_alloc_hw_stats,
> +};

keep sorted

Don't use vertical white space

should be const

>  static int bnxt_re_register_ib(struct bnxt_re_dev *rdev)
>  {
>  	struct ib_device *ibdev = &rdev->ibdev;
> @@ -671,6 +715,7 @@ static int bnxt_re_register_ib(struct bnxt_re_dev *rdev)
>  	ibdev->alloc_hw_stats           = bnxt_re_ib_alloc_hw_stats;
>  
>  	ibdev->driver_id = RDMA_DRIVER_BNXT_RE;
> +	ib_set_device_ops(ibdev, &bnxt_re_dev_ops);

All of these driver patches need to remove the existing method
assignments at the same time they do this consolidation, otherwise it
is too hard to review the patches.

Jason
diff mbox series

Patch

diff --git a/drivers/infiniband/hw/bnxt_re/main.c b/drivers/infiniband/hw/bnxt_re/main.c
index 73632e5b819f..14cd92bd300f 100644
--- a/drivers/infiniband/hw/bnxt_re/main.c
+++ b/drivers/infiniband/hw/bnxt_re/main.c
@@ -572,6 +572,50 @@  static void bnxt_re_unregister_ib(struct bnxt_re_dev *rdev)
 	ib_unregister_device(&rdev->ibdev);
 }
 
+static struct ib_device_ops bnxt_re_dev_ops = {
+	.query_device		= bnxt_re_query_device,
+	.modify_device		= bnxt_re_modify_device,
+	.query_port		= bnxt_re_query_port,
+	.get_port_immutable	= bnxt_re_get_port_immutable,
+	.get_dev_fw_str		= bnxt_re_query_fw_str,
+	.query_pkey		= bnxt_re_query_pkey,
+	.get_netdev		= bnxt_re_get_netdev,
+	.add_gid		= bnxt_re_add_gid,
+	.del_gid		= bnxt_re_del_gid,
+	.get_link_layer		= bnxt_re_get_link_layer,
+	.alloc_pd		= bnxt_re_alloc_pd,
+	.dealloc_pd		= bnxt_re_dealloc_pd,
+	.create_ah		= bnxt_re_create_ah,
+	.modify_ah		= bnxt_re_modify_ah,
+	.query_ah		= bnxt_re_query_ah,
+	.destroy_ah		= bnxt_re_destroy_ah,
+	.create_srq		= bnxt_re_create_srq,
+	.modify_srq		= bnxt_re_modify_srq,
+	.query_srq		= bnxt_re_query_srq,
+	.destroy_srq		= bnxt_re_destroy_srq,
+	.post_srq_recv		= bnxt_re_post_srq_recv,
+	.create_qp		= bnxt_re_create_qp,
+	.modify_qp		= bnxt_re_modify_qp,
+	.query_qp		= bnxt_re_query_qp,
+	.destroy_qp		= bnxt_re_destroy_qp,
+	.post_send		= bnxt_re_post_send,
+	.post_recv		= bnxt_re_post_recv,
+	.create_cq		= bnxt_re_create_cq,
+	.destroy_cq		= bnxt_re_destroy_cq,
+	.poll_cq		= bnxt_re_poll_cq,
+	.req_notify_cq		= bnxt_re_req_notify_cq,
+	.get_dma_mr		= bnxt_re_get_dma_mr,
+	.dereg_mr		= bnxt_re_dereg_mr,
+	.alloc_mr		= bnxt_re_alloc_mr,
+	.map_mr_sg		= bnxt_re_map_mr_sg,
+	.reg_user_mr		= bnxt_re_reg_user_mr,
+	.alloc_ucontext		= bnxt_re_alloc_ucontext,
+	.dealloc_ucontext	= bnxt_re_dealloc_ucontext,
+	.mmap			= bnxt_re_mmap,
+	.get_hw_stats		= bnxt_re_ib_get_hw_stats,
+	.alloc_hw_stats		= bnxt_re_ib_alloc_hw_stats,
+};
+
 static int bnxt_re_register_ib(struct bnxt_re_dev *rdev)
 {
 	struct ib_device *ibdev = &rdev->ibdev;
@@ -671,6 +715,7 @@  static int bnxt_re_register_ib(struct bnxt_re_dev *rdev)
 	ibdev->alloc_hw_stats           = bnxt_re_ib_alloc_hw_stats;
 
 	ibdev->driver_id = RDMA_DRIVER_BNXT_RE;
+	ib_set_device_ops(ibdev, &bnxt_re_dev_ops);
 	return ib_register_device(ibdev, "bnxt_re%d", NULL);
 }