Commit a263c124 authored by Kamal Heib's avatar Kamal Heib Committed by Jason Gunthorpe

RDMA/ocrdma: Initialize ib_device_ops struct

Initialize ib_device_ops with the supported operations using
ib_set_device_ops().
Signed-off-by: default avatarKamal Heib <kamalheib1@gmail.com>
Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
parent 5a6c6e71
...@@ -143,6 +143,50 @@ static const struct attribute_group ocrdma_attr_group = { ...@@ -143,6 +143,50 @@ static const struct attribute_group ocrdma_attr_group = {
.attrs = ocrdma_attributes, .attrs = ocrdma_attributes,
}; };
static const struct ib_device_ops ocrdma_dev_ops = {
.alloc_mr = ocrdma_alloc_mr,
.alloc_pd = ocrdma_alloc_pd,
.alloc_ucontext = ocrdma_alloc_ucontext,
.create_ah = ocrdma_create_ah,
.create_cq = ocrdma_create_cq,
.create_qp = ocrdma_create_qp,
.dealloc_pd = ocrdma_dealloc_pd,
.dealloc_ucontext = ocrdma_dealloc_ucontext,
.dereg_mr = ocrdma_dereg_mr,
.destroy_ah = ocrdma_destroy_ah,
.destroy_cq = ocrdma_destroy_cq,
.destroy_qp = ocrdma_destroy_qp,
.get_dev_fw_str = get_dev_fw_str,
.get_dma_mr = ocrdma_get_dma_mr,
.get_link_layer = ocrdma_link_layer,
.get_netdev = ocrdma_get_netdev,
.get_port_immutable = ocrdma_port_immutable,
.map_mr_sg = ocrdma_map_mr_sg,
.mmap = ocrdma_mmap,
.modify_port = ocrdma_modify_port,
.modify_qp = ocrdma_modify_qp,
.poll_cq = ocrdma_poll_cq,
.post_recv = ocrdma_post_recv,
.post_send = ocrdma_post_send,
.process_mad = ocrdma_process_mad,
.query_ah = ocrdma_query_ah,
.query_device = ocrdma_query_device,
.query_pkey = ocrdma_query_pkey,
.query_port = ocrdma_query_port,
.query_qp = ocrdma_query_qp,
.reg_user_mr = ocrdma_reg_user_mr,
.req_notify_cq = ocrdma_arm_cq,
.resize_cq = ocrdma_resize_cq,
};
static const struct ib_device_ops ocrdma_dev_srq_ops = {
.create_srq = ocrdma_create_srq,
.destroy_srq = ocrdma_destroy_srq,
.modify_srq = ocrdma_modify_srq,
.post_srq_recv = ocrdma_post_srq_recv,
.query_srq = ocrdma_query_srq,
};
static int ocrdma_register_device(struct ocrdma_dev *dev) static int ocrdma_register_device(struct ocrdma_dev *dev)
{ {
ocrdma_get_guid(dev, (u8 *)&dev->ibdev.node_guid); ocrdma_get_guid(dev, (u8 *)&dev->ibdev.node_guid);
...@@ -182,50 +226,10 @@ static int ocrdma_register_device(struct ocrdma_dev *dev) ...@@ -182,50 +226,10 @@ static int ocrdma_register_device(struct ocrdma_dev *dev)
dev->ibdev.phys_port_cnt = 1; dev->ibdev.phys_port_cnt = 1;
dev->ibdev.num_comp_vectors = dev->eq_cnt; dev->ibdev.num_comp_vectors = dev->eq_cnt;
/* mandatory verbs. */
dev->ibdev.query_device = ocrdma_query_device;
dev->ibdev.query_port = ocrdma_query_port;
dev->ibdev.modify_port = ocrdma_modify_port;
dev->ibdev.get_netdev = ocrdma_get_netdev;
dev->ibdev.get_link_layer = ocrdma_link_layer;
dev->ibdev.alloc_pd = ocrdma_alloc_pd;
dev->ibdev.dealloc_pd = ocrdma_dealloc_pd;
dev->ibdev.create_cq = ocrdma_create_cq;
dev->ibdev.destroy_cq = ocrdma_destroy_cq;
dev->ibdev.resize_cq = ocrdma_resize_cq;
dev->ibdev.create_qp = ocrdma_create_qp;
dev->ibdev.modify_qp = ocrdma_modify_qp;
dev->ibdev.query_qp = ocrdma_query_qp;
dev->ibdev.destroy_qp = ocrdma_destroy_qp;
dev->ibdev.query_pkey = ocrdma_query_pkey;
dev->ibdev.create_ah = ocrdma_create_ah;
dev->ibdev.destroy_ah = ocrdma_destroy_ah;
dev->ibdev.query_ah = ocrdma_query_ah;
dev->ibdev.poll_cq = ocrdma_poll_cq;
dev->ibdev.post_send = ocrdma_post_send;
dev->ibdev.post_recv = ocrdma_post_recv;
dev->ibdev.req_notify_cq = ocrdma_arm_cq;
dev->ibdev.get_dma_mr = ocrdma_get_dma_mr;
dev->ibdev.dereg_mr = ocrdma_dereg_mr;
dev->ibdev.reg_user_mr = ocrdma_reg_user_mr;
dev->ibdev.alloc_mr = ocrdma_alloc_mr;
dev->ibdev.map_mr_sg = ocrdma_map_mr_sg;
/* mandatory to support user space verbs consumer. */ /* mandatory to support user space verbs consumer. */
dev->ibdev.alloc_ucontext = ocrdma_alloc_ucontext;
dev->ibdev.dealloc_ucontext = ocrdma_dealloc_ucontext;
dev->ibdev.mmap = ocrdma_mmap;
dev->ibdev.dev.parent = &dev->nic_info.pdev->dev; dev->ibdev.dev.parent = &dev->nic_info.pdev->dev;
dev->ibdev.process_mad = ocrdma_process_mad; ib_set_device_ops(&dev->ibdev, &ocrdma_dev_ops);
dev->ibdev.get_port_immutable = ocrdma_port_immutable;
dev->ibdev.get_dev_fw_str = get_dev_fw_str;
if (ocrdma_get_asic_type(dev) == OCRDMA_ASIC_GEN_SKH_R) { if (ocrdma_get_asic_type(dev) == OCRDMA_ASIC_GEN_SKH_R) {
dev->ibdev.uverbs_cmd_mask |= dev->ibdev.uverbs_cmd_mask |=
...@@ -235,11 +239,7 @@ static int ocrdma_register_device(struct ocrdma_dev *dev) ...@@ -235,11 +239,7 @@ static int ocrdma_register_device(struct ocrdma_dev *dev)
OCRDMA_UVERBS(DESTROY_SRQ) | OCRDMA_UVERBS(DESTROY_SRQ) |
OCRDMA_UVERBS(POST_SRQ_RECV); OCRDMA_UVERBS(POST_SRQ_RECV);
dev->ibdev.create_srq = ocrdma_create_srq; ib_set_device_ops(&dev->ibdev, &ocrdma_dev_srq_ops);
dev->ibdev.modify_srq = ocrdma_modify_srq;
dev->ibdev.query_srq = ocrdma_query_srq;
dev->ibdev.destroy_srq = ocrdma_destroy_srq;
dev->ibdev.post_srq_recv = ocrdma_post_srq_recv;
} }
rdma_set_device_sysfs_group(&dev->ibdev, &ocrdma_attr_group); rdma_set_device_sysfs_group(&dev->ibdev, &ocrdma_attr_group);
dev->ibdev.driver_id = RDMA_DRIVER_OCRDMA; dev->ibdev.driver_id = RDMA_DRIVER_OCRDMA;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment