From patchwork Tue Jan 30 16:59:04 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Wise X-Patchwork-Id: 10194693 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 2380C601A0 for ; Wed, 31 Jan 2018 19:28:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0544B287F0 for ; Wed, 31 Jan 2018 19:28:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EE3A3287F5; Wed, 31 Jan 2018 19:28:12 +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=-5.6 required=2.0 tests=BAYES_00, DATE_IN_PAST_24_48, 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 5B447287F0 for ; Wed, 31 Jan 2018 19:28:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751163AbeAaT2K (ORCPT ); Wed, 31 Jan 2018 14:28:10 -0500 Received: from opengridcomputing.com ([70.118.0.34]:42672 "EHLO smtp.opengridcomputing.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750820AbeAaT2K (ORCPT ); Wed, 31 Jan 2018 14:28:10 -0500 Received: by smtp.opengridcomputing.com (Postfix, from userid 503) id 919AB2BC78; Wed, 31 Jan 2018 13:28:09 -0600 (CST) Message-Id: In-Reply-To: References: From: Steve Wise Date: Tue, 30 Jan 2018 08:59:04 -0800 Subject: [PATCH RFC 1/2] RDMA/CM: move rdma_id_private into include/rdma/rdma_cm.h To: dledford@redhat.com, jgg@mellanox.com Cc: linux-rdma@vger.kernel.org, leon@kernel.org 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 So the resource tracking services in core/nldev.c can see useful information about cm_ids. There are other approaches. I just moved rdma_id_private to develop this prototype quickly, and it was simple. Other approaches include: 1) move the nldev cm_id dumpit functions into cma.c, and have nldev.c call it. This, however puts a ib_core->rdma_cm module dependency which makes the two modules interdependent in both directions. Thus, rdma_cm would have to be merged into ib_core. This might not be a bad idea with all the kernel rdma ULPs now using the rdma_cm. 2) move the specific attributes that are being dumped from the rdma_id_private struct to the rdma_cm_id struct, so nldev.c has access to them. Signed-off-by: Steve Wise --- drivers/infiniband/core/cma.c | 40 ---------------------------------------- include/rdma/rdma_cm.h | 41 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+), 40 deletions(-) diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c index e66963c..72ad52b 100644 --- a/drivers/infiniband/core/cma.c +++ b/drivers/infiniband/core/cma.c @@ -327,46 +327,6 @@ struct ib_device *cma_get_ib_dev(struct cma_device *cma_dev) * We do this by disabling removal notification while a callback is in process, * and reporting it after the callback completes. */ -struct rdma_id_private { - struct rdma_cm_id id; - - struct rdma_bind_list *bind_list; - struct hlist_node node; - struct list_head list; /* listen_any_list or cma_device.list */ - struct list_head listen_list; /* per device listens */ - struct cma_device *cma_dev; - struct list_head mc_list; - - int internal_id; - enum rdma_cm_state state; - spinlock_t lock; - struct mutex qp_mutex; - - struct completion comp; - atomic_t refcount; - struct mutex handler_mutex; - - int backlog; - int timeout_ms; - struct ib_sa_query *query; - int query_id; - union { - struct ib_cm_id *ib; - struct iw_cm_id *iw; - } cm_id; - - u32 seq_num; - u32 qkey; - u32 qp_num; - pid_t owner; - u32 options; - u8 srq; - u8 tos; - bool tos_set; - u8 reuseaddr; - u8 afonly; - enum ib_gid_type gid_type; -}; struct cma_multicast { struct rdma_id_private *id_priv; diff --git a/include/rdma/rdma_cm.h b/include/rdma/rdma_cm.h index 6538a5c..5984225 100644 --- a/include/rdma/rdma_cm.h +++ b/include/rdma/rdma_cm.h @@ -157,6 +157,47 @@ struct rdma_cm_id { u8 port_num; }; +struct rdma_id_private { + struct rdma_cm_id id; + + struct rdma_bind_list *bind_list; + struct hlist_node node; + struct list_head list; /* listen_any_list or cma_device.list */ + struct list_head listen_list; /* per device listens */ + struct cma_device *cma_dev; + struct list_head mc_list; + + int internal_id; + enum rdma_cm_state state; + spinlock_t lock; + struct mutex qp_mutex; + + struct completion comp; + atomic_t refcount; + struct mutex handler_mutex; + + int backlog; + int timeout_ms; + struct ib_sa_query *query; + int query_id; + union { + struct ib_cm_id *ib; + struct iw_cm_id *iw; + } cm_id; + + u32 seq_num; + u32 qkey; + u32 qp_num; + pid_t owner; + u32 options; + u8 srq; + u8 tos; + bool tos_set; + u8 reuseaddr; + u8 afonly; + enum ib_gid_type gid_type; +}; + /** * rdma_create_id - Create an RDMA identifier. *