Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755064AbdDLQZu (ORCPT ); Wed, 12 Apr 2017 12:25:50 -0400 Received: from mail-cys01nam02on0072.outbound.protection.outlook.com ([104.47.37.72]:54304 "EHLO NAM02-CY1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1755046AbdDLQZn (ORCPT ); Wed, 12 Apr 2017 12:25:43 -0400 Authentication-Results: spf=fail (sender IP is 192.88.168.50) smtp.mailfrom=nxp.com; nxp.com; dkim=none (message not signed) header.d=none;nxp.com; dmarc=fail action=none header.from=nxp.com; From: Ioana Radulescu To: CC: , , , , , , , , , , , Subject: [PATCH v2 7/9] staging: fsl-dpaa2/eth: Add trace points Date: Wed, 12 Apr 2017 11:25:36 -0500 Message-ID: <20170412162538.25302-8-ruxandra.radulescu@nxp.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170412162538.25302-1-ruxandra.radulescu@nxp.com> References: <20170412162538.25302-1-ruxandra.radulescu@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131364879405168371;(91ab9b29-cfa4-454e-5278-08d120cd25b8);() X-Forefront-Antispam-Report: CIP:192.88.168.50;IPV:NLI;CTRY:US;EFV:NLI;SFV:NSPM;SFS:(10009020)(6009001)(336005)(39860400002)(39410400002)(39400400002)(39850400002)(39380400002)(39840400002)(39450400003)(2980300002)(1109001)(1110001)(339900001)(189002)(199003)(9170700003)(2351001)(6916009)(50226002)(2950100002)(105606002)(53936002)(39060400002)(5003940100001)(575784001)(48376002)(8936002)(110136004)(36756003)(33646002)(106466001)(86362001)(38730400002)(356003)(1076002)(7416002)(189998001)(76176999)(50986999)(5660300001)(8676002)(81166006)(85426001)(47776003)(50466002)(2906002)(104016004)(77096006)(8656002)(6666003)(54906002)(4326008)(305945005)(2004002);DIR:OUT;SFP:1101;SCL:1;SRVR:BN1PR03MB250;H:tx30smr01.am.freescale.net;FPR:;SPF:Fail;MLV:ovrnspm;MX:1;A:1;PTR:InfoDomainNonexistent;LANG:en; X-Microsoft-Exchange-Diagnostics: 1;BL2FFO11FD032;1:xGa24dXMbUwTyl32brV+NlYxHJ/Mlrj2UeBdHMpLhZ5KcFiBLhfLvfbHsq18h6U10KbqfKwn9Ul20CDwPvg7aEbS8EgIZxsX5K9mzdsNwacfmmS5YRsun/tH97tFu0HYZI1hAEEjTSFSmCXZeib/7VFmIed8R+CaAqH8Fhxsw/SjIp6AYzyDD6p/J1gDPMaftgUcdf7Xqhbi6UUtzVv8Bbe9wuzYH/xMuX7xM5zdd9UG87jWWXuqOwZCaOunXlGJG8XTk17wBXf/gp8fWly1YOR/i9xocdcQQwHj0AW22JfDelSx7aOxRDK1FDb1/QNuVLwRX9Y2d3UrG6lqj7z7Mdlg8xQZKp0sFeH7ot6LBV5ktufzxcE+65G2bDosUKTYugm5zmRLL+syoDK0JydICfkEim+kuaDCAFaNsIPSF3ZurcxZa+BPRYIVu8cE4B2nLs7en6UHtOXHnKZDM/+Gyodt+IZsusZ8lIO2R5Mu3xYejbPgY/iGSvMNpmOchWAIW7BfwqVVf6y7fYdDt4wLDE/vc5jC8Bn/1EiFSRdqpN3MNDdP3uFKrxMFBmZ5t8UoJrDKTJxZ/XstIJdnHHWZKCo4fSBdNtTTgGSP9J+yyFSP94sNoqs3itFmB55FgJabXPev4xCQocZm+RfdD/ZMdYV3kQt2XYi5EZ62YovOepJkYBWPQeMUC0lPT5XtIh/RX7SoHiYC13mitdFpadSTyR43EkfZAnLsy9Qf4SeqDvc= MIME-Version: 1.0 Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: f05998d3-1b7b-4886-d592-08d481c08f5c X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001)(2017030255120)(201703131430075)(201703131517081);SRVR:BN1PR03MB250; X-Microsoft-Exchange-Diagnostics: 1;BN1PR03MB250;3:wPO0LlacF0MJgd5m8hYdYtz0PDZ0l7RC0NjFluHRHdKZTx+Q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YbMiOa1NUG3rssRDUr1LysaW8JxFX6Y9Ocf8tRoOStG7RpDlV7GLRg4N6V6F/xmi1UVKNP3hPg3VdoGuh0IsmMcFqx6nUCvyDClM9M3SoSJkOAjHeqwXWAlT2JsEC5GRvo2pDLE69w45mhLqL6ygf0NhMoGY0= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197); X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6095135)(601004)(2401047)(13015025)(8121501046)(5005006)(13023025)(13017025)(13018025)(13024025)(3002001)(93006095)(93001095)(10201501046)(6055026)(6096035)(20161123563025)(20161123556025)(20161123565025)(201703131430075)(201703131448075)(201703131433075)(201703161259110)(20161123561025);SRVR:BN1PR03MB250;BCL:0;PCL:0;RULEID:(400006);SRVR:BN1PR03MB250; X-Microsoft-Exchange-Diagnostics: 1;BN1PR03MB250;4:Q3xiKhkTSEaOg+EBvYWmIwGZ5vgNGHTuidlEMjPGhkGUNVsJWzOOB4cZNPbe2ywYxIHCIigrBw1mxteBZrXZD88jBR3pCGmd1YH7iNTRTJ/zo11bjmY4Hj/X2Vyjax20fzRF0+hqV8+nnYWJF80iAMIzSDVOwU4gJs0x8vBv0LOWNUUg9IWaok6WXI9ZMUD3lHjVr3/R2lcOGg1BF0YFhJLN0kTbSUSTzFiYKw4di9Upq0MSaMK5Hs59YSZLrgdoaWywHxJUAdb8LAz6NTPHlpUkKSc8bNwfCWI/5y+TgQZONvLV9IV73gklDH5ke+inMl4ZLSmEYwsK5gN6vO6N6tUJ5HenJYV1XTRLKT43b7NuXBNfvcJNApvwTBOlV04P8Su0eOehWMjnT4qU7PV/edYOXOzFmNy2AfUwDpVH1HODPmdCdEbBduUK4qLepb5QLOOn0jtwVFmAIvzeV7mHIXVnX/PRy8z43LbuoIWoqe03bZEtYd7Rrr6IAxVjVHrOQcklYXV0oH6VOCqy2uIYPhnzvB/XaKRM54tJugSb6Yi+1dicYKN86y3J6UtV2l0PFt0p3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WxCPOX6p2CRX7Ntc8kImFPUIeRaduLvvsHv6Gbjri4NiES/eL8iq2ZmgD6r1/SyIs+tK8zzg9ZQvEh7SjW559HWnZ7GhJDgs8g== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Apr 2017 16:25:40.3296 (UTC) X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e;Ip=[192.88.168.50];Helo=[tx30smr01.am.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN1PR03MB250 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 9937 Lines: 291 Add trace events in significant places of the data path. Useful for debuggging. Signed-off-by: Ioana Radulescu --- v2: no changes drivers/staging/fsl-dpaa2/ethernet/Makefile | 3 + .../staging/fsl-dpaa2/ethernet/dpaa2-eth-trace.h | 185 +++++++++++++++++++++ drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c | 21 +++ drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h | 2 + 4 files changed, 211 insertions(+) create mode 100644 drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth-trace.h diff --git a/drivers/staging/fsl-dpaa2/ethernet/Makefile b/drivers/staging/fsl-dpaa2/ethernet/Makefile index 4327ebe803cb..77b0b74f835a 100644 --- a/drivers/staging/fsl-dpaa2/ethernet/Makefile +++ b/drivers/staging/fsl-dpaa2/ethernet/Makefile @@ -5,3 +5,6 @@ obj-$(CONFIG_FSL_DPAA2_ETH) += fsl-dpaa2-eth.o fsl-dpaa2-eth-objs := dpaa2-eth.o dpaa2-ethtool.o dpni.o + +# Needed by the tracing framework +CFLAGS_dpaa2-eth.o := -I$(src) diff --git a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth-trace.h b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth-trace.h new file mode 100644 index 000000000000..3b040e8d6a4e --- /dev/null +++ b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth-trace.h @@ -0,0 +1,185 @@ +/* Copyright 2014-2015 Freescale Semiconductor Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Freescale Semiconductor nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * + * ALTERNATIVELY, this software may be distributed under the terms of the + * GNU General Public License ("GPL") as published by the Free Software + * Foundation, either version 2 of that License or (at your option) any + * later version. + * + * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#undef TRACE_SYSTEM +#define TRACE_SYSTEM dpaa2_eth + +#if !defined(_DPAA2_ETH_TRACE_H) || defined(TRACE_HEADER_MULTI_READ) +#define _DPAA2_ETH_TRACE_H + +#include +#include +#include "dpaa2-eth.h" +#include + +#define TR_FMT "[%s] fd: addr=0x%llx, len=%u, off=%u" +/* trace_printk format for raw buffer event class */ +#define TR_BUF_FMT "[%s] vaddr=%p size=%zu dma_addr=%pad map_size=%zu bpid=%d" + +/* This is used to declare a class of events. + * individual events of this type will be defined below. + */ + +/* Store details about a frame descriptor */ +DECLARE_EVENT_CLASS(dpaa2_eth_fd, + /* Trace function prototype */ + TP_PROTO(struct net_device *netdev, + const struct dpaa2_fd *fd), + + /* Repeat argument list here */ + TP_ARGS(netdev, fd), + + /* A structure containing the relevant information we want + * to record. Declare name and type for each normal element, + * name, type and size for arrays. Use __string for variable + * length strings. + */ + TP_STRUCT__entry( + __field(u64, fd_addr) + __field(u32, fd_len) + __field(u16, fd_offset) + __string(name, netdev->name) + ), + + /* The function that assigns values to the above declared + * fields + */ + TP_fast_assign( + __entry->fd_addr = dpaa2_fd_get_addr(fd); + __entry->fd_len = dpaa2_fd_get_len(fd); + __entry->fd_offset = dpaa2_fd_get_offset(fd); + __assign_str(name, netdev->name); + ), + + /* This is what gets printed when the trace event is + * triggered. + */ + TP_printk(TR_FMT, + __get_str(name), + __entry->fd_addr, + __entry->fd_len, + __entry->fd_offset) +); + +/* Now declare events of the above type. Format is: + * DEFINE_EVENT(class, name, proto, args), with proto and args same as for class + */ + +/* Tx (egress) fd */ +DEFINE_EVENT(dpaa2_eth_fd, dpaa2_tx_fd, + TP_PROTO(struct net_device *netdev, + const struct dpaa2_fd *fd), + + TP_ARGS(netdev, fd) +); + +/* Rx fd */ +DEFINE_EVENT(dpaa2_eth_fd, dpaa2_rx_fd, + TP_PROTO(struct net_device *netdev, + const struct dpaa2_fd *fd), + + TP_ARGS(netdev, fd) +); + +/* Tx confirmation fd */ +DEFINE_EVENT(dpaa2_eth_fd, dpaa2_tx_conf_fd, + TP_PROTO(struct net_device *netdev, + const struct dpaa2_fd *fd), + + TP_ARGS(netdev, fd) +); + +/* Log data about raw buffers. Useful for tracing DPBP content. */ +TRACE_EVENT(dpaa2_eth_buf_seed, + /* Trace function prototype */ + TP_PROTO(struct net_device *netdev, + /* virtual address and size */ + void *vaddr, + size_t size, + /* dma map address and size */ + dma_addr_t dma_addr, + size_t map_size, + /* buffer pool id, if relevant */ + u16 bpid), + + /* Repeat argument list here */ + TP_ARGS(netdev, vaddr, size, dma_addr, map_size, bpid), + + /* A structure containing the relevant information we want + * to record. Declare name and type for each normal element, + * name, type and size for arrays. Use __string for variable + * length strings. + */ + TP_STRUCT__entry( + __field(void *, vaddr) + __field(size_t, size) + __field(dma_addr_t, dma_addr) + __field(size_t, map_size) + __field(u16, bpid) + __string(name, netdev->name) + ), + + /* The function that assigns values to the above declared + * fields + */ + TP_fast_assign( + __entry->vaddr = vaddr; + __entry->size = size; + __entry->dma_addr = dma_addr; + __entry->map_size = map_size; + __entry->bpid = bpid; + __assign_str(name, netdev->name); + ), + + /* This is what gets printed when the trace event is + * triggered. + */ + TP_printk(TR_BUF_FMT, + __get_str(name), + __entry->vaddr, + __entry->size, + &__entry->dma_addr, + __entry->map_size, + __entry->bpid) +); + +/* If only one event of a certain type needs to be declared, use TRACE_EVENT(). + * The syntax is the same as for DECLARE_EVENT_CLASS(). + */ + +#endif /* _DPAA2_ETH_TRACE_H */ + +/* This must be outside ifdef _DPAA2_ETH_TRACE_H */ +#undef TRACE_INCLUDE_PATH +#define TRACE_INCLUDE_PATH . +#undef TRACE_INCLUDE_FILE +#define TRACE_INCLUDE_FILE dpaa2-eth-trace +#include diff --git a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c index 67f007bdbe79..6f9eed66c64d 100644 --- a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c +++ b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c @@ -42,6 +42,12 @@ #include "../../fsl-mc/include/mc-sys.h" #include "dpaa2-eth.h" +/* CREATE_TRACE_POINTS only needs to be defined once. Other dpa files + * using trace events only need to #include + */ +#define CREATE_TRACE_POINTS +#include "dpaa2-eth-trace.h" + MODULE_LICENSE("Dual BSD/GPL"); MODULE_AUTHOR("Freescale Semiconductor, Inc"); MODULE_DESCRIPTION("Freescale DPAA2 Ethernet Driver"); @@ -213,6 +219,9 @@ static void dpaa2_eth_rx(struct dpaa2_eth_priv *priv, struct dpaa2_fas *fas; u32 status = 0; + /* Tracing point */ + trace_dpaa2_rx_fd(priv->net_dev, fd); + dma_unmap_single(dev, addr, DPAA2_ETH_RX_BUF_SIZE, DMA_FROM_DEVICE); vaddr = phys_to_virt(addr); @@ -583,6 +592,9 @@ static int dpaa2_eth_tx(struct sk_buff *skb, struct net_device *net_dev) goto err_build_fd; } + /* Tracing point */ + trace_dpaa2_tx_fd(net_dev, &fd); + /* TxConf FQ selection primarily based on cpu affinity; this is * non-migratable context, so it's safe to call smp_processor_id(). */ @@ -623,6 +635,9 @@ static void dpaa2_eth_tx_conf(struct dpaa2_eth_priv *priv, struct dpaa2_eth_drv_stats *percpu_extras; u32 status = 0; + /* Tracing point */ + trace_dpaa2_tx_conf_fd(priv->net_dev, fd); + percpu_extras = this_cpu_ptr(priv->percpu_extras); percpu_extras->tx_conf_frames++; percpu_extras->tx_conf_bytes += dpaa2_fd_get_len(fd); @@ -707,6 +722,12 @@ static int add_bufs(struct dpaa2_eth_priv *priv, u16 bpid) goto err_map; buf_array[i] = addr; + + /* tracing point */ + trace_dpaa2_eth_buf_seed(priv->net_dev, + buf, DPAA2_ETH_BUF_RAW_SIZE, + addr, DPAA2_ETH_RX_BUF_SIZE, + bpid); } release_bufs: diff --git a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h index f2b0a60795fe..c67cced55b72 100644 --- a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h +++ b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h @@ -43,6 +43,8 @@ #include "dpni.h" #include "dpni-cmd.h" +#include "dpaa2-eth-trace.h" + #define DPAA2_ETH_STORE_SIZE 16 /* Maximum number of scatter-gather entries in an ingress frame, -- 2.11.0