From patchwork Tue Oct 9 18:45:37 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kamal Heib X-Patchwork-Id: 10633159 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4E623933 for ; Tue, 9 Oct 2018 18:46:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 44EAA294F9 for ; Tue, 9 Oct 2018 18:46:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 39580294FD; Tue, 9 Oct 2018 18:46:59 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AA7AF294F9 for ; Tue, 9 Oct 2018 18:46:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727034AbeJJCFS (ORCPT ); Tue, 9 Oct 2018 22:05:18 -0400 Received: from mail-wm1-f68.google.com ([209.85.128.68]:39664 "EHLO mail-wm1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726496AbeJJCFR (ORCPT ); Tue, 9 Oct 2018 22:05:17 -0400 Received: by mail-wm1-f68.google.com with SMTP id y144-v6so3082601wmd.4 for ; Tue, 09 Oct 2018 11:46:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=5zfkwUnKP03G6y8nzrZjffU+ry/YHFw2yqYvicoudlI=; b=J6HO5ZP4koqgVXeBwtQYwuPuLp1XD3hM1LNtlCwSBHljJ1pLqHFQ089VTYkKrZRhDz M7Ww7XTa8Uusm91QocWd/r46mNc+eylYdFsv88VagcKIRyJZbWzFjTTzD/5SL162PBYH eIntWNeeFfs5qD8SLbeeQaPUyO0zqcGi21/ybG6DAjh0Ylz0z6yHbBqMpSsfcFGzrbQo WUVqAQfwAVRI3qzNqxjReYi0rK3nP8LP9x+lrf3gk7io/p/vrWqvo5tmONPUDexkPNVm aiaJSdMHDebegW4B5LP8vb9sRsF1f+wGhB6+uIryXKlUxQW14/MHXmN5VFcOSEEgNc3i LXGg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=5zfkwUnKP03G6y8nzrZjffU+ry/YHFw2yqYvicoudlI=; b=OM74sW67jFs/TKWqrv4jgcKKwX2Oqj9KxbAcatAifF03EjINP/uAezT+2WV9DQfGZ6 U/zcVL8x+dip4r5DDhC90da4NQ+kAuQdcdBUVctTTBBtwmavVUD2Kb+FMUzipfiAPLc6 XTSgxdRVEvBR7s0wKEIfOfRbmqn7UJgNgD3abUZkvlgUdYffF9oGLubDlzkubs6NWwvP BGL0s3Btw1wLtChGH0bwehzsrWyavRykvaAT774LgXb+uPgDADPz+3YJCA8+W6I6HFfP 6lMcH9CG33U/8o/Sqi53ARWVR+oMsNk8iDLGV+1aY2wLxmpHokQKU9JnPPw/srEGbADo cAyA== X-Gm-Message-State: ABuFfojbsSjXh2TcbkOVlIs1UG7ZWs+bB1ZjOw/vV3jHuzKSdJfNyDys ysHXnnvJk5/+FsQ6S/YDoTQ= X-Google-Smtp-Source: ACcGV62lqnsMo0vR/SDnArkmO4RqLVH14mwneG6SSnOJ/R33vg1g/xn0bY5rGN0nfWdmGpE7DF/KZw== X-Received: by 2002:a7b:c150:: with SMTP id z16-v6mr3005249wmi.25.1539110815492; Tue, 09 Oct 2018 11:46:55 -0700 (PDT) Received: from localhost.localdomain (bzq-79-179-121-186.red.bezeqint.net. [79.179.121.186]) by smtp.gmail.com with ESMTPSA id r16-v6sm27093327wrv.21.2018.10.09.11.46.54 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 09 Oct 2018 11:46:55 -0700 (PDT) From: Kamal Heib To: Doug Ledford , Jason Gunthorpe Cc: linux-rdma@vger.kernel.org, kamalheib1@gmail.com Subject: [PATCH rdma-next 08/18] RDMA/mlx4: Initialize ib_device_ops struct Date: Tue, 9 Oct 2018 21:45:37 +0300 Message-Id: <20181009184547.5907-9-kamalheib1@gmail.com> X-Mailer: git-send-email 2.14.4 In-Reply-To: <20181009184547.5907-1-kamalheib1@gmail.com> References: <20181009184547.5907-1-kamalheib1@gmail.com> Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Initialize ib_device_ops with the supported operations. Signed-off-by: Kamal Heib --- 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) |