From patchwork Mon Nov 5 11:35:25 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kamal Heib X-Patchwork-Id: 10667899 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 CF99F15A6 for ; Mon, 5 Nov 2018 11:36:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BF5A329789 for ; Mon, 5 Nov 2018 11:36:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B386E2978B; Mon, 5 Nov 2018 11:36:10 +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 48AEA28DB6 for ; Mon, 5 Nov 2018 11:36:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728874AbeKEUz0 (ORCPT ); Mon, 5 Nov 2018 15:55:26 -0500 Received: from mail-wm1-f65.google.com ([209.85.128.65]:54357 "EHLO mail-wm1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728643AbeKEUz0 (ORCPT ); Mon, 5 Nov 2018 15:55:26 -0500 Received: by mail-wm1-f65.google.com with SMTP id r63-v6so7972252wma.4 for ; Mon, 05 Nov 2018 03:36:07 -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=o8btSrAjmux8W0vXk/pvYu1cQPX2KKwNgiqOLHDDycA=; b=T66c1fKcpBwaQwcrxizVspvU9M73vBi7BmuWBoLhXyLXi4fSdFJTCODnKwldahF1e1 MVfq2YTJb7EeUFSxZ+5Uzv2Zo7aEfEXrQaipybqboJ18Nk61RW5gmd67VjdlklE79Tuw NVcXbAkRp1V/mayJKzo42KqkRWNlmdMvbiK/PD1wyKj60Sn0hhym2CFDBzzK7Ml66ACS 1YN4GKCHMsJBifGlYAaSBnSUhn/Th0CvptafgyjBA4zuTW22H2fTpF2z81wkp0v3QCV3 96RSeFct0+DK/gBAJWX05MuZuW0FlSABva3hYZc0puWWySY9b1LwggA2QRsADslWderm fD7w== 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=o8btSrAjmux8W0vXk/pvYu1cQPX2KKwNgiqOLHDDycA=; b=PzFwXlZgUqxihgH3WF21GxkxDi6pqZthID2f42521PTAF47MhXt+mBaRv0TRQFqTFy lCGnImlAkKoXgaZwLhzC8ttL5Qe9AJ55ucikJmnMzH/vcEOx8TdzyR2I7XAU6povKL9E orBdlCB4ohM0+T2SQEU6WG/5rbwXov6rEDUAzXmjtwcwvy1Oi7yVmYS9TRTqbGFRjCfU YtfBhTmeax86ibi5JNEjYHS36OvtCXR5yDGXZF9uD4XxdWRdJ4fwv6U7fYiRn8eI+MvF pjYhXdTKObmhjsh230wGwnpkC1Uke9sF4Mtod9G5wokP6rViWsycoyXSRA4fNTanYhw9 w1lw== X-Gm-Message-State: AGRZ1gLM+HahQkjdbl7HAlpX1w6Ck0hayCqbEAGfpodSFXaKAF3bBDYh s0lNgvXVYbkzwg/klLoKWv8= X-Google-Smtp-Source: AJdET5eTFgpFs7Al4axbH3bXLEo1dr+xWQOCY8V4O55O9pJuMxfJQqM3IXb+Y9eRKtZglQ0eYwqRIw== X-Received: by 2002:a1c:2543:: with SMTP id l64-v6mr6104432wml.74.1541417766308; Mon, 05 Nov 2018 03:36:06 -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.05 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 05 Nov 2018 03:36:05 -0800 (PST) From: Kamal Heib To: Doug Ledford , Jason Gunthorpe Cc: linux-rdma@vger.kernel.org, kamalheib1@gmail.com Subject: [PATCH rdma-next v3 17/20] RDMA/rxe: Initialize ib_device_ops struct Date: Mon, 5 Nov 2018 13:35:25 +0200 Message-Id: <20181105113528.8317-18-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/sw/rxe/rxe_verbs.c | 102 ++++++++++++++++++++-------------- 1 file changed, 59 insertions(+), 43 deletions(-) diff --git a/drivers/infiniband/sw/rxe/rxe_verbs.c b/drivers/infiniband/sw/rxe/rxe_verbs.c index 9c19f2027511..9ac3467b5a56 100644 --- a/drivers/infiniband/sw/rxe/rxe_verbs.c +++ b/drivers/infiniband/sw/rxe/rxe_verbs.c @@ -1157,6 +1157,64 @@ static const struct attribute_group rxe_attr_group = { .attrs = rxe_dev_attributes, }; +static const struct ib_device_ops rxe_dev_ops = { + /* Device operations */ + .query_device = rxe_query_device, + .modify_device = rxe_modify_device, + /* Port operations */ + .query_port = rxe_query_port, + .modify_port = rxe_modify_port, + .get_link_layer = rxe_get_link_layer, + .get_netdev = rxe_get_netdev, + .get_port_immutable = rxe_port_immutable, + /* PKey operations */ + .query_pkey = rxe_query_pkey, + /* Ucontext operations */ + .alloc_ucontext = rxe_alloc_ucontext, + .dealloc_ucontext = rxe_dealloc_ucontext, + .mmap = rxe_mmap, + /* PD operations */ + .alloc_pd = rxe_alloc_pd, + .dealloc_pd = rxe_dealloc_pd, + /* AH operations */ + .create_ah = rxe_create_ah, + .modify_ah = rxe_modify_ah, + .query_ah = rxe_query_ah, + .destroy_ah = rxe_destroy_ah, + /* SRQ operations */ + .create_srq = rxe_create_srq, + .modify_srq = rxe_modify_srq, + .query_srq = rxe_query_srq, + .destroy_srq = rxe_destroy_srq, + .post_srq_recv = rxe_post_srq_recv, + /* QP operations */ + .create_qp = rxe_create_qp, + .modify_qp = rxe_modify_qp, + .query_qp = rxe_query_qp, + .destroy_qp = rxe_destroy_qp, + .post_send = rxe_post_send, + .post_recv = rxe_post_recv, + /* CQ operations */ + .create_cq = rxe_create_cq, + .destroy_cq = rxe_destroy_cq, + .resize_cq = rxe_resize_cq, + .poll_cq = rxe_poll_cq, + .peek_cq = rxe_peek_cq, + .req_notify_cq = rxe_req_notify_cq, + /* MR operations */ + .get_dma_mr = rxe_get_dma_mr, + .reg_user_mr = rxe_reg_user_mr, + .dereg_mr = rxe_dereg_mr, + .alloc_mr = rxe_alloc_mr, + .map_mr_sg = rxe_map_mr_sg, + /* Multicast operations */ + .attach_mcast = rxe_attach_mcast, + .detach_mcast = rxe_detach_mcast, + /* Stats operations */ + .get_hw_stats = rxe_ib_get_hw_stats, + .alloc_hw_stats = rxe_ib_alloc_hw_stats, +}; + int rxe_register_device(struct rxe_dev *rxe) { int err; @@ -1211,49 +1269,7 @@ int rxe_register_device(struct rxe_dev *rxe) | BIT_ULL(IB_USER_VERBS_CMD_DETACH_MCAST) ; - dev->query_device = rxe_query_device; - dev->modify_device = rxe_modify_device; - dev->query_port = rxe_query_port; - dev->modify_port = rxe_modify_port; - dev->get_link_layer = rxe_get_link_layer; - dev->get_netdev = rxe_get_netdev; - dev->query_pkey = rxe_query_pkey; - dev->alloc_ucontext = rxe_alloc_ucontext; - dev->dealloc_ucontext = rxe_dealloc_ucontext; - dev->mmap = rxe_mmap; - dev->get_port_immutable = rxe_port_immutable; - dev->alloc_pd = rxe_alloc_pd; - dev->dealloc_pd = rxe_dealloc_pd; - dev->create_ah = rxe_create_ah; - dev->modify_ah = rxe_modify_ah; - dev->query_ah = rxe_query_ah; - dev->destroy_ah = rxe_destroy_ah; - dev->create_srq = rxe_create_srq; - dev->modify_srq = rxe_modify_srq; - dev->query_srq = rxe_query_srq; - dev->destroy_srq = rxe_destroy_srq; - dev->post_srq_recv = rxe_post_srq_recv; - dev->create_qp = rxe_create_qp; - dev->modify_qp = rxe_modify_qp; - dev->query_qp = rxe_query_qp; - dev->destroy_qp = rxe_destroy_qp; - dev->post_send = rxe_post_send; - dev->post_recv = rxe_post_recv; - dev->create_cq = rxe_create_cq; - dev->destroy_cq = rxe_destroy_cq; - dev->resize_cq = rxe_resize_cq; - dev->poll_cq = rxe_poll_cq; - dev->peek_cq = rxe_peek_cq; - dev->req_notify_cq = rxe_req_notify_cq; - dev->get_dma_mr = rxe_get_dma_mr; - dev->reg_user_mr = rxe_reg_user_mr; - dev->dereg_mr = rxe_dereg_mr; - dev->alloc_mr = rxe_alloc_mr; - dev->map_mr_sg = rxe_map_mr_sg; - dev->attach_mcast = rxe_attach_mcast; - dev->detach_mcast = rxe_detach_mcast; - dev->get_hw_stats = rxe_ib_get_hw_stats; - dev->alloc_hw_stats = rxe_ib_alloc_hw_stats; + ib_set_device_ops(dev, &rxe_dev_ops); tfm = crypto_alloc_shash("crc32", 0, 0); if (IS_ERR(tfm)) {