From patchwork Mon Nov 5 11:35:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kamal Heib X-Patchwork-Id: 10667897 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 E7A631751 for ; Mon, 5 Nov 2018 11:36:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D6D7C28DB6 for ; Mon, 5 Nov 2018 11:36:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CA0282978D; Mon, 5 Nov 2018 11:36:08 +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 4BD332977F for ; Mon, 5 Nov 2018 11:36:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728757AbeKEUzY (ORCPT ); Mon, 5 Nov 2018 15:55:24 -0500 Received: from mail-wr1-f68.google.com ([209.85.221.68]:36022 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728245AbeKEUzY (ORCPT ); Mon, 5 Nov 2018 15:55:24 -0500 Received: by mail-wr1-f68.google.com with SMTP id z13-v6so6731965wrs.3 for ; Mon, 05 Nov 2018 03:36:05 -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=qlgbmoqvlL8GhcRA8XnDHBisdW68j40ssYY3fn2McVU=; b=NG+c6g8qeE6E+GR4onB7zNHfZf2jyLI7orHyPX56D08eDacZl3zGQ96JtNW3qSSM0u CSEWPfsKFZqQVJTADxKl5mML2N7aH5nH29YJMGg30mFtr/iqEMDeuPv4J0joflYcjfiD YId5Mk4bvEiDqIoxTwM15d2oCRXi9bYazlz8RjCDEeQZEkXjG1KyA+8xJOI20RmqNwiz gy9FozPMIu9uNlHCa7nmYEQi04d83lor6lQ2i1ntbsuCywd6uVem4HRZpZSW4lLILTF+ exIVeOpeyrTWwKfbz6+2gFDDm5i2wwmTfp6CqjxLr22wQzq/tNguRL2Bbm0bTr2qe9nd 3AjQ== 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=qlgbmoqvlL8GhcRA8XnDHBisdW68j40ssYY3fn2McVU=; b=e654jpmBwI7qrwmJXS0WxQ76w9k78NW6d6J58m4e3CfmAvSVXw7q6eFCbvEaPGxf1X X8Hm5ooh4r+wwe+fF6+fuu9TgNXRX4vbjFZSdFOLP7+ZNAe/WEw/co5KnD0dZIHBkUca b9CBsYvCiBR0HafDRC3hmsPJNvj+cbBdQXQ0somk+s2D1JU4MjJWjyoa6raUReiLRru+ tkbW2wW0/kCnRmZTOsTSBR28CKynJN9hxZw6UTXP/VtrYM4Tai2FInCUCXvK0SD15Dje EJ79cjw9CtA+spqxwQyvEyYmTm3VUgJguz7N1BmxFnMetV8rLKb1HfcvzcJSVukXATWP a58Q== X-Gm-Message-State: AGRZ1gLXVJeBBCbcwJ0qanJpQP2z5R3oR6AD3NWv4qskQS8FoIThT+dV RY4+n2vt969JLEfKbM/D5To= X-Google-Smtp-Source: AJdET5ewLjKcry6XXAGscroL0sRtEaA7Z/MrHdcHd1jFBznD/wYUOXdZog8Saasif832wYwQ2vz51w== X-Received: by 2002:adf:b6a8:: with SMTP id j40-v6mr17863026wre.55.1541417765045; Mon, 05 Nov 2018 03:36:05 -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.36.03 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 05 Nov 2018 03:36:04 -0800 (PST) From: Kamal Heib To: Doug Ledford , Jason Gunthorpe Cc: linux-rdma@vger.kernel.org, kamalheib1@gmail.com Subject: [PATCH rdma-next v3 16/20] RDMA/vmw_pvrdma: Initialize ib_device_ops struct Date: Mon, 5 Nov 2018 13:35:24 +0200 Message-Id: <20181105113528.8317-17-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/vmw_pvrdma/pvrdma_main.c | 92 +++++++++++++++----------- 1 file changed, 55 insertions(+), 37 deletions(-) diff --git a/drivers/infiniband/hw/vmw_pvrdma/pvrdma_main.c b/drivers/infiniband/hw/vmw_pvrdma/pvrdma_main.c index 398443f43dc3..ee5352d18be2 100644 --- a/drivers/infiniband/hw/vmw_pvrdma/pvrdma_main.c +++ b/drivers/infiniband/hw/vmw_pvrdma/pvrdma_main.c @@ -161,6 +161,59 @@ static struct net_device *pvrdma_get_netdev(struct ib_device *ibdev, return netdev; } +static const struct ib_device_ops pvrdma_dev_ops = { + /* Device operations */ + .query_device = pvrdma_query_device, + .get_dev_fw_str = pvrdma_get_fw_ver_str, + /* Port operations */ + .query_port = pvrdma_query_port, + .modify_port = pvrdma_modify_port, + .get_netdev = pvrdma_get_netdev, + .get_port_immutable = pvrdma_port_immutable, + .get_link_layer = pvrdma_port_link_layer, + /* GID operations */ + .query_gid = pvrdma_query_gid, + .add_gid = pvrdma_add_gid, + .del_gid = pvrdma_del_gid, + /* PKey operations */ + .query_pkey = pvrdma_query_pkey, + /* Ucontext operations */ + .alloc_ucontext = pvrdma_alloc_ucontext, + .dealloc_ucontext = pvrdma_dealloc_ucontext, + .mmap = pvrdma_mmap, + /* PD operations */ + .alloc_pd = pvrdma_alloc_pd, + .dealloc_pd = pvrdma_dealloc_pd, + /* AH operations */ + .create_ah = pvrdma_create_ah, + .destroy_ah = pvrdma_destroy_ah, + /* QP operations */ + .create_qp = pvrdma_create_qp, + .modify_qp = pvrdma_modify_qp, + .query_qp = pvrdma_query_qp, + .destroy_qp = pvrdma_destroy_qp, + .post_send = pvrdma_post_send, + .post_recv = pvrdma_post_recv, + /* CQ operations */ + .create_cq = pvrdma_create_cq, + .destroy_cq = pvrdma_destroy_cq, + .poll_cq = pvrdma_poll_cq, + .req_notify_cq = pvrdma_req_notify_cq, + /* MR operations */ + .get_dma_mr = pvrdma_get_dma_mr, + .reg_user_mr = pvrdma_reg_user_mr, + .dereg_mr = pvrdma_dereg_mr, + .alloc_mr = pvrdma_alloc_mr, + .map_mr_sg = pvrdma_map_mr_sg, +}; + +static const struct ib_device_ops pvrdma_dev_srq_ops = { + .create_srq = pvrdma_create_srq, + .modify_srq = pvrdma_modify_srq, + .query_srq = pvrdma_query_srq, + .destroy_srq = pvrdma_destroy_srq, +}; + static int pvrdma_register_device(struct pvrdma_dev *dev) { int ret = -1; @@ -197,39 +250,7 @@ static int pvrdma_register_device(struct pvrdma_dev *dev) dev->ib_dev.node_type = RDMA_NODE_IB_CA; dev->ib_dev.phys_port_cnt = dev->dsr->caps.phys_port_cnt; - dev->ib_dev.query_device = pvrdma_query_device; - dev->ib_dev.query_port = pvrdma_query_port; - dev->ib_dev.query_gid = pvrdma_query_gid; - dev->ib_dev.query_pkey = pvrdma_query_pkey; - dev->ib_dev.modify_port = pvrdma_modify_port; - dev->ib_dev.alloc_ucontext = pvrdma_alloc_ucontext; - dev->ib_dev.dealloc_ucontext = pvrdma_dealloc_ucontext; - dev->ib_dev.mmap = pvrdma_mmap; - dev->ib_dev.alloc_pd = pvrdma_alloc_pd; - dev->ib_dev.dealloc_pd = pvrdma_dealloc_pd; - dev->ib_dev.create_ah = pvrdma_create_ah; - dev->ib_dev.destroy_ah = pvrdma_destroy_ah; - dev->ib_dev.create_qp = pvrdma_create_qp; - dev->ib_dev.modify_qp = pvrdma_modify_qp; - dev->ib_dev.query_qp = pvrdma_query_qp; - dev->ib_dev.destroy_qp = pvrdma_destroy_qp; - dev->ib_dev.post_send = pvrdma_post_send; - dev->ib_dev.post_recv = pvrdma_post_recv; - dev->ib_dev.create_cq = pvrdma_create_cq; - dev->ib_dev.destroy_cq = pvrdma_destroy_cq; - dev->ib_dev.poll_cq = pvrdma_poll_cq; - dev->ib_dev.req_notify_cq = pvrdma_req_notify_cq; - dev->ib_dev.get_dma_mr = pvrdma_get_dma_mr; - dev->ib_dev.reg_user_mr = pvrdma_reg_user_mr; - dev->ib_dev.dereg_mr = pvrdma_dereg_mr; - dev->ib_dev.alloc_mr = pvrdma_alloc_mr; - dev->ib_dev.map_mr_sg = pvrdma_map_mr_sg; - dev->ib_dev.add_gid = pvrdma_add_gid; - dev->ib_dev.del_gid = pvrdma_del_gid; - dev->ib_dev.get_netdev = pvrdma_get_netdev; - dev->ib_dev.get_port_immutable = pvrdma_port_immutable; - dev->ib_dev.get_link_layer = pvrdma_port_link_layer; - dev->ib_dev.get_dev_fw_str = pvrdma_get_fw_ver_str; + ib_set_device_ops(&dev->ib_dev, &pvrdma_dev_ops); mutex_init(&dev->port_mutex); spin_lock_init(&dev->desc_lock); @@ -255,10 +276,7 @@ static int pvrdma_register_device(struct pvrdma_dev *dev) (1ull << IB_USER_VERBS_CMD_DESTROY_SRQ) | (1ull << IB_USER_VERBS_CMD_POST_SRQ_RECV); - dev->ib_dev.create_srq = pvrdma_create_srq; - dev->ib_dev.modify_srq = pvrdma_modify_srq; - dev->ib_dev.query_srq = pvrdma_query_srq; - dev->ib_dev.destroy_srq = pvrdma_destroy_srq; + ib_set_device_ops(&dev->ib_dev, &pvrdma_dev_srq_ops); dev->srq_tbl = kcalloc(dev->dsr->caps.max_srq, sizeof(struct pvrdma_srq *),