From patchwork Thu Feb 28 22:05:11 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ira Weiny X-Patchwork-Id: 10833779 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 72F9E1399 for ; Thu, 28 Feb 2019 22:05:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5F7872F9F2 for ; Thu, 28 Feb 2019 22:05:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 504E72FC8A; Thu, 28 Feb 2019 22:05:06 +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 53A102FC81 for ; Thu, 28 Feb 2019 22:05:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727707AbfB1WFD (ORCPT ); Thu, 28 Feb 2019 17:05:03 -0500 Received: from mga03.intel.com ([134.134.136.65]:31896 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726027AbfB1WFD (ORCPT ); Thu, 28 Feb 2019 17:05:03 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 28 Feb 2019 14:05:02 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.58,424,1544515200"; d="scan'208";a="126301271" Received: from iweiny-desk2.sc.intel.com ([10.3.52.157]) by fmsmga007.fm.intel.com with ESMTP; 28 Feb 2019 14:05:02 -0800 From: ira.weiny@intel.com To: Jason Gunthorpe , Steven Rostedt , linux-rdma@vger.kernel.org Cc: Ingo Molnar , Ira Weiny Subject: [PATCH] IB/MAD: Use trace struct in create_mad_addr_info() helper Date: Thu, 28 Feb 2019 14:05:11 -0800 Message-Id: <20190228220511.1072-1-ira.weiny@intel.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 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 Using a structure pointer is more efficient in the helper. Signed-off-by: Ira Weiny --- drivers/infiniband/core/mad.c | 26 ++++++++++++++------------ include/trace/events/ib_mad.h | 10 ++++++---- 2 files changed, 20 insertions(+), 16 deletions(-) diff --git a/drivers/infiniband/core/mad.c b/drivers/infiniband/core/mad.c index 87eff3f3f887..0a6136dded47 100644 --- a/drivers/infiniband/core/mad.c +++ b/drivers/infiniband/core/mad.c @@ -51,11 +51,14 @@ #include "opa_smi.h" #include "agent.h" +#define CREATE_TRACE_POINTS +#include + static void create_mad_addr_info(struct ib_mad_send_wr_private *mad_send_wr, - struct ib_mad_qp_info *qp_info, - u32 *dlid, u8 *sl, u16 *pkey, u32 *rqpn, - u32 *rqkey) + struct ib_mad_qp_info *qp_info, + struct trace_event_raw_ib_mad_send_template *entry) { + u16 pkey; struct ib_device *dev = qp_info->port_priv->device; u8 pnum = qp_info->port_priv->port_num; struct ib_ud_wr *wr = &mad_send_wr->send_wr; @@ -65,26 +68,25 @@ static void create_mad_addr_info(struct ib_mad_send_wr_private *mad_send_wr, rdma_query_ah(wr->ah, &attr); /* These are common */ - *sl = attr.sl; - ib_query_pkey(dev, pnum, wr->pkey_index, pkey); - *rqpn = wr->remote_qpn; - *rqkey = wr->remote_qkey; + entry->sl = attr.sl; + ib_query_pkey(dev, pnum, wr->pkey_index, &pkey); + entry->pkey = pkey; + entry->rqpn = wr->remote_qpn; + entry->rqkey = wr->remote_qkey; switch (attr.type) { case RDMA_AH_ATTR_TYPE_IB: - *dlid = attr.ib.dlid; + entry->dlid = attr.ib.dlid; break; case RDMA_AH_ATTR_TYPE_OPA: - *dlid = attr.opa.dlid; + entry->dlid = attr.opa.dlid; break; case RDMA_AH_ATTR_TYPE_ROCE: case RDMA_AH_ATTR_TYPE_UNDEFINED: - *dlid = 0; + entry->dlid = 0; break; } } -#define CREATE_TRACE_POINTS -#include static int mad_sendq_size = IB_MAD_QP_SEND_SIZE; static int mad_recvq_size = IB_MAD_QP_RECV_SIZE; diff --git a/include/trace/events/ib_mad.h b/include/trace/events/ib_mad.h index 7f2486535d04..cccb2cf4a8f7 100644 --- a/include/trace/events/ib_mad.h +++ b/include/trace/events/ib_mad.h @@ -13,6 +13,11 @@ #include #include +struct trace_event_raw_ib_mad_send_template; +static void create_mad_addr_info(struct ib_mad_send_wr_private *mad_send_wr, + struct ib_mad_qp_info *qp_info, + struct trace_event_raw_ib_mad_send_template *entry); + DECLARE_EVENT_CLASS(ib_mad_send_template, TP_PROTO(struct ib_mad_send_wr_private *wr, struct ib_mad_qp_info *qp_info), @@ -74,10 +79,7 @@ DECLARE_EVENT_CLASS(ib_mad_send_template, ((struct ib_mad_hdr *)wr->send_buf.mad)->attr_id; __entry->attr_mod = ((struct ib_mad_hdr *)wr->send_buf.mad)->attr_mod; - create_mad_addr_info(wr, qp_info, - &__entry->dlid, &__entry->sl, - &__entry->pkey, &__entry->rqpn, - &__entry->rqkey); + create_mad_addr_info(wr, qp_info, __entry); ), TP_printk("%d:%d QP%d agent %p: " \