From patchwork Sun Oct 21 12:49:47 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kamal Heib X-Patchwork-Id: 10650779 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 89B30109C for ; Sun, 21 Oct 2018 12:50:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7823D28765 for ; Sun, 21 Oct 2018 12:50:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6C5FA28780; Sun, 21 Oct 2018 12:50:31 +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 EF7CB2877E for ; Sun, 21 Oct 2018 12:50:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727698AbeJUVEn (ORCPT ); Sun, 21 Oct 2018 17:04:43 -0400 Received: from mail-wm1-f68.google.com ([209.85.128.68]:52134 "EHLO mail-wm1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727603AbeJUVEn (ORCPT ); Sun, 21 Oct 2018 17:04:43 -0400 Received: by mail-wm1-f68.google.com with SMTP id 143-v6so7567399wmf.1 for ; Sun, 21 Oct 2018 05:50:28 -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=eoCVNb77cHOWPeQ4cX1fKnXsNkvpT3DYkkOYyV82das=; b=DhCHhzLPPiawfmUMTg3EfrvNsJwr8vBASkbE9DzoVOzWR88diHrDPwmTU4MQMWAwfy dHzHoo3jZvSUJ2JoNqX5lRr7I/a3JjypCDiESsHh2FLFl055xvKoTlw9MMBfIT0SV8ow hsHT3fj/T0TqxI09ho8dpSTWGPohCnB5f6IrEEvCi6F3+CsZYtdQ1oQYtlSsa8JAQK6x 6nRToqJ+SkUH5nbZg0YQmLV+Uta557d4AsXkegSrqTZUNBpCZkOfK5bXOwXE1qlAdnhg 0TZm4qDbDs7wbg5gJzkbJLU5X5KnYWup/pwynO6ZLYZL0EMK1pra6jR4QAxTotLu64eq JyIQ== 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=eoCVNb77cHOWPeQ4cX1fKnXsNkvpT3DYkkOYyV82das=; b=DxTFbMbXwvgX2bnOdzo8WtolqKiTWFA6KbyMx302QelMXI30On1Zp1/8jyt/wF2IQk G7gBVlHWo4z3JlxfiVH8d2WrWLE6C//ioFwpYIe5l/AWD2FzNYb0m9yX4TQKvOYAby4D wpdFDhKZc2rOlC0rBbYGyvs9TVF7OXj3R1e90q5bzBtLHW/sVfSxB01s5Xu6MQr/Jpys KVcSvS3YsL5axDNlUC9zvGzHbykL+/IrjG+FyjMaJkxsuNAtzbSJcd5NeClO1q/jAB6c voLCRP15rRQobmkX/Yklt/DTXaU9IL0W8VLQPYWxhNwCMRp450ekKLJOw40Qch8shZF3 iJbg== X-Gm-Message-State: ABuFfojuDF4DBt367p6OfX0UEdQgeajaMCSbWVo5oElKa4mrroWgmPKl KNLKaANABbfj+yLYTK6B5L4= X-Google-Smtp-Source: ACcGV61UxzgZfUrGBDlT06DkmvUUvWk8ZYg5Mw9aH68SZH7hsg7fQ+ulgeRbr2QbMkBqp6gffBuc2g== X-Received: by 2002:a1c:ae15:: with SMTP id x21-v6mr11585895wme.73.1540126227964; Sun, 21 Oct 2018 05:50:27 -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.26 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 21 Oct 2018 05:50:27 -0700 (PDT) From: Kamal Heib To: Doug Ledford , Jason Gunthorpe Cc: linux-rdma@vger.kernel.org, kamalheib1@gmail.com Subject: [PATCH rdma-next v2 12/18] RDMA/ocrdma: Initialize ib_device_ops struct Date: Sun, 21 Oct 2018 15:49:47 +0300 Message-Id: <20181021124953.11558-13-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/ocrdma/ocrdma_main.c | 92 +++++++++++++++--------------- 1 file changed, 46 insertions(+), 46 deletions(-) diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_main.c b/drivers/infiniband/hw/ocrdma/ocrdma_main.c index 873cc7f6fe61..54ac65e118e3 100644 --- a/drivers/infiniband/hw/ocrdma/ocrdma_main.c +++ b/drivers/infiniband/hw/ocrdma/ocrdma_main.c @@ -143,6 +143,50 @@ static const struct attribute_group ocrdma_attr_group = { .attrs = ocrdma_attributes, }; +static const struct ib_device_ops ocrdma_dev_ops = { + .query_device = ocrdma_query_device, + .query_port = ocrdma_query_port, + .modify_port = ocrdma_modify_port, + .get_netdev = ocrdma_get_netdev, + .get_link_layer = ocrdma_link_layer, + .alloc_pd = ocrdma_alloc_pd, + .dealloc_pd = ocrdma_dealloc_pd, + .create_cq = ocrdma_create_cq, + .destroy_cq = ocrdma_destroy_cq, + .resize_cq = ocrdma_resize_cq, + .create_qp = ocrdma_create_qp, + .modify_qp = ocrdma_modify_qp, + .query_qp = ocrdma_query_qp, + .destroy_qp = ocrdma_destroy_qp, + .query_pkey = ocrdma_query_pkey, + .create_ah = ocrdma_create_ah, + .destroy_ah = ocrdma_destroy_ah, + .query_ah = ocrdma_query_ah, + .poll_cq = ocrdma_poll_cq, + .post_send = ocrdma_post_send, + .post_recv = ocrdma_post_recv, + .req_notify_cq = ocrdma_arm_cq, + .get_dma_mr = ocrdma_get_dma_mr, + .dereg_mr = ocrdma_dereg_mr, + .reg_user_mr = ocrdma_reg_user_mr, + .alloc_mr = ocrdma_alloc_mr, + .map_mr_sg = ocrdma_map_mr_sg, + .alloc_ucontext = ocrdma_alloc_ucontext, + .dealloc_ucontext = ocrdma_dealloc_ucontext, + .mmap = ocrdma_mmap, + .process_mad = ocrdma_process_mad, + .get_port_immutable = ocrdma_port_immutable, + .get_dev_fw_str = get_dev_fw_str, +}; + +static const struct ib_device_ops ocrdma_dev_srq_ops = { + .create_srq = ocrdma_create_srq, + .modify_srq = ocrdma_modify_srq, + .query_srq = ocrdma_query_srq, + .destroy_srq = ocrdma_destroy_srq, + .post_srq_recv = ocrdma_post_srq_recv, +}; + static int ocrdma_register_device(struct ocrdma_dev *dev) { ocrdma_get_guid(dev, (u8 *)&dev->ibdev.node_guid); @@ -182,50 +226,10 @@ static int ocrdma_register_device(struct ocrdma_dev *dev) dev->ibdev.phys_port_cnt = 1; dev->ibdev.num_comp_vectors = dev->eq_cnt; - /* mandatory verbs. */ - dev->ibdev.query_device = ocrdma_query_device; - dev->ibdev.query_port = ocrdma_query_port; - dev->ibdev.modify_port = ocrdma_modify_port; - dev->ibdev.get_netdev = ocrdma_get_netdev; - dev->ibdev.get_link_layer = ocrdma_link_layer; - dev->ibdev.alloc_pd = ocrdma_alloc_pd; - dev->ibdev.dealloc_pd = ocrdma_dealloc_pd; - - dev->ibdev.create_cq = ocrdma_create_cq; - dev->ibdev.destroy_cq = ocrdma_destroy_cq; - dev->ibdev.resize_cq = ocrdma_resize_cq; - - dev->ibdev.create_qp = ocrdma_create_qp; - dev->ibdev.modify_qp = ocrdma_modify_qp; - dev->ibdev.query_qp = ocrdma_query_qp; - dev->ibdev.destroy_qp = ocrdma_destroy_qp; - - dev->ibdev.query_pkey = ocrdma_query_pkey; - dev->ibdev.create_ah = ocrdma_create_ah; - dev->ibdev.destroy_ah = ocrdma_destroy_ah; - dev->ibdev.query_ah = ocrdma_query_ah; - - dev->ibdev.poll_cq = ocrdma_poll_cq; - dev->ibdev.post_send = ocrdma_post_send; - dev->ibdev.post_recv = ocrdma_post_recv; - dev->ibdev.req_notify_cq = ocrdma_arm_cq; - - dev->ibdev.get_dma_mr = ocrdma_get_dma_mr; - dev->ibdev.dereg_mr = ocrdma_dereg_mr; - dev->ibdev.reg_user_mr = ocrdma_reg_user_mr; - - dev->ibdev.alloc_mr = ocrdma_alloc_mr; - dev->ibdev.map_mr_sg = ocrdma_map_mr_sg; - /* mandatory to support user space verbs consumer. */ - dev->ibdev.alloc_ucontext = ocrdma_alloc_ucontext; - dev->ibdev.dealloc_ucontext = ocrdma_dealloc_ucontext; - dev->ibdev.mmap = ocrdma_mmap; dev->ibdev.dev.parent = &dev->nic_info.pdev->dev; - dev->ibdev.process_mad = ocrdma_process_mad; - dev->ibdev.get_port_immutable = ocrdma_port_immutable; - dev->ibdev.get_dev_fw_str = get_dev_fw_str; + ib_set_device_ops(&dev->ibdev, &ocrdma_dev_ops); if (ocrdma_get_asic_type(dev) == OCRDMA_ASIC_GEN_SKH_R) { dev->ibdev.uverbs_cmd_mask |= @@ -235,11 +239,7 @@ static int ocrdma_register_device(struct ocrdma_dev *dev) OCRDMA_UVERBS(DESTROY_SRQ) | OCRDMA_UVERBS(POST_SRQ_RECV); - dev->ibdev.create_srq = ocrdma_create_srq; - dev->ibdev.modify_srq = ocrdma_modify_srq; - dev->ibdev.query_srq = ocrdma_query_srq; - dev->ibdev.destroy_srq = ocrdma_destroy_srq; - dev->ibdev.post_srq_recv = ocrdma_post_srq_recv; + ib_set_device_ops(&dev->ibdev, &ocrdma_dev_srq_ops); } rdma_set_device_sysfs_group(&dev->ibdev, &ocrdma_attr_group); dev->ibdev.driver_id = RDMA_DRIVER_OCRDMA;