From patchwork Sun Oct 21 12:49:38 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kamal Heib X-Patchwork-Id: 10650761 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 ED02214DE for ; Sun, 21 Oct 2018 12:50:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DDB4228765 for ; Sun, 21 Oct 2018 12:50:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D24782877B; Sun, 21 Oct 2018 12:50:19 +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 692D828765 for ; Sun, 21 Oct 2018 12:50:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727673AbeJUVEb (ORCPT ); Sun, 21 Oct 2018 17:04:31 -0400 Received: from mail-wm1-f66.google.com ([209.85.128.66]:53992 "EHLO mail-wm1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727603AbeJUVEb (ORCPT ); Sun, 21 Oct 2018 17:04:31 -0400 Received: by mail-wm1-f66.google.com with SMTP id y11-v6so7607793wma.3 for ; Sun, 21 Oct 2018 05:50:16 -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=OBB+CmOF+iThD9M9T9K3RmNHkANuYOj3D4R9acgwi5A=; b=Forcv9/g/3XVW7+ms0TAPvi/HrYUsXQxk+QcyjXSUnDkpiy/2gCxGsmqF3Y/AUFRiM z4oUeVu61bPSh5HxW0uiivSXt6JRBJucbZriYFBv9cJAd8VobT7uKzLV4pBjSTtR35Kx TkBZqGYPQANYPcTlQftnddgSFXdJS1gAi1YwJ8KOvWRq+mEFaVsGFiktdctVooopScrI Set1KYjp/lPfnVmv9j1Za9OL0e5OPWOR6oVbrKiZi6i3iFIvtwYFR6ntECfo63xNmbov ENjIA65Gk8ydSip3hnw+sAmMioA2V3bV7FgMjWX7t+siVPLfOkkgzD4OT07QRgW7B3ew JB9w== 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=OBB+CmOF+iThD9M9T9K3RmNHkANuYOj3D4R9acgwi5A=; b=iJ0WX9iMzVyZX/s5xI2tnmHNSmr9tjtx4HR2wHVfyEM6s9f2ChO4+DhfvyFDWAkXD8 YNxV/7qkxBv/G96eptEy69XPajst9+/EELLY5gw0EKg8gYi9viQizJ+TfgJ62XkuB5/K QDtld4/I2D4s2yIciWzf2IXLisMC2VMfS+S4ta3V8FYKYiC69e8yn8yQ7uAaNfe6fJ6o 7BdHZgClAvj8j3hxzr7LE0D1nLLZZ9JlNjPwZNTDK4ei/9AgRi9qJYifA09MWFvx39zF 1TWMkwAS9BZEbHBBSy0cZnb/Uswn7XVDXmzvY08+v2rEa6rbATlTb8QI9Q/EFH+e43sZ Nf4g== X-Gm-Message-State: ABuFfog7owjoZurwhQuawGUnYgPi3Eah0dAh27q+U745SnieMbEK5ea/ llK1ya1zrxQrPPLGegTsHkQ= X-Google-Smtp-Source: ACcGV63P9uoUnxmGWMXbAiIJSz6kMOXyP2Qofqf0tmoiWe5M3xIxHWTN/VDTXKTG8qHLbPGF9XhqIA== X-Received: by 2002:a1c:1694:: with SMTP id 142-v6mr12308104wmw.113.1540126216002; Sun, 21 Oct 2018 05:50:16 -0700 (PDT) Received: from kheib-workstation.redhat.com ([192.116.94.216]) by smtp.gmail.com with ESMTPSA id v76-v6sm14375380wmd.32.2018.10.21.05.50.14 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 21 Oct 2018 05:50:15 -0700 (PDT) From: Kamal Heib To: Doug Ledford , Jason Gunthorpe Cc: linux-rdma@vger.kernel.org, kamalheib1@gmail.com Subject: [PATCH rdma-next v2 03/18] RDMA/cxgb3: Initialize ib_device_ops struct Date: Sun, 21 Oct 2018 15:49:38 +0300 Message-Id: <20181021124953.11558-4-kamalheib1@gmail.com> X-Mailer: git-send-email 2.14.5 In-Reply-To: <20181021124953.11558-1-kamalheib1@gmail.com> References: <20181021124953.11558-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 using ib_set_device_ops(). Signed-off-by: Kamal Heib --- drivers/infiniband/hw/cxgb3/iwch_provider.c | 64 +++++++++++++++-------------- 1 file changed, 34 insertions(+), 30 deletions(-) diff --git a/drivers/infiniband/hw/cxgb3/iwch_provider.c b/drivers/infiniband/hw/cxgb3/iwch_provider.c index ebbec02cebe0..d8a6fc480a8e 100644 --- a/drivers/infiniband/hw/cxgb3/iwch_provider.c +++ b/drivers/infiniband/hw/cxgb3/iwch_provider.c @@ -1317,6 +1317,39 @@ static void get_dev_fw_ver_str(struct ib_device *ibdev, char *str) snprintf(str, IB_FW_VERSION_NAME_MAX, "%s", info.fw_version); } +static const struct ib_device_ops iwch_dev_ops = { + .query_device = iwch_query_device, + .query_port = iwch_query_port, + .query_pkey = iwch_query_pkey, + .query_gid = iwch_query_gid, + .alloc_ucontext = iwch_alloc_ucontext, + .dealloc_ucontext = iwch_dealloc_ucontext, + .mmap = iwch_mmap, + .alloc_pd = iwch_allocate_pd, + .dealloc_pd = iwch_deallocate_pd, + .create_qp = iwch_create_qp, + .modify_qp = iwch_ib_modify_qp, + .destroy_qp = iwch_destroy_qp, + .create_cq = iwch_create_cq, + .destroy_cq = iwch_destroy_cq, + .resize_cq = iwch_resize_cq, + .poll_cq = iwch_poll_cq, + .get_dma_mr = iwch_get_dma_mr, + .reg_user_mr = iwch_reg_user_mr, + .dereg_mr = iwch_dereg_mr, + .alloc_mw = iwch_alloc_mw, + .dealloc_mw = iwch_dealloc_mw, + .alloc_mr = iwch_alloc_mr, + .map_mr_sg = iwch_map_mr_sg, + .req_notify_cq = iwch_arm_cq, + .post_send = iwch_post_send, + .post_recv = iwch_post_receive, + .alloc_hw_stats = iwch_alloc_stats, + .get_hw_stats = iwch_get_mib, + .get_port_immutable = iwch_port_immutable, + .get_dev_fw_str = get_dev_fw_ver_str, +}; + int iwch_register_device(struct iwch_dev *dev) { int ret; @@ -1356,37 +1389,7 @@ int iwch_register_device(struct iwch_dev *dev) dev->ibdev.phys_port_cnt = dev->rdev.port_info.nports; dev->ibdev.num_comp_vectors = 1; dev->ibdev.dev.parent = &dev->rdev.rnic_info.pdev->dev; - dev->ibdev.query_device = iwch_query_device; - dev->ibdev.query_port = iwch_query_port; - dev->ibdev.query_pkey = iwch_query_pkey; - dev->ibdev.query_gid = iwch_query_gid; - dev->ibdev.alloc_ucontext = iwch_alloc_ucontext; - dev->ibdev.dealloc_ucontext = iwch_dealloc_ucontext; - dev->ibdev.mmap = iwch_mmap; - dev->ibdev.alloc_pd = iwch_allocate_pd; - dev->ibdev.dealloc_pd = iwch_deallocate_pd; - dev->ibdev.create_qp = iwch_create_qp; - dev->ibdev.modify_qp = iwch_ib_modify_qp; - dev->ibdev.destroy_qp = iwch_destroy_qp; - dev->ibdev.create_cq = iwch_create_cq; - dev->ibdev.destroy_cq = iwch_destroy_cq; - dev->ibdev.resize_cq = iwch_resize_cq; - dev->ibdev.poll_cq = iwch_poll_cq; - dev->ibdev.get_dma_mr = iwch_get_dma_mr; - dev->ibdev.reg_user_mr = iwch_reg_user_mr; - dev->ibdev.dereg_mr = iwch_dereg_mr; - dev->ibdev.alloc_mw = iwch_alloc_mw; - dev->ibdev.dealloc_mw = iwch_dealloc_mw; - dev->ibdev.alloc_mr = iwch_alloc_mr; - dev->ibdev.map_mr_sg = iwch_map_mr_sg; - dev->ibdev.req_notify_cq = iwch_arm_cq; - dev->ibdev.post_send = iwch_post_send; - dev->ibdev.post_recv = iwch_post_receive; - dev->ibdev.alloc_hw_stats = iwch_alloc_stats; - dev->ibdev.get_hw_stats = iwch_get_mib; dev->ibdev.uverbs_abi_ver = IWCH_UVERBS_ABI_VERSION; - dev->ibdev.get_port_immutable = iwch_port_immutable; - dev->ibdev.get_dev_fw_str = get_dev_fw_ver_str; dev->ibdev.iwcm = kmalloc(sizeof(struct iw_cm_verbs), GFP_KERNEL); if (!dev->ibdev.iwcm) @@ -1405,6 +1408,7 @@ int iwch_register_device(struct iwch_dev *dev) dev->ibdev.driver_id = RDMA_DRIVER_CXGB3; rdma_set_device_sysfs_group(&dev->ibdev, &iwch_attr_group); + ib_set_device_ops(&dev->ibdev, &iwch_dev_ops); ret = ib_register_device(&dev->ibdev, "cxgb3_%d", NULL); if (ret) kfree(dev->ibdev.iwcm);