From patchwork Mon Sep 24 05:27:58 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Venkateswara Naralasetty X-Patchwork-Id: 10611913 X-Patchwork-Delegate: kvalo@adurom.com 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 AA1056CB for ; Mon, 24 Sep 2018 05:28:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7675329B69 for ; Mon, 24 Sep 2018 05:28:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 51B1B29BAD; Mon, 24 Sep 2018 05:28:09 +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.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI,T_DKIM_INVALID 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 6516929B69 for ; Mon, 24 Sep 2018 05:28:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727338AbeIXL21 (ORCPT ); Mon, 24 Sep 2018 07:28:27 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:39436 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725982AbeIXL20 (ORCPT ); Mon, 24 Sep 2018 07:28:26 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 34C2960214; Mon, 24 Sep 2018 05:28:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1537766885; bh=ouW85/4tnsXetySYp/ZsUq52HNULhZ4ucWIvDGM9qXU=; h=From:To:Cc:Subject:Date:From; b=j7VjlSWZ7RNh5aqSQpmAEdPv+7NyBFLOyb0wmKatE/cdjpXzcF4sHSDRDWmsiHwE/ WWWq6SnuVlDQW/V8uX98i9hLyx3oxylUwnVwMGHUISCUpOhvyLxMvPxv8rw4ZeMeRn hFEydXGn3wevxUu0E7mvGN60zVfMt4bB9f1S4Avc= Received: from tejas.qca.qualcomm.com (blr-c-bdr-fw-01_globalnat_allzones-outside.qualcomm.com [103.229.19.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: vnaralas@codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id A8B8860214; Mon, 24 Sep 2018 05:28:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1537766884; bh=ouW85/4tnsXetySYp/ZsUq52HNULhZ4ucWIvDGM9qXU=; h=From:To:Cc:Subject:Date:From; b=dbX8G6ulcv+k6hC4T4OzE7GVXgiCyEQd/NuAHIv1Eyk9fYsEH5kcgb8r7Ns7Mm1AS GB6CkeZjHpj1jLMHspbEiQHXxrCcBuJ/N6iAyebg2x4Jfef0vkcT9BcM/XtQrBmVYS cgvjIAy8PtHjHXqw4QU5obccT3ToXcBTikmVPxPg= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org A8B8860214 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=vnaralas@codeaurora.org From: Venkateswara Naralasetty To: ath10k@lists.infradead.org Cc: linux-wireless@vger.kernel.org, Venkateswara Naralasetty , Kan Yan Subject: [PATCH] ath10k: Add wrapper function to ath10k debug Date: Mon, 24 Sep 2018 10:57:58 +0530 Message-Id: <1537766878-11238-1-git-send-email-vnaralas@codeaurora.org> X-Mailer: git-send-email 2.7.4 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 Signed-off-by: Venkateswara Naralasetty --- drivers/net/wireless/ath/ath10k/core.c | 2 ++ drivers/net/wireless/ath/ath10k/debug.c | 11 +++++------ drivers/net/wireless/ath/ath10k/debug.h | 22 ++++++++++++++++------ 3 files changed, 23 insertions(+), 12 deletions(-) diff --git a/drivers/net/wireless/ath/ath10k/core.c b/drivers/net/wireless/ath/ath10k/core.c index cf3c47b..8460037 100644 --- a/drivers/net/wireless/ath/ath10k/core.c +++ b/drivers/net/wireless/ath/ath10k/core.c @@ -37,6 +37,8 @@ #include "coredump.h" unsigned int ath10k_debug_mask; +EXPORT_SYMBOL(ath10k_debug_mask); + static unsigned int ath10k_cryptmode_param; static bool uart_print; static bool skip_otp; diff --git a/drivers/net/wireless/ath/ath10k/debug.c b/drivers/net/wireless/ath/ath10k/debug.c index ada29a4..8f305c6 100644 --- a/drivers/net/wireless/ath/ath10k/debug.c +++ b/drivers/net/wireless/ath/ath10k/debug.c @@ -2545,8 +2545,8 @@ void ath10k_debug_unregister(struct ath10k *ar) #endif /* CONFIG_ATH10K_DEBUGFS */ #ifdef CONFIG_ATH10K_DEBUG -void ath10k_dbg(struct ath10k *ar, enum ath10k_debug_mask mask, - const char *fmt, ...) +void __ath10k_dbg(struct ath10k *ar, enum ath10k_debug_mask mask, + const char *fmt, ...) { struct va_format vaf; va_list args; @@ -2556,14 +2556,13 @@ void ath10k_dbg(struct ath10k *ar, enum ath10k_debug_mask mask, vaf.fmt = fmt; vaf.va = &args; - if (ath10k_debug_mask & mask) - dev_printk(KERN_DEBUG, ar->dev, "%pV", &vaf); + dev_printk(KERN_DEBUG, ar->dev, "%pV", &vaf); trace_ath10k_log_dbg(ar, mask, &vaf); va_end(args); } -EXPORT_SYMBOL(ath10k_dbg); +EXPORT_SYMBOL(__ath10k_dbg); void ath10k_dbg_dump(struct ath10k *ar, enum ath10k_debug_mask mask, @@ -2576,7 +2575,7 @@ void ath10k_dbg_dump(struct ath10k *ar, if (ath10k_debug_mask & mask) { if (msg) - ath10k_dbg(ar, mask, "%s\n", msg); + __ath10k_dbg(ar, mask, "%s\n", msg); for (ptr = buf; (ptr - buf) < len; ptr += 16) { linebuflen = 0; diff --git a/drivers/net/wireless/ath/ath10k/debug.h b/drivers/net/wireless/ath/ath10k/debug.h index 3a6191c..88fead6 100644 --- a/drivers/net/wireless/ath/ath10k/debug.h +++ b/drivers/net/wireless/ath/ath10k/debug.h @@ -250,18 +250,18 @@ void ath10k_sta_update_rx_tid_stats_ampdu(struct ath10k *ar, #endif /* CONFIG_MAC80211_DEBUGFS */ #ifdef CONFIG_ATH10K_DEBUG -__printf(3, 4) void ath10k_dbg(struct ath10k *ar, - enum ath10k_debug_mask mask, - const char *fmt, ...); +__printf(3, 4) void __ath10k_dbg(struct ath10k *ar, + enum ath10k_debug_mask mask, + const char *fmt, ...); void ath10k_dbg_dump(struct ath10k *ar, enum ath10k_debug_mask mask, const char *msg, const char *prefix, const void *buf, size_t len); #else /* CONFIG_ATH10K_DEBUG */ -static inline int ath10k_dbg(struct ath10k *ar, - enum ath10k_debug_mask dbg_mask, - const char *fmt, ...) +static inline int __ath10k_dbg(struct ath10k *ar, + enum ath10k_debug_mask dbg_mask, + const char *fmt, ...) { return 0; } @@ -273,4 +273,14 @@ static inline void ath10k_dbg_dump(struct ath10k *ar, { } #endif /* CONFIG_ATH10K_DEBUG */ + +/* Avoid calling __ath10k_dbg() if debug_mask is not set and tracing + * disabled. + */ +#define ath10k_dbg(ar, dbg_mask, fmt, ...) \ +do { \ + if (IS_ENABLED(CONFIG_ATH10K_TRACING) || \ + (ath10k_debug_mask & dbg_mask)) \ + __ath10k_dbg(ar, dbg_mask, fmt, ##__VA_ARGS__); \ +} while (0) #endif /* _DEBUG_H_ */