diff mbox series

[rdma-next,v2,14/18] RDMA/qib: Initialize ib_device_ops struct

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

Commit Message

Kamal Heib Oct. 21, 2018, 12:49 p.m. UTC
Initialize ib_device_ops with the supported operations using
ib_set_device_ops().

Signed-off-by: Kamal Heib <kamalheib1@gmail.com>
---
 drivers/infiniband/hw/qib/qib_verbs.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

Comments

Jason Gunthorpe Oct. 22, 2018, 7:19 p.m. UTC | #1
On Sun, Oct 21, 2018 at 03:49:49PM +0300, Kamal Heib wrote:
> Initialize ib_device_ops with the supported operations using
> ib_set_device_ops().
> 
> Signed-off-by: Kamal Heib <kamalheib1@gmail.com>
>  drivers/infiniband/hw/qib/qib_verbs.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/infiniband/hw/qib/qib_verbs.c b/drivers/infiniband/hw/qib/qib_verbs.c
> index 4b0f5761a646..2112308b0700 100644
> +++ b/drivers/infiniband/hw/qib/qib_verbs.c
> @@ -1496,6 +1496,11 @@ static void qib_fill_device_attr(struct qib_devdata *dd)
>  	dd->verbs_dev.rdi.wc_opcode = ib_qib_wc_opcode;
>  }
>  
> +static const struct ib_device_ops qib_dev_ops = {
> +	.modify_device = qib_modify_device,
> +	.process_mad = qib_process_mad,
> +};
> +
>  /**
>   * qib_register_ib_device - register our device with the infiniband core
>   * @dd: the device data structure
> @@ -1558,8 +1563,6 @@ int qib_register_ib_device(struct qib_devdata *dd)
>  	ibdev->node_guid = ppd->guid;
>  	ibdev->phys_port_cnt = dd->num_pports;
>  	ibdev->dev.parent = &dd->pcidev->dev;
> -	ibdev->modify_device = qib_modify_device;
> -	ibdev->process_mad = qib_process_mad;
>  
>  	snprintf(ibdev->node_desc, sizeof(ibdev->node_desc),
>  		 "Intel Infiniband HCA %s", init_utsname()->nodename);
> @@ -1627,6 +1630,7 @@ int qib_register_ib_device(struct qib_devdata *dd)
>  	}
>  	rdma_set_device_sysfs_group(&dd->verbs_dev.rdi.ibdev, &qib_attr_group);
>  
> +	ib_set_device_ops(ibdev, &qib_dev_ops);
>  	ret = rvt_register_device(&dd->verbs_dev.rdi, RDMA_DRIVER_QIB);
>  	if (ret)
>  		goto err_tx;

This can't be right, qib has a full verbs interface in here someplace??

Jason
diff mbox series

Patch

diff --git a/drivers/infiniband/hw/qib/qib_verbs.c b/drivers/infiniband/hw/qib/qib_verbs.c
index 4b0f5761a646..2112308b0700 100644
--- a/drivers/infiniband/hw/qib/qib_verbs.c
+++ b/drivers/infiniband/hw/qib/qib_verbs.c
@@ -1496,6 +1496,11 @@  static void qib_fill_device_attr(struct qib_devdata *dd)
 	dd->verbs_dev.rdi.wc_opcode = ib_qib_wc_opcode;
 }
 
+static const struct ib_device_ops qib_dev_ops = {
+	.modify_device = qib_modify_device,
+	.process_mad = qib_process_mad,
+};
+
 /**
  * qib_register_ib_device - register our device with the infiniband core
  * @dd: the device data structure
@@ -1558,8 +1563,6 @@  int qib_register_ib_device(struct qib_devdata *dd)
 	ibdev->node_guid = ppd->guid;
 	ibdev->phys_port_cnt = dd->num_pports;
 	ibdev->dev.parent = &dd->pcidev->dev;
-	ibdev->modify_device = qib_modify_device;
-	ibdev->process_mad = qib_process_mad;
 
 	snprintf(ibdev->node_desc, sizeof(ibdev->node_desc),
 		 "Intel Infiniband HCA %s", init_utsname()->nodename);
@@ -1627,6 +1630,7 @@  int qib_register_ib_device(struct qib_devdata *dd)
 	}
 	rdma_set_device_sysfs_group(&dd->verbs_dev.rdi.ibdev, &qib_attr_group);
 
+	ib_set_device_ops(ibdev, &qib_dev_ops);
 	ret = rvt_register_device(&dd->verbs_dev.rdi, RDMA_DRIVER_QIB);
 	if (ret)
 		goto err_tx;