[PATCH rdma-next 15/18] RDMA/usnic: Initialize ib_device_ops struct

From: Kamal Heib
Date: Tue Oct 09 2018 - 12:29:07 EST


Initialize ib_device_ops with the supported operations.

Signed-off-by: Kamal Heib <kamalheib1@xxxxxxxxx>
---
drivers/infiniband/hw/usnic/usnic_ib_main.c | 32 +++++++++++++++++++++++++++++
1 file changed, 32 insertions(+)

diff --git a/drivers/infiniband/hw/usnic/usnic_ib_main.c b/drivers/infiniband/hw/usnic/usnic_ib_main.c
index e3f98fe2f1e6..e327f5ec818e 100644
--- a/drivers/infiniband/hw/usnic/usnic_ib_main.c
+++ b/drivers/infiniband/hw/usnic/usnic_ib_main.c
@@ -330,6 +330,37 @@ static void usnic_get_dev_fw_str(struct ib_device *device, char *str)
snprintf(str, IB_FW_VERSION_NAME_MAX, "%s", info.fw_version);
}

+static struct ib_device_ops usnic_dev_ops = {
+ .query_device = usnic_ib_query_device,
+ .query_port = usnic_ib_query_port,
+ .query_pkey = usnic_ib_query_pkey,
+ .query_gid = usnic_ib_query_gid,
+ .get_netdev = usnic_get_netdev,
+ .get_link_layer = usnic_ib_port_link_layer,
+ .alloc_pd = usnic_ib_alloc_pd,
+ .dealloc_pd = usnic_ib_dealloc_pd,
+ .create_qp = usnic_ib_create_qp,
+ .modify_qp = usnic_ib_modify_qp,
+ .query_qp = usnic_ib_query_qp,
+ .destroy_qp = usnic_ib_destroy_qp,
+ .create_cq = usnic_ib_create_cq,
+ .destroy_cq = usnic_ib_destroy_cq,
+ .reg_user_mr = usnic_ib_reg_mr,
+ .dereg_mr = usnic_ib_dereg_mr,
+ .alloc_ucontext = usnic_ib_alloc_ucontext,
+ .dealloc_ucontext = usnic_ib_dealloc_ucontext,
+ .mmap = usnic_ib_mmap,
+ .create_ah = usnic_ib_create_ah,
+ .destroy_ah = usnic_ib_destroy_ah,
+ .post_send = usnic_ib_post_send,
+ .post_recv = usnic_ib_post_recv,
+ .poll_cq = usnic_ib_poll_cq,
+ .req_notify_cq = usnic_ib_req_notify_cq,
+ .get_dma_mr = usnic_ib_get_dma_mr,
+ .get_port_immutable = usnic_port_immutable,
+ .get_dev_fw_str = usnic_get_dev_fw_str,
+};
+
/* Start of PF discovery section */
static void *usnic_ib_device_add(struct pci_dev *dev)
{
@@ -415,6 +446,7 @@ static void *usnic_ib_device_add(struct pci_dev *dev)
us_ibdev->ib_dev.get_port_immutable = usnic_port_immutable;
us_ibdev->ib_dev.get_dev_fw_str = usnic_get_dev_fw_str;

+ ib_set_device_ops(&us_ibdev->ib_dev, &usnic_dev_ops);

us_ibdev->ib_dev.driver_id = RDMA_DRIVER_USNIC;
if (ib_register_device(&us_ibdev->ib_dev, "usnic_%d", NULL))
--
2.14.4