From patchwork Mon Nov 5 11:35:15 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kamal Heib X-Patchwork-Id: 10667879 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 40BF21751 for ; Mon, 5 Nov 2018 11:35:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2DB3528DB6 for ; Mon, 5 Nov 2018 11:35:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2247229782; Mon, 5 Nov 2018 11:35:57 +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 A4A6928DB6 for ; Mon, 5 Nov 2018 11:35:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728222AbeKEUzM (ORCPT ); Mon, 5 Nov 2018 15:55:12 -0500 Received: from mail-wr1-f68.google.com ([209.85.221.68]:42357 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726358AbeKEUzM (ORCPT ); Mon, 5 Nov 2018 15:55:12 -0500 Received: by mail-wr1-f68.google.com with SMTP id y15-v6so9108381wru.9 for ; Mon, 05 Nov 2018 03:35:54 -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=GzmYOzAu6ocq76cfugYkSgcHd4f7+cHwawPmXeSDPgM=; b=WqI2IED1VvjT9VCoMMg8Exyql+QImTYKI1f+ESbez5c/O3Auj4D8FBWYHkIcbe5Iqs Nd1s+zHnddZZ3+Y08GHOPQTDq28eBLonWwjFDbtomT0n+QVNYyzpvE5C68n+IbNrAQpq FdSE2345MVC1lH8udCI6akBcfc/9M+Hhd8I+J+VfC6XMtEpeL0uonk0lwaHtMDP0dUYV bbVHGHoN9xHcwzV5pVqEC6FjSqw2YDfVkJGIKD1gSko2m24DG52sMAs88ucv/WE1IPGQ RmOV3ettFE8UcH+ExOZ3R94KInDw4nU3qR35uJN2IoJieplYQ/ZormEY6MZS6lKJNOUr SiKQ== 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=GzmYOzAu6ocq76cfugYkSgcHd4f7+cHwawPmXeSDPgM=; b=qEEvcItgQz3AUTVwUU4tJArY8Hj0DbuYl/8vHIJq3jSGwPSmo9pZh98QjF7J5G9sJw xKcjyMXWFBkcSDU9slrdHGAKBBJfWhEWBQGq59Jualvbw2jckgWfTgVGMeoO1ivJ7+Q4 x/rDnv2e+61eszwRyDB2F2Scy8DM2ESaVjQsfD8fTUG4kTkQ9epX9M3WDZACYUT00Pp5 WyhBKFrgwPO7wRfJZkt1YqnRuoEGRQt6miD03H6lkEtC7g5zTZW4HYY0LsW/c420sliM an4pxKkugidozcFD2zhGDrw0LrmdIRwhMR53fnJECFfdb2LzSZbuYAS/HImPHCDdf/Vo MA7w== X-Gm-Message-State: AGRZ1gIOuCuStu2zxCqX5rgJP7HtzZVW9tlCp+WzR+/RTLZ+16Bbx5i1 NosAAqj+0P6qlb6sQ2f17xDl7WZ7 X-Google-Smtp-Source: AJdET5cCz/eOxX/SK6BZCPtQALcOgVLTS+u0AuEpnwDm4XhKJ8TPVQwB9pE47OZ06lHqdvwhio+84g== X-Received: by 2002:adf:fb4b:: with SMTP id c11-v6mr18560892wrs.117.1541417753237; Mon, 05 Nov 2018 03:35:53 -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.52 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 05 Nov 2018 03:35:52 -0800 (PST) From: Kamal Heib To: Doug Ledford , Jason Gunthorpe Cc: linux-rdma@vger.kernel.org, kamalheib1@gmail.com Subject: [PATCH rdma-next v3 07/20] RDMA/i40iw: Initialize ib_device_ops struct Date: Mon, 5 Nov 2018 13:35:15 +0200 Message-Id: <20181105113528.8317-8-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/i40iw/i40iw_verbs.c | 76 ++++++++++++++++++------------- 1 file changed, 45 insertions(+), 31 deletions(-) diff --git a/drivers/infiniband/hw/i40iw/i40iw_verbs.c b/drivers/infiniband/hw/i40iw/i40iw_verbs.c index 102875872bea..ee2061298e7c 100644 --- a/drivers/infiniband/hw/i40iw/i40iw_verbs.c +++ b/drivers/infiniband/hw/i40iw/i40iw_verbs.c @@ -2740,6 +2740,50 @@ 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 = { + /* Device operations */ + .query_device = i40iw_query_device, + .get_dev_fw_str = i40iw_get_dev_fw_str, + .get_vector_affinity = i40iw_get_vector_affinity, + /* Port operations */ + .query_port = i40iw_query_port, + .get_port_immutable = i40iw_port_immutable, + /* PKey operations */ + .query_pkey = i40iw_query_pkey, + /* GID operations */ + .query_gid = i40iw_query_gid, + /* Ucontext operations */ + .alloc_ucontext = i40iw_alloc_ucontext, + .dealloc_ucontext = i40iw_dealloc_ucontext, + .mmap = i40iw_mmap, + /* PD operations */ + .alloc_pd = i40iw_alloc_pd, + .dealloc_pd = i40iw_dealloc_pd, + /* QP operations */ + .create_qp = i40iw_create_qp, + .modify_qp = i40iw_modify_qp, + .query_qp = i40iw_query_qp, + .destroy_qp = i40iw_destroy_qp, + .post_send = i40iw_post_send, + .post_recv = i40iw_post_recv, + .drain_sq = i40iw_drain_sq, + .drain_rq = i40iw_drain_rq, + /* CQ operations */ + .create_cq = i40iw_create_cq, + .destroy_cq = i40iw_destroy_cq, + .poll_cq = i40iw_poll_cq, + .req_notify_cq = i40iw_req_notify_cq, + /* MR operations */ + .get_dma_mr = i40iw_get_dma_mr, + .reg_user_mr = i40iw_reg_user_mr, + .dereg_mr = i40iw_dereg_mr, + .alloc_mr = i40iw_alloc_mr, + .map_mr_sg = i40iw_map_mr_sg, + /* Stats operations */ + .alloc_hw_stats = i40iw_alloc_hw_stats, + .get_hw_stats = i40iw_get_hw_stats, +}; + /** * i40iw_init_rdma_device - initialization of iwarp device * @iwdev: iwarp device @@ -2786,30 +2830,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 +2846,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; }