diff mbox series

[rdma-next,05/18] RDMA/hfi1: Initialize ib_device_ops struct

Message ID 20181009184547.5907-6-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/hfi1/verbs.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

Comments

Dennis Dalessandro Oct. 17, 2018, 11:23 a.m. UTC | #1
On 10/9/2018 2:45 PM, Kamal Heib wrote:
> Initialize ib_device_ops with the supported operations.
> 
> Signed-off-by: Kamal Heib <kamalheib1@gmail.com>
> ---
>   drivers/infiniband/hw/hfi1/verbs.c | 11 +++++++++++
>   1 file changed, 11 insertions(+)
> 
> diff --git a/drivers/infiniband/hw/hfi1/verbs.c b/drivers/infiniband/hw/hfi1/verbs.c
> index bc7f00ba1988..c63f331dbf7a 100644
> --- a/drivers/infiniband/hw/hfi1/verbs.c
> +++ b/drivers/infiniband/hw/hfi1/verbs.c
> @@ -1610,6 +1610,15 @@ static int get_hw_stats(struct ib_device *ibdev, struct rdma_hw_stats *stats,
>   	return count;
>   }
>   
> +static struct ib_device_ops hfi1_dev_ops = {
> +	.modify_device		= modify_device,
> +	.alloc_hw_stats		= alloc_hw_stats,
> +	.get_hw_stats		= get_hw_stats,
> +	.alloc_rdma_netdev	= hfi1_vnic_alloc_rn,
> +	.process_mad		= hfi1_process_mad,
> +	.get_dev_fw_str		= hfi1_get_dev_fw_str,
> +};
> +
>   /**
>    * hfi1_register_ib_device - register our device with the infiniband core
>    * @dd: the device data structure
> @@ -1662,6 +1671,8 @@ int hfi1_register_ib_device(struct hfi1_devdata *dd)
>   	ibdev->process_mad = hfi1_process_mad;
>   	ibdev->get_dev_fw_str = hfi1_get_dev_fw_str;
>   
> +	ib_set_device_ops(ibdev, &hfi1_dev_ops);
> +
>   	strlcpy(ibdev->node_desc, init_utsname()->nodename,
>   		sizeof(ibdev->node_desc));

Haven't had a chance to review the rest of this series yet, but this 
seems wrong to me as it should probably be in rdmavt.

-Denny
diff mbox series

Patch

diff --git a/drivers/infiniband/hw/hfi1/verbs.c b/drivers/infiniband/hw/hfi1/verbs.c
index bc7f00ba1988..c63f331dbf7a 100644
--- a/drivers/infiniband/hw/hfi1/verbs.c
+++ b/drivers/infiniband/hw/hfi1/verbs.c
@@ -1610,6 +1610,15 @@  static int get_hw_stats(struct ib_device *ibdev, struct rdma_hw_stats *stats,
 	return count;
 }
 
+static struct ib_device_ops hfi1_dev_ops = {
+	.modify_device		= modify_device,
+	.alloc_hw_stats		= alloc_hw_stats,
+	.get_hw_stats		= get_hw_stats,
+	.alloc_rdma_netdev	= hfi1_vnic_alloc_rn,
+	.process_mad		= hfi1_process_mad,
+	.get_dev_fw_str		= hfi1_get_dev_fw_str,
+};
+
 /**
  * hfi1_register_ib_device - register our device with the infiniband core
  * @dd: the device data structure
@@ -1662,6 +1671,8 @@  int hfi1_register_ib_device(struct hfi1_devdata *dd)
 	ibdev->process_mad = hfi1_process_mad;
 	ibdev->get_dev_fw_str = hfi1_get_dev_fw_str;
 
+	ib_set_device_ops(ibdev, &hfi1_dev_ops);
+
 	strlcpy(ibdev->node_desc, init_utsname()->nodename,
 		sizeof(ibdev->node_desc));