From patchwork Mon Nov 5 11:35:11 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kamal Heib X-Patchwork-Id: 10667871 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 50E3515A6 for ; Mon, 5 Nov 2018 11:35:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4078A29702 for ; Mon, 5 Nov 2018 11:35:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 328B029782; Mon, 5 Nov 2018 11:35:52 +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 BAFE929702 for ; Mon, 5 Nov 2018 11:35:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728094AbeKEUzH (ORCPT ); Mon, 5 Nov 2018 15:55:07 -0500 Received: from mail-wm1-f68.google.com ([209.85.128.68]:51681 "EHLO mail-wm1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726358AbeKEUzH (ORCPT ); Mon, 5 Nov 2018 15:55:07 -0500 Received: by mail-wm1-f68.google.com with SMTP id w7-v6so7938940wmc.1 for ; Mon, 05 Nov 2018 03:35:49 -0800 (PST) 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=xMwGI4dOoooS4ewawI7RIiajEg5IJEbPsQ4Q6T3bsho=; b=Ian5Z/CCWxVgsabWALMQbC4xcVOyYUxUY3ts+x2uwiBRk6jv/im27h6lUR3iscA+B7 Jm5KZWrKR6VCatbDy6n9eiTSYzaXFQsuEaWossl8lA6qb0LK18OB+EGNDfiAQTc9N2ZA MVUMU4lhSNG2DjPOZ7VE2lkNtf9Wvs+UIvlXRz5OHCmZ/jL1bmM2P+ZrKHnqNZTDhp6G nPEadwI3g/HOodVRUfW9PGl5I406MehCRfqcNXCdTCQXejat7gfdOthMYZPsPlg+ZX4H j1IkoVrkTROKT+kbnPd0ink239l0+Ge1GSvmqNjHHN77+pzFVfnffwYG+0EleO3SRWJz 9O8g== 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=xMwGI4dOoooS4ewawI7RIiajEg5IJEbPsQ4Q6T3bsho=; b=o27wvyR5OYbZgq/wqHKCaFi3LFoU9LNYfyobeH51jFG3jt+cinM6w2swDhvrTBL4X9 mJORgolJDHFlOSUUKqf6PBaHNoAZWggZ6bLqsNd6KJpkLSu55870E7RvN3IInhmXp108 uUGnia0yvXbUrPDyp2z/WRiitiJJ1OdjR2qeDJLd2tT7j0/PyfpAzIO9ajc6GCLO6x2D hd+2qLyEnM7mv0KNlBzbCYS93HZP4MqWyHfyfrpWMbeaHrT+4741zgSX7OvfoVxm7BvS c7Bs52bWhSVlvNg6NUacjR5LgAj8BTjkuE4Av7WvfFHz+J959h1D1Sr1SgOGWYgJqxqD xF5w== X-Gm-Message-State: AGRZ1gLqskQKQUGqu4SzQiZ6Zm+fRMJxWGCM5zPq1WJWWK77E1QNUNLi iefQxlNEt6vl7umkv1Rx3Wo= X-Google-Smtp-Source: AJdET5coSl+Hdg8UBfpIeRg3mr8F2WxL4TwrPFYQf6DoMijMGYwJfNSdcHULHX02V1C1FK+ZaB8XJg== X-Received: by 2002:a1c:8414:: with SMTP id g20-v6mr5840553wmd.123.1541417747848; Mon, 05 Nov 2018 03:35:47 -0800 (PST) Received: from kheib-workstation.redhat.com ([192.116.94.216]) by smtp.gmail.com with ESMTPSA id z18-v6sm10762147wru.83.2018.11.05.03.35.46 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 05 Nov 2018 03:35:47 -0800 (PST) From: Kamal Heib To: Doug Ledford , Jason Gunthorpe Cc: linux-rdma@vger.kernel.org, kamalheib1@gmail.com Subject: [PATCH rdma-next v3 03/20] RDMA/cxgb3: Initialize ib_device_ops struct Date: Mon, 5 Nov 2018 13:35:11 +0200 Message-Id: <20181105113528.8317-4-kamalheib1@gmail.com> X-Mailer: git-send-email 2.14.5 In-Reply-To: <20181105113528.8317-1-kamalheib1@gmail.com> References: <20181105113528.8317-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 | 75 +++++++++++++++++------------ 1 file changed, 45 insertions(+), 30 deletions(-) diff --git a/drivers/infiniband/hw/cxgb3/iwch_provider.c b/drivers/infiniband/hw/cxgb3/iwch_provider.c index ebbec02cebe0..5bc5837f1ef9 100644 --- a/drivers/infiniband/hw/cxgb3/iwch_provider.c +++ b/drivers/infiniband/hw/cxgb3/iwch_provider.c @@ -1317,6 +1317,50 @@ 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 = { + /* Device operations */ + .query_device = iwch_query_device, + .get_dev_fw_str = get_dev_fw_ver_str, + /* Port operations */ + .get_port_immutable = iwch_port_immutable, + .query_port = iwch_query_port, + /* PKey operations */ + .query_pkey = iwch_query_pkey, + /* GID operations */ + .query_gid = iwch_query_gid, + /* Ucontext operations */ + .alloc_ucontext = iwch_alloc_ucontext, + .dealloc_ucontext = iwch_dealloc_ucontext, + .mmap = iwch_mmap, + /* PD operations */ + .alloc_pd = iwch_allocate_pd, + .dealloc_pd = iwch_deallocate_pd, + /* QP operations */ + .create_qp = iwch_create_qp, + .modify_qp = iwch_ib_modify_qp, + .destroy_qp = iwch_destroy_qp, + .post_send = iwch_post_send, + .post_recv = iwch_post_receive, + /* CQ operations */ + .create_cq = iwch_create_cq, + .destroy_cq = iwch_destroy_cq, + .resize_cq = iwch_resize_cq, + .poll_cq = iwch_poll_cq, + .req_notify_cq = iwch_arm_cq, + /* MR operations */ + .get_dma_mr = iwch_get_dma_mr, + .reg_user_mr = iwch_reg_user_mr, + .dereg_mr = iwch_dereg_mr, + .map_mr_sg = iwch_map_mr_sg, + .alloc_mr = iwch_alloc_mr, + /* MW operations */ + .alloc_mw = iwch_alloc_mw, + .dealloc_mw = iwch_dealloc_mw, + /* Stats operations */ + .alloc_hw_stats = iwch_alloc_stats, + .get_hw_stats = iwch_get_mib, +}; + int iwch_register_device(struct iwch_dev *dev) { int ret; @@ -1356,37 +1400,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 +1419,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);