From patchwork Fri Jul 31 18:27:20 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rakesh Pillai X-Patchwork-Id: 11695359 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BB7131746 for ; Fri, 31 Jul 2020 18:28:25 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 887A922B42 for ; Fri, 31 Jul 2020 18:28:25 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="1UcAyhpt"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=mg.codeaurora.org header.i=@mg.codeaurora.org header.b="emfqA6j7" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 887A922B42 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=ath10k-bounces+patchwork-ath10k=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.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=E1Zp5wb3jz+ppZr9887Bq/COQ4/Wy+rOR9qW04rVR38=; b=1UcAyhptlo0KQbgFHdFB/i3OQr mFR5Z8dN4R5u3ONprJh0uBU0mXhcm9HS8QDekUt+mj1htylSz79bM2tOZ1mrEf8fC4amOaI49RRBL 1gLKfQ+vpfpxZ4yPeJGUlxmyR6cZJcEyWpHppixNQk5Darcl3jYuIcQ3xqZkBb8mU4INzQGPcPKnZ Ctx27GPNTvodNx805RRWirztmFeyNFrXe5NdO2rfKWxPAuyIOmZM1WDoXfE9iLsXOMB0ey2lz0I3J +jWMp2I6TocKDo1n7Zv1/Z+zxZXXrGWud66YNOOKpOtK2yKB/NTGD42RmxXLXAlRkQJ0kxlnuSr36 4Yt3dQtw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1k1Zl1-0003Xk-3o; Fri, 31 Jul 2020 18:27:51 +0000 Received: from mail29.static.mailgun.info ([104.130.122.29]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1k1Zkw-0003Vp-VR for ath10k@lists.infradead.org; Fri, 31 Jul 2020 18:27:49 +0000 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1596220068; h=References: In-Reply-To: Message-Id: Date: Subject: Cc: To: From: Sender; bh=o7f3Xk/EixElVTO6+Uz9inas4c+cBqV/P656fdel21Y=; b=emfqA6j75y1DOl/Ao2DOp2X0zcIZfM3COr4nOOx2VCsyxhxiwwN0f3HIiJ3MDEloDcsNWSQu O1CtONesOZAw/cL5k5Cq7Ycm066+rlmxLjI92BsBCPgj/jJ2gxq37V79XcA/7P5qWLmuBS1f q+rhqWhrWzltPKZk1nc9JIU2Lp4= X-Mailgun-Sending-Ip: 104.130.122.29 X-Mailgun-Sid: WyJiZDQ3OSIsICJhdGgxMGtAbGlzdHMuaW5mcmFkZWFkLm9yZyIsICJiZTllNGEiXQ== Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by smtp-out-n16.prod.us-west-2.postgun.com with SMTP id 5f24629deb556d49a6534d02 (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Fri, 31 Jul 2020 18:27:41 GMT Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 0A8B9C433AF; Fri, 31 Jul 2020 18:27:40 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-caf-mail-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=2.0 tests=ALL_TRUSTED,SPF_NONE autolearn=unavailable autolearn_force=no version=3.4.0 Received: from pillair-linux.qualcomm.com (unknown [202.46.22.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: pillair) by smtp.codeaurora.org (Postfix) with ESMTPSA id BAE7DC433AD; Fri, 31 Jul 2020 18:27:35 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org BAE7DC433AD Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; spf=none smtp.mailfrom=pillair@codeaurora.org From: Rakesh Pillai To: ath10k@lists.infradead.org Subject: [PATCH v2 1/3] ath10k: Add history for tracking certain events Date: Fri, 31 Jul 2020 23:57:20 +0530 Message-Id: <1596220042-2778-2-git-send-email-pillair@codeaurora.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1596220042-2778-1-git-send-email-pillair@codeaurora.org> References: <1596220042-2778-1-git-send-email-pillair@codeaurora.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200731_142748_387208_7DBF02DD X-CRM114-Status: GOOD ( 22.96 ) X-Spam-Score: -0.0 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [104.130.122.29 listed in list.dnswl.org] -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [104.130.122.29 listed in wl.mailspike.net] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-BeenThere: ath10k@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: netdev@vger.kernel.org, linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, Rakesh Pillai , kuba@kernel.org, davem@davemloft.net, kvalo@codeaurora.org MIME-Version: 1.0 Sender: "ath10k" Errors-To: ath10k-bounces+patchwork-ath10k=patchwork.kernel.org@lists.infradead.org Add history for tracking the below events - register read - register write - IRQ trigger - NAPI poll - CE service - WMI cmd - WMI event - WMI tx completion This will help in debugging any crash or any improper behaviour. Tested-on: WCN3990 hw1.0 SNOC WLAN.HL.3.1-01040-QCAHLSWMTPLZ-1 Signed-off-by: Rakesh Pillai --- drivers/net/wireless/ath/ath10k/ce.c | 1 + drivers/net/wireless/ath/ath10k/core.h | 74 +++++++++++++++++ drivers/net/wireless/ath/ath10k/debug.c | 133 ++++++++++++++++++++++++++++++ drivers/net/wireless/ath/ath10k/debug.h | 74 +++++++++++++++++ drivers/net/wireless/ath/ath10k/snoc.c | 15 +++- drivers/net/wireless/ath/ath10k/wmi-tlv.c | 1 + drivers/net/wireless/ath/ath10k/wmi.c | 10 +++ 7 files changed, 307 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/ath/ath10k/ce.c b/drivers/net/wireless/ath/ath10k/ce.c index 84ec80c..0f541de 100644 --- a/drivers/net/wireless/ath/ath10k/ce.c +++ b/drivers/net/wireless/ath/ath10k/ce.c @@ -1299,6 +1299,7 @@ void ath10k_ce_per_engine_service(struct ath10k *ar, unsigned int ce_id) struct ath10k_hw_ce_host_wm_regs *wm_regs = ar->hw_ce_regs->wm_regs; u32 ctrl_addr = ce_state->ctrl_addr; + ath10k_record_ce_event(ar, ATH10K_CE_SERVICE, ce_id); /* * Clear before handling * diff --git a/drivers/net/wireless/ath/ath10k/core.h b/drivers/net/wireless/ath/ath10k/core.h index 5c18f6c..46bd5aa 100644 --- a/drivers/net/wireless/ath/ath10k/core.h +++ b/drivers/net/wireless/ath/ath10k/core.h @@ -970,6 +970,75 @@ struct ath10k_bus_params { bool hl_msdu_ids; }; +#define ATH10K_REG_ACCESS_HISTORY_MAX 512 +#define ATH10K_CE_EVENT_HISTORY_MAX 1024 +#define ATH10K_WMI_EVENT_HISTORY_MAX 512 +#define ATH10K_WMI_CMD_HISTORY_MAX 256 + +#define ATH10K_WMI_DATA_LEN 16 + +enum ath10k_ce_event { + ATH10K_IRQ_TRIGGER, + ATH10K_NAPI_POLL, + ATH10K_CE_SERVICE, + ATH10K_NAPI_COMPLETE, + ATH10K_NAPI_RESCHED, + ATH10K_IRQ_SUMMARY, +}; + +enum ath10k_wmi_type { + ATH10K_WMI_EVENT, + ATH10K_WMI_CMD, + ATH10K_WMI_TX_COMPL, +}; + +struct ath10k_reg_access_entry { + u32 cpu_id; + bool write; + u32 offset; + u32 val; + u64 timestamp; +}; + +struct ath10k_wmi_event_entry { + u32 cpu_id; + enum ath10k_wmi_type type; + u32 id; + u64 timestamp; + unsigned char data[ATH10K_WMI_DATA_LEN]; +}; + +struct ath10k_ce_event_entry { + u32 cpu_id; + enum ath10k_ce_event event_type; + u32 ce_id; + u64 timestamp; +}; + +struct ath10k_wmi_event_history { + struct ath10k_wmi_event_entry *record; + u32 max_entries; + atomic_t index; + /* lock for accessing wmi event history */ + spinlock_t hist_lock; +}; + +struct ath10k_ce_event_history { + struct ath10k_ce_event_entry *record; + u32 max_entries; + atomic_t index; + /* lock for accessing ce event history */ + spinlock_t hist_lock; +}; + +struct ath10k_reg_access_history { + struct ath10k_reg_access_entry *record; + u32 max_entries; + atomic_t index; + /* lock for accessing register access history */ + spinlock_t hist_lock; +}; + struct ath10k { struct ath_common ath_common; struct ieee80211_hw *hw; @@ -1261,6 +1330,11 @@ struct ath10k { bool coex_support; int coex_gpio_pin; + struct ath10k_reg_access_history reg_access_history; + struct ath10k_ce_event_history ce_event_history; + struct ath10k_wmi_event_history wmi_event_history; + struct ath10k_wmi_event_history wmi_cmd_history; + /* must be last */ u8 drv_priv[] __aligned(sizeof(void *)); }; diff --git a/drivers/net/wireless/ath/ath10k/debug.c b/drivers/net/wireless/ath/ath10k/debug.c index e8250a6..9105b0b 100644 --- a/drivers/net/wireless/ath/ath10k/debug.c +++ b/drivers/net/wireless/ath/ath10k/debug.c @@ -2722,4 +2722,137 @@ void ath10k_dbg_dump(struct ath10k *ar, } EXPORT_SYMBOL(ath10k_dbg_dump); +int ath10k_core_reg_access_history_init(struct ath10k *ar, u32 max_entries) +{ + ar->reg_access_history.record = vzalloc(max_entries * + sizeof(struct ath10k_reg_access_entry)); + if (!ar->reg_access_history.record) + return -ENOMEM; + + ar->reg_access_history.max_entries = max_entries; + atomic_set(&ar->reg_access_history.index, 0); + spin_lock_init(&ar->reg_access_history.hist_lock); + + return 0; +} +EXPORT_SYMBOL(ath10k_core_reg_access_history_init); + +int ath10k_core_wmi_cmd_history_init(struct ath10k *ar, u32 max_entries) +{ + ar->wmi_cmd_history.record = vzalloc(max_entries * + sizeof(struct ath10k_wmi_event_entry)); + if (!ar->wmi_cmd_history.record) + return -ENOMEM; + + ar->wmi_cmd_history.max_entries = max_entries; + atomic_set(&ar->wmi_cmd_history.index, 0); + spin_lock_init(&ar->wmi_cmd_history.hist_lock); + + return 0; +} +EXPORT_SYMBOL(ath10k_core_wmi_cmd_history_init); + +int ath10k_core_wmi_event_history_init(struct ath10k *ar, u32 max_entries) +{ + ar->wmi_event_history.record = vzalloc(max_entries * + sizeof(struct ath10k_wmi_event_entry)); + if (!ar->wmi_event_history.record) + return -ENOMEM; + + ar->wmi_event_history.max_entries = max_entries; + atomic_set(&ar->wmi_event_history.index, 0); + spin_lock_init(&ar->wmi_event_history.hist_lock); + + return 0; +} +EXPORT_SYMBOL(ath10k_core_wmi_event_history_init); + +int ath10k_core_ce_event_history_init(struct ath10k *ar, u32 max_entries) +{ + ar->ce_event_history.record = vzalloc(max_entries * + sizeof(struct ath10k_ce_event_entry)); + if (!ar->ce_event_history.record) + return -ENOMEM; + + ar->ce_event_history.max_entries = max_entries; + atomic_set(&ar->ce_event_history.index, 0); + spin_lock_init(&ar->ce_event_history.hist_lock); + + return 0; +} +EXPORT_SYMBOL(ath10k_core_ce_event_history_init); + +void ath10k_record_reg_access(struct ath10k *ar, u32 offset, u32 val, bool write) +{ + struct ath10k_reg_access_entry *entry; + u32 idx; + + if (!ar->reg_access_history.record) + return; + + idx = ath10k_core_get_next_idx(&ar->reg_access_history.index, + ar->reg_access_history.max_entries); + entry = &ar->reg_access_history.record[idx]; + + entry->timestamp = ath10k_core_get_timestamp(); + entry->write = write; + entry->offset = offset; + entry->val = val; +} +EXPORT_SYMBOL(ath10k_record_reg_access); + +void ath10k_record_wmi_event(struct ath10k *ar, enum ath10k_wmi_type type, + u32 id, unsigned char *data) +{ + struct ath10k_wmi_event_entry *entry; + u32 idx; + + if (type == ATH10K_WMI_EVENT) { + if (!ar->wmi_event_history.record) + return; + + spin_lock_bh(&ar->wmi_event_history.hist_lock); + idx = ath10k_core_get_next_idx(&ar->reg_access_history.index, + ar->wmi_event_history.max_entries); + spin_unlock_bh(&ar->wmi_event_history.hist_lock); + entry = &ar->wmi_event_history.record[idx]; + } else { + if (!ar->wmi_cmd_history.record) + return; + + spin_lock_bh(&ar->wmi_cmd_history.hist_lock); + idx = ath10k_core_get_next_idx(&ar->reg_access_history.index, + ar->wmi_cmd_history.max_entries); + spin_unlock_bh(&ar->wmi_cmd_history.hist_lock); + entry = &ar->wmi_cmd_history.record[idx]; + } + + entry->timestamp = ath10k_core_get_timestamp(); + entry->cpu_id = smp_processor_id(); + entry->type = type; + entry->id = id; + memcpy(&entry->data, data + 4, ATH10K_WMI_DATA_LEN); +} +EXPORT_SYMBOL(ath10k_record_wmi_event); + +void ath10k_record_ce_event(struct ath10k *ar, enum ath10k_ce_event event_type, + int ce_id) +{ + struct ath10k_ce_event_entry *entry; + u32 idx; + + if (!ar->ce_event_history.record) + return; + + idx = ath10k_core_get_next_idx(&ar->ce_event_history.index, + ar->ce_event_history.max_entries); + entry = &ar->ce_event_history.record[idx]; + + entry->timestamp = ath10k_core_get_timestamp(); + entry->cpu_id = smp_processor_id(); + entry->event_type = event_type; + entry->ce_id = ce_id; +} +EXPORT_SYMBOL(ath10k_record_ce_event); + #endif /* CONFIG_ATH10K_DEBUG */ diff --git a/drivers/net/wireless/ath/ath10k/debug.h b/drivers/net/wireless/ath/ath10k/debug.h index 997c1c8..c28aeb1 100644 --- a/drivers/net/wireless/ath/ath10k/debug.h +++ b/drivers/net/wireless/ath/ath10k/debug.h @@ -258,6 +258,38 @@ void ath10k_dbg_dump(struct ath10k *ar, enum ath10k_debug_mask mask, const char *msg, const char *prefix, const void *buf, size_t len); + +/* ========== History init APIs =========== */ +int ath10k_core_reg_access_history_init(struct ath10k *ar, u32 max_entries); +int ath10k_core_wmi_cmd_history_init(struct ath10k *ar, u32 max_entries); +int ath10k_core_wmi_event_history_init(struct ath10k *ar, u32 max_entries); +int ath10k_core_ce_event_history_init(struct ath10k *ar, u32 max_entries); + +/* ========== History record APIs =========== */ +void ath10k_record_reg_access(struct ath10k *ar, u32 offset, u32 val, + bool write); +void ath10k_record_wmi_event(struct ath10k *ar, enum ath10k_wmi_type type, + u32 id, unsigned char *data); +void ath10k_record_ce_event(struct ath10k *ar, + enum ath10k_ce_event event_type, + int ce_id); + +static inline u64 ath10k_core_get_timestamp(void) +{ + struct timespec64 ts; + + ktime_get_real_ts64(&ts); + return ((u64)ts.tv_sec * 1000000) + (ts.tv_nsec / 1000); +} + +static inline int ath10k_core_get_next_idx(atomic_t *index, u32 max_entries) +{ + u32 curr_idx; + + curr_idx = atomic_fetch_inc(index); + return (curr_idx & (max_entries - 1)); +} + #else /* CONFIG_ATH10K_DEBUG */ static inline int __ath10k_dbg(struct ath10k *ar, @@ -273,6 +305,48 @@ static inline void ath10k_dbg_dump(struct ath10k *ar, const void *buf, size_t len) { } + +static inline int ath10k_core_reg_access_history_init(struct ath10k *ar, + u32 max_entries) +{ + return 0; +} + +static inline int ath10k_core_wmi_cmd_history_init(struct ath10k *ar, + u32 max_entries) +{ + return 0; +} + +static inline int ath10k_core_wmi_event_history_init(struct ath10k *ar, + u32 max_entries) +{ + return 0; +} + +static inline int ath10k_core_ce_event_history_init(struct ath10k *ar, + u32 max_entries) +{ + return 0; +} + +static inline void ath10k_record_reg_access(struct ath10k *ar, u32 offset, + u32 val, bool write) +{ +} + +static inline void ath10k_record_wmi_event(struct ath10k *ar, + enum ath10k_wmi_type type, + u32 id, unsigned char *data) +{ +} + +static inline void ath10k_record_ce_event(struct ath10k *ar, + enum ath10k_ce_event event_type, + int ce_id) +{ +} + #endif /* CONFIG_ATH10K_DEBUG */ /* Avoid calling __ath10k_dbg() if debug_mask is not set and tracing diff --git a/drivers/net/wireless/ath/ath10k/snoc.c b/drivers/net/wireless/ath/ath10k/snoc.c index 1ef5fdb..aa7ee32 100644 --- a/drivers/net/wireless/ath/ath10k/snoc.c +++ b/drivers/net/wireless/ath/ath10k/snoc.c @@ -473,6 +473,7 @@ static void ath10k_snoc_write32(struct ath10k *ar, u32 offset, u32 value) { struct ath10k_snoc *ar_snoc = ath10k_snoc_priv(ar); + ath10k_record_reg_access(ar, offset, value, true); iowrite32(value, ar_snoc->mem + offset); } @@ -482,6 +483,7 @@ static u32 ath10k_snoc_read32(struct ath10k *ar, u32 offset) u32 val; val = ioread32(ar_snoc->mem + offset); + ath10k_record_reg_access(ar, offset, val, false); return val; } @@ -1159,6 +1161,7 @@ static irqreturn_t ath10k_snoc_per_engine_handler(int irq, void *arg) ce_id); return IRQ_HANDLED; } + ath10k_record_ce_event(ar, ATH10K_IRQ_TRIGGER, ce_id); ath10k_ce_disable_interrupt(ar, ce_id); set_bit(ce_id, ar_snoc->pending_ce_irqs); @@ -1175,6 +1178,7 @@ static int ath10k_snoc_napi_poll(struct napi_struct *ctx, int budget) int done = 0; int ce_id; + ath10k_record_ce_event(ar, ATH10K_NAPI_POLL, 0); if (test_bit(ATH10K_FLAG_CRASH_FLUSH, &ar->dev_flags)) { napi_complete(ctx); return done; @@ -1188,8 +1192,12 @@ static int ath10k_snoc_napi_poll(struct napi_struct *ctx, int budget) done = ath10k_htt_txrx_compl_task(ar, budget); - if (done < budget) + if (done < budget) { napi_complete(ctx); + ath10k_record_ce_event(ar, ATH10K_NAPI_COMPLETE, 0); + } else { + ath10k_record_ce_event(ar, ATH10K_NAPI_RESCHED, 0); + } return done; } @@ -1660,6 +1668,11 @@ static int ath10k_snoc_probe(struct platform_device *pdev) ar->ce_priv = &ar_snoc->ce; msa_size = drv_data->msa_size; + ath10k_core_reg_access_history_init(ar, ATH10K_REG_ACCESS_HISTORY_MAX); + ath10k_core_wmi_event_history_init(ar, ATH10K_WMI_EVENT_HISTORY_MAX); + ath10k_core_wmi_cmd_history_init(ar, ATH10K_WMI_CMD_HISTORY_MAX); + ath10k_core_ce_event_history_init(ar, ATH10K_CE_EVENT_HISTORY_MAX); + ath10k_snoc_quirks_init(ar); ret = ath10k_snoc_resource_init(ar); diff --git a/drivers/net/wireless/ath/ath10k/wmi-tlv.c b/drivers/net/wireless/ath/ath10k/wmi-tlv.c index 932266d..9df5748 100644 --- a/drivers/net/wireless/ath/ath10k/wmi-tlv.c +++ b/drivers/net/wireless/ath/ath10k/wmi-tlv.c @@ -627,6 +627,7 @@ static void ath10k_wmi_tlv_op_rx(struct ath10k *ar, struct sk_buff *skb) if (skb_pull(skb, sizeof(struct wmi_cmd_hdr)) == NULL) goto out; + ath10k_record_wmi_event(ar, ATH10K_WMI_EVENT, id, skb->data); trace_ath10k_wmi_event(ar, id, skb->data, skb->len); consumed = ath10k_tm_event_wmi(ar, id, skb); diff --git a/drivers/net/wireless/ath/ath10k/wmi.c b/drivers/net/wireless/ath/ath10k/wmi.c index a81a1ab..8ebd05c 100644 --- a/drivers/net/wireless/ath/ath10k/wmi.c +++ b/drivers/net/wireless/ath/ath10k/wmi.c @@ -1802,6 +1802,15 @@ struct sk_buff *ath10k_wmi_alloc_skb(struct ath10k *ar, u32 len) static void ath10k_wmi_htc_tx_complete(struct ath10k *ar, struct sk_buff *skb) { + struct wmi_cmd_hdr *cmd_hdr; + enum wmi_tlv_event_id id; + + cmd_hdr = (struct wmi_cmd_hdr *)skb->data; + id = MS(__le32_to_cpu(cmd_hdr->cmd_id), WMI_CMD_HDR_CMD_ID); + + ath10k_record_wmi_event(ar, ATH10K_WMI_TX_COMPL, id, + skb->data + sizeof(struct wmi_cmd_hdr)); + dev_kfree_skb(skb); } @@ -1912,6 +1921,7 @@ int ath10k_wmi_cmd_send(struct ath10k *ar, struct sk_buff *skb, u32 cmd_id) might_sleep(); + ath10k_record_wmi_event(ar, ATH10K_WMI_CMD, cmd_id, skb->data); if (cmd_id == WMI_CMD_UNSUPPORTED) { ath10k_warn(ar, "wmi command %d is not supported by firmware\n", cmd_id); From patchwork Fri Jul 31 18:27:21 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rakesh Pillai X-Patchwork-Id: 11695361 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9BEB9138C for ; Fri, 31 Jul 2020 18:28:30 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7692522B42 for ; Fri, 31 Jul 2020 18:28:30 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="fRtRNCow"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=mg.codeaurora.org header.i=@mg.codeaurora.org header.b="FHn6V5de" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7692522B42 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=ath10k-bounces+patchwork-ath10k=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.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=SUIsIwtYw9ou+x1QMNwnBWyU7q9OepICriRqB0junIY=; b=fRtRNCowbfUI6ROoYF5iZaNOk8 B4pHmPCmgfcKaoohs0mXbrztQHOZt97ZycEjaQ97A5mjTVh1UoH8E7lewyrcRbCdOfVQUMexFPQOG rzRHDe1bLrbeGb4Bv24bnzzLH/XscX6Rxc97fBvGPDX4Q7/ydTlFcPDUR17D1cqlCOR3eHPqB6knA ibaC6H/Cp+npm6mlBS0V6G+95YScTtrhM++BgYVfOQFWJ1TgEFeXPPOrZsrtesWKJntnQw4ywKwB+ U/CxUijZ8kjMmnBfvg37qVJnH5e/4UvMd7i8XBKx4MNQjJ5FacRe0v/AZ/eyYvur/ebMkNyKAqxfT j9HcIDIw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1k1Zl2-0003Y3-3v; Fri, 31 Jul 2020 18:27:52 +0000 Received: from m43-7.mailgun.net ([69.72.43.7]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1k1Zky-0003WM-EV for ath10k@lists.infradead.org; Fri, 31 Jul 2020 18:27:50 +0000 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1596220069; h=References: In-Reply-To: Message-Id: Date: Subject: Cc: To: From: Sender; bh=030JoecpEIrEnydLpDjXJle+pUmDUIp7YgIR7pKOOMQ=; b=FHn6V5deMbv2lihKyhM58OmqLwA0UgXxaGhb2ZdK+FhWhfE6pmOItQ7jmRDRatL0/eIXz2FL gRr9fHmYlLJY7Ss1KyiJM0In1M6mLCksTl6q0G9FaX0wynig68iuQKLKDH2D1xYtnc+trWzo 6PfzHLuq9NR76FgLT28v+/IJSoc= X-Mailgun-Sending-Ip: 69.72.43.7 X-Mailgun-Sid: WyJiZDQ3OSIsICJhdGgxMGtAbGlzdHMuaW5mcmFkZWFkLm9yZyIsICJiZTllNGEiXQ== Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by smtp-out-n19.prod.us-west-2.postgun.com with SMTP id 5f24629e849144fbcb3d7c86 (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Fri, 31 Jul 2020 18:27:42 GMT Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 9358AC433AD; Fri, 31 Jul 2020 18:27:42 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-caf-mail-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=2.0 tests=ALL_TRUSTED,SPF_NONE autolearn=ham autolearn_force=no version=3.4.0 Received: from pillair-linux.qualcomm.com (unknown [202.46.22.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: pillair) by smtp.codeaurora.org (Postfix) with ESMTPSA id 407EFC43395; Fri, 31 Jul 2020 18:27:38 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 407EFC43395 Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; spf=none smtp.mailfrom=pillair@codeaurora.org From: Rakesh Pillai To: ath10k@lists.infradead.org Subject: [PATCH v2 2/3] ath10k: Add module param to enable history Date: Fri, 31 Jul 2020 23:57:21 +0530 Message-Id: <1596220042-2778-3-git-send-email-pillair@codeaurora.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1596220042-2778-1-git-send-email-pillair@codeaurora.org> References: <1596220042-2778-1-git-send-email-pillair@codeaurora.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200731_142749_183883_EA3EC393 X-CRM114-Status: GOOD ( 19.73 ) X-Spam-Score: 0.0 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [69.72.43.7 listed in list.dnswl.org] 0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [69.72.43.7 listed in wl.mailspike.net] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.0 RCVD_IN_MSPIKE_WL Mailspike good senders X-BeenThere: ath10k@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: netdev@vger.kernel.org, linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, Rakesh Pillai , kuba@kernel.org, davem@davemloft.net, kvalo@codeaurora.org MIME-Version: 1.0 Sender: "ath10k" Errors-To: ath10k-bounces+patchwork-ath10k=patchwork.kernel.org@lists.infradead.org Add a module param to enable recording history of certain debug events. This module parameter is a mask of the different history recording to be enabled. The memory for recording the history will not be allocated if its not enabled via module parameter. This is to avoid unnecessary memory allocation when recording the history is not needed. To enable all the history recording, the driver should be loaded as below "insmod ath10k_core.ko history_enable_mask=0xf" Tested-on: WCN3990 hw1.0 SNOC WLAN.HL.3.1-01040-QCAHLSWMTPLZ-1 Signed-off-by: Rakesh Pillai --- drivers/net/wireless/ath/ath10k/core.c | 3 +++ drivers/net/wireless/ath/ath10k/core.h | 8 ++++++++ drivers/net/wireless/ath/ath10k/debug.c | 26 ++++++++++++++++++++++---- drivers/net/wireless/ath/ath10k/debug.h | 1 + 4 files changed, 34 insertions(+), 4 deletions(-) diff --git a/drivers/net/wireless/ath/ath10k/core.c b/drivers/net/wireless/ath/ath10k/core.c index 9104496..f91a9d0 100644 --- a/drivers/net/wireless/ath/ath10k/core.c +++ b/drivers/net/wireless/ath/ath10k/core.c @@ -29,6 +29,7 @@ unsigned int ath10k_debug_mask; EXPORT_SYMBOL(ath10k_debug_mask); +unsigned long ath10k_history_enable_mask; static unsigned int ath10k_cryptmode_param; static bool uart_print; static bool skip_otp; @@ -46,6 +47,7 @@ module_param(skip_otp, bool, 0644); module_param(rawmode, bool, 0644); module_param(fw_diag_log, bool, 0644); module_param_named(coredump_mask, ath10k_coredump_mask, ulong, 0444); +module_param_named(history_enable_mask, ath10k_history_enable_mask, ulong, 0444); MODULE_PARM_DESC(debug_mask, "Debugging mask"); MODULE_PARM_DESC(uart_print, "Uart target debugging"); @@ -54,6 +56,7 @@ MODULE_PARM_DESC(cryptmode, "Crypto mode: 0-hardware, 1-software"); MODULE_PARM_DESC(rawmode, "Use raw 802.11 frame datapath"); MODULE_PARM_DESC(coredump_mask, "Bitfield of what to include in firmware crash file"); MODULE_PARM_DESC(fw_diag_log, "Diag based fw log debugging"); +MODULE_PARM_DESC(history_enable_mask, "Enable events history recording"); static const struct ath10k_hw_params ath10k_hw_params_list[] = { { diff --git a/drivers/net/wireless/ath/ath10k/core.h b/drivers/net/wireless/ath/ath10k/core.h index 46bd5aa..ce429df 100644 --- a/drivers/net/wireless/ath/ath10k/core.h +++ b/drivers/net/wireless/ath/ath10k/core.h @@ -977,6 +977,14 @@ struct ath10k_bus_params { #define ATH10K_WMI_DATA_LEN 16 +enum ath10k_history { + ATH10K_REG_ACCESS_HISTORY, + ATH10K_CE_EVENTS_HISTORY, + ATH10K_WMI_CMD_HISTORY, + ATH10K_WMI_EVENTS_HISTORY, + ATH10K_HISTORY_MAX, +}; + enum ath10k_ce_event { ATH10K_IRQ_TRIGGER, ATH10K_NAPI_POLL, diff --git a/drivers/net/wireless/ath/ath10k/debug.c b/drivers/net/wireless/ath/ath10k/debug.c index 9105b0b..5d08652 100644 --- a/drivers/net/wireless/ath/ath10k/debug.c +++ b/drivers/net/wireless/ath/ath10k/debug.c @@ -2724,6 +2724,9 @@ EXPORT_SYMBOL(ath10k_dbg_dump); int ath10k_core_reg_access_history_init(struct ath10k *ar, u32 max_entries) { + if (!test_bit(ATH10K_REG_ACCESS_HISTORY, &ath10k_history_enable_mask)) + return 0; + ar->reg_access_history.record = vzalloc(max_entries * sizeof(struct ath10k_reg_access_entry)); if (!ar->reg_access_history.record) @@ -2739,6 +2742,9 @@ EXPORT_SYMBOL(ath10k_core_reg_access_history_init); int ath10k_core_wmi_cmd_history_init(struct ath10k *ar, u32 max_entries) { + if (!test_bit(ATH10K_WMI_CMD_HISTORY, &ath10k_history_enable_mask)) + return 0; + ar->wmi_cmd_history.record = vzalloc(max_entries * sizeof(struct ath10k_wmi_event_entry)); if (!ar->wmi_cmd_history.record) @@ -2754,6 +2760,9 @@ EXPORT_SYMBOL(ath10k_core_wmi_cmd_history_init); int ath10k_core_wmi_event_history_init(struct ath10k *ar, u32 max_entries) { + if (!test_bit(ATH10K_WMI_EVENTS_HISTORY, &ath10k_history_enable_mask)) + return 0; + ar->wmi_event_history.record = vzalloc(max_entries * sizeof(struct ath10k_wmi_event_entry)); if (!ar->wmi_event_history.record) @@ -2769,6 +2778,9 @@ EXPORT_SYMBOL(ath10k_core_wmi_event_history_init); int ath10k_core_ce_event_history_init(struct ath10k *ar, u32 max_entries) { + if (!test_bit(ATH10K_CE_EVENTS_HISTORY, &ath10k_history_enable_mask)) + return 0; + ar->ce_event_history.record = vzalloc(max_entries * sizeof(struct ath10k_ce_event_entry)); if (!ar->ce_event_history.record) @@ -2787,7 +2799,8 @@ void ath10k_record_reg_access(struct ath10k *ar, u32 offset, u32 val, bool write struct ath10k_reg_access_entry *entry; u32 idx; - if (!ar->reg_access_history.record) + if (!test_bit(ATH10K_REG_ACCESS_HISTORY, &ath10k_history_enable_mask) || + !ar->reg_access_history.record) return; idx = ath10k_core_get_next_idx(&ar->reg_access_history.index, @@ -2808,7 +2821,9 @@ void ath10k_record_wmi_event(struct ath10k *ar, enum ath10k_wmi_type type, u32 idx; if (type == ATH10K_WMI_EVENT) { - if (!ar->wmi_event_history.record) + if (!test_bit(ATH10K_WMI_EVENTS_HISTORY, + &ath10k_history_enable_mask) || + !ar->wmi_event_history.record) return; spin_lock_bh(&ar->wmi_event_history.hist_lock); @@ -2817,7 +2832,9 @@ void ath10k_record_wmi_event(struct ath10k *ar, enum ath10k_wmi_type type, spin_unlock_bh(&ar->wmi_event_history.hist_lock); entry = &ar->wmi_event_history.record[idx]; } else { - if (!ar->wmi_cmd_history.record) + if (!test_bit(ATH10K_WMI_CMD_HISTORY, + &ath10k_history_enable_mask) || + !ar->wmi_event_history.record) return; spin_lock_bh(&ar->wmi_cmd_history.hist_lock); @@ -2841,7 +2858,8 @@ void ath10k_record_ce_event(struct ath10k *ar, enum ath10k_ce_event event_type, struct ath10k_ce_event_entry *entry; u32 idx; - if (!ar->ce_event_history.record) + if (!test_bit(ATH10K_CE_EVENTS_HISTORY, &ath10k_history_enable_mask) || + !ar->ce_event_history.record) return; idx = ath10k_core_get_next_idx(&ar->ce_event_history.index, diff --git a/drivers/net/wireless/ath/ath10k/debug.h b/drivers/net/wireless/ath/ath10k/debug.h index c28aeb1..7799b89 100644 --- a/drivers/net/wireless/ath/ath10k/debug.h +++ b/drivers/net/wireless/ath/ath10k/debug.h @@ -75,6 +75,7 @@ struct ath10k_pktlog_hdr { #define ATH10K_TX_POWER_MIN_VAL 0 extern unsigned int ath10k_debug_mask; +extern unsigned long ath10k_history_enable_mask; __printf(2, 3) void ath10k_info(struct ath10k *ar, const char *fmt, ...); __printf(2, 3) void ath10k_err(struct ath10k *ar, const char *fmt, ...); From patchwork Fri Jul 31 18:27:22 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rakesh Pillai X-Patchwork-Id: 11695357 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7807A161F for ; Fri, 31 Jul 2020 18:28:25 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 51DB822BEA for ; Fri, 31 Jul 2020 18:28:25 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="U3s6KWMS"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=mg.codeaurora.org header.i=@mg.codeaurora.org header.b="V/ERma/e" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 51DB822BEA Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=ath10k-bounces+patchwork-ath10k=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.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=tKvQw1P7qG9JGrBMsN9oIvSpymI8mC6bX8feVQgYGIs=; b=U3s6KWMSJ22PXFaO1C7zN7jrzD PWbtOwHOi3SBrzqTd6ZQ5sT2Ovfe/ecAuMlNIdV+XKOSGmy8AvA9d5Q5TXq7ja1NIB2k3wEjCQW0O Z1ZK6KSYZfOOBmE+usoLuxbITk6OB0mQChiqnEgvxJqrcUdiz7ePqSTc2qXFQIykQeLgDKoLkwg8u vwpWFe7YEn5Ih6kE2PfEgI0dBAqcTKySyv0UhMyAlyg6wAwXurtsLZYcoGxjhUMs7/cw4xmUFt3lv LzivGairn89QxxizZjbxdxOEdBSObIEaBAK7lQUPagTcRK34unZlp/x5LmjLozgonq2El7pEnTLgs qHMlEUQQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1k1ZlL-0003du-Cu; Fri, 31 Jul 2020 18:28:11 +0000 Received: from mail29.static.mailgun.info ([104.130.122.29]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1k1ZlC-0003at-C0 for ath10k@lists.infradead.org; Fri, 31 Jul 2020 18:28:09 +0000 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1596220088; h=References: In-Reply-To: Message-Id: Date: Subject: Cc: To: From: Sender; bh=vjQiGVYzJ12zA+igqujOYlOj1OL8iIPU8CB8EiC7eQw=; b=V/ERma/eflF4cCYF/veW1VrBM0/yRWp+aNYdootEugzfboNLLnuJlGjpSxcbYznYFTcCMaLn tkiM3T3UIvg84FISExYZdIHIULTIH11RFvAJRpfEhpliQzN5UADsSJVLaz5gm65sxJt33w/2 HGsVp7ZGmjJVl+9xERKq/s4jCCo= X-Mailgun-Sending-Ip: 104.130.122.29 X-Mailgun-Sid: WyJiZDQ3OSIsICJhdGgxMGtAbGlzdHMuaW5mcmFkZWFkLm9yZyIsICJiZTllNGEiXQ== Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by smtp-out-n09.prod.us-west-2.postgun.com with SMTP id 5f2462a2849144fbcb3d8228 (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Fri, 31 Jul 2020 18:27:46 GMT Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 03B3CC433B1; Fri, 31 Jul 2020 18:27:45 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-caf-mail-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=2.0 tests=ALL_TRUSTED,SPF_NONE autolearn=unavailable autolearn_force=no version=3.4.0 Received: from pillair-linux.qualcomm.com (unknown [202.46.22.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: pillair) by smtp.codeaurora.org (Postfix) with ESMTPSA id 875B1C433A1; Fri, 31 Jul 2020 18:27:42 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 875B1C433A1 Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; spf=none smtp.mailfrom=pillair@codeaurora.org From: Rakesh Pillai To: ath10k@lists.infradead.org Subject: [PATCH v2 3/3] ath10k: Add debugfs support to enable event history Date: Fri, 31 Jul 2020 23:57:22 +0530 Message-Id: <1596220042-2778-4-git-send-email-pillair@codeaurora.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1596220042-2778-1-git-send-email-pillair@codeaurora.org> References: <1596220042-2778-1-git-send-email-pillair@codeaurora.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200731_142808_767000_2FD40726 X-CRM114-Status: GOOD ( 17.73 ) X-Spam-Score: -0.0 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [104.130.122.29 listed in wl.mailspike.net] -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [104.130.122.29 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-BeenThere: ath10k@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: netdev@vger.kernel.org, linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, Rakesh Pillai , kuba@kernel.org, davem@davemloft.net, kvalo@codeaurora.org MIME-Version: 1.0 Sender: "ath10k" Errors-To: ath10k-bounces+patchwork-ath10k=patchwork.kernel.org@lists.infradead.org Add the support to enable/disable the recording of debug events history. The enable/disable of the history from debugfs will not make any affect if its not enabled via module parameter. Tested-on: WCN3990 hw1.0 SNOC WLAN.HL.3.1-01040-QCAHLSWMTPLZ-1 Signed-off-by: Rakesh Pillai --- drivers/net/wireless/ath/ath10k/debug.c | 56 +++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) diff --git a/drivers/net/wireless/ath/ath10k/debug.c b/drivers/net/wireless/ath/ath10k/debug.c index 5d08652..6785fae 100644 --- a/drivers/net/wireless/ath/ath10k/debug.c +++ b/drivers/net/wireless/ath/ath10k/debug.c @@ -610,6 +610,59 @@ static const struct file_operations fops_simulate_fw_crash = { .llseek = default_llseek, }; +static ssize_t ath10k_read_history_enable(struct file *file, + char __user *user_buf, + size_t count, loff_t *ppos) +{ + const char buf[] = + "To enable recording of certain event history, write to this file with the enable mask\n" + "BIT(0): Enable Reg Access history\n" + " - Register write events\n" + " - Register read events\n" + "BIT(1): Enable CE events history\n" + " - ATH10K_IRQ_TRIGGER event\n" + " - ATH10K_NAPI_POLL event\n" + " - ATH10K_CE_SERVICE event\n" + " - ATH10K_NAPI_COMPLETE event\n" + " - ATH10K_NAPI_RESCHED event\n" + " - ATH10K_IRQ_SUMMARY event\n" + "BIT(2): Enable WMI CMD history\n" + " - WMI CMD event\n" + " - WMI CMD TX completion event\n" + "BIT(3): Enable WMI events history\n" + " - WMI Events event\n"; + + return simple_read_from_buffer(user_buf, count, ppos, buf, strlen(buf)); +} + +static ssize_t ath10k_write_history_enable(struct file *file, + const char __user *user_buf, + size_t count, loff_t *ppos) +{ + u32 history_enable_mask; + int i, ret; + + ret = kstrtou32_from_user(user_buf, count, 0, &history_enable_mask); + if (ret) + return ret; + + for (i = 0; i < ATH10K_HISTORY_MAX; i++) + if (history_enable_mask & BIT(i)) + set_bit(i, &ath10k_history_enable_mask); + else + clear_bit(i, &ath10k_history_enable_mask); + + return count; +} + +static const struct file_operations fops_history_enable = { + .read = ath10k_read_history_enable, + .write = ath10k_write_history_enable, + .open = simple_open, + .owner = THIS_MODULE, + .llseek = default_llseek, +}; + static ssize_t ath10k_read_chip_id(struct file *file, char __user *user_buf, size_t count, loff_t *ppos) { @@ -2658,6 +2711,9 @@ int ath10k_debug_register(struct ath10k *ar) debugfs_create_file("reset_htt_stats", 0200, ar->debug.debugfs_phy, ar, &fops_reset_htt_stats); + debugfs_create_file("history_enable", 0644, ar->debug.debugfs_phy, ar, + &fops_history_enable); + return 0; }