From patchwork Mon Nov 5 11:35:12 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kamal Heib X-Patchwork-Id: 10667873 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 1A78C1751 for ; Mon, 5 Nov 2018 11:35:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 09C7F29702 for ; Mon, 5 Nov 2018 11:35:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F220129782; Mon, 5 Nov 2018 11:35:52 +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 813F829702 for ; Mon, 5 Nov 2018 11:35:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728136AbeKEUzI (ORCPT ); Mon, 5 Nov 2018 15:55:08 -0500 Received: from mail-wr1-f66.google.com ([209.85.221.66]:35966 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726319AbeKEUzI (ORCPT ); Mon, 5 Nov 2018 15:55:08 -0500 Received: by mail-wr1-f66.google.com with SMTP id z13-v6so6730894wrs.3 for ; Mon, 05 Nov 2018 03:35:49 -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=by4oIX+K0v9Ndrzl5ZtvDtVpo6rGPJomx318zbkwPhU=; b=e2sRnMKbZApu19zQ/C8EkQnt7nFDlyaNkdyeN8J8jvdB247FXeEg6/xup1SZrbbBjF f0Br+JepsozWCqwgJo+bjmnhoABUdqN6ehS3a7+Ab/XV/SAFSAUS2Arevl8Gq/piq6W5 57Q96imTmcupdPUQK18y3Hchad6HaqMsW+n0WNsR45aHw1YzfSbb/mWorQmobQFQfqgQ 1ahonH6LfpgJ7f/SOf2stkq0ByVA9y/OcYVXBak2SO7TQ9XEi6ri8oGp1QpSowjiq75y Fpd/sHGyZhyO4d4qUnQl9DrenR0GMUQRwzCi6Klyq2M9Z4ju86pUxOjuDYKbJudno2dq UCBg== 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=by4oIX+K0v9Ndrzl5ZtvDtVpo6rGPJomx318zbkwPhU=; b=KPdSP7x6ss2ktJDYpXKF/uV1vwULRHGVvZNoNaEdb+M7BI+x40pDrs3MA+vs7/K5xJ Z2eZN6Anm36VDRA4ATEZZRovAV4eFVHaStGUfc+wbkaM/CydorzggAHuXCEKJqTGt4Yv 7TDHg404bgMcDOZb6iW3SxBM8Kq0WW/TIdIU8pbgNzAKwfRuvANax+ziKQcsu28NM9tl /ebscfhKsP1g9RsflrcTp+3XgaWpSy+/6YoOVsmD4wFyjtY6ywiuV0M+HiKgbUUjs1TF 8lFDdaVZ5JV4DfnAvF9vnPKPZ/EYmb8b3t31oRqxpTxA19CKHfEAxAIz2w9n7k0nV03F DJ+g== X-Gm-Message-State: AGRZ1gIpsQ3Hkz27uckpDat0om0E+UsiV/tbM4nnVIbyvqXm8uLOqxby LBdbHDRC7u+6lMwDGS7Qpuw= X-Google-Smtp-Source: AJdET5fvbX92CFMSOOw216klFGT6Pc0fHb+Wh3Kyp8Mm6V61dPSp/mSEEcyEYiqHr5AicZ3W1Uwm0g== X-Received: by 2002:adf:93e6:: with SMTP id 93-v6mr18025976wrp.311.1541417749200; Mon, 05 Nov 2018 03:35:49 -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.47 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 05 Nov 2018 03:35:48 -0800 (PST) From: Kamal Heib To: Doug Ledford , Jason Gunthorpe Cc: linux-rdma@vger.kernel.org, kamalheib1@gmail.com Subject: [PATCH rdma-next v3 04/20] RDMA/cxgb4: Initialize ib_device_ops struct Date: Mon, 5 Nov 2018 13:35:12 +0200 Message-Id: <20181105113528.8317-5-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/cxgb4/provider.c | 86 ++++++++++++++++++++-------------- 1 file changed, 51 insertions(+), 35 deletions(-) diff --git a/drivers/infiniband/hw/cxgb4/provider.c b/drivers/infiniband/hw/cxgb4/provider.c index cbb3c0ddd990..604cc03e105a 100644 --- a/drivers/infiniband/hw/cxgb4/provider.c +++ b/drivers/infiniband/hw/cxgb4/provider.c @@ -531,6 +531,56 @@ static int fill_res_entry(struct sk_buff *msg, struct rdma_restrack_entry *res) c4iw_restrack_funcs[res->type](msg, res) : 0; } +static const struct ib_device_ops c4iw_dev_ops = { + /* Device operations */ + .query_device = c4iw_query_device, + .get_dev_fw_str = get_dev_fw_str, + /* Port operations */ + .query_port = c4iw_query_port, + .get_port_immutable = c4iw_port_immutable, + .get_netdev = get_netdev, + /* PKey operations */ + .query_pkey = c4iw_query_pkey, + /* GID operations */ + .query_gid = c4iw_query_gid, + /* Ucontext operations */ + .alloc_ucontext = c4iw_alloc_ucontext, + .dealloc_ucontext = c4iw_dealloc_ucontext, + .mmap = c4iw_mmap, + /* PD operations */ + .alloc_pd = c4iw_allocate_pd, + .dealloc_pd = c4iw_deallocate_pd, + /* QP operations */ + .create_qp = c4iw_create_qp, + .modify_qp = c4iw_ib_modify_qp, + .query_qp = c4iw_ib_query_qp, + .destroy_qp = c4iw_destroy_qp, + .post_send = c4iw_post_send, + .post_recv = c4iw_post_receive, + /* SRQ operations */ + .create_srq = c4iw_create_srq, + .modify_srq = c4iw_modify_srq, + .destroy_srq = c4iw_destroy_srq, + .post_srq_recv = c4iw_post_srq_recv, + /* CQ operations */ + .create_cq = c4iw_create_cq, + .destroy_cq = c4iw_destroy_cq, + .poll_cq = c4iw_poll_cq, + .req_notify_cq = c4iw_arm_cq, + /* MR operations */ + .get_dma_mr = c4iw_get_dma_mr, + .reg_user_mr = c4iw_reg_user_mr, + .dereg_mr = c4iw_dereg_mr, + .alloc_mr = c4iw_alloc_mr, + .map_mr_sg = c4iw_map_mr_sg, + /* MW operations */ + .alloc_mw = c4iw_alloc_mw, + .dealloc_mw = c4iw_dealloc_mw, + /* Stats operations */ + .alloc_hw_stats = c4iw_alloc_stats, + .get_hw_stats = c4iw_get_mib, +}; + void c4iw_register_device(struct work_struct *work) { int ret; @@ -573,42 +623,7 @@ void c4iw_register_device(struct work_struct *work) dev->ibdev.phys_port_cnt = dev->rdev.lldi.nports; dev->ibdev.num_comp_vectors = dev->rdev.lldi.nciq; dev->ibdev.dev.parent = &dev->rdev.lldi.pdev->dev; - dev->ibdev.query_device = c4iw_query_device; - dev->ibdev.query_port = c4iw_query_port; - dev->ibdev.query_pkey = c4iw_query_pkey; - dev->ibdev.query_gid = c4iw_query_gid; - dev->ibdev.alloc_ucontext = c4iw_alloc_ucontext; - dev->ibdev.dealloc_ucontext = c4iw_dealloc_ucontext; - dev->ibdev.mmap = c4iw_mmap; - dev->ibdev.alloc_pd = c4iw_allocate_pd; - dev->ibdev.dealloc_pd = c4iw_deallocate_pd; - dev->ibdev.create_qp = c4iw_create_qp; - dev->ibdev.modify_qp = c4iw_ib_modify_qp; - dev->ibdev.query_qp = c4iw_ib_query_qp; - dev->ibdev.destroy_qp = c4iw_destroy_qp; - dev->ibdev.create_srq = c4iw_create_srq; - dev->ibdev.modify_srq = c4iw_modify_srq; - dev->ibdev.destroy_srq = c4iw_destroy_srq; - dev->ibdev.create_cq = c4iw_create_cq; - dev->ibdev.destroy_cq = c4iw_destroy_cq; - dev->ibdev.poll_cq = c4iw_poll_cq; - dev->ibdev.get_dma_mr = c4iw_get_dma_mr; - dev->ibdev.reg_user_mr = c4iw_reg_user_mr; - dev->ibdev.dereg_mr = c4iw_dereg_mr; - dev->ibdev.alloc_mw = c4iw_alloc_mw; - dev->ibdev.dealloc_mw = c4iw_dealloc_mw; - dev->ibdev.alloc_mr = c4iw_alloc_mr; - dev->ibdev.map_mr_sg = c4iw_map_mr_sg; - dev->ibdev.req_notify_cq = c4iw_arm_cq; - dev->ibdev.post_send = c4iw_post_send; - dev->ibdev.post_recv = c4iw_post_receive; - dev->ibdev.post_srq_recv = c4iw_post_srq_recv; - dev->ibdev.alloc_hw_stats = c4iw_alloc_stats; - dev->ibdev.get_hw_stats = c4iw_get_mib; dev->ibdev.uverbs_abi_ver = C4IW_UVERBS_ABI_VERSION; - dev->ibdev.get_port_immutable = c4iw_port_immutable; - dev->ibdev.get_dev_fw_str = get_dev_fw_str; - dev->ibdev.get_netdev = get_netdev; dev->ibdev.iwcm = kmalloc(sizeof(struct iw_cm_verbs), GFP_KERNEL); if (!dev->ibdev.iwcm) { @@ -630,6 +645,7 @@ void c4iw_register_device(struct work_struct *work) rdma_set_device_sysfs_group(&dev->ibdev, &c4iw_attr_group); dev->ibdev.driver_id = RDMA_DRIVER_CXGB4; + ib_set_device_ops(&dev->ibdev, &c4iw_dev_ops); ret = ib_register_device(&dev->ibdev, "cxgb4_%d", NULL); if (ret) goto err_kfree_iwcm;