From patchwork Tue May 8 14:08:56 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Wise X-Patchwork-Id: 10386255 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 18D9860236 for ; Tue, 8 May 2018 14:33:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 062E728864 for ; Tue, 8 May 2018 14:33:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 03C72288ED; Tue, 8 May 2018 14:33:39 +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=-7.9 required=2.0 tests=BAYES_00, 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 BB7A02903C for ; Tue, 8 May 2018 14:32:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932277AbeEHOcP (ORCPT ); Tue, 8 May 2018 10:32:15 -0400 Received: from 72-48-214-68.dyn.grandenetworks.net ([72.48.214.68]:51945 "EHLO smtp.opengridcomputing.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932386AbeEHOcO (ORCPT ); Tue, 8 May 2018 10:32:14 -0400 Received: by smtp.opengridcomputing.com (Postfix, from userid 503) id 9F34D2B8C7; Tue, 8 May 2018 09:25:34 -0500 (CDT) Message-Id: <17ec22ecf17afad89f4a6de61e4091d27f6057f5.1525788595.git.swise@opengridcomputing.com> In-Reply-To: References: From: Steve Wise Date: Tue, 8 May 2018 07:08:56 -0700 Subject: [PATCH rdma-next 3/5] iw_cxgb4: provide detailed provider-specific CM_ID information To: jgg@mellanox.com, dledford@redhat.com Cc: leon@kernel.org, linux-rdma@vger.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 Add a table of important fields from the c4iw_ep* structures to the cm_id resource tracking table. This is helpful in debugging. Signed-off-by: Steve Wise --- drivers/infiniband/hw/cxgb4/restrack.c | 72 ++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) diff --git a/drivers/infiniband/hw/cxgb4/restrack.c b/drivers/infiniband/hw/cxgb4/restrack.c index a677940..4a6fc1d8 100644 --- a/drivers/infiniband/hw/cxgb4/restrack.c +++ b/drivers/infiniband/hw/cxgb4/restrack.c @@ -30,6 +30,8 @@ * SOFTWARE. */ +#include + #include "iw_cxgb4.h" #include #include @@ -243,6 +245,76 @@ static int fill_res_qp_entry(struct sk_buff *msg, return -EMSGSIZE; } +static int fill_res_ep_entry(struct sk_buff *msg, + struct rdma_restrack_entry *res) +{ + struct rdma_cm_id *cm_id = rdma_res_to_id(res); + struct nlattr *table_attr; + struct c4iw_ep_common epc, *epcp; + struct c4iw_listen_ep listen_ep; + struct iw_cm_id *iw_cm_id; + struct c4iw_ep ep; + + iw_cm_id = rdma_iw_cm_id(cm_id); + if (!iw_cm_id) + return 0; + epcp = (struct c4iw_ep_common *)iw_cm_id->provider_data; + if (!epcp) + return 0; + + table_attr = nla_nest_start(msg, RDMA_NLDEV_ATTR_DRIVER); + if (!table_attr) + goto err; + + /* Get a consistent snapshot */ + mutex_lock(&epcp->mutex); + if (epcp->state == LISTEN) { + listen_ep = *(struct c4iw_listen_ep *)epcp; + mutex_unlock(&epcp->mutex); + epcp = &listen_ep.com; + } else { + ep = *(struct c4iw_ep *)epcp; + mutex_unlock(&epcp->mutex); + epcp = &ep.com; + } + epc = *epcp; + + if (rdma_nl_put_driver_u32(msg, "state", epc.state)) + goto err_cancel_table; + if (rdma_nl_put_driver_u64_hex(msg, "flags", epc.flags)) + goto err_cancel_table; + if (rdma_nl_put_driver_u64_hex(msg, "history", epc.history)) + goto err_cancel_table; + + if (epc.state == LISTEN) { + if (rdma_nl_put_driver_u32(msg, "stid", listen_ep.stid)) + goto err_cancel_table; + if (rdma_nl_put_driver_u32(msg, "backlog", listen_ep.backlog)) + goto err_cancel_table; + } else { + if (rdma_nl_put_driver_u32(msg, "hwtid", ep.hwtid)) + goto err_cancel_table; + if (rdma_nl_put_driver_u32(msg, "ord", ep.ord)) + goto err_cancel_table; + if (rdma_nl_put_driver_u32(msg, "ird", ep.ird)) + goto err_cancel_table; + if (rdma_nl_put_driver_u32(msg, "emss", ep.emss)) + goto err_cancel_table; + + if (!ep.parent_ep && rdma_nl_put_driver_u32(msg, "atid", + ep.atid)) + goto err_cancel_table; + } + nla_nest_end(msg, table_attr); + return 0; + +err_cancel_table: + nla_nest_cancel(msg, table_attr); +err: + return -EMSGSIZE; +} + c4iw_restrack_func *c4iw_restrack_funcs[RDMA_RESTRACK_MAX] = { [RDMA_RESTRACK_QP] = fill_res_qp_entry, + [RDMA_RESTRACK_CM_ID] = fill_res_ep_entry, };