From patchwork Mon Nov 5 11:35:19 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kamal Heib X-Patchwork-Id: 10667887 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 B61D71751 for ; Mon, 5 Nov 2018 11:36:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A487D28DB6 for ; Mon, 5 Nov 2018 11:36:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9646029789; Mon, 5 Nov 2018 11:36:02 +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 13ECD28DB6 for ; Mon, 5 Nov 2018 11:36:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727820AbeKEUzS (ORCPT ); Mon, 5 Nov 2018 15:55:18 -0500 Received: from mail-wr1-f67.google.com ([209.85.221.67]:35267 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727040AbeKEUzS (ORCPT ); Mon, 5 Nov 2018 15:55:18 -0500 Received: by mail-wr1-f67.google.com with SMTP id z16-v6so9144338wrv.2 for ; Mon, 05 Nov 2018 03:35:59 -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=Hv58lm4S6KHfSC7Z3+C2hOu8rLB2zF43xb6bHdsRrDk=; b=pfSrsgmqOAmz2Nekk1DfstEQHMdNFMVWHdmlLymoJ38wVwQQ5GfSm52HySfQ6xmygj kKIwcf7BUIpiiqqV+EECYU7tZe1gFtpOmgD77TPSBlEOdsjYxra/2CI1tckveH+PDu6W o4UIEXk8KUcIuUy4Wirp1dnk5qUTC/J+B0pvGI7vwsUzh3XRQYDpxWXbNEUsLqfdMwXn DRYIlsA8kguKKJczEhVagSldqXA5Alcf1gb3J4ZrUusAXpksyt01S/52kKSO1iGNJBJJ W/iBfXHsTtm+lpwFbpr05i+p3hkIUxK76oK2oX8Nzg4B1YkN6f797dky5lZrXcOc7pee OJew== 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=Hv58lm4S6KHfSC7Z3+C2hOu8rLB2zF43xb6bHdsRrDk=; b=WBA7MmrAH9w04Xi8j64tFtrAJUJ/WhDni6S45gBAQRvcW/hheHSGeos2Iu62Ju5aKe PAq3PA5takvGpfdhrIrVvlEEK5kzzLxRuFP25UDjOVHx7rZYy/Y2u2BZi9X6IavPeJGU WkLHN0xjj7DiCeDL1YrvADADpiVXXArpgFeATJMf8AyYJbgRBuTaHRYd7mYMtRgnMT/N wPMpUtEvixMccOoiylEIOAmQpNyK7aPZM192voy04+92yePgC6Y7nCZ4ZNVtOwu+fPxz 9/2ndYeW5zedWYMs+h9ciDZ1HarP8Mr6UBGttA5mwoA1upc63RZc2C8fbuVRgNAzvuU7 /BNA== X-Gm-Message-State: AGRZ1gLDMtZKDN8UxDZ1ruCFHfNH2Yk2EmXzFxjVzq/NWIOqIEntapdo kCRMJPnfgMnxzITrpTqOTuQ= X-Google-Smtp-Source: AJdET5dmBCayQQN95cyfqVBFCYFJ6OTJ+XTY5utOcUONSVLpauC0NuFJPvWV7sFFV5rRHcgPokwX5Q== X-Received: by 2002:adf:fbc6:: with SMTP id d6-v6mr15428330wrs.241.1541417758464; Mon, 05 Nov 2018 03:35:58 -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.57 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 05 Nov 2018 03:35:58 -0800 (PST) From: Kamal Heib To: Doug Ledford , Jason Gunthorpe Cc: linux-rdma@vger.kernel.org, kamalheib1@gmail.com Subject: [PATCH rdma-next v3 11/20] RDMA/nes: Initialize ib_device_ops struct Date: Mon, 5 Nov 2018 13:35:19 +0200 Message-Id: <20181105113528.8317-12-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/nes/nes_verbs.c | 77 ++++++++++++++++++++--------------- 1 file changed, 45 insertions(+), 32 deletions(-) diff --git a/drivers/infiniband/hw/nes/nes_verbs.c b/drivers/infiniband/hw/nes/nes_verbs.c index 92d1cadd4cfd..92fe8788ccfc 100644 --- a/drivers/infiniband/hw/nes/nes_verbs.c +++ b/drivers/infiniband/hw/nes/nes_verbs.c @@ -3627,6 +3627,49 @@ static void get_dev_fw_str(struct ib_device *dev, char *str) (nesvnic->nesdev->nesadapter->firmware_version & 0x000000ff)); } +static const struct ib_device_ops nes_dev_ops = { + /* Device operations */ + .query_device = nes_query_device, + .get_dev_fw_str = get_dev_fw_str, + /* Port operations */ + .query_port = nes_query_port, + .get_port_immutable = nes_port_immutable, + /* PKey operations */ + .query_pkey = nes_query_pkey, + /* GID operations */ + .query_gid = nes_query_gid, + /* Ucontext operations */ + .alloc_ucontext = nes_alloc_ucontext, + .dealloc_ucontext = nes_dealloc_ucontext, + .mmap = nes_mmap, + /* PD operations */ + .alloc_pd = nes_alloc_pd, + .dealloc_pd = nes_dealloc_pd, + /* QP operations */ + .create_qp = nes_create_qp, + .modify_qp = nes_modify_qp, + .query_qp = nes_query_qp, + .destroy_qp = nes_destroy_qp, + .post_send = nes_post_send, + .post_recv = nes_post_recv, + .drain_sq = nes_drain_sq, + .drain_rq = nes_drain_rq, + /* CQ operations */ + .create_cq = nes_create_cq, + .destroy_cq = nes_destroy_cq, + .poll_cq = nes_poll_cq, + .req_notify_cq = nes_req_notify_cq, + /* MR operations */ + .get_dma_mr = nes_get_dma_mr, + .reg_user_mr = nes_reg_user_mr, + .dereg_mr = nes_dereg_mr, + .alloc_mr = nes_alloc_mr, + .map_mr_sg = nes_map_mr_sg, + /* MW operations */ + .alloc_mw = nes_alloc_mw, + .dealloc_mw = nes_dealloc_mw, +}; + /** * nes_init_ofa_device */ @@ -3673,36 +3716,6 @@ struct nes_ib_device *nes_init_ofa_device(struct net_device *netdev) nesibdev->ibdev.phys_port_cnt = 1; nesibdev->ibdev.num_comp_vectors = 1; nesibdev->ibdev.dev.parent = &nesdev->pcidev->dev; - nesibdev->ibdev.query_device = nes_query_device; - nesibdev->ibdev.query_port = nes_query_port; - nesibdev->ibdev.query_pkey = nes_query_pkey; - nesibdev->ibdev.query_gid = nes_query_gid; - nesibdev->ibdev.alloc_ucontext = nes_alloc_ucontext; - nesibdev->ibdev.dealloc_ucontext = nes_dealloc_ucontext; - nesibdev->ibdev.mmap = nes_mmap; - nesibdev->ibdev.alloc_pd = nes_alloc_pd; - nesibdev->ibdev.dealloc_pd = nes_dealloc_pd; - nesibdev->ibdev.create_qp = nes_create_qp; - nesibdev->ibdev.modify_qp = nes_modify_qp; - nesibdev->ibdev.query_qp = nes_query_qp; - nesibdev->ibdev.destroy_qp = nes_destroy_qp; - nesibdev->ibdev.create_cq = nes_create_cq; - nesibdev->ibdev.destroy_cq = nes_destroy_cq; - nesibdev->ibdev.poll_cq = nes_poll_cq; - nesibdev->ibdev.get_dma_mr = nes_get_dma_mr; - nesibdev->ibdev.reg_user_mr = nes_reg_user_mr; - nesibdev->ibdev.dereg_mr = nes_dereg_mr; - nesibdev->ibdev.alloc_mw = nes_alloc_mw; - nesibdev->ibdev.dealloc_mw = nes_dealloc_mw; - - nesibdev->ibdev.alloc_mr = nes_alloc_mr; - nesibdev->ibdev.map_mr_sg = nes_map_mr_sg; - - nesibdev->ibdev.req_notify_cq = nes_req_notify_cq; - nesibdev->ibdev.post_send = nes_post_send; - nesibdev->ibdev.post_recv = nes_post_recv; - nesibdev->ibdev.drain_sq = nes_drain_sq; - nesibdev->ibdev.drain_rq = nes_drain_rq; nesibdev->ibdev.iwcm = kzalloc(sizeof(*nesibdev->ibdev.iwcm), GFP_KERNEL); if (nesibdev->ibdev.iwcm == NULL) { @@ -3717,8 +3730,8 @@ struct nes_ib_device *nes_init_ofa_device(struct net_device *netdev) nesibdev->ibdev.iwcm->reject = nes_reject; nesibdev->ibdev.iwcm->create_listen = nes_create_listen; nesibdev->ibdev.iwcm->destroy_listen = nes_destroy_listen; - nesibdev->ibdev.get_port_immutable = nes_port_immutable; - nesibdev->ibdev.get_dev_fw_str = get_dev_fw_str; + + ib_set_device_ops(&nesibdev->ibdev, &nes_dev_ops); memcpy(nesibdev->ibdev.iwcm->ifname, netdev->name, sizeof(nesibdev->ibdev.iwcm->ifname));