From patchwork Sun Oct 21 12:49: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: 10650759 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 24C9614DE 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 1488F28765 for ; Sun, 21 Oct 2018 12:50:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 08CC22877B; 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 9205E28765 for ; Sun, 21 Oct 2018 12:50:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727658AbeJUVEa (ORCPT ); Sun, 21 Oct 2018 17:04:30 -0400 Received: from mail-wm1-f68.google.com ([209.85.128.68]:54792 "EHLO mail-wm1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727477AbeJUVEa (ORCPT ); Sun, 21 Oct 2018 17:04:30 -0400 Received: by mail-wm1-f68.google.com with SMTP id r63-v6so7612418wma.4 for ; Sun, 21 Oct 2018 05:50:15 -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=q4R6JGeEH9+5ZH06DkgxZVO4MQKbJyrDvOQo/K4hPS4=; b=uSn7nyjQXlZRnLyGvBw+E/l7TJb2VefwMXpZPgi8IdlABhewQoOSwmZV+ybZb6k6gt uPTfwFzBhLO00HFxq2IR+nE9vhrsDN5CoQ4EGLJ9yDVw3CjqUKMIvYNMpi/1/W+YCx8E qQhZB/itt5XeQ/JVlFgS4ElnZVhWa7ry+qCR4RirczRWuUS24wc7vMap26CvlARu5Yvg 7KJsRrpM57sovD8tC4fJWr0pHWE9ufeRgGaAxh19HNjHQ1D1KSm0NJYIDuZj2qeuncqN o6y2IjlDllrpSF5fkd3a/v32sQZgyADx5otZra1EJhHzP7WCtJGZ6/hz98ZddxNpeVqg Lvrg== 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=q4R6JGeEH9+5ZH06DkgxZVO4MQKbJyrDvOQo/K4hPS4=; b=cZp4I5/eVtlROH/E3WJ2ysoSEyAgE8wFkOpf94cxaXpS8UF0MyGEYCMZYX6vLsjuZr NTUMZljtKiyqL+h9auIPUqQXmVyFuDzNsThxvNyPaxFyi6TaltPpq2Cez411pwc4sSRd kY50v0jg7yxuC923ENTsiLYIvtm1jGrkJ0QknGNzA7NOjsujI32OAzVKcmv6N2ghnQYi +9Il85YFY1phCfdIPRBZl709aUiLpgdfiJGJxZGfKO6s+mqJwyAW8nOcenJ/FfUkKnD5 x+y+eL4jnjOrLkgj85EUqF91C6h/xihj6KyPJmfCcR0JYgeUYAMLUMu2hHLCeMzldZYe WIiA== X-Gm-Message-State: ABuFfoj3kKBJQ7EQih+YKk9ulmEyCQGujnotYmVbKg3yilOeV/JSpS6J BSevqPVVvt7H9WmMB6WSA+c= X-Google-Smtp-Source: ACcGV61m9nrwxd6JGPzhyW9VzCq2/iLMo4jVVjEOXI5DiF2RolnjymYjNtcKsuwwT5Z8f4EAX6XQDg== X-Received: by 2002:a1c:544d:: with SMTP id p13-v6mr11667168wmi.144.1540126214725; Sun, 21 Oct 2018 05:50:14 -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.13 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 21 Oct 2018 05:50:14 -0700 (PDT) From: Kamal Heib To: Doug Ledford , Jason Gunthorpe Cc: linux-rdma@vger.kernel.org, kamalheib1@gmail.com Subject: [PATCH rdma-next v2 02/18] RDMA/bnxt_re: Initialize ib_device_ops struct Date: Sun, 21 Oct 2018 15:49:37 +0300 Message-Id: <20181021124953.11558-3-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/bnxt_re/main.c | 96 +++++++++++++++++------------------- 1 file changed, 45 insertions(+), 51 deletions(-) diff --git a/drivers/infiniband/hw/bnxt_re/main.c b/drivers/infiniband/hw/bnxt_re/main.c index cf2282654210..097b5a18fec1 100644 --- a/drivers/infiniband/hw/bnxt_re/main.c +++ b/drivers/infiniband/hw/bnxt_re/main.c @@ -568,6 +568,50 @@ static void bnxt_re_unregister_ib(struct bnxt_re_dev *rdev) ib_unregister_device(&rdev->ibdev); } +static const struct ib_device_ops bnxt_re_dev_ops = { + .query_device = bnxt_re_query_device, + .modify_device = bnxt_re_modify_device, + .query_port = bnxt_re_query_port, + .get_port_immutable = bnxt_re_get_port_immutable, + .get_dev_fw_str = bnxt_re_query_fw_str, + .query_pkey = bnxt_re_query_pkey, + .get_netdev = bnxt_re_get_netdev, + .add_gid = bnxt_re_add_gid, + .del_gid = bnxt_re_del_gid, + .get_link_layer = bnxt_re_get_link_layer, + .alloc_pd = bnxt_re_alloc_pd, + .dealloc_pd = bnxt_re_dealloc_pd, + .create_ah = bnxt_re_create_ah, + .modify_ah = bnxt_re_modify_ah, + .query_ah = bnxt_re_query_ah, + .destroy_ah = bnxt_re_destroy_ah, + .create_srq = bnxt_re_create_srq, + .modify_srq = bnxt_re_modify_srq, + .query_srq = bnxt_re_query_srq, + .destroy_srq = bnxt_re_destroy_srq, + .post_srq_recv = bnxt_re_post_srq_recv, + .create_qp = bnxt_re_create_qp, + .modify_qp = bnxt_re_modify_qp, + .query_qp = bnxt_re_query_qp, + .destroy_qp = bnxt_re_destroy_qp, + .post_send = bnxt_re_post_send, + .post_recv = bnxt_re_post_recv, + .create_cq = bnxt_re_create_cq, + .destroy_cq = bnxt_re_destroy_cq, + .poll_cq = bnxt_re_poll_cq, + .req_notify_cq = bnxt_re_req_notify_cq, + .get_dma_mr = bnxt_re_get_dma_mr, + .dereg_mr = bnxt_re_dereg_mr, + .alloc_mr = bnxt_re_alloc_mr, + .map_mr_sg = bnxt_re_map_mr_sg, + .reg_user_mr = bnxt_re_reg_user_mr, + .alloc_ucontext = bnxt_re_alloc_ucontext, + .dealloc_ucontext = bnxt_re_dealloc_ucontext, + .mmap = bnxt_re_mmap, + .get_hw_stats = bnxt_re_ib_get_hw_stats, + .alloc_hw_stats = bnxt_re_ib_alloc_hw_stats, +}; + static int bnxt_re_register_ib(struct bnxt_re_dev *rdev) { struct ib_device *ibdev = &rdev->ibdev; @@ -614,60 +658,10 @@ static int bnxt_re_register_ib(struct bnxt_re_dev *rdev) (1ull << IB_USER_VERBS_CMD_DESTROY_AH); /* POLL_CQ and REQ_NOTIFY_CQ is directly handled in libbnxt_re */ - /* Kernel verbs */ - ibdev->query_device = bnxt_re_query_device; - ibdev->modify_device = bnxt_re_modify_device; - - ibdev->query_port = bnxt_re_query_port; - ibdev->get_port_immutable = bnxt_re_get_port_immutable; - ibdev->get_dev_fw_str = bnxt_re_query_fw_str; - ibdev->query_pkey = bnxt_re_query_pkey; - ibdev->get_netdev = bnxt_re_get_netdev; - ibdev->add_gid = bnxt_re_add_gid; - ibdev->del_gid = bnxt_re_del_gid; - ibdev->get_link_layer = bnxt_re_get_link_layer; - - ibdev->alloc_pd = bnxt_re_alloc_pd; - ibdev->dealloc_pd = bnxt_re_dealloc_pd; - - ibdev->create_ah = bnxt_re_create_ah; - ibdev->modify_ah = bnxt_re_modify_ah; - ibdev->query_ah = bnxt_re_query_ah; - ibdev->destroy_ah = bnxt_re_destroy_ah; - - ibdev->create_srq = bnxt_re_create_srq; - ibdev->modify_srq = bnxt_re_modify_srq; - ibdev->query_srq = bnxt_re_query_srq; - ibdev->destroy_srq = bnxt_re_destroy_srq; - ibdev->post_srq_recv = bnxt_re_post_srq_recv; - - ibdev->create_qp = bnxt_re_create_qp; - ibdev->modify_qp = bnxt_re_modify_qp; - ibdev->query_qp = bnxt_re_query_qp; - ibdev->destroy_qp = bnxt_re_destroy_qp; - - ibdev->post_send = bnxt_re_post_send; - ibdev->post_recv = bnxt_re_post_recv; - - ibdev->create_cq = bnxt_re_create_cq; - ibdev->destroy_cq = bnxt_re_destroy_cq; - ibdev->poll_cq = bnxt_re_poll_cq; - ibdev->req_notify_cq = bnxt_re_req_notify_cq; - - ibdev->get_dma_mr = bnxt_re_get_dma_mr; - ibdev->dereg_mr = bnxt_re_dereg_mr; - ibdev->alloc_mr = bnxt_re_alloc_mr; - ibdev->map_mr_sg = bnxt_re_map_mr_sg; - - ibdev->reg_user_mr = bnxt_re_reg_user_mr; - ibdev->alloc_ucontext = bnxt_re_alloc_ucontext; - ibdev->dealloc_ucontext = bnxt_re_dealloc_ucontext; - ibdev->mmap = bnxt_re_mmap; - ibdev->get_hw_stats = bnxt_re_ib_get_hw_stats; - ibdev->alloc_hw_stats = bnxt_re_ib_alloc_hw_stats; rdma_set_device_sysfs_group(ibdev, &bnxt_re_dev_attr_group); ibdev->driver_id = RDMA_DRIVER_BNXT_RE; + ib_set_device_ops(ibdev, &bnxt_re_dev_ops); return ib_register_device(ibdev, "bnxt_re%d", NULL); }