From patchwork Mon Nov 5 11:35:20 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kamal Heib X-Patchwork-Id: 10667889 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 5405F1751 for ; Mon, 5 Nov 2018 11:36:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4408928DB6 for ; Mon, 5 Nov 2018 11:36:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3866229789; Mon, 5 Nov 2018 11:36:04 +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 B2C5528DB6 for ; Mon, 5 Nov 2018 11:36:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727040AbeKEUzT (ORCPT ); Mon, 5 Nov 2018 15:55:19 -0500 Received: from mail-wm1-f68.google.com ([209.85.128.68]:54346 "EHLO mail-wm1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727254AbeKEUzT (ORCPT ); Mon, 5 Nov 2018 15:55:19 -0500 Received: by mail-wm1-f68.google.com with SMTP id r63-v6so7971878wma.4 for ; Mon, 05 Nov 2018 03:36:00 -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=24PJiZerf6fsgbfkXBmjpaUTa/R8Hi6q+t1lRBcVqrY=; b=jYSpOVVg79vwfuUO5q0yOiSSFwwDJxuNObvppyOiNDCkcpaD7QsAqCcSGUgaaxuUrO 8NdPQeHQ7hziXNhmeZfLUzLxLdKqetiPTgoJqVhTemY9yUIz0wdQVAu13wAZic5cAaIr U3oa8Gilge9kOBuwV+E3GJUxiWAtPUb0zXJpPMch5nlxU6UbEEqcLwZBS0n8Rg52NwbV ZfuCGyNVYZQZHFOSd+Lo+Ob42C6cPJGwNsqw2NBUg0/KzXXrX8bbspjJ+jkwn/oh10fS ftgmYx9vP/RxfGeLuSBlhc2OqXvHFYPGqbKzxogiB56w8gVjyHfHhd5NnyIkANxwc/hx 69EQ== 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=24PJiZerf6fsgbfkXBmjpaUTa/R8Hi6q+t1lRBcVqrY=; b=FgSOhvrt7LjlTUB07Vn0MSTdfGYmNwGg3pDyC0gon9lx3TLw3YLCPqeRq8TuaDuDez 1TyDuFr0hM7OGHkWSNjjGpBf4Na7onBRASC6+gPADD1S/Ov8maG4MT/wT+XVbCNnSS6a ypkN2UVMi90U7tJvwojLVqGEN3HNpgsCrPmPiG8+IBm6az9LAsDyyFWXBLaS6bUdOGvr xBX3TGKPI1msbnG3Hxj+hSNTQ2F1JVA5y/NGQfB86wJ3liNNt5TvxErc8H0XMqEvsv44 LnpW6SQSe5isY+eYT2UF7y98inCas/n1OCr1xexz+NTXhjtNuTVZmN+XQj8Qq5UsPykU SMQg== X-Gm-Message-State: AGRZ1gKPauIMvPnT/rxHu/4U8cAX2BjbYvASmPLv+PLMM2BwbQWTZHt3 q1aIOA/7/oFxNlvz6I8rquQ= X-Google-Smtp-Source: AJdET5cifJbyDZuvROiUBuKyGAuESpLYpooWw5uCLPEgzlzcPXVYP2w12BmkRlD/lW3qGo3wTfV23w== X-Received: by 2002:a1c:2345:: with SMTP id j66-v6mr5818914wmj.79.1541417759843; Mon, 05 Nov 2018 03:35:59 -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.58 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 05 Nov 2018 03:35:59 -0800 (PST) From: Kamal Heib To: Doug Ledford , Jason Gunthorpe Cc: linux-rdma@vger.kernel.org, kamalheib1@gmail.com Subject: [PATCH rdma-next v3 12/20] RDMA/ocrdma: Initialize ib_device_ops struct Date: Mon, 5 Nov 2018 13:35:20 +0200 Message-Id: <20181105113528.8317-13-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/ocrdma/ocrdma_main.c | 102 ++++++++++++++++------------- 1 file changed, 56 insertions(+), 46 deletions(-) diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_main.c b/drivers/infiniband/hw/ocrdma/ocrdma_main.c index 873cc7f6fe61..a9ee7d1b2ca5 100644 --- a/drivers/infiniband/hw/ocrdma/ocrdma_main.c +++ b/drivers/infiniband/hw/ocrdma/ocrdma_main.c @@ -143,6 +143,60 @@ static const struct attribute_group ocrdma_attr_group = { .attrs = ocrdma_attributes, }; +static const struct ib_device_ops ocrdma_dev_ops = { + /* Device operations */ + .query_device = ocrdma_query_device, + .get_dev_fw_str = get_dev_fw_str, + /* Port operations */ + .query_port = ocrdma_query_port, + .modify_port = ocrdma_modify_port, + .get_netdev = ocrdma_get_netdev, + .get_link_layer = ocrdma_link_layer, + .get_port_immutable = ocrdma_port_immutable, + /* PD operations */ + .alloc_pd = ocrdma_alloc_pd, + .dealloc_pd = ocrdma_dealloc_pd, + /* CQ operations */ + .create_cq = ocrdma_create_cq, + .destroy_cq = ocrdma_destroy_cq, + .resize_cq = ocrdma_resize_cq, + .poll_cq = ocrdma_poll_cq, + .req_notify_cq = ocrdma_arm_cq, + /* QP operations */ + .create_qp = ocrdma_create_qp, + .modify_qp = ocrdma_modify_qp, + .query_qp = ocrdma_query_qp, + .destroy_qp = ocrdma_destroy_qp, + .post_send = ocrdma_post_send, + .post_recv = ocrdma_post_recv, + /* PKey operations */ + .query_pkey = ocrdma_query_pkey, + /* AH operations */ + .create_ah = ocrdma_create_ah, + .destroy_ah = ocrdma_destroy_ah, + .query_ah = ocrdma_query_ah, + /* MR operations */ + .get_dma_mr = ocrdma_get_dma_mr, + .dereg_mr = ocrdma_dereg_mr, + .reg_user_mr = ocrdma_reg_user_mr, + .alloc_mr = ocrdma_alloc_mr, + .map_mr_sg = ocrdma_map_mr_sg, + /* Ucontext operations */ + .alloc_ucontext = ocrdma_alloc_ucontext, + .dealloc_ucontext = ocrdma_dealloc_ucontext, + .mmap = ocrdma_mmap, + /* MAD operations */ + .process_mad = ocrdma_process_mad, +}; + +static const struct ib_device_ops ocrdma_dev_srq_ops = { + .create_srq = ocrdma_create_srq, + .modify_srq = ocrdma_modify_srq, + .query_srq = ocrdma_query_srq, + .destroy_srq = ocrdma_destroy_srq, + .post_srq_recv = ocrdma_post_srq_recv, +}; + static int ocrdma_register_device(struct ocrdma_dev *dev) { ocrdma_get_guid(dev, (u8 *)&dev->ibdev.node_guid); @@ -182,50 +236,10 @@ static int ocrdma_register_device(struct ocrdma_dev *dev) dev->ibdev.phys_port_cnt = 1; dev->ibdev.num_comp_vectors = dev->eq_cnt; - /* mandatory verbs. */ - dev->ibdev.query_device = ocrdma_query_device; - dev->ibdev.query_port = ocrdma_query_port; - dev->ibdev.modify_port = ocrdma_modify_port; - dev->ibdev.get_netdev = ocrdma_get_netdev; - dev->ibdev.get_link_layer = ocrdma_link_layer; - dev->ibdev.alloc_pd = ocrdma_alloc_pd; - dev->ibdev.dealloc_pd = ocrdma_dealloc_pd; - - dev->ibdev.create_cq = ocrdma_create_cq; - dev->ibdev.destroy_cq = ocrdma_destroy_cq; - dev->ibdev.resize_cq = ocrdma_resize_cq; - - dev->ibdev.create_qp = ocrdma_create_qp; - dev->ibdev.modify_qp = ocrdma_modify_qp; - dev->ibdev.query_qp = ocrdma_query_qp; - dev->ibdev.destroy_qp = ocrdma_destroy_qp; - - dev->ibdev.query_pkey = ocrdma_query_pkey; - dev->ibdev.create_ah = ocrdma_create_ah; - dev->ibdev.destroy_ah = ocrdma_destroy_ah; - dev->ibdev.query_ah = ocrdma_query_ah; - - dev->ibdev.poll_cq = ocrdma_poll_cq; - dev->ibdev.post_send = ocrdma_post_send; - dev->ibdev.post_recv = ocrdma_post_recv; - dev->ibdev.req_notify_cq = ocrdma_arm_cq; - - dev->ibdev.get_dma_mr = ocrdma_get_dma_mr; - dev->ibdev.dereg_mr = ocrdma_dereg_mr; - dev->ibdev.reg_user_mr = ocrdma_reg_user_mr; - - dev->ibdev.alloc_mr = ocrdma_alloc_mr; - dev->ibdev.map_mr_sg = ocrdma_map_mr_sg; - /* mandatory to support user space verbs consumer. */ - dev->ibdev.alloc_ucontext = ocrdma_alloc_ucontext; - dev->ibdev.dealloc_ucontext = ocrdma_dealloc_ucontext; - dev->ibdev.mmap = ocrdma_mmap; dev->ibdev.dev.parent = &dev->nic_info.pdev->dev; - dev->ibdev.process_mad = ocrdma_process_mad; - dev->ibdev.get_port_immutable = ocrdma_port_immutable; - dev->ibdev.get_dev_fw_str = get_dev_fw_str; + ib_set_device_ops(&dev->ibdev, &ocrdma_dev_ops); if (ocrdma_get_asic_type(dev) == OCRDMA_ASIC_GEN_SKH_R) { dev->ibdev.uverbs_cmd_mask |= @@ -235,11 +249,7 @@ static int ocrdma_register_device(struct ocrdma_dev *dev) OCRDMA_UVERBS(DESTROY_SRQ) | OCRDMA_UVERBS(POST_SRQ_RECV); - dev->ibdev.create_srq = ocrdma_create_srq; - dev->ibdev.modify_srq = ocrdma_modify_srq; - dev->ibdev.query_srq = ocrdma_query_srq; - dev->ibdev.destroy_srq = ocrdma_destroy_srq; - dev->ibdev.post_srq_recv = ocrdma_post_srq_recv; + ib_set_device_ops(&dev->ibdev, &ocrdma_dev_srq_ops); } rdma_set_device_sysfs_group(&dev->ibdev, &ocrdma_attr_group); dev->ibdev.driver_id = RDMA_DRIVER_OCRDMA;