From patchwork Mon Jan 8 21:26:29 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Gunthorpe X-Patchwork-Id: 10150595 X-Patchwork-Delegate: leon@leon.nu 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 2494160210 for ; Mon, 8 Jan 2018 21:26:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 21F9228449 for ; Mon, 8 Jan 2018 21:26:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 16DAE284B5; Mon, 8 Jan 2018 21:26:51 +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.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID 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 8A7B928449 for ; Mon, 8 Jan 2018 21:26:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754183AbeAHV0s (ORCPT ); Mon, 8 Jan 2018 16:26:48 -0500 Received: from mail-wm0-f66.google.com ([74.125.82.66]:46397 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753964AbeAHV0p (ORCPT ); Mon, 8 Jan 2018 16:26:45 -0500 Received: by mail-wm0-f66.google.com with SMTP id r78so16802589wme.5 for ; Mon, 08 Jan 2018 13:26:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Bl54CAJmqpY5qhQGpAfmGnV+znoeoKeXVl15qOhE2gA=; b=TN7u+1gsBXosUwY83uhvTXMq744qzkKYu56bMLC0Dn0wdMYB0uLsoQSqdJc35XE+SL hVG5PoJMexys9XMIyc7E04xJGY5zL3Ke2DGfoU1MGZdgMqKoffAHDk5EaXSSM/spkt/N 6gcqN23+o6557f3XNMD308GLDly523ey8bGjbYwHg2t1j3i9ZpJd5kIr+KQbWYXMuYMa zmTunPo4V1qCswXjYE+wWC3g87hv+MfMgTUuw8XXdjHRm+eYnBtJ22ICdLOBpgShMlMU CEu/3rGZDntDGrKN96AJUuFrmVHuV4sC50DDI3ysbjoz0DQT3bR07MlbcuZ+L1TeBn0r /8hg== 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=Bl54CAJmqpY5qhQGpAfmGnV+znoeoKeXVl15qOhE2gA=; b=mPx+Jnlo3FpbYRWYsAFEq+hHRI7J6e6dTmnLUMoFYkWEmnNTP7TrLsTn9x+6d0T+cV wcRI+AehVWoBKzPFqyOe4buOzM7pJIjy91GXQINxO/EyJPsoSiQxcAGmRWUnUzYwvsaM /HvpZfQxaEXlSbSR7/dTB8Qf+GHrJLzvS9EDvwxHNQCTNHi8rq/kOjAwzKsxIIT6xA4U DALuJBl8R2eHEah1ypgW+LBxjJUyJ4LODC1KDspSUHnIJZ2gkXOHY63LyNGjLb9iwnQD WugHcykcEQdNhcKonMAQONA+ujB58DnX0/+qU+KgqPf3Yco1mb3Q0L+KeYdoU+iRfoA0 VeUw== X-Gm-Message-State: AKGB3mJtnP0KK/agPn/k/J7WCb3HhcMdfANmsSVFtiOQdjmhE7OcNfY0 +I2rTB7Nnr+gBSZ0tZcMj3gjjTWup9c= X-Google-Smtp-Source: ACJfBou1EGXIonOFeJQib+yysfkJlFwtillp23eKY8+XT0mjM97GH2e5KkOHuxL55qxvc0NnxuNV/g== X-Received: by 10.28.59.133 with SMTP id i127mr9368645wma.74.1515446804368; Mon, 08 Jan 2018 13:26:44 -0800 (PST) Received: from ziepe.ca (S010614cc2056d97f.ed.shawcable.net. [70.74.179.152]) by smtp.gmail.com with ESMTPSA id m68sm17173526wmi.28.2018.01.08.13.26.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 08 Jan 2018 13:26:42 -0800 (PST) Received: from jgg by mlx.ziepe.ca with local (Exim 4.86_2) (envelope-from ) id 1eYewJ-0001Oc-SV; Mon, 08 Jan 2018 14:26:39 -0700 From: Jason Gunthorpe To: linux-rdma@vger.kernel.org Cc: Jason Gunthorpe , Doug Ledford , Yishai Hadas , Devesh Sharma Subject: [PATCH 5/8] verbs: Remove init_context/uninit_context Date: Mon, 8 Jan 2018 14:26:29 -0700 Message-Id: <20180108212632.5183-6-jgg@ziepe.ca> X-Mailer: git-send-email 2.15.1 In-Reply-To: <20180108212632.5183-1-jgg@ziepe.ca> References: <20180108212632.5183-1-jgg@ziepe.ca> 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 From: Jason Gunthorpe All providers now use the alloc_context interface and support verbs_context. Remove the dead code. Signed-off-by: Jason Gunthorpe Reviewed-By: Devesh Sharma --- libibverbs/device.c | 39 ++------------------------------------- libibverbs/driver.h | 9 --------- providers/bnxt_re/main.c | 4 ---- providers/mlx4/mlx4.c | 4 ---- providers/mlx5/mlx5.c | 4 ---- 5 files changed, 2 insertions(+), 58 deletions(-) diff --git a/libibverbs/device.c b/libibverbs/device.c index e42e37bd0a1f8d..db6dae5b25af59 100644 --- a/libibverbs/device.c +++ b/libibverbs/device.c @@ -259,29 +259,6 @@ err_free: return NULL; } -/* Use the init_context flow to create a verbs_context */ -static struct verbs_context *alloc_context(struct verbs_device *device, - int cmd_fd) -{ - struct verbs_context *context; - - context = _verbs_init_and_alloc_context( - &device->device, cmd_fd, - sizeof(*context) + device->size_of_context, NULL); - if (!context) - return NULL; - - if (device->ops->init_context(device, &context->context, cmd_fd)) - goto err_uninit; - - return context; - -err_uninit: - verbs_uninit_context(context); - free(context); - return NULL; -} - LATEST_SYMVER_FUNC(ibv_open_device, 1_1, "IBVERBS_1.1", struct ibv_context *, struct ibv_device *device) @@ -304,15 +281,11 @@ LATEST_SYMVER_FUNC(ibv_open_device, 1_1, "IBVERBS_1.1", if (cmd_fd < 0) return NULL; - if (!verbs_device->ops->init_context) - context_ex = verbs_device->ops->alloc_context(device, cmd_fd); - else - context_ex = alloc_context(verbs_device, cmd_fd); - /* * cmd_fd ownership is transferred into alloc_context, if it fails * then it closes cmd_fd and returns NULL */ + context_ex = verbs_device->ops->alloc_context(device, cmd_fd); if (context_ex == NULL) return NULL; @@ -338,15 +311,7 @@ LATEST_SYMVER_FUNC(ibv_close_device, 1_1, "IBVERBS_1.1", { struct verbs_device *verbs_device = verbs_get_device(context->device); - if (verbs_device->ops->uninit_context) { - struct verbs_context *context_ex = - container_of(context, struct verbs_context, context); - - verbs_device->ops->uninit_context(verbs_device, context); - verbs_uninit_context(context_ex); - } else { - verbs_device->ops->free_context(context); - } + verbs_device->ops->free_context(context); return 0; } diff --git a/libibverbs/driver.h b/libibverbs/driver.h index 809c4f5c8cdf39..00847a41bc468e 100644 --- a/libibverbs/driver.h +++ b/libibverbs/driver.h @@ -152,17 +152,10 @@ struct verbs_device_ops { bool (*match_device)(struct verbs_sysfs_dev *sysfs_dev); - /* Old interface, do not use in new code. */ struct verbs_context *(*alloc_context)(struct ibv_device *device, int cmd_fd); void (*free_context)(struct ibv_context *context); - /* New interface */ - int (*init_context)(struct verbs_device *device, - struct ibv_context *ctx, int cmd_fd); - void (*uninit_context)(struct verbs_device *device, - struct ibv_context *ctx); - struct verbs_device *(*alloc_device)(struct verbs_sysfs_dev *sysfs_dev); void (*uninit_device)(struct verbs_device *device); }; @@ -171,8 +164,6 @@ struct verbs_device_ops { struct verbs_device { struct ibv_device device; /* Must be first */ const struct verbs_device_ops *ops; - size_t sz; - size_t size_of_context; atomic_int refcount; struct list_node entry; struct verbs_sysfs_dev *sysfs; diff --git a/providers/bnxt_re/main.c b/providers/bnxt_re/main.c index c225f09eaa58f7..d689b392d05b5d 100644 --- a/providers/bnxt_re/main.c +++ b/providers/bnxt_re/main.c @@ -179,10 +179,6 @@ bnxt_re_device_alloc(struct verbs_sysfs_dev *sysfs_dev) if (!dev) return NULL; - dev->vdev.sz = sizeof(*dev); - dev->vdev.size_of_context = - sizeof(struct bnxt_re_context) - sizeof(struct ibv_context); - return &dev->vdev; } diff --git a/providers/mlx4/mlx4.c b/providers/mlx4/mlx4.c index 3d64b8c8ebae65..f0d63b57792602 100644 --- a/providers/mlx4/mlx4.c +++ b/providers/mlx4/mlx4.c @@ -298,10 +298,6 @@ static struct verbs_device *mlx4_device_alloc(struct verbs_sysfs_dev *sysfs_dev) dev->page_size = sysconf(_SC_PAGESIZE); dev->abi_version = sysfs_dev->abi_ver; - dev->verbs_dev.sz = sizeof(*dev); - dev->verbs_dev.size_of_context = - sizeof(struct mlx4_context) - sizeof(struct ibv_context); - return &dev->verbs_dev; } diff --git a/providers/mlx5/mlx5.c b/providers/mlx5/mlx5.c index 7e8dc9b1951192..41b484fce29683 100644 --- a/providers/mlx5/mlx5.c +++ b/providers/mlx5/mlx5.c @@ -1099,10 +1099,6 @@ static struct verbs_device *mlx5_device_alloc(struct verbs_sysfs_dev *sysfs_dev) dev->page_size = sysconf(_SC_PAGESIZE); dev->driver_abi_ver = sysfs_dev->abi_ver; - dev->verbs_dev.sz = sizeof(*dev); - dev->verbs_dev.size_of_context = sizeof(struct mlx5_context) - - sizeof(struct ibv_context); - return &dev->verbs_dev; }