From patchwork Mon Nov 5 11:35:10 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kamal Heib X-Patchwork-Id: 10667869 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 83CFE15A6 for ; Mon, 5 Nov 2018 11:35:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7363D29702 for ; Mon, 5 Nov 2018 11:35:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6802329782; Mon, 5 Nov 2018 11:35:51 +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 E95AD2977F for ; Mon, 5 Nov 2018 11:35:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727814AbeKEUzG (ORCPT ); Mon, 5 Nov 2018 15:55:06 -0500 Received: from mail-wr1-f67.google.com ([209.85.221.67]:42328 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726319AbeKEUzF (ORCPT ); Mon, 5 Nov 2018 15:55:05 -0500 Received: by mail-wr1-f67.google.com with SMTP id y15-v6so9107865wru.9 for ; Mon, 05 Nov 2018 03:35:47 -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=N5+LmMdJxOG3dGCEWAkXnbVpFHuzaN/3vdh6kcDkqwk=; b=tpwLNJLYAyay8fWyVrLCEtXEVYs+L3zyrDpF9U4cplEbt/8Xlr5XVcrFogPquqFZM4 0KiqK1RpD+bPPXHRpe1UbGx/0clPBevtSrQqad5TzMJ/U8HvHOQaAo7Fxcs9q9eul3Ik SC2Qe0KNzNuoGhDiIoh0/RXoOy9/T53XKnMf4SzJZzIH1miZK82ttgbRrz6zQF38lrNK pCYs20mvn6VTOPiNdDOqdfrQ3wiv/Zm8143EVz3WbiHTbGvm9hyMxt2jTGWnvAGTGBMK LkjLMEPMQ/O6LbLGQBCVOTMtiFnI6cKHMm3tjkB6xMViNojR5UD/qfW9S89+i94ej0Wd dbug== 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=N5+LmMdJxOG3dGCEWAkXnbVpFHuzaN/3vdh6kcDkqwk=; b=YNVcFq1n9sB2AyfdBAIFnzWfaOevlblulR9Ep9z/1hBzjLnkNN9Va2CrQ22i/McxVu bimcm9fZJmCXaepG02k39uN2MCUja5+poOv96XtWzvFa1eKZFo4ChcqpM7/0v8O6W5hp P1hDThzQ5nFdcf7WH0YrWicr/zayBZ1LC0SJF8dIUNUCflstaxSTcaui4YoFh/Dq6JcG +RMTGnjSpDJiSD3N/y/eOkkD+hDqccfL28XGNuOk1d9746TEhGstmzHqEiUEPvcm5zCg 7DovVmA6fmuWpqFosM28vVC0Kfou6zU+tIeC2CbZc8ot2lbwzUzF5f6+W3FgshyWeAcr rpjQ== X-Gm-Message-State: AGRZ1gJKI4i8GH8Apg6zbehP4Sp4noY8BYb+vyxGufVsXrPs9vXLDr/R HUpxaCS03UUEQ/BgnKlvl2w= X-Google-Smtp-Source: AJdET5dxTm0s8wnouIrOHQnt9JGDjTQ8ZTeexCe7frF0WNXhRQjUZExw4vFRe0Y+WYb8v6umUjunFw== X-Received: by 2002:a5d:4844:: with SMTP id n4-v6mr20047729wrs.28.1541417746626; Mon, 05 Nov 2018 03:35:46 -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.45 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 05 Nov 2018 03:35:46 -0800 (PST) From: Kamal Heib To: Doug Ledford , Jason Gunthorpe Cc: linux-rdma@vger.kernel.org, kamalheib1@gmail.com Subject: [PATCH rdma-next v3 02/20] RDMA/bnxt_re: Initialize ib_device_ops struct Date: Mon, 5 Nov 2018 13:35:10 +0200 Message-Id: <20181105113528.8317-3-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/bnxt_re/main.c | 107 ++++++++++++++++++----------------- 1 file changed, 56 insertions(+), 51 deletions(-) diff --git a/drivers/infiniband/hw/bnxt_re/main.c b/drivers/infiniband/hw/bnxt_re/main.c index cf2282654210..6e7b3eb75fce 100644 --- a/drivers/infiniband/hw/bnxt_re/main.c +++ b/drivers/infiniband/hw/bnxt_re/main.c @@ -568,6 +568,61 @@ 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 = { + /* Device operations */ + .query_device = bnxt_re_query_device, + .modify_device = bnxt_re_modify_device, + .get_dev_fw_str = bnxt_re_query_fw_str, + /* Port operations */ + .query_port = bnxt_re_query_port, + .get_port_immutable = bnxt_re_get_port_immutable, + .query_pkey = bnxt_re_query_pkey, + .get_netdev = bnxt_re_get_netdev, + .get_link_layer = bnxt_re_get_link_layer, + /* GID operations */ + .add_gid = bnxt_re_add_gid, + .del_gid = bnxt_re_del_gid, + /* PD operations */ + .alloc_pd = bnxt_re_alloc_pd, + .dealloc_pd = bnxt_re_dealloc_pd, + /* AH operations */ + .create_ah = bnxt_re_create_ah, + .modify_ah = bnxt_re_modify_ah, + .query_ah = bnxt_re_query_ah, + .destroy_ah = bnxt_re_destroy_ah, + /* SRQ operations */ + .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, + /* QP operations */ + .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, + /* CQ operations */ + .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, + /* MR operations */ + .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, + /* Ucontext operations */ + .alloc_ucontext = bnxt_re_alloc_ucontext, + .dealloc_ucontext = bnxt_re_dealloc_ucontext, + .mmap = bnxt_re_mmap, + /* Stats operations */ + .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 +669,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); }