From patchwork Sun Oct 21 12:49:50 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kamal Heib X-Patchwork-Id: 10650785 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 4E8D7109C for ; Sun, 21 Oct 2018 12:50:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3F32728765 for ; Sun, 21 Oct 2018 12:50:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 340692877B; Sun, 21 Oct 2018 12:50:35 +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 C399228765 for ; Sun, 21 Oct 2018 12:50:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727706AbeJUVEr (ORCPT ); Sun, 21 Oct 2018 17:04:47 -0400 Received: from mail-wm1-f65.google.com ([209.85.128.65]:52549 "EHLO mail-wm1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727676AbeJUVEr (ORCPT ); Sun, 21 Oct 2018 17:04:47 -0400 Received: by mail-wm1-f65.google.com with SMTP id 189-v6so7616289wmw.2 for ; Sun, 21 Oct 2018 05:50:32 -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=LiHeW/gMynaAhVv68hyy63kYqoPxYnCv/H30ouHldZg=; b=Gr1cOuX+IJ8yRQZ9PAU7PBQ6uj7bC/3fb9l2hA4AkXzcSNU3xOtGBibzFXCvFgFAxK h/57Ll/2Q7VkttIpg31X5mYFvU/yceaVHuZrTjLzsa6qlK7/yWIPXOZplgHSAgKsZjVz M7JXuWr6UIZGXkHTP5rr5DfplRQZbKZjoH36FFM1awKVhOFfDxewiWZKCArjkJ9ecxzX WbVrDyq8oys2JbKvAE2C83XmBjMglcrVZUgARXLXnQFzeTzrADtOiNxsPKx3T1ooTh7e eZCIlI4v+5bhmrebLppR5IwBhEA2ko8Nqgyh3aA/y+iDfzD6xlgbNsiUkkTMhEKsNYBp lvvQ== 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=LiHeW/gMynaAhVv68hyy63kYqoPxYnCv/H30ouHldZg=; b=Qs9akAn57KRaCmBGCNVcG8RmIlmUhEaXaXC/t3VUxIy0TmFWlfHvkBn1qomZeZ44rW EA57gDJ9HvH+qOYC+dBskzYCqw0170/ECzpZcqv/mA7PDc/Tgf5UdKu1PRWQFcUcV3a2 s/GWEddGTunYB3brJViG1/ff+K2NX2KfhextjGrV3LB7nPqJl4bQDAEWAdR0yj9fz4QP nT0JT1zRf7eeSHEofeb9kgjzIs4MstwZQYwGqp3fC1Y3gmhZKfW11E2NYDsnglT0ecIM 882PsgFJd3F3AvOHXYWtsNZHUnM5QsI4jb18TNsifoZiUOjtlqt63ouSX2GZfoACledM F6iA== X-Gm-Message-State: ABuFfohkr5ES1LPb2zCOqBms6tILsi014csvzrqlVoKElzGhxXivtteK OYU5JYuS00AXynfCqeb0IKo= X-Google-Smtp-Source: ACcGV61XTeNiDNK2V6eHawrrXckMjKvA+XRLS/GepBM00yeYLWVLdvWPQ4NMIrsdXOwu1tGR3oQnjQ== X-Received: by 2002:a1c:e386:: with SMTP id a128-v6mr12922543wmh.106.1540126231803; Sun, 21 Oct 2018 05:50:31 -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.30 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 21 Oct 2018 05:50:31 -0700 (PDT) From: Kamal Heib To: Doug Ledford , Jason Gunthorpe Cc: linux-rdma@vger.kernel.org, kamalheib1@gmail.com Subject: [PATCH rdma-next v2 15/18] RDMA/usnic: Initialize ib_device_ops struct Date: Sun, 21 Oct 2018 15:49:50 +0300 Message-Id: <20181021124953.11558-16-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/usnic/usnic_ib_main.c | 61 +++++++++++++++-------------- 1 file changed, 32 insertions(+), 29 deletions(-) diff --git a/drivers/infiniband/hw/usnic/usnic_ib_main.c b/drivers/infiniband/hw/usnic/usnic_ib_main.c index 73bd00f8d2c8..2d6f0a804456 100644 --- a/drivers/infiniband/hw/usnic/usnic_ib_main.c +++ b/drivers/infiniband/hw/usnic/usnic_ib_main.c @@ -330,6 +330,37 @@ static void usnic_get_dev_fw_str(struct ib_device *device, char *str) snprintf(str, IB_FW_VERSION_NAME_MAX, "%s", info.fw_version); } +static const struct ib_device_ops usnic_dev_ops = { + .query_device = usnic_ib_query_device, + .query_port = usnic_ib_query_port, + .query_pkey = usnic_ib_query_pkey, + .query_gid = usnic_ib_query_gid, + .get_netdev = usnic_get_netdev, + .get_link_layer = usnic_ib_port_link_layer, + .alloc_pd = usnic_ib_alloc_pd, + .dealloc_pd = usnic_ib_dealloc_pd, + .create_qp = usnic_ib_create_qp, + .modify_qp = usnic_ib_modify_qp, + .query_qp = usnic_ib_query_qp, + .destroy_qp = usnic_ib_destroy_qp, + .create_cq = usnic_ib_create_cq, + .destroy_cq = usnic_ib_destroy_cq, + .reg_user_mr = usnic_ib_reg_mr, + .dereg_mr = usnic_ib_dereg_mr, + .alloc_ucontext = usnic_ib_alloc_ucontext, + .dealloc_ucontext = usnic_ib_dealloc_ucontext, + .mmap = usnic_ib_mmap, + .create_ah = usnic_ib_create_ah, + .destroy_ah = usnic_ib_destroy_ah, + .post_send = usnic_ib_post_send, + .post_recv = usnic_ib_post_recv, + .poll_cq = usnic_ib_poll_cq, + .req_notify_cq = usnic_ib_req_notify_cq, + .get_dma_mr = usnic_ib_get_dma_mr, + .get_port_immutable = usnic_port_immutable, + .get_dev_fw_str = usnic_get_dev_fw_str, +}; + /* Start of PF discovery section */ static void *usnic_ib_device_add(struct pci_dev *dev) { @@ -386,35 +417,7 @@ static void *usnic_ib_device_add(struct pci_dev *dev) (1ull << IB_USER_VERBS_CMD_DETACH_MCAST) | (1ull << IB_USER_VERBS_CMD_OPEN_QP); - us_ibdev->ib_dev.query_device = usnic_ib_query_device; - us_ibdev->ib_dev.query_port = usnic_ib_query_port; - us_ibdev->ib_dev.query_pkey = usnic_ib_query_pkey; - us_ibdev->ib_dev.query_gid = usnic_ib_query_gid; - us_ibdev->ib_dev.get_netdev = usnic_get_netdev; - us_ibdev->ib_dev.get_link_layer = usnic_ib_port_link_layer; - us_ibdev->ib_dev.alloc_pd = usnic_ib_alloc_pd; - us_ibdev->ib_dev.dealloc_pd = usnic_ib_dealloc_pd; - us_ibdev->ib_dev.create_qp = usnic_ib_create_qp; - us_ibdev->ib_dev.modify_qp = usnic_ib_modify_qp; - us_ibdev->ib_dev.query_qp = usnic_ib_query_qp; - us_ibdev->ib_dev.destroy_qp = usnic_ib_destroy_qp; - us_ibdev->ib_dev.create_cq = usnic_ib_create_cq; - us_ibdev->ib_dev.destroy_cq = usnic_ib_destroy_cq; - us_ibdev->ib_dev.reg_user_mr = usnic_ib_reg_mr; - us_ibdev->ib_dev.dereg_mr = usnic_ib_dereg_mr; - us_ibdev->ib_dev.alloc_ucontext = usnic_ib_alloc_ucontext; - us_ibdev->ib_dev.dealloc_ucontext = usnic_ib_dealloc_ucontext; - us_ibdev->ib_dev.mmap = usnic_ib_mmap; - us_ibdev->ib_dev.create_ah = usnic_ib_create_ah; - us_ibdev->ib_dev.destroy_ah = usnic_ib_destroy_ah; - us_ibdev->ib_dev.post_send = usnic_ib_post_send; - us_ibdev->ib_dev.post_recv = usnic_ib_post_recv; - us_ibdev->ib_dev.poll_cq = usnic_ib_poll_cq; - us_ibdev->ib_dev.req_notify_cq = usnic_ib_req_notify_cq; - us_ibdev->ib_dev.get_dma_mr = usnic_ib_get_dma_mr; - us_ibdev->ib_dev.get_port_immutable = usnic_port_immutable; - us_ibdev->ib_dev.get_dev_fw_str = usnic_get_dev_fw_str; - + ib_set_device_ops(&us_ibdev->ib_dev, &usnic_dev_ops); us_ibdev->ib_dev.driver_id = RDMA_DRIVER_USNIC; rdma_set_device_sysfs_group(&us_ibdev->ib_dev, &usnic_attr_group);