From patchwork Fri May 13 16:18:45 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roland Dreier X-Patchwork-Id: 783492 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p4DGJCiN028132 for ; Fri, 13 May 2011 16:19:12 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932762Ab1EMQTF (ORCPT ); Fri, 13 May 2011 12:19:05 -0400 Received: from na3sys010aog102.obsmtp.com ([74.125.245.72]:43044 "HELO na3sys010aog102.obsmtp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1759486Ab1EMQS4 (ORCPT ); Fri, 13 May 2011 12:18:56 -0400 Received: from mail-pz0-f42.google.com ([209.85.210.42]) (using TLSv1) by na3sys010aob102.postini.com ([74.125.244.12]) with SMTP ID DSNKTc1Z7lvKziLIYP8OGdJH+iLuN6/mHF8C@postini.com; Fri, 13 May 2011 09:18:55 PDT Received: by pzk37 with SMTP id 37so2213417pzk.1 for ; Fri, 13 May 2011 09:18:54 -0700 (PDT) Received: by 10.68.43.99 with SMTP id v3mr2468644pbl.387.1305303534441; Fri, 13 May 2011 09:18:54 -0700 (PDT) Received: from localhost.localdomain ([216.200.155.2]) by mx.google.com with ESMTPS id c10sm1446240pbi.67.2011.05.13.09.18.53 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 13 May 2011 09:18:53 -0700 (PDT) From: Roland Dreier To: netdev@vger.kernel.org, linux-rdma@vger.kernel.org Subject: [RFC 3/3] RDMA/cma: Save PID of ID's owner Date: Fri, 13 May 2011 09:18:45 -0700 Message-Id: <1305303525-11113-4-git-send-email-roland@kernel.org> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1305303525-11113-1-git-send-email-roland@kernel.org> References: <1305303525-11113-1-git-send-email-roland@kernel.org> Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Fri, 13 May 2011 16:19:12 +0000 (UTC) From: Nir Muchtar [Dave please do not apply even if this ends up in netdev patchwork!] Save the PID associated with an RDMA CM ID for reporting via netlink. NOT-Signed-off-by: Nir Muchtar NOT-Signed-off-by: Roland Dreier --- drivers/infiniband/core/cma.c | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-) diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c index d4701a8..1e25434 100644 --- a/drivers/infiniband/core/cma.c +++ b/drivers/infiniband/core/cma.c @@ -133,6 +133,7 @@ struct rdma_id_private { u32 seq_num; u32 qkey; u32 qp_num; + pid_t owner; u8 srq; u8 tos; }; @@ -423,6 +424,7 @@ struct rdma_cm_id *rdma_create_id(rdma_cm_event_handler event_handler, if (!id_priv) return ERR_PTR(-ENOMEM); + id_priv->owner = task_pid_nr(current); id_priv->state = RDMA_CM_IDLE; id_priv->id.context = context; id_priv->id.event_handler = event_handler; @@ -2678,6 +2680,9 @@ int rdma_accept(struct rdma_cm_id *id, struct rdma_conn_param *conn_param) int ret; id_priv = container_of(id, struct rdma_id_private, id); + + id_priv->owner = task_pid_nr(current); + if (!cma_comp(id_priv, RDMA_CM_CONNECT)) return -EINVAL; @@ -3320,6 +3325,7 @@ static int cma_get_id_stats(struct sk_buff *skb, struct netlink_callback *cb) id_stats->port_space = id->ps; id_stats->cm_state = id_priv->state; id_stats->qp_num = id_priv->qp_num; + id_stats->pid = id_priv->owner; i_id++; }