From patchwork Wed Feb 27 11:24:42 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maharaja Kennadyrajan X-Patchwork-Id: 10831595 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 8A6091575 for ; Wed, 27 Feb 2019 11:23:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 727FC2D0F4 for ; Wed, 27 Feb 2019 11:23:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 668FC2D13A; Wed, 27 Feb 2019 11:23:14 +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=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 04EFC2D0F4 for ; Wed, 27 Feb 2019 11:23:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=MjUeMqt/bwhOidmDtHgpbY0Y4p2l633TVoMVP24UULA=; b=T+VWPlQvn4sHXkN9XdAtAWHYUg jSEBEhq71/zwJj86T1yCq5/zAlc0P2mL7P/2SisFyg/LXVyR1UqyZvMqcFEz4St1ftfjzCBSq5/PB MQRAE4JUJJeob9QegxSDLn60bF+lWGYP3LfLylZhZWuHJPRZMuCMgYRnq33ory6Hq64W1s/SiDHAh tLpevinCYDCr96k5fZ7b7KXG/LSIVF0sPFfJBbxMTU2ajsJjyM/HKB3f7S0ctf/rxJExiuaICacgU mj3wAJqiCXZFmMQ1SNefXoesHm0hpKBYr0KLmnwPvKAJqcizrsllKyjbH5oRNftA4DzN7IGmW/YFQ g5Sq5yhA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gyxIv-00076g-26; Wed, 27 Feb 2019 11:23:13 +0000 Received: from smtp.codeaurora.org ([198.145.29.96]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gyxIr-00075y-9F for ath10k@lists.infradead.org; Wed, 27 Feb 2019 11:23:11 +0000 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 02CD360E7A; Wed, 27 Feb 2019 11:23:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1551266589; bh=c+bhn/ttlntgoPtmKspAuKKp/siRxFgP+kOSsYxuqrY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lz4iM2kWpY5enxtjlJLEYOKSpWVb2EzlAKGPDG6RWhTdXQQnTRxuoMT9tX4/LBzpc 5IubWFzCevpcVdPwORIIk+Y0JNPUvVRFsUn9NnPFctYONaUjsdEOKTsSEi2KZe+5ox BV+WsYaFGQXMPbm5v3wtTVGN+Q9CQ46+bSaq5O8o= Received: from localhost (blr-c-bdr-fw-01_globalnat_allzones-outside.qualcomm.com [103.229.19.19]) (using TLSv1.2 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) (Authenticated sender: mkenna@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 4CE1E60909; Wed, 27 Feb 2019 11:23:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1551266588; bh=c+bhn/ttlntgoPtmKspAuKKp/siRxFgP+kOSsYxuqrY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kh+RFoNcPISkV2dE1VmtXKpUds4qKv9Q+PjKpygWnB//HjbQt0286fuxU81JaOQbu Je9nXam35EyJTT/o/2F782YMcAmYVX/tMXplIfJJhzMK11J1z/oSgqZQ388qw1hgkv j/nuwR+c+o0pQ8h/kSOg/qSnrEV1Qr5fyTMgVq78= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 4CE1E60909 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=mkenna@codeaurora.org From: Maharaja Kennadyrajan To: ath10k@lists.infradead.org Subject: [PATCH 2/2] ath10k: Added support to reset HTT stats in debugfs Date: Wed, 27 Feb 2019 16:54:42 +0530 Message-Id: <1551266682-32073-2-git-send-email-mkenna@codeaurora.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1551266682-32073-1-git-send-email-mkenna@codeaurora.org> References: <1551266682-32073-1-git-send-email-mkenna@codeaurora.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190227_032309_360727_32469AF3 X-CRM114-Status: GOOD ( 13.08 ) X-BeenThere: ath10k@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Maharaja Kennadyrajan , vikpatel@codeaurora.org, arnagara@codeaurora.org, linux-wireless@vger.kernel.org MIME-Version: 1.0 Sender: "ath10k" Errors-To: ath10k-bounces+patchwork-ath10k=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Reset HTT stats helps to get the aggregated HTT stats via tracing and also we can clear the accumulated HTT stats with this debugfs file. Signed-off-by: Maharaja Kennadyrajan --- drivers/net/wireless/ath/ath10k/core.h | 1 + drivers/net/wireless/ath/ath10k/debug.c | 43 +++++++++++++++++++++++- drivers/net/wireless/ath/ath10k/htt.h | 3 +- drivers/net/wireless/ath/ath10k/htt_tx.c | 5 +-- 4 files changed, 48 insertions(+), 4 deletions(-) diff --git a/drivers/net/wireless/ath/ath10k/core.h b/drivers/net/wireless/ath/ath10k/core.h index 27ec5557de88..317a41c2a9b1 100644 --- a/drivers/net/wireless/ath/ath10k/core.h +++ b/drivers/net/wireless/ath/ath10k/core.h @@ -614,6 +614,7 @@ struct ath10k_debug { bool fw_stats_done; unsigned long htt_stats_mask; + unsigned long reset_htt_stats; struct delayed_work htt_stats_dwork; struct ath10k_dfs_stats dfs_stats; struct ath_dfs_pool_stats dfs_pool_stats; diff --git a/drivers/net/wireless/ath/ath10k/debug.c b/drivers/net/wireless/ath/ath10k/debug.c index ca1af0e1623c..daf30eaa53c5 100644 --- a/drivers/net/wireless/ath/ath10k/debug.c +++ b/drivers/net/wireless/ath/ath10k/debug.c @@ -873,7 +873,7 @@ static int ath10k_debug_htt_stats_req(struct ath10k *ar) cookie = get_jiffies_64(); ret = ath10k_htt_h2t_stats_req(&ar->htt, ar->debug.htt_stats_mask, - cookie); + ar->debug.reset_htt_stats, cookie); if (ret) { ath10k_warn(ar, "failed to send htt stats request: %d\n", ret); return ret; @@ -2466,6 +2466,44 @@ static const struct file_operations fops_ps_state_enable = { .llseek = default_llseek, }; +static ssize_t ath10k_write_reset_htt_stats(struct file *file, + const char __user *user_buf, + size_t count, loff_t *ppos) +{ + struct ath10k *ar = file->private_data; + unsigned long reset; + int ret; + + ret = kstrtoul_from_user(user_buf, count, 0, &reset); + if (ret) + return ret; + + if (reset == 0 || reset > 0x1ffff) + return -EINVAL; + + mutex_lock(&ar->conf_mutex); + + ar->debug.reset_htt_stats = reset; + + ret = ath10k_debug_htt_stats_req(ar); + if (ret) + goto out; + + ar->debug.reset_htt_stats = 0; + ret = count; + +out: + mutex_unlock(&ar->conf_mutex); + return ret; +} + +static const struct file_operations fops_reset_htt_stats = { + .write = ath10k_write_reset_htt_stats, + .owner = THIS_MODULE, + .open = simple_open, + .llseek = default_llseek, +}; + int ath10k_debug_create(struct ath10k *ar) { ar->debug.cal_data = vzalloc(ATH10K_DEBUG_CAL_DATA_LEN); @@ -2606,6 +2644,9 @@ int ath10k_debug_register(struct ath10k *ar) debugfs_create_file("ps_state_enable", 0600, ar->debug.debugfs_phy, ar, &fops_ps_state_enable); + debugfs_create_file("reset_htt_stats", 0200, ar->debug.debugfs_phy, ar, + &fops_reset_htt_stats); + return 0; } diff --git a/drivers/net/wireless/ath/ath10k/htt.h b/drivers/net/wireless/ath/ath10k/htt.h index 8ff432bb2e86..b909f2f079c7 100644 --- a/drivers/net/wireless/ath/ath10k/htt.h +++ b/drivers/net/wireless/ath/ath10k/htt.h @@ -2110,7 +2110,8 @@ void ath10k_htt_htc_tx_complete(struct ath10k *ar, struct sk_buff *skb); void ath10k_htt_htc_t2h_msg_handler(struct ath10k *ar, struct sk_buff *skb); bool ath10k_htt_t2h_msg_handler(struct ath10k *ar, struct sk_buff *skb); int ath10k_htt_h2t_ver_req_msg(struct ath10k_htt *htt); -int ath10k_htt_h2t_stats_req(struct ath10k_htt *htt, u32 mask, u64 cookie); +int ath10k_htt_h2t_stats_req(struct ath10k_htt *htt, u32 mask, u32 reset_mask, + u64 cookie); int ath10k_htt_h2t_aggr_cfg_msg(struct ath10k_htt *htt, u8 max_subfrms_ampdu, u8 max_subfrms_amsdu); diff --git a/drivers/net/wireless/ath/ath10k/htt_tx.c b/drivers/net/wireless/ath/ath10k/htt_tx.c index 7e5f0eba043b..524bd8b44580 100644 --- a/drivers/net/wireless/ath/ath10k/htt_tx.c +++ b/drivers/net/wireless/ath/ath10k/htt_tx.c @@ -580,7 +580,8 @@ int ath10k_htt_h2t_ver_req_msg(struct ath10k_htt *htt) return 0; } -int ath10k_htt_h2t_stats_req(struct ath10k_htt *htt, u32 mask, u64 cookie) +int ath10k_htt_h2t_stats_req(struct ath10k_htt *htt, u32 mask, u32 reset_mask, + u64 cookie) { struct ath10k *ar = htt->ar; struct htt_stats_req *req; @@ -607,7 +608,7 @@ int ath10k_htt_h2t_stats_req(struct ath10k_htt *htt, u32 mask, u64 cookie) * about endian support */ memcpy(req->upload_types, &mask, 3); - memcpy(req->reset_types, &mask, 3); + memcpy(req->reset_types, &reset_mask, 3); req->stat_type = HTT_STATS_REQ_CFG_STAT_TYPE_INVALID; req->cookie_lsb = cpu_to_le32(cookie & 0xffffffff); req->cookie_msb = cpu_to_le32((cookie & 0xffffffff00000000ULL) >> 32);