From patchwork Sun Dec 11 12:58:05 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matan Barak X-Patchwork-Id: 9469749 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 7E7F960476 for ; Sun, 11 Dec 2016 12:58:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 786BB2847B for ; Sun, 11 Dec 2016 12:58:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6D19028499; Sun, 11 Dec 2016 12:58: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=-6.9 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY 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 DA4722847B for ; Sun, 11 Dec 2016 12:58:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753633AbcLKM6z (ORCPT ); Sun, 11 Dec 2016 07:58:55 -0500 Received: from mail-il-dmz.mellanox.com ([193.47.165.129]:57704 "EHLO mellanox.co.il" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753502AbcLKM6y (ORCPT ); Sun, 11 Dec 2016 07:58:54 -0500 Received: from Internal Mail-Server by MTLPINE1 (envelope-from matanb@mellanox.com) with ESMTPS (AES256-SHA encrypted); 11 Dec 2016 14:58:43 +0200 Received: from gen-l-vrt-078.mtl.labs.mlnx. (gen-l-vrt-078.mtl.labs.mlnx [10.137.78.1]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id uBBCwVO3018366; Sun, 11 Dec 2016 14:58:43 +0200 From: Matan Barak To: linux-rdma@vger.kernel.org Cc: Doug Ledford , Jason Gunthorpe , Sean Hefty , Christoph Lameter , Liran Liss , Haggai Eran , Majd Dibbiny , Matan Barak , Tal Alon , Leon Romanovsky Subject: [RFC ABI V6 11/14] IB/mlx5: Implement common uverb objects Date: Sun, 11 Dec 2016 14:58:05 +0200 Message-Id: <1481461088-56355-12-git-send-email-matanb@mellanox.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1481461088-56355-1-git-send-email-matanb@mellanox.com> References: <1481461088-56355-1-git-send-email-matanb@mellanox.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 This patch simply tells mlx5 to use the uverb objects declared by the common layer. Signed-off-by: Matan Barak --- drivers/infiniband/hw/mlx5/main.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c index a10b203..4e739e7 100644 --- a/drivers/infiniband/hw/mlx5/main.c +++ b/drivers/infiniband/hw/mlx5/main.c @@ -51,6 +51,7 @@ #include #include #include +#include #include #include #include @@ -2919,8 +2920,6 @@ free: return ARRAY_SIZE(names); } -DECLARE_UVERBS_TYPES_GROUP(root, &uverbs_common_types); - static void *mlx5_ib_add(struct mlx5_core_dev *mdev) { struct mlx5_ib_dev *dev; @@ -2929,6 +2928,10 @@ static void *mlx5_ib_add(struct mlx5_core_dev *mdev) const char *name; int err; int i; + static const struct uverbs_root_spec root_spec[] = { + [0] = {.types = &uverbs_common_types, + .group_id = 0}, + }; port_type_cap = MLX5_CAP_GEN(mdev, port_type); ll = mlx5_port_type_cap_to_rdma_ll(port_type_cap); @@ -3131,10 +3134,15 @@ static void *mlx5_ib_add(struct mlx5_core_dev *mdev) if (err) goto err_odp; - dev->ib_dev.specs_root = (struct uverbs_root *)&root; + dev->ib_dev.specs_root = + uverbs_alloc_spec_tree(ARRAY_SIZE(root_spec), + root_spec); + if (IS_ERR(dev->ib_dev.specs_root)) + goto err_q_cnt; + err = ib_register_device(&dev->ib_dev, NULL); if (err) - goto err_q_cnt; + goto err_alloc_spec_tree; err = create_umr_res(dev); if (err) @@ -3157,6 +3165,9 @@ err_umrc: err_dev: ib_unregister_device(&dev->ib_dev); +err_alloc_spec_tree: + uverbs_specs_free(dev->ib_dev.specs_root); + err_q_cnt: mlx5_ib_dealloc_q_counters(dev); @@ -3188,6 +3199,7 @@ static void mlx5_ib_remove(struct mlx5_core_dev *mdev, void *context) mlx5_remove_roce_notifier(dev); ib_unregister_device(&dev->ib_dev); + uverbs_specs_free(dev->ib_dev.specs_root); mlx5_ib_dealloc_q_counters(dev); destroy_umrc_res(dev); mlx5_ib_odp_remove_one(dev);