From patchwork Sun Oct 21 12:49:46 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kamal Heib X-Patchwork-Id: 10650777 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 B469E109C for ; Sun, 21 Oct 2018 12:50:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A451F2877E for ; Sun, 21 Oct 2018 12:50:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 98DF428780; Sun, 21 Oct 2018 12:50:30 +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 308C72877E for ; Sun, 21 Oct 2018 12:50:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727686AbeJUVEm (ORCPT ); Sun, 21 Oct 2018 17:04:42 -0400 Received: from mail-wr1-f67.google.com ([209.85.221.67]:38388 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727676AbeJUVEm (ORCPT ); Sun, 21 Oct 2018 17:04:42 -0400 Received: by mail-wr1-f67.google.com with SMTP id d10-v6so2369950wrs.5 for ; Sun, 21 Oct 2018 05:50:27 -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=rHEEqxbj6xcs1qUGqHNdsgogslEdEAhGQ/vAZexFf9M=; b=AImqEen0SmQ3qC01fIHDVzMc4vBgjMq/anhv84rdpTvlNEVXF92Ycge7DZcPC7VolP V90pqcegzmC1Jxj55L0eSU649mQQNwxoSUwZAU6Nx+1/fag1ITFar5thFKseU1sM7nbx 4a2urxR5Y6S71d0ITz5ku/51zx+UwJUOuXn+b664KOryaULmoP4DJa8uaEcnu3FUH87P EPk9BSO0ndyK+3HJrDflRFc28X3YbqpUXbAHUHZuUHIfeLalRIawZkzSMgDFoUZH3OFM za74oE20s8fRBIsoiKgwssZnYUOSKoB0sIrn4zO3CIriMzSOPiMljPzP1WqoyNEjlg2Q 5Epw== 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=rHEEqxbj6xcs1qUGqHNdsgogslEdEAhGQ/vAZexFf9M=; b=MDIJEj9ETm0MBSnpZqNPuyUpNwUwdQ4iEJ1C381gWwcEK8ExIFaDmQi09/4ZEGpfTM dAdWokgfnPdm5mOj/RVtb0CbwTYI3J77Ipx+JrZQ+3PpbprnEgqID8DMbo07CJPGGHuc B9KLgtUff90aDQOZcsYshfSQicPKm3cg6VO10xMr1yjiFxJXRRtBLH2T0YCcHcrq0kvL CON8sF/Uqm2wnJ+mD/cD/cT8BSa35LGq3EurSnvk3fHBnwL5senL8WCaEucOaMk1U9Yc HFPbSH6PSawhLVee4IQB01ITjrnxe/JliMXopp219H5wK6fjLIjkMYY7mS2HX/woo07D EQ9Q== X-Gm-Message-State: ABuFfoh9d9UUXNA8oy8J6jw3DBNiNOkJOySDPmc8x2IQLTIY9aBKLMyz sZE7NUf5mxxmvqXOHrRRPhMCr2sl X-Google-Smtp-Source: ACcGV63uwfWYnOBrPuYd1WAVpm9WbFfx8flyq4vijk8DtFLw5LmqK+mm4L3mQXkEsoQO4RqrCzwUQg== X-Received: by 2002:adf:f941:: with SMTP id q1-v6mr39803943wrr.151.1540126226701; Sun, 21 Oct 2018 05:50:26 -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.25 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 21 Oct 2018 05:50:26 -0700 (PDT) From: Kamal Heib To: Doug Ledford , Jason Gunthorpe Cc: linux-rdma@vger.kernel.org, kamalheib1@gmail.com Subject: [PATCH rdma-next v2 11/18] RDMA/nes: Initialize ib_device_ops struct Date: Sun, 21 Oct 2018 15:49:46 +0300 Message-Id: <20181021124953.11558-12-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/nes/nes_verbs.c | 67 ++++++++++++++++++----------------- 1 file changed, 35 insertions(+), 32 deletions(-) diff --git a/drivers/infiniband/hw/nes/nes_verbs.c b/drivers/infiniband/hw/nes/nes_verbs.c index 92d1cadd4cfd..b348239d7822 100644 --- a/drivers/infiniband/hw/nes/nes_verbs.c +++ b/drivers/infiniband/hw/nes/nes_verbs.c @@ -3627,6 +3627,39 @@ 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 = { + .query_device = nes_query_device, + .query_port = nes_query_port, + .query_pkey = nes_query_pkey, + .query_gid = nes_query_gid, + .alloc_ucontext = nes_alloc_ucontext, + .dealloc_ucontext = nes_dealloc_ucontext, + .mmap = nes_mmap, + .alloc_pd = nes_alloc_pd, + .dealloc_pd = nes_dealloc_pd, + .create_qp = nes_create_qp, + .modify_qp = nes_modify_qp, + .query_qp = nes_query_qp, + .destroy_qp = nes_destroy_qp, + .create_cq = nes_create_cq, + .destroy_cq = nes_destroy_cq, + .poll_cq = nes_poll_cq, + .get_dma_mr = nes_get_dma_mr, + .reg_user_mr = nes_reg_user_mr, + .dereg_mr = nes_dereg_mr, + .alloc_mw = nes_alloc_mw, + .dealloc_mw = nes_dealloc_mw, + .alloc_mr = nes_alloc_mr, + .map_mr_sg = nes_map_mr_sg, + .req_notify_cq = nes_req_notify_cq, + .post_send = nes_post_send, + .post_recv = nes_post_recv, + .drain_sq = nes_drain_sq, + .drain_rq = nes_drain_rq, + .get_port_immutable = nes_port_immutable, + .get_dev_fw_str = get_dev_fw_str, +}; + /** * nes_init_ofa_device */ @@ -3673,36 +3706,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 +3720,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));