From patchwork Sun Oct 21 12:49:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kamal Heib X-Patchwork-Id: 10650769 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 2E49314DE for ; Sun, 21 Oct 2018 12:50:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1C52A28765 for ; Sun, 21 Oct 2018 12:50:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1099A2877B; Sun, 21 Oct 2018 12:50:25 +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 9AFC328765 for ; Sun, 21 Oct 2018 12:50:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727652AbeJUVEh (ORCPT ); Sun, 21 Oct 2018 17:04:37 -0400 Received: from mail-wm1-f66.google.com ([209.85.128.66]:34253 "EHLO mail-wm1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727686AbeJUVEg (ORCPT ); Sun, 21 Oct 2018 17:04:36 -0400 Received: by mail-wm1-f66.google.com with SMTP id z25-v6so7213506wmf.1 for ; Sun, 21 Oct 2018 05:50:22 -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=o0Z8wfpkqoITWYvHSkWr/41B3oUumI/xqd3cpY6dgWo=; b=lQlU+hg2yP4h5PrK3rQ4oLaVztKtX1fC1H6f7tFcaiaup/4GV5KN4pOtD1brJn/q5I EtVtsJ9j94sJv/N7DMhEcByM6/KXahlRL6Z6uoQdDaXXZpMl32SPMlTDkCQr4Hm/xEtr e5cNZudKHZ7gLwaEwPxzKqPUMUKmxw1bvlwekNJVgt8a3L+FffZ5hGI32Vta5XnIyi2V GcW9HitgVa5POF+vOIpOhNbTQO+01vZVgZMxnBXYowOpZKP+bkpytFdR5BDwv/M78TW2 LHVq1QBnYu4Auo9Wck4/DxuByiqbjgN4FoGPYYljf5TV0B91WxIf2VntfLuL/mlnvrXc uoqw== 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=o0Z8wfpkqoITWYvHSkWr/41B3oUumI/xqd3cpY6dgWo=; b=lSZsh/tDAsTisBTscbWKeNBqzcODxBrclcRqKQzvgu/TkMKEMvtwGnzyNbKdVLe1L5 m780rz8by98zZuHg3AKX+KewlyFQ1BcrLDEceVTL/yL95so1DTekl436iNNY7eyLsPiU RlPpCtD20r4j+26PiXBwsBerPGlV2cjBWfotNEDzks9saxkgHOpknYe+mtKYSlC9kCyt vv5lrXM7miK5Xe9hmD0Sp+LNQk4e3SsP1Ysfz/grhkl1HbI7YOb+ZrA27a8yy5dEXAh6 4+BjGNa0kIE/vuM2lMKuppZHn5mjDRbyZ3w6Aq3+sJi0p1Bt1SNk9jOwV0ShET4PeEne z1Aw== X-Gm-Message-State: ABuFfojFPZscozHmTEVv3bBLpsTj7XoKORX1xO1kR1wSrqWvC/mrCgdP QvFjfeo8Z81BP+HWm7Wh2Mw= X-Google-Smtp-Source: ACcGV60Fb2xw0I/ruEN8UZGYAygonv0ZHiooAo/J+q2LVz8QXwAnKdrRfnwK+S1H4N8HA7b9nzE4zQ== X-Received: by 2002:a7b:c151:: with SMTP id z17-v6mr12581534wmi.39.1540126221376; Sun, 21 Oct 2018 05:50:21 -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.20 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 21 Oct 2018 05:50:20 -0700 (PDT) From: Kamal Heib To: Doug Ledford , Jason Gunthorpe Cc: linux-rdma@vger.kernel.org, kamalheib1@gmail.com Subject: [PATCH rdma-next v2 07/18] RDMA/i40iw: Initialize ib_device_ops struct Date: Sun, 21 Oct 2018 15:49:42 +0300 Message-Id: <20181021124953.11558-8-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/i40iw/i40iw_verbs.c | 66 ++++++++++++++++--------------- 1 file changed, 35 insertions(+), 31 deletions(-) diff --git a/drivers/infiniband/hw/i40iw/i40iw_verbs.c b/drivers/infiniband/hw/i40iw/i40iw_verbs.c index 102875872bea..0ac882318a8e 100644 --- a/drivers/infiniband/hw/i40iw/i40iw_verbs.c +++ b/drivers/infiniband/hw/i40iw/i40iw_verbs.c @@ -2740,6 +2740,40 @@ static const struct cpumask *i40iw_get_vector_affinity(struct ib_device *ibdev, return irq_get_affinity_mask(msix_vec->irq); } +static const struct ib_device_ops i40iw_dev_ops = { + .query_port = i40iw_query_port, + .query_pkey = i40iw_query_pkey, + .query_gid = i40iw_query_gid, + .alloc_ucontext = i40iw_alloc_ucontext, + .dealloc_ucontext = i40iw_dealloc_ucontext, + .mmap = i40iw_mmap, + .alloc_pd = i40iw_alloc_pd, + .dealloc_pd = i40iw_dealloc_pd, + .create_qp = i40iw_create_qp, + .modify_qp = i40iw_modify_qp, + .query_qp = i40iw_query_qp, + .destroy_qp = i40iw_destroy_qp, + .create_cq = i40iw_create_cq, + .destroy_cq = i40iw_destroy_cq, + .get_dma_mr = i40iw_get_dma_mr, + .reg_user_mr = i40iw_reg_user_mr, + .dereg_mr = i40iw_dereg_mr, + .alloc_hw_stats = i40iw_alloc_hw_stats, + .get_hw_stats = i40iw_get_hw_stats, + .query_device = i40iw_query_device, + .drain_sq = i40iw_drain_sq, + .drain_rq = i40iw_drain_rq, + .alloc_mr = i40iw_alloc_mr, + .map_mr_sg = i40iw_map_mr_sg, + .get_port_immutable = i40iw_port_immutable, + .get_dev_fw_str = i40iw_get_dev_fw_str, + .poll_cq = i40iw_poll_cq, + .req_notify_cq = i40iw_req_notify_cq, + .post_send = i40iw_post_send, + .post_recv = i40iw_post_recv, + .get_vector_affinity = i40iw_get_vector_affinity, +}; + /** * i40iw_init_rdma_device - initialization of iwarp device * @iwdev: iwarp device @@ -2786,30 +2820,6 @@ static struct i40iw_ib_device *i40iw_init_rdma_device(struct i40iw_device *iwdev iwibdev->ibdev.phys_port_cnt = 1; iwibdev->ibdev.num_comp_vectors = iwdev->ceqs_count; iwibdev->ibdev.dev.parent = &pcidev->dev; - iwibdev->ibdev.query_port = i40iw_query_port; - iwibdev->ibdev.query_pkey = i40iw_query_pkey; - iwibdev->ibdev.query_gid = i40iw_query_gid; - iwibdev->ibdev.alloc_ucontext = i40iw_alloc_ucontext; - iwibdev->ibdev.dealloc_ucontext = i40iw_dealloc_ucontext; - iwibdev->ibdev.mmap = i40iw_mmap; - iwibdev->ibdev.alloc_pd = i40iw_alloc_pd; - iwibdev->ibdev.dealloc_pd = i40iw_dealloc_pd; - iwibdev->ibdev.create_qp = i40iw_create_qp; - iwibdev->ibdev.modify_qp = i40iw_modify_qp; - iwibdev->ibdev.query_qp = i40iw_query_qp; - iwibdev->ibdev.destroy_qp = i40iw_destroy_qp; - iwibdev->ibdev.create_cq = i40iw_create_cq; - iwibdev->ibdev.destroy_cq = i40iw_destroy_cq; - iwibdev->ibdev.get_dma_mr = i40iw_get_dma_mr; - iwibdev->ibdev.reg_user_mr = i40iw_reg_user_mr; - iwibdev->ibdev.dereg_mr = i40iw_dereg_mr; - iwibdev->ibdev.alloc_hw_stats = i40iw_alloc_hw_stats; - iwibdev->ibdev.get_hw_stats = i40iw_get_hw_stats; - iwibdev->ibdev.query_device = i40iw_query_device; - iwibdev->ibdev.drain_sq = i40iw_drain_sq; - iwibdev->ibdev.drain_rq = i40iw_drain_rq; - iwibdev->ibdev.alloc_mr = i40iw_alloc_mr; - iwibdev->ibdev.map_mr_sg = i40iw_map_mr_sg; iwibdev->ibdev.iwcm = kzalloc(sizeof(*iwibdev->ibdev.iwcm), GFP_KERNEL); if (!iwibdev->ibdev.iwcm) { ib_dealloc_device(&iwibdev->ibdev); @@ -2826,13 +2836,7 @@ static struct i40iw_ib_device *i40iw_init_rdma_device(struct i40iw_device *iwdev iwibdev->ibdev.iwcm->destroy_listen = i40iw_destroy_listen; memcpy(iwibdev->ibdev.iwcm->ifname, netdev->name, sizeof(iwibdev->ibdev.iwcm->ifname)); - iwibdev->ibdev.get_port_immutable = i40iw_port_immutable; - iwibdev->ibdev.get_dev_fw_str = i40iw_get_dev_fw_str; - iwibdev->ibdev.poll_cq = i40iw_poll_cq; - iwibdev->ibdev.req_notify_cq = i40iw_req_notify_cq; - iwibdev->ibdev.post_send = i40iw_post_send; - iwibdev->ibdev.post_recv = i40iw_post_recv; - iwibdev->ibdev.get_vector_affinity = i40iw_get_vector_affinity; + ib_set_device_ops(&iwibdev->ibdev, &i40iw_dev_ops); return iwibdev; }