From patchwork Thu Dec 20 02:22:41 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ira Weiny X-Patchwork-Id: 10738485 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CB15E13B5 for ; Thu, 20 Dec 2018 02:23:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BA9782884F for ; Thu, 20 Dec 2018 02:23:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AE94B28899; Thu, 20 Dec 2018 02:23:25 +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 4A33C2884F for ; Thu, 20 Dec 2018 02:23:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730044AbeLTCXZ (ORCPT ); Wed, 19 Dec 2018 21:23:25 -0500 Received: from mga11.intel.com ([192.55.52.93]:38899 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726604AbeLTCXZ (ORCPT ); Wed, 19 Dec 2018 21:23:25 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 19 Dec 2018 18:23:24 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,375,1539673200"; d="scan'208";a="303653399" Received: from phlsvsds.ph.intel.com ([10.228.164.149]) by fmsmga006.fm.intel.com with ESMTP; 19 Dec 2018 18:23:23 -0800 Received: from phlsvsds.ph.intel.com (localhost.localdomain [127.0.0.1]) by phlsvsds.ph.intel.com (8.13.8/8.13.8) with ESMTP id wBK2NFpQ029574; Wed, 19 Dec 2018 21:23:15 -0500 Received: (from iweiny@localhost) by phlsvsds.ph.intel.com (8.13.8/8.13.8/Submit) id wBK2NEci029571; Wed, 19 Dec 2018 21:23:14 -0500 X-Authentication-Warning: phlsvsds.ph.intel.com: iweiny set sender to ira.weiny@intel.com using -f From: ira.weiny@intel.com To: linux-rdma@vger.kernel.org Cc: Doug Ledford , Jason Gunthorpe , Steven Rostedt , Ingo Molnar , Alexei Starovoitov , Daniel Borkmann , Ira Weiny Subject: [RDMA for-next v2 2/6] IB/MAD: Add recv path trace point Date: Wed, 19 Dec 2018 21:22:41 -0500 Message-Id: <1545272565-29493-3-git-send-email-ira.weiny@intel.com> X-Mailer: git-send-email 1.8.2.3 In-Reply-To: <1545272565-29493-1-git-send-email-ira.weiny@intel.com> References: <1545074124-18185-1-git-send-email-ira.weiny@intel.com> <1545272565-29493-1-git-send-email-ira.weiny@intel.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 From: Ira Weiny Trace received MAD details. Signed-off-by: Ira Weiny --- drivers/infiniband/core/mad.c | 10 +++++++ include/trace/events/ib_mad.h | 64 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 74 insertions(+) diff --git a/drivers/infiniband/core/mad.c b/drivers/infiniband/core/mad.c index 3853c57bce40..880a23811923 100644 --- a/drivers/infiniband/core/mad.c +++ b/drivers/infiniband/core/mad.c @@ -2339,6 +2339,16 @@ static void ib_mad_recv_done(struct ib_cq *cq, struct ib_wc *wc) if (!validate_mad((const struct ib_mad_hdr *)recv->mad, qp_info, opa)) goto out; + if (trace_ib_mad_recv_done_handler_enabled()) { + u16 pkey; + + ib_query_pkey(qp_info->port_priv->device, qp_info->port_priv->port_num, + wc->pkey_index, &pkey); + + trace_ib_mad_recv_done_handler(qp_info, wc, (struct ib_mad_hdr *)recv->mad, + pkey); + } + mad_size = recv->mad_size; response = alloc_mad_private(mad_size, GFP_KERNEL); if (!response) diff --git a/include/trace/events/ib_mad.h b/include/trace/events/ib_mad.h index 8c08eaefbc08..95a78732e643 100644 --- a/include/trace/events/ib_mad.h +++ b/include/trace/events/ib_mad.h @@ -187,6 +187,70 @@ ) ); +TRACE_EVENT(ib_mad_recv_done_handler, + TP_PROTO(struct ib_mad_qp_info *qp_info, struct ib_wc *wc, struct ib_mad_hdr *mad_hdr, + u16 pkey), + TP_ARGS(qp_info, wc, mad_hdr, pkey), + + TP_STRUCT__entry( + __array(char, dev_name, IB_DEVICE_NAME_MAX) + __field(u8, port_num) + __field(u32, qp_num) + __field(u32, length) + __field(u8, base_version) + __field(u8, mgmt_class) + __field(u8, class_version) + __field(u8, method) + __field(u16, status) + __field(u16, class_specific) + __field(u64, tid) + __field(u16, attr_id) + __field(u32, attr_mod) + __field(u32, slid) + __field(u16, src_qp) + __field(u8, sl) + __field(u16, pkey) + __field(u16, wc_status) + ), + + TP_fast_assign( + memcpy(__entry->dev_name, qp_info->port_priv->device->name, IB_DEVICE_NAME_MAX); + __entry->port_num = qp_info->port_priv->port_num; + __entry->qp_num = qp_info->qp->qp_num; + __entry->length = wc->byte_len; + __entry->base_version = mad_hdr->base_version; + __entry->mgmt_class = mad_hdr->mgmt_class; + __entry->class_version = mad_hdr->class_version; + __entry->method = mad_hdr->method; + __entry->status = mad_hdr->status; + __entry->class_specific = mad_hdr->class_specific; + __entry->tid = mad_hdr->tid; + __entry->attr_id = mad_hdr->attr_id; + __entry->attr_mod = mad_hdr->attr_mod; + __entry->slid = wc->slid; + __entry->src_qp = wc->src_qp; + __entry->sl = wc->sl; + __entry->pkey = pkey; + __entry->wc_status = wc->status; + ), + + TP_printk("%s:%d QP%d : RECV WC Status %d : length %d : hdr : " \ + "base_ver 0x%02x class 0x%02x class_ver 0x%02x method 0x%02x " \ + "status 0x%04x class_specific 0x%04x tid 0x%016llx " \ + "attr_id 0x%04x attr_mod 0x%08x slid 0x%08x src QP%d, sl %d " \ + "pkey 0x%04x", + __entry->dev_name, __entry->port_num, __entry->qp_num, + __entry->wc_status, + __entry->length, + __entry->base_version, __entry->mgmt_class, __entry->class_version, + __entry->method, be16_to_cpu(__entry->status), + be16_to_cpu(__entry->class_specific), + be64_to_cpu(__entry->tid), be16_to_cpu(__entry->attr_id), + be32_to_cpu(__entry->attr_mod), + __entry->slid, __entry->src_qp, __entry->sl, __entry->pkey + ) +); + #endif /* _TRACE_IB_MAD_H */