Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ath10k: Add wrapper function to ath10k debug

ath10k_dbg() is called in ath10k_process_rx() with huge set of arguments
which is causing CPU overhead even when debug_mask is not set.
Good improvement was observed in the receive side performance when call
to ath10k_dbg() is avoided in the RX path.

Since currently all debug messages are sent via tracing infrastructure,
we cannot entirely avoid calling ath10k_dbg. Therefore, call to
ath10k_dbg() is made conditional based on tracing config in the driver.

Trasmit performance remains unchanged with this patch; below are some
experimental results with this patch and tracing disabled.

mesh mode:

w/o this patch with this patch
Traffic TP CPU Usage TP CPU usage

TCP 840Mbps 76.53% 960Mbps 78.14%
UDP 1030Mbps 74.58% 1132Mbps 74.31%

Infra mode:

w/o this patch with this patch
Traffic TP CPU Usage TP CPU usage

TCP Rx 1241Mbps 80.89% 1270Mbps 73.50%
UDP Rx 1433Mbps 81.77% 1472Mbps 72.80%

Tested platform : IPQ8064
hardware used : QCA9984
firmware ver : ver 10.4-3.5.3-00057

Signed-off-by: Kan Yan <kyan@chromium.org>
Signed-off-by: Venkateswara Naralasetty <vnaralas@codeaurora.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>

authored by

Venkateswara Naralasetty and committed by
Kalle Valo
9d740d63 bc31c2cf

+28 -11
+2
drivers/net/wireless/ath/ath10k/core.c
··· 26 26 #include "coredump.h" 27 27 28 28 unsigned int ath10k_debug_mask; 29 + EXPORT_SYMBOL(ath10k_debug_mask); 30 + 29 31 static unsigned int ath10k_cryptmode_param; 30 32 static bool uart_print; 31 33 static bool skip_otp;
+4 -4
drivers/net/wireless/ath/ath10k/debug.c
··· 2664 2664 #endif /* CONFIG_ATH10K_DEBUGFS */ 2665 2665 2666 2666 #ifdef CONFIG_ATH10K_DEBUG 2667 - void ath10k_dbg(struct ath10k *ar, enum ath10k_debug_mask mask, 2668 - const char *fmt, ...) 2667 + void __ath10k_dbg(struct ath10k *ar, enum ath10k_debug_mask mask, 2668 + const char *fmt, ...) 2669 2669 { 2670 2670 struct va_format vaf; 2671 2671 va_list args; ··· 2682 2682 2683 2683 va_end(args); 2684 2684 } 2685 - EXPORT_SYMBOL(ath10k_dbg); 2685 + EXPORT_SYMBOL(__ath10k_dbg); 2686 2686 2687 2687 void ath10k_dbg_dump(struct ath10k *ar, 2688 2688 enum ath10k_debug_mask mask, ··· 2695 2695 2696 2696 if (ath10k_debug_mask & mask) { 2697 2697 if (msg) 2698 - ath10k_dbg(ar, mask, "%s\n", msg); 2698 + __ath10k_dbg(ar, mask, "%s\n", msg); 2699 2699 2700 2700 for (ptr = buf; (ptr - buf) < len; ptr += 16) { 2701 2701 linebuflen = 0;
+16 -6
drivers/net/wireless/ath/ath10k/debug.h
··· 240 240 #endif /* CONFIG_MAC80211_DEBUGFS */ 241 241 242 242 #ifdef CONFIG_ATH10K_DEBUG 243 - __printf(3, 4) void ath10k_dbg(struct ath10k *ar, 244 - enum ath10k_debug_mask mask, 245 - const char *fmt, ...); 243 + __printf(3, 4) void __ath10k_dbg(struct ath10k *ar, 244 + enum ath10k_debug_mask mask, 245 + const char *fmt, ...); 246 246 void ath10k_dbg_dump(struct ath10k *ar, 247 247 enum ath10k_debug_mask mask, 248 248 const char *msg, const char *prefix, 249 249 const void *buf, size_t len); 250 250 #else /* CONFIG_ATH10K_DEBUG */ 251 251 252 - static inline int ath10k_dbg(struct ath10k *ar, 253 - enum ath10k_debug_mask dbg_mask, 254 - const char *fmt, ...) 252 + static inline int __ath10k_dbg(struct ath10k *ar, 253 + enum ath10k_debug_mask dbg_mask, 254 + const char *fmt, ...) 255 255 { 256 256 return 0; 257 257 } ··· 263 263 { 264 264 } 265 265 #endif /* CONFIG_ATH10K_DEBUG */ 266 + 267 + /* Avoid calling __ath10k_dbg() if debug_mask is not set and tracing 268 + * disabled. 269 + */ 270 + #define ath10k_dbg(ar, dbg_mask, fmt, ...) \ 271 + do { \ 272 + if ((ath10k_debug_mask & dbg_mask) || \ 273 + trace_ath10k_log_dbg_enabled()) \ 274 + __ath10k_dbg(ar, dbg_mask, fmt, ##__VA_ARGS__); \ 275 + } while (0) 266 276 #endif /* _DEBUG_H_ */
+1
drivers/net/wireless/ath/ath10k/trace.c
··· 7 7 8 8 #define CREATE_TRACE_POINTS 9 9 #include "trace.h" 10 + EXPORT_SYMBOL(__tracepoint_ath10k_log_dbg);
+5 -1
drivers/net/wireless/ath/ath10k/trace.h
··· 29 29 #if !defined(CONFIG_ATH10K_TRACING) 30 30 #undef TRACE_EVENT 31 31 #define TRACE_EVENT(name, proto, ...) \ 32 - static inline void trace_ ## name(proto) {} 32 + static inline void trace_ ## name(proto) {} \ 33 + static inline bool trace_##name##_enabled(void) \ 34 + { \ 35 + return false; \ 36 + } 33 37 #undef DECLARE_EVENT_CLASS 34 38 #define DECLARE_EVENT_CLASS(...) 35 39 #undef DEFINE_EVENT