From patchwork Mon Jan 12 18:32:41 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Greear X-Patchwork-Id: 5616191 Return-Path: X-Original-To: patchwork-ath10k@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 02CF69F358 for ; Mon, 12 Jan 2015 19:49:56 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id AC6A6204DE for ; Mon, 12 Jan 2015 19:49:54 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id AC8F5204D8 for ; Mon, 12 Jan 2015 19:49:53 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1YAkzj-0003a6-Se; Mon, 12 Jan 2015 19:49:47 +0000 Received: from mail2.candelatech.com ([208.74.158.173]) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1YAkzO-0002sN-JC for ath10k@lists.infradead.org; Mon, 12 Jan 2015 19:49:29 +0000 Received: from firewall.candelatech.com (unknown [50.251.239.81]) by mail2.candelatech.com (Postfix) with ESMTP id 8EA7F40D706; Mon, 12 Jan 2015 11:48:44 -0800 (PST) Received: from ben-dt2.candelatech.com. (ben-dt2.candelatech.com [192.168.100.236]) by firewall.candelatech.com (Postfix) with ESMTP id 05DC15A0730; Mon, 12 Jan 2015 10:32:51 -0800 (PST) From: greearb@candelatech.com To: ath10k@lists.infradead.org Subject: [RFC 5/8] ath10k: add firmware wmi keep-alive message. Date: Mon, 12 Jan 2015 10:32:41 -0800 Message-Id: <1421087564-10384-5-git-send-email-greearb@candelatech.com> X-Mailer: git-send-email 1.7.11.7 In-Reply-To: <1421087564-10384-1-git-send-email-greearb@candelatech.com> References: <1421087564-10384-1-git-send-email-greearb@candelatech.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150112_114926_751390_9BAE6C42 X-CRM114-Status: GOOD ( 12.89 ) X-Spam-Score: -0.0 (/) Cc: Ben Greear , linux-wireless@vger.kernel.org X-BeenThere: ath10k@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "ath10k" Errors-To: ath10k-bounces+patchwork-ath10k=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Ben Greear Only useful for CT firmware. This sends a wmi message to the firmware every 2 seconds or so. Once CT firmware receives one of these messages, it will assert if it does not receive more within a 10 second window. This helps debug and work-around wmi transport hangs. Signed-off-by: Ben Greear --- This is for comment only, as it requires at least minimal CT firmware support patches in order to compile or work. drivers/net/wireless/ath/ath10k/core.h | 2 ++ drivers/net/wireless/ath/ath10k/debug.c | 29 +++++++++++++++++++++++++++++ drivers/net/wireless/ath/ath10k/wmi.c | 32 ++++++++++++++++++++++++++++++++ drivers/net/wireless/ath/ath10k/wmi.h | 7 +++++++ 4 files changed, 70 insertions(+) diff --git a/drivers/net/wireless/ath/ath10k/core.h b/drivers/net/wireless/ath/ath10k/core.h index a16cadd..f3729bc 100644 --- a/drivers/net/wireless/ath/ath10k/core.h +++ b/drivers/net/wireless/ath/ath10k/core.h @@ -367,6 +367,7 @@ struct ath10k_debug { unsigned long htt_stats_mask; struct delayed_work htt_stats_dwork; + struct delayed_work nop_dwork; struct ath10k_dfs_stats dfs_stats; struct ath_dfs_pool_stats dfs_pool_stats; @@ -374,6 +375,7 @@ struct ath10k_debug { u32 fw_dbglog_mask; u32 pktlog_filter; u32 reg_addr; + u32 nop_id; u8 htt_max_amsdu; u8 htt_max_ampdu; diff --git a/drivers/net/wireless/ath/ath10k/debug.c b/drivers/net/wireless/ath/ath10k/debug.c index 92c8488..f419e88 100644 --- a/drivers/net/wireless/ath/ath10k/debug.c +++ b/drivers/net/wireless/ath/ath10k/debug.c @@ -27,6 +27,8 @@ /* ms */ #define ATH10K_DEBUG_HTT_STATS_INTERVAL 1000 +#define ATH10K_DEBUG_NOP_INTERVAL 2000 /* ms */ + #define ATH10K_FW_CRASH_DUMP_VERSION 1 /** @@ -1550,6 +1552,27 @@ static void ath10k_debug_htt_stats_dwork(struct work_struct *work) mutex_unlock(&ar->conf_mutex); } +static void ath10k_debug_nop_dwork(struct work_struct *work) +{ + struct ath10k *ar = container_of(work, struct ath10k, + debug.nop_dwork.work); + + mutex_lock(&ar->conf_mutex); + + if (ar->state == ATH10K_STATE_ON) { + int ret = ath10k_wmi_request_nop(ar); + if (ret) { + ath10k_warn(ar, "failed to send wmi nop: %d\n", ret); + } + } + + /* Re-arm periodic work. */ + queue_delayed_work(ar->workqueue, &ar->debug.nop_dwork, + msecs_to_jiffies(ATH10K_DEBUG_NOP_INTERVAL)); + + mutex_unlock(&ar->conf_mutex); +} + static ssize_t ath10k_read_htt_stats_mask(struct file *file, char __user *user_buf, size_t count, loff_t *ppos) @@ -2192,6 +2215,11 @@ int ath10k_debug_register(struct ath10k *ar) return -ENOMEM; } + INIT_DELAYED_WORK(&ar->debug.nop_dwork, ath10k_debug_nop_dwork); + + queue_delayed_work(ar->workqueue, &ar->debug.nop_dwork, + msecs_to_jiffies(ATH10K_DEBUG_NOP_INTERVAL)); + INIT_DELAYED_WORK(&ar->debug.htt_stats_dwork, ath10k_debug_htt_stats_dwork); @@ -2262,6 +2290,7 @@ int ath10k_debug_register(struct ath10k *ar) void ath10k_debug_unregister(struct ath10k *ar) { + cancel_delayed_work_sync(&ar->debug.nop_dwork); cancel_delayed_work_sync(&ar->debug.htt_stats_dwork); } diff --git a/drivers/net/wireless/ath/ath10k/wmi.c b/drivers/net/wireless/ath/ath10k/wmi.c index 203bcb9..5d3fe88 100644 --- a/drivers/net/wireless/ath/ath10k/wmi.c +++ b/drivers/net/wireless/ath/ath10k/wmi.c @@ -4480,6 +4480,38 @@ int ath10k_wmi_request_stats(struct ath10k *ar, enum wmi_stats_id stats_id) return ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->request_stats_cmdid); } +#ifdef CONFIG_ATH10K_DEBUG +/* CT firmware only: + * (re) start wmi keep-alive timer in firmware. Once we start + * sending these, firmware will assert if it does not receive one + * after about 10 seconds. + */ + +struct wmi_request_nop_cmd { + u32 nop_id; /* for debugging purposes */ +}; + +int ath10k_wmi_request_nop(struct ath10k *ar) +{ + struct wmi_request_nop_cmd *cmd; + struct sk_buff *skb; + + if (! test_bit(ATH10K_FW_FEATURE_WMI_10X_CT, ar->fw_features)) + return 0; + + skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd)); + if (!skb) + return -ENOMEM; + + cmd = (struct wmi_request_nop_cmd *)skb->data; + cmd->nop_id = __cpu_to_le32(ar->debug.nop_id++); + + ath10k_dbg(ar, ATH10K_DBG_WMI, "wmi request nop (id %d)\n", + ar->debug.nop_id - 1); + return ath10k_wmi_cmd_send(ar, skb, WMI_NOP); +} +#endif + int ath10k_wmi_force_fw_hang(struct ath10k *ar, enum wmi_force_fw_hang_type type, u32 delay_ms) { diff --git a/drivers/net/wireless/ath/ath10k/wmi.h b/drivers/net/wireless/ath/ath10k/wmi.h index 026a697..fc9f068 100644 --- a/drivers/net/wireless/ath/ath10k/wmi.h +++ b/drivers/net/wireless/ath/ath10k/wmi.h @@ -901,6 +901,8 @@ enum wmi_10x_cmd_id { WMI_10X_GPIO_CONFIG_CMDID, WMI_10X_GPIO_OUTPUT_CMDID, + WMI_NOP = WMI_10X_END_CMDID - 100, /* CT only: wmi transport keep-alive, basically */ + WMI_10X_PDEV_UTF_CMDID = WMI_10X_END_CMDID - 1, }; @@ -4736,4 +4738,9 @@ int ath10k_wmi_pull_fw_stats(struct ath10k *ar, struct sk_buff *skb, int ath10k_wmi_pdev_pktlog_enable(struct ath10k *ar, u32 ev_list); int ath10k_wmi_pdev_pktlog_disable(struct ath10k *ar); +#ifdef CONFIG_ATH10K_DEBUG +/* CT Firmware only */ +int ath10k_wmi_request_nop(struct ath10k *ar); +#endif + #endif /* _WMI_H_ */