aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/iwl-devtrace.h
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2012-09-04 18:33:53 -0400
committerJohannes Berg <johannes.berg@intel.com>2012-09-05 10:17:57 -0400
commit45eab7ccacb2c2e63f7645fa92a7f742898044b4 (patch)
treefa68a9b60a27cb6244c5093c1be4db3620c49512 /drivers/net/wireless/iwlwifi/iwl-devtrace.h
parent12bf6f45d17038589e0eaa8adeb7ee8169c0e4de (diff)
iwlwifi: reduce overhead if tracing disabled
Tracing commands builds an array of trace data items even when the tracepoint is disabled. Instead, loop in the tracepoint assignment. This reduces overhead if tracing is compiled into the driver but not enabled and slightly reduces overall driver size as well: text data bss dec hex filename 114514 6509 48 121071 1d8ef before/iwlwifi.ko 114189 6509 48 120746 1d7aa after/iwlwifi.ko Reviewed-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com> Reviewed-by: Max Stepanov <Max.Stepanov@intel.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-devtrace.h')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-devtrace.h34
1 files changed, 21 insertions, 13 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-devtrace.h b/drivers/net/wireless/iwlwifi/iwl-devtrace.h
index 06ca505bb2cc..59a5f78402fc 100644
--- a/drivers/net/wireless/iwlwifi/iwl-devtrace.h
+++ b/drivers/net/wireless/iwlwifi/iwl-devtrace.h
@@ -29,6 +29,7 @@
29 29
30#include <linux/tracepoint.h> 30#include <linux/tracepoint.h>
31#include <linux/device.h> 31#include <linux/device.h>
32#include "iwl-trans.h"
32 33
33 34
34#if !defined(CONFIG_IWLWIFI_DEVICE_TRACING) || defined(__CHECKER__) 35#if !defined(CONFIG_IWLWIFI_DEVICE_TRACING) || defined(__CHECKER__)
@@ -237,27 +238,34 @@ TRACE_EVENT(iwlwifi_dbg,
237#define TRACE_SYSTEM iwlwifi 238#define TRACE_SYSTEM iwlwifi
238 239
239TRACE_EVENT(iwlwifi_dev_hcmd, 240TRACE_EVENT(iwlwifi_dev_hcmd,
240 TP_PROTO(const struct device *dev, u32 flags, 241 TP_PROTO(const struct device *dev,
241 const void *hcmd0, size_t len0, 242 struct iwl_host_cmd *cmd, u16 total_size,
242 const void *hcmd1, size_t len1, 243 const void *hdr, size_t hdr_len),
243 const void *hcmd2, size_t len2), 244 TP_ARGS(dev, cmd, total_size, hdr, hdr_len),
244 TP_ARGS(dev, flags, hcmd0, len0, hcmd1, len1, hcmd2, len2),
245 TP_STRUCT__entry( 245 TP_STRUCT__entry(
246 DEV_ENTRY 246 DEV_ENTRY
247 __dynamic_array(u8, hcmd0, len0) 247 __dynamic_array(u8, hcmd, total_size)
248 __dynamic_array(u8, hcmd1, len1)
249 __dynamic_array(u8, hcmd2, len2)
250 __field(u32, flags) 248 __field(u32, flags)
251 ), 249 ),
252 TP_fast_assign( 250 TP_fast_assign(
251 int i, offset = hdr_len;
252
253 DEV_ASSIGN; 253 DEV_ASSIGN;
254 memcpy(__get_dynamic_array(hcmd0), hcmd0, len0); 254 __entry->flags = cmd->flags;
255 memcpy(__get_dynamic_array(hcmd1), hcmd1, len1); 255 memcpy(__get_dynamic_array(hcmd), hdr, hdr_len);
256 memcpy(__get_dynamic_array(hcmd2), hcmd2, len2); 256
257 __entry->flags = flags; 257 for (i = 0; i < IWL_MAX_CMD_TFDS; i++) {
258 if (!cmd->len[i])
259 continue;
260 if (!(cmd->dataflags[i] & IWL_HCMD_DFL_NOCOPY))
261 continue;
262 memcpy((u8 *)__get_dynamic_array(hcmd) + offset,
263 cmd->data[i], cmd->len[i]);
264 offset += cmd->len[i];
265 }
258 ), 266 ),
259 TP_printk("[%s] hcmd %#.2x (%ssync)", 267 TP_printk("[%s] hcmd %#.2x (%ssync)",
260 __get_str(dev), ((u8 *)__get_dynamic_array(hcmd0))[0], 268 __get_str(dev), ((u8 *)__get_dynamic_array(hcmd))[0],
261 __entry->flags & CMD_ASYNC ? "a" : "") 269 __entry->flags & CMD_ASYNC ? "a" : "")
262); 270);
263 271