From patchwork Mon Nov 5 11:35:23 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kamal Heib X-Patchwork-Id: 10667895 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 D7EE815A6 for ; Mon, 5 Nov 2018 11:36:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C70BF28DB6 for ; Mon, 5 Nov 2018 11:36:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B99CD29789; Mon, 5 Nov 2018 11:36:06 +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 4C7CD28DB6 for ; Mon, 5 Nov 2018 11:36:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727254AbeKEUzW (ORCPT ); Mon, 5 Nov 2018 15:55:22 -0500 Received: from mail-wm1-f68.google.com ([209.85.128.68]:33450 "EHLO mail-wm1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728245AbeKEUzW (ORCPT ); Mon, 5 Nov 2018 15:55:22 -0500 Received: by mail-wm1-f68.google.com with SMTP id f19-v6so6183201wmb.0 for ; Mon, 05 Nov 2018 03:36:04 -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=sLhblML80PBywa984eWyr9qdpvHVjojg1Z4DNMQb7Pc=; b=dRN/TAnrMUmnGQqLvFj65pUE+vcz0KgI5oV9HA6e4YcraRnAytN332P7OpN/VAx+1T +wRTHXREGEkVoDhMLIC2TO3xrZEc2c5VJaQFSujmkGxh+P2fasx4kHeWZxes5MYCa4vP MdSi8RW1gMXIIGFWbnShuOiTMJxxcOUHx9TBuku0pmLFP4XVH4JWLSKHUe+ES1GK8rmU MLHuef8c95fTIzji0wxFGVn5amq5A5RpWqRkxnJ+Xb70qYo5k2wkP3daKE/nlzNsvwlb DMjXU8Z8mwaRTNzVDbO5gL3h8AR4AgfJ5W1DfOG7gno2Nl392kKAtpPjkEqCS7fPJmg4 NQRg== 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=sLhblML80PBywa984eWyr9qdpvHVjojg1Z4DNMQb7Pc=; b=NPy/vk92AaegHS6TVltrge3FZ1FmajQNI++8QRXGBm2k7ZiG9Hvvu8n0U8/W4pt1mC HJKmrz260KHN+YPto/yQhN9evz9J3azPTAH9X3jXokFPI0CsQq3iTiIbd/ZvOvIuNhye 58RclG+XI4EKXLIcrrwp+rctOLa76HmWDLqHDuXqBDk9H9Kk9Df16W6Q9imIUqfCT1tG TnDS6QaiBp2iO4ya3uw39gOx8QA2CNDFCOC2fifcDEcaDO9nChMJLSaMUTQQlMn0Pgs9 57P86Od4KmiwphY8dMVt0Z4Ci1lj3E5OiWjM6JGjhK561V7pool88HL7pWm3DPIdYREA rPIw== X-Gm-Message-State: AGRZ1gL5hBqlmP0iO9HDPSFd+dpedbnF61+/FKeeUHndT4xKloP95Al4 kk/OqWWHDMxW/gP6ZLU6yig= X-Google-Smtp-Source: AJdET5f6UrNGDAO5PUIhXzsvNQCsBi1pFdZBGV5XF1sMi1CMF678xXJkc5VcTRhB1pAb7gwq1e+ycA== X-Received: by 2002:a1c:3d03:: with SMTP id k3-v6mr6259825wma.90.1541417763697; Mon, 05 Nov 2018 03:36:03 -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.36.02 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 05 Nov 2018 03:36:03 -0800 (PST) From: Kamal Heib To: Doug Ledford , Jason Gunthorpe Cc: linux-rdma@vger.kernel.org, kamalheib1@gmail.com Subject: [PATCH rdma-next v3 15/20] RDMA/usnic: Initialize ib_device_ops struct Date: Mon, 5 Nov 2018 13:35:23 +0200 Message-Id: <20181105113528.8317-16-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/usnic/usnic_ib_main.c | 71 +++++++++++++++++------------ 1 file changed, 42 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..e369072c0d89 100644 --- a/drivers/infiniband/hw/usnic/usnic_ib_main.c +++ b/drivers/infiniband/hw/usnic/usnic_ib_main.c @@ -330,6 +330,47 @@ 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 = { + /* Device operations */ + .query_device = usnic_ib_query_device, + .get_dev_fw_str = usnic_get_dev_fw_str, + /* Port operations */ + .query_port = usnic_ib_query_port, + .get_netdev = usnic_get_netdev, + .get_link_layer = usnic_ib_port_link_layer, + .get_port_immutable = usnic_port_immutable, + /* PKey operations */ + .query_pkey = usnic_ib_query_pkey, + /* GID operations */ + .query_gid = usnic_ib_query_gid, + /* PD operations */ + .alloc_pd = usnic_ib_alloc_pd, + .dealloc_pd = usnic_ib_dealloc_pd, + /* QP operations */ + .create_qp = usnic_ib_create_qp, + .modify_qp = usnic_ib_modify_qp, + .query_qp = usnic_ib_query_qp, + .destroy_qp = usnic_ib_destroy_qp, + .post_send = usnic_ib_post_send, + .post_recv = usnic_ib_post_recv, + /* CQ operations */ + .create_cq = usnic_ib_create_cq, + .destroy_cq = usnic_ib_destroy_cq, + .poll_cq = usnic_ib_poll_cq, + .req_notify_cq = usnic_ib_req_notify_cq, + /* MR operations */ + .reg_user_mr = usnic_ib_reg_mr, + .dereg_mr = usnic_ib_dereg_mr, + .get_dma_mr = usnic_ib_get_dma_mr, + /* Ucontext operations */ + .alloc_ucontext = usnic_ib_alloc_ucontext, + .dealloc_ucontext = usnic_ib_dealloc_ucontext, + .mmap = usnic_ib_mmap, + /* AH operations */ + .create_ah = usnic_ib_create_ah, + .destroy_ah = usnic_ib_destroy_ah, +}; + /* Start of PF discovery section */ static void *usnic_ib_device_add(struct pci_dev *dev) { @@ -386,35 +427,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);