@@ -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;
@@ -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);
}
@@ -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)
{
@@ -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_ */