From: Kamal Heib <kamalheib1@gmail.com>
To: Doug Ledford <dledford@redhat.com>, Jason Gunthorpe <jgg@ziepe.ca>
Cc: linux-kernel@vger.kernel.org, kamalheib1@gmail.com
Subject: [PATCH rdma-next 08/18] RDMA/mlx4: Initialize ib_device_ops struct
Date: Tue, 9 Oct 2018 19:28:07 +0300 [thread overview]
Message-ID: <20181009162817.4635-9-kamalheib1@gmail.com> (raw)
In-Reply-To: <20181009162817.4635-1-kamalheib1@gmail.com>
Initialize ib_device_ops with the supported operations.
Signed-off-by: Kamal Heib <kamalheib1@gmail.com>
---
drivers/infiniband/hw/mlx4/main.c | 94 +++++++++++++++++++++++++++++++++++++++
1 file changed, 94 insertions(+)
diff --git a/drivers/infiniband/hw/mlx4/main.c b/drivers/infiniband/hw/mlx4/main.c
index fa5d20eccc21..2c189f90261c 100644
--- a/drivers/infiniband/hw/mlx4/main.c
+++ b/drivers/infiniband/hw/mlx4/main.c
@@ -2214,6 +2214,11 @@ static void mlx4_ib_fill_diag_counters(struct mlx4_ib_dev *ibdev,
}
}
+static struct ib_device_ops mlx4_ib_hw_stats_ops = {
+ .get_hw_stats = mlx4_ib_get_hw_stats,
+ .alloc_hw_stats = mlx4_ib_alloc_hw_stats,
+};
+
static int mlx4_ib_alloc_diag_counters(struct mlx4_ib_dev *ibdev)
{
struct mlx4_ib_diag_counters *diag = ibdev->diag_counters;
@@ -2242,6 +2247,7 @@ static int mlx4_ib_alloc_diag_counters(struct mlx4_ib_dev *ibdev)
ibdev->ib_dev.get_hw_stats = mlx4_ib_get_hw_stats;
ibdev->ib_dev.alloc_hw_stats = mlx4_ib_alloc_hw_stats;
+ ib_set_device_ops(&ibdev->ib_dev, &mlx4_ib_hw_stats_ops);
return 0;
@@ -2493,6 +2499,88 @@ static void get_fw_ver_str(struct ib_device *device, char *str)
(int) dev->dev->caps.fw_ver & 0xffff);
}
+static struct ib_device_ops mlx4_ib_dev_ops = {
+ .get_netdev = mlx4_ib_get_netdev,
+ .add_gid = mlx4_ib_add_gid,
+ .del_gid = mlx4_ib_del_gid,
+ .query_device = mlx4_ib_query_device,
+ .query_port = mlx4_ib_query_port,
+ .get_link_layer = mlx4_ib_port_link_layer,
+ .query_gid = mlx4_ib_query_gid,
+ .query_pkey = mlx4_ib_query_pkey,
+ .modify_device = mlx4_ib_modify_device,
+ .modify_port = mlx4_ib_modify_port,
+ .alloc_ucontext = mlx4_ib_alloc_ucontext,
+ .dealloc_ucontext = mlx4_ib_dealloc_ucontext,
+ .mmap = mlx4_ib_mmap,
+ .alloc_pd = mlx4_ib_alloc_pd,
+ .dealloc_pd = mlx4_ib_dealloc_pd,
+ .create_ah = mlx4_ib_create_ah,
+ .query_ah = mlx4_ib_query_ah,
+ .destroy_ah = mlx4_ib_destroy_ah,
+ .create_srq = mlx4_ib_create_srq,
+ .modify_srq = mlx4_ib_modify_srq,
+ .query_srq = mlx4_ib_query_srq,
+ .destroy_srq = mlx4_ib_destroy_srq,
+ .post_srq_recv = mlx4_ib_post_srq_recv,
+ .create_qp = mlx4_ib_create_qp,
+ .modify_qp = mlx4_ib_modify_qp,
+ .query_qp = mlx4_ib_query_qp,
+ .destroy_qp = mlx4_ib_destroy_qp,
+ .drain_sq = mlx4_ib_drain_sq,
+ .drain_rq = mlx4_ib_drain_rq,
+ .post_send = mlx4_ib_post_send,
+ .post_recv = mlx4_ib_post_recv,
+ .create_cq = mlx4_ib_create_cq,
+ .modify_cq = mlx4_ib_modify_cq,
+ .resize_cq = mlx4_ib_resize_cq,
+ .destroy_cq = mlx4_ib_destroy_cq,
+ .poll_cq = mlx4_ib_poll_cq,
+ .req_notify_cq = mlx4_ib_arm_cq,
+ .get_dma_mr = mlx4_ib_get_dma_mr,
+ .reg_user_mr = mlx4_ib_reg_user_mr,
+ .rereg_user_mr = mlx4_ib_rereg_user_mr,
+ .dereg_mr = mlx4_ib_dereg_mr,
+ .alloc_mr = mlx4_ib_alloc_mr,
+ .map_mr_sg = mlx4_ib_map_mr_sg,
+ .attach_mcast = mlx4_ib_mcg_attach,
+ .detach_mcast = mlx4_ib_mcg_detach,
+ .process_mad = mlx4_ib_process_mad,
+ .get_port_immutable = mlx4_port_immutable,
+ .get_dev_fw_str = get_fw_ver_str,
+ .disassociate_ucontext = mlx4_ib_disassociate_ucontext,
+};
+
+static struct ib_device_ops mlx4_ib_dev_wq_ops = {
+ .create_wq = mlx4_ib_create_wq,
+ .modify_wq = mlx4_ib_modify_wq,
+ .destroy_wq = mlx4_ib_destroy_wq,
+ .create_rwq_ind_table = mlx4_ib_create_rwq_ind_table,
+ .destroy_rwq_ind_table = mlx4_ib_destroy_rwq_ind_table,
+};
+
+static struct ib_device_ops mlx4_ib_dev_fmr_ops = {
+ .alloc_fmr = mlx4_ib_fmr_alloc,
+ .map_phys_fmr = mlx4_ib_map_phys_fmr,
+ .unmap_fmr = mlx4_ib_unmap_fmr,
+ .dealloc_fmr = mlx4_ib_fmr_dealloc,
+};
+
+static struct ib_device_ops mlx4_ib_dev_mw_ops = {
+ .alloc_mw = mlx4_ib_alloc_mw,
+ .dealloc_mw = mlx4_ib_dealloc_mw,
+};
+
+static struct ib_device_ops mlx4_ib_dev_xrc_ops = {
+ .alloc_xrcd = mlx4_ib_alloc_xrcd,
+ .dealloc_xrcd = mlx4_ib_dealloc_xrcd,
+};
+
+static struct ib_device_ops mlx4_ib_dev_fs_ops = {
+ .create_flow = mlx4_ib_create_flow,
+ .destroy_flow = mlx4_ib_destroy_flow,
+};
+
static void *mlx4_ib_add(struct mlx4_dev *dev)
{
struct mlx4_ib_dev *ibdev;
@@ -2630,6 +2718,7 @@ static void *mlx4_ib_add(struct mlx4_dev *dev)
ibdev->ib_dev.get_dev_fw_str = get_fw_ver_str;
ibdev->ib_dev.disassociate_ucontext = mlx4_ib_disassociate_ucontext;
+ ib_set_device_ops(&ibdev->ib_dev, &mlx4_ib_dev_ops);
ibdev->ib_dev.uverbs_ex_cmd_mask |=
(1ull << IB_USER_VERBS_EX_CMD_MODIFY_CQ);
@@ -2645,6 +2734,7 @@ static void *mlx4_ib_add(struct mlx4_dev *dev)
mlx4_ib_create_rwq_ind_table;
ibdev->ib_dev.destroy_rwq_ind_table =
mlx4_ib_destroy_rwq_ind_table;
+ ib_set_device_ops(&ibdev->ib_dev, &mlx4_ib_dev_wq_ops);
ibdev->ib_dev.uverbs_ex_cmd_mask |=
(1ull << IB_USER_VERBS_EX_CMD_CREATE_WQ) |
(1ull << IB_USER_VERBS_EX_CMD_MODIFY_WQ) |
@@ -2658,12 +2748,14 @@ static void *mlx4_ib_add(struct mlx4_dev *dev)
ibdev->ib_dev.map_phys_fmr = mlx4_ib_map_phys_fmr;
ibdev->ib_dev.unmap_fmr = mlx4_ib_unmap_fmr;
ibdev->ib_dev.dealloc_fmr = mlx4_ib_fmr_dealloc;
+ ib_set_device_ops(&ibdev->ib_dev, &mlx4_ib_dev_fmr_ops);
}
if (dev->caps.flags & MLX4_DEV_CAP_FLAG_MEM_WINDOW ||
dev->caps.bmme_flags & MLX4_BMME_FLAG_TYPE_2_WIN) {
ibdev->ib_dev.alloc_mw = mlx4_ib_alloc_mw;
ibdev->ib_dev.dealloc_mw = mlx4_ib_dealloc_mw;
+ ib_set_device_ops(&ibdev->ib_dev, &mlx4_ib_dev_mw_ops);
ibdev->ib_dev.uverbs_cmd_mask |=
(1ull << IB_USER_VERBS_CMD_ALLOC_MW) |
@@ -2673,6 +2765,7 @@ static void *mlx4_ib_add(struct mlx4_dev *dev)
if (dev->caps.flags & MLX4_DEV_CAP_FLAG_XRC) {
ibdev->ib_dev.alloc_xrcd = mlx4_ib_alloc_xrcd;
ibdev->ib_dev.dealloc_xrcd = mlx4_ib_dealloc_xrcd;
+ ib_set_device_ops(&ibdev->ib_dev, &mlx4_ib_dev_xrc_ops);
ibdev->ib_dev.uverbs_cmd_mask |=
(1ull << IB_USER_VERBS_CMD_OPEN_XRCD) |
(1ull << IB_USER_VERBS_CMD_CLOSE_XRCD);
@@ -2682,6 +2775,7 @@ static void *mlx4_ib_add(struct mlx4_dev *dev)
ibdev->steering_support = MLX4_STEERING_MODE_DEVICE_MANAGED;
ibdev->ib_dev.create_flow = mlx4_ib_create_flow;
ibdev->ib_dev.destroy_flow = mlx4_ib_destroy_flow;
+ ib_set_device_ops(&ibdev->ib_dev, &mlx4_ib_dev_fs_ops);
ibdev->ib_dev.uverbs_ex_cmd_mask |=
(1ull << IB_USER_VERBS_EX_CMD_CREATE_FLOW) |
--
2.14.4
next prev parent reply other threads:[~2018-10-09 16:29 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-09 16:27 [PATCH rdma-next 00/18] RDMA: Add support for ib_device_ops Kamal Heib
2018-10-09 16:28 ` [PATCH rdma-next 01/18] RDMA/core: Introduce ib_device_ops Kamal Heib
2018-10-09 16:28 ` [PATCH rdma-next 02/18] RDMA/bnxt_re: Initialize ib_device_ops struct Kamal Heib
2018-10-09 16:28 ` [PATCH rdma-next 03/18] RDMA/cxgb3: " Kamal Heib
2018-10-09 16:28 ` [PATCH rdma-next 04/18] RDMA/cxgb4: " Kamal Heib
2018-10-09 16:28 ` [PATCH rdma-next 05/18] RDMA/hfi1: " Kamal Heib
2018-10-09 16:28 ` [PATCH rdma-next 06/18] RDMA/hns: " Kamal Heib
2018-10-09 16:28 ` [PATCH rdma-next 07/18] RDMA/i40iw: " Kamal Heib
2018-10-09 16:28 ` Kamal Heib [this message]
2018-10-09 16:28 ` [PATCH rdma-next 09/18] RDMA/mlx5: " Kamal Heib
2018-10-09 16:28 ` [PATCH rdma-next 10/18] RDMA/mthca: " Kamal Heib
2018-10-09 16:28 ` [PATCH rdma-next 11/18] RDMA/nes: " Kamal Heib
2018-10-09 16:28 ` [PATCH rdma-next 12/18] RDMA/ocrdma: " Kamal Heib
2018-10-09 16:28 ` [PATCH rdma-next 13/18] RDMA/qedr: " Kamal Heib
2018-10-09 16:28 ` [PATCH rdma-next 14/18] RDMA/qib: " Kamal Heib
2018-10-09 16:28 ` [PATCH rdma-next 15/18] RDMA/usnic: " Kamal Heib
2018-10-09 16:28 ` [PATCH rdma-next 16/18] RDMA/vmw_pvrdma: " Kamal Heib
2018-10-09 16:28 ` [PATCH rdma-next 17/18] RDMA/rxe: " Kamal Heib
2018-10-09 16:28 ` [PATCH rdma-next 18/18] RDMA: Start use ib_device_ops Kamal Heib
2018-10-09 18:31 ` [PATCH rdma-next 00/18] RDMA: Add support for ib_device_ops Doug Ledford
2018-10-09 18:44 ` Kamal Heib
[not found] ` <CALEgSQuQyA9JiqaLfC5Un=foTeDHQG6EFJSCqBLTevD1KKKBhA@mail.gmail.com>
2018-10-09 19:01 ` Doug Ledford
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20181009162817.4635-9-kamalheib1@gmail.com \
--to=kamalheib1@gmail.com \
--cc=dledford@redhat.com \
--cc=jgg@ziepe.ca \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox