2 * Copyright (c) 2005-2011 Atheros Communications Inc.
3 * Copyright (c) 2011-2013 Qualcomm Atheros, Inc.
5 * Permission to use, copy, modify, and/or distribute this software for any
6 * purpose with or without fee is hereby granted, provided that the above
7 * copyright notice and this permission notice appear in all copies.
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18 #include <linux/module.h>
19 #include <linux/debugfs.h>
20 #include <linux/vmalloc.h>
21 #include <linux/utsname.h>
22 #include <linux/crc32.h>
23 #include <linux/firmware.h>
31 #define ATH10K_DEBUG_HTT_STATS_INTERVAL 1000
33 #define ATH10K_DEBUG_CAL_DATA_LEN 12064
35 #define ATH10K_FW_CRASH_DUMP_VERSION 1
38 * enum ath10k_fw_crash_dump_type - types of data in the dump file
39 * @ATH10K_FW_CRASH_DUMP_REGDUMP: Register crash dump in binary format
41 enum ath10k_fw_crash_dump_type {
42 ATH10K_FW_CRASH_DUMP_REGISTERS = 0,
44 ATH10K_FW_CRASH_DUMP_MAX,
47 struct ath10k_tlv_dump_data {
48 /* see ath10k_fw_crash_dump_type above */
54 /* pad to 32-bit boundaries as needed */
58 struct ath10k_dump_file_data {
59 /* dump file information */
61 /* "ATH10K-FW-DUMP" */
66 /* file dump version */
69 /* some info we can get from ath10k struct that might help */
75 /* 0 for now, in place for later hardware */
78 __le32 target_version;
79 __le32 fw_version_major;
80 __le32 fw_version_minor;
81 __le32 fw_version_release;
82 __le32 fw_version_build;
83 __le32 phy_capability;
84 __le32 hw_min_tx_power;
85 __le32 hw_max_tx_power;
90 /* firmware version string */
91 char fw_ver[ETHTOOL_FWVERS_LEN];
93 /* Kernel related information */
95 /* time-of-day stamp */
98 /* time-of-day stamp, nano-seconds */
101 /* LINUX_VERSION_CODE */
102 __le32 kernel_ver_code;
104 /* VERMAGIC_STRING */
107 /* room for growth w/out changing binary format */
110 /* struct ath10k_tlv_dump_data + more */
114 void ath10k_info(struct ath10k *ar, const char *fmt, ...)
116 struct va_format vaf = {
123 dev_info(ar->dev, "%pV", &vaf);
124 trace_ath10k_log_info(ar, &vaf);
127 EXPORT_SYMBOL(ath10k_info);
129 void ath10k_debug_print_hwfw_info(struct ath10k *ar)
131 const struct firmware *firmware;
132 char fw_features[128] = {};
135 ath10k_core_get_fw_features_str(ar, fw_features, sizeof(fw_features));
137 ath10k_info(ar, "%s target 0x%08x chip_id 0x%08x sub %04x:%04x",
141 ar->id.subsystem_vendor, ar->id.subsystem_device);
143 ath10k_info(ar, "kconfig debug %d debugfs %d tracing %d dfs %d testmode %d\n",
144 IS_ENABLED(CONFIG_ATH10K_DEBUG),
145 IS_ENABLED(CONFIG_ATH10K_DEBUGFS),
146 IS_ENABLED(CONFIG_ATH10K_TRACING),
147 IS_ENABLED(CONFIG_ATH10K_DFS_CERTIFIED),
148 IS_ENABLED(CONFIG_NL80211_TESTMODE));
150 firmware = ar->normal_mode_fw.fw_file.firmware;
152 crc = crc32_le(0, firmware->data, firmware->size);
154 ath10k_info(ar, "firmware ver %s api %d features %s crc32 %08x\n",
155 ar->hw->wiphy->fw_version,
161 void ath10k_debug_print_board_info(struct ath10k *ar)
165 if (ar->id.bmi_ids_valid)
166 scnprintf(boardinfo, sizeof(boardinfo), "%d:%d",
167 ar->id.bmi_chip_id, ar->id.bmi_board_id);
169 scnprintf(boardinfo, sizeof(boardinfo), "N/A");
171 ath10k_info(ar, "board_file api %d bmi_id %s crc32 %08x",
174 crc32_le(0, ar->normal_mode_fw.board->data,
175 ar->normal_mode_fw.board->size));
178 void ath10k_debug_print_boot_info(struct ath10k *ar)
180 ath10k_info(ar, "htt-ver %d.%d wmi-op %d htt-op %d cal %s max-sta %d raw %d hwcrypto %d\n",
181 ar->htt.target_version_major,
182 ar->htt.target_version_minor,
183 ar->normal_mode_fw.fw_file.wmi_op_version,
184 ar->normal_mode_fw.fw_file.htt_op_version,
185 ath10k_cal_mode_str(ar->cal_mode),
186 ar->max_num_stations,
187 test_bit(ATH10K_FLAG_RAW_MODE, &ar->dev_flags),
188 !test_bit(ATH10K_FLAG_HW_CRYPTO_DISABLED, &ar->dev_flags));
191 void ath10k_print_driver_info(struct ath10k *ar)
193 ath10k_debug_print_hwfw_info(ar);
194 ath10k_debug_print_board_info(ar);
195 ath10k_debug_print_boot_info(ar);
197 EXPORT_SYMBOL(ath10k_print_driver_info);
199 void ath10k_err(struct ath10k *ar, const char *fmt, ...)
201 struct va_format vaf = {
208 dev_err(ar->dev, "%pV", &vaf);
209 trace_ath10k_log_err(ar, &vaf);
212 EXPORT_SYMBOL(ath10k_err);
214 void ath10k_warn(struct ath10k *ar, const char *fmt, ...)
216 struct va_format vaf = {
223 dev_warn_ratelimited(ar->dev, "%pV", &vaf);
224 trace_ath10k_log_warn(ar, &vaf);
228 EXPORT_SYMBOL(ath10k_warn);
230 #ifdef CONFIG_ATH10K_DEBUGFS
232 static ssize_t ath10k_read_wmi_services(struct file *file,
233 char __user *user_buf,
234 size_t count, loff_t *ppos)
236 struct ath10k *ar = file->private_data;
238 unsigned int len = 0, buf_len = 4096;
244 buf = kzalloc(buf_len, GFP_KERNEL);
248 mutex_lock(&ar->conf_mutex);
253 spin_lock_bh(&ar->data_lock);
254 for (i = 0; i < WMI_SERVICE_MAX; i++) {
255 enabled = test_bit(i, ar->wmi.svc_map);
256 name = wmi_service_name(i);
260 len += scnprintf(buf + len, buf_len - len,
261 "%-40s %s (bit %d)\n",
262 "unknown", "enabled", i);
267 len += scnprintf(buf + len, buf_len - len,
269 name, enabled ? "enabled" : "-");
271 spin_unlock_bh(&ar->data_lock);
273 ret_cnt = simple_read_from_buffer(user_buf, count, ppos, buf, len);
275 mutex_unlock(&ar->conf_mutex);
281 static const struct file_operations fops_wmi_services = {
282 .read = ath10k_read_wmi_services,
284 .owner = THIS_MODULE,
285 .llseek = default_llseek,
288 static void ath10k_fw_stats_pdevs_free(struct list_head *head)
290 struct ath10k_fw_stats_pdev *i, *tmp;
292 list_for_each_entry_safe(i, tmp, head, list) {
298 static void ath10k_fw_stats_vdevs_free(struct list_head *head)
300 struct ath10k_fw_stats_vdev *i, *tmp;
302 list_for_each_entry_safe(i, tmp, head, list) {
308 static void ath10k_fw_stats_peers_free(struct list_head *head)
310 struct ath10k_fw_stats_peer *i, *tmp;
312 list_for_each_entry_safe(i, tmp, head, list) {
318 static void ath10k_fw_extd_stats_peers_free(struct list_head *head)
320 struct ath10k_fw_extd_stats_peer *i, *tmp;
322 list_for_each_entry_safe(i, tmp, head, list) {
328 static void ath10k_debug_fw_stats_reset(struct ath10k *ar)
330 spin_lock_bh(&ar->data_lock);
331 ar->debug.fw_stats_done = false;
332 ar->debug.fw_stats.extended = false;
333 ath10k_fw_stats_pdevs_free(&ar->debug.fw_stats.pdevs);
334 ath10k_fw_stats_vdevs_free(&ar->debug.fw_stats.vdevs);
335 ath10k_fw_stats_peers_free(&ar->debug.fw_stats.peers);
336 ath10k_fw_extd_stats_peers_free(&ar->debug.fw_stats.peers_extd);
337 spin_unlock_bh(&ar->data_lock);
340 void ath10k_debug_fw_stats_process(struct ath10k *ar, struct sk_buff *skb)
342 struct ath10k_fw_stats stats = {};
343 bool is_start, is_started, is_end;
348 INIT_LIST_HEAD(&stats.pdevs);
349 INIT_LIST_HEAD(&stats.vdevs);
350 INIT_LIST_HEAD(&stats.peers);
351 INIT_LIST_HEAD(&stats.peers_extd);
353 spin_lock_bh(&ar->data_lock);
354 ret = ath10k_wmi_pull_fw_stats(ar, skb, &stats);
356 ath10k_warn(ar, "failed to pull fw stats: %d\n", ret);
360 /* Stat data may exceed htc-wmi buffer limit. In such case firmware
361 * splits the stats data and delivers it in a ping-pong fashion of
362 * request cmd-update event.
364 * However there is no explicit end-of-data. Instead start-of-data is
365 * used as an implicit one. This works as follows:
366 * a) discard stat update events until one with pdev stats is
367 * delivered - this skips session started at end of (b)
368 * b) consume stat update events until another one with pdev stats is
369 * delivered which is treated as end-of-data and is itself discarded
371 if (ath10k_peer_stats_enabled(ar))
372 ath10k_sta_update_rx_duration(ar, &stats);
374 if (ar->debug.fw_stats_done) {
375 if (!ath10k_peer_stats_enabled(ar))
376 ath10k_warn(ar, "received unsolicited stats update event\n");
381 num_peers = ath10k_wmi_fw_stats_num_peers(&ar->debug.fw_stats.peers);
382 num_vdevs = ath10k_wmi_fw_stats_num_vdevs(&ar->debug.fw_stats.vdevs);
383 is_start = (list_empty(&ar->debug.fw_stats.pdevs) &&
384 !list_empty(&stats.pdevs));
385 is_end = (!list_empty(&ar->debug.fw_stats.pdevs) &&
386 !list_empty(&stats.pdevs));
389 list_splice_tail_init(&stats.pdevs, &ar->debug.fw_stats.pdevs);
392 ar->debug.fw_stats_done = true;
394 is_started = !list_empty(&ar->debug.fw_stats.pdevs);
396 if (is_started && !is_end) {
397 if (num_peers >= ATH10K_MAX_NUM_PEER_IDS) {
398 /* Although this is unlikely impose a sane limit to
399 * prevent firmware from DoS-ing the host.
401 ath10k_fw_stats_peers_free(&ar->debug.fw_stats.peers);
402 ath10k_warn(ar, "dropping fw peer stats\n");
406 if (num_vdevs >= BITS_PER_LONG) {
407 ath10k_fw_stats_vdevs_free(&ar->debug.fw_stats.vdevs);
408 ath10k_warn(ar, "dropping fw vdev stats\n");
412 list_splice_tail_init(&stats.peers, &ar->debug.fw_stats.peers);
413 list_splice_tail_init(&stats.vdevs, &ar->debug.fw_stats.vdevs);
414 list_splice_tail_init(&stats.peers_extd,
415 &ar->debug.fw_stats.peers_extd);
418 complete(&ar->debug.fw_stats_complete);
421 /* In some cases lists have been spliced and cleared. Free up
422 * resources if that is not the case.
424 ath10k_fw_stats_pdevs_free(&stats.pdevs);
425 ath10k_fw_stats_vdevs_free(&stats.vdevs);
426 ath10k_fw_stats_peers_free(&stats.peers);
427 ath10k_fw_extd_stats_peers_free(&stats.peers_extd);
429 spin_unlock_bh(&ar->data_lock);
432 static int ath10k_debug_fw_stats_request(struct ath10k *ar)
434 unsigned long timeout, time_left;
437 lockdep_assert_held(&ar->conf_mutex);
439 timeout = jiffies + msecs_to_jiffies(1 * HZ);
441 ath10k_debug_fw_stats_reset(ar);
444 if (time_after(jiffies, timeout))
447 reinit_completion(&ar->debug.fw_stats_complete);
449 ret = ath10k_wmi_request_stats(ar, ar->fw_stats_req_mask);
451 ath10k_warn(ar, "could not request stats (%d)\n", ret);
456 wait_for_completion_timeout(&ar->debug.fw_stats_complete,
461 spin_lock_bh(&ar->data_lock);
462 if (ar->debug.fw_stats_done) {
463 spin_unlock_bh(&ar->data_lock);
466 spin_unlock_bh(&ar->data_lock);
472 static int ath10k_fw_stats_open(struct inode *inode, struct file *file)
474 struct ath10k *ar = inode->i_private;
478 mutex_lock(&ar->conf_mutex);
480 if (ar->state != ATH10K_STATE_ON) {
485 buf = vmalloc(ATH10K_FW_STATS_BUF_SIZE);
491 ret = ath10k_debug_fw_stats_request(ar);
493 ath10k_warn(ar, "failed to request fw stats: %d\n", ret);
497 ret = ath10k_wmi_fw_stats_fill(ar, &ar->debug.fw_stats, buf);
499 ath10k_warn(ar, "failed to fill fw stats: %d\n", ret);
503 file->private_data = buf;
505 mutex_unlock(&ar->conf_mutex);
512 mutex_unlock(&ar->conf_mutex);
516 static int ath10k_fw_stats_release(struct inode *inode, struct file *file)
518 vfree(file->private_data);
523 static ssize_t ath10k_fw_stats_read(struct file *file, char __user *user_buf,
524 size_t count, loff_t *ppos)
526 const char *buf = file->private_data;
527 unsigned int len = strlen(buf);
529 return simple_read_from_buffer(user_buf, count, ppos, buf, len);
532 static const struct file_operations fops_fw_stats = {
533 .open = ath10k_fw_stats_open,
534 .release = ath10k_fw_stats_release,
535 .read = ath10k_fw_stats_read,
536 .owner = THIS_MODULE,
537 .llseek = default_llseek,
540 static ssize_t ath10k_debug_fw_reset_stats_read(struct file *file,
541 char __user *user_buf,
542 size_t count, loff_t *ppos)
544 struct ath10k *ar = file->private_data;
545 int ret, len, buf_len;
549 buf = kmalloc(buf_len, GFP_KERNEL);
553 spin_lock_bh(&ar->data_lock);
556 len += scnprintf(buf + len, buf_len - len,
557 "fw_crash_counter\t\t%d\n", ar->stats.fw_crash_counter);
558 len += scnprintf(buf + len, buf_len - len,
559 "fw_warm_reset_counter\t\t%d\n",
560 ar->stats.fw_warm_reset_counter);
561 len += scnprintf(buf + len, buf_len - len,
562 "fw_cold_reset_counter\t\t%d\n",
563 ar->stats.fw_cold_reset_counter);
565 spin_unlock_bh(&ar->data_lock);
567 ret = simple_read_from_buffer(user_buf, count, ppos, buf, len);
574 static const struct file_operations fops_fw_reset_stats = {
576 .read = ath10k_debug_fw_reset_stats_read,
577 .owner = THIS_MODULE,
578 .llseek = default_llseek,
581 /* This is a clean assert crash in firmware. */
582 static int ath10k_debug_fw_assert(struct ath10k *ar)
584 struct wmi_vdev_install_key_cmd *cmd;
587 skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd) + 16);
591 cmd = (struct wmi_vdev_install_key_cmd *)skb->data;
592 memset(cmd, 0, sizeof(*cmd));
594 /* big enough number so that firmware asserts */
595 cmd->vdev_id = __cpu_to_le32(0x7ffe);
597 return ath10k_wmi_cmd_send(ar, skb,
598 ar->wmi.cmd->vdev_install_key_cmdid);
601 static ssize_t ath10k_read_simulate_fw_crash(struct file *file,
602 char __user *user_buf,
603 size_t count, loff_t *ppos)
606 "To simulate firmware crash write one of the keywords to this file:\n"
607 "`soft` - this will send WMI_FORCE_FW_HANG_ASSERT to firmware if FW supports that command.\n"
608 "`hard` - this will send to firmware command with illegal parameters causing firmware crash.\n"
609 "`assert` - this will send special illegal parameter to firmware to cause assert failure and crash.\n"
610 "`hw-restart` - this will simply queue hw restart without fw/hw actually crashing.\n";
612 return simple_read_from_buffer(user_buf, count, ppos, buf, strlen(buf));
615 /* Simulate firmware crash:
616 * 'soft': Call wmi command causing firmware hang. This firmware hang is
617 * recoverable by warm firmware reset.
618 * 'hard': Force firmware crash by setting any vdev parameter for not allowed
619 * vdev id. This is hard firmware crash because it is recoverable only by cold
622 static ssize_t ath10k_write_simulate_fw_crash(struct file *file,
623 const char __user *user_buf,
624 size_t count, loff_t *ppos)
626 struct ath10k *ar = file->private_data;
630 simple_write_to_buffer(buf, sizeof(buf) - 1, ppos, user_buf, count);
632 /* make sure that buf is null terminated */
633 buf[sizeof(buf) - 1] = 0;
635 /* drop the possible '\n' from the end */
636 if (buf[count - 1] == '\n')
639 mutex_lock(&ar->conf_mutex);
641 if (ar->state != ATH10K_STATE_ON &&
642 ar->state != ATH10K_STATE_RESTARTED) {
647 if (!strcmp(buf, "soft")) {
648 ath10k_info(ar, "simulating soft firmware crash\n");
649 ret = ath10k_wmi_force_fw_hang(ar, WMI_FORCE_FW_HANG_ASSERT, 0);
650 } else if (!strcmp(buf, "hard")) {
651 ath10k_info(ar, "simulating hard firmware crash\n");
652 /* 0x7fff is vdev id, and it is always out of range for all
653 * firmware variants in order to force a firmware crash.
655 ret = ath10k_wmi_vdev_set_param(ar, 0x7fff,
656 ar->wmi.vdev_param->rts_threshold,
658 } else if (!strcmp(buf, "assert")) {
659 ath10k_info(ar, "simulating firmware assert crash\n");
660 ret = ath10k_debug_fw_assert(ar);
661 } else if (!strcmp(buf, "hw-restart")) {
662 ath10k_info(ar, "user requested hw restart\n");
663 queue_work(ar->workqueue, &ar->restart_work);
671 ath10k_warn(ar, "failed to simulate firmware crash: %d\n", ret);
678 mutex_unlock(&ar->conf_mutex);
682 static const struct file_operations fops_simulate_fw_crash = {
683 .read = ath10k_read_simulate_fw_crash,
684 .write = ath10k_write_simulate_fw_crash,
686 .owner = THIS_MODULE,
687 .llseek = default_llseek,
690 static ssize_t ath10k_read_chip_id(struct file *file, char __user *user_buf,
691 size_t count, loff_t *ppos)
693 struct ath10k *ar = file->private_data;
697 len = scnprintf(buf, sizeof(buf), "0x%08x\n", ar->chip_id);
699 return simple_read_from_buffer(user_buf, count, ppos, buf, len);
702 static const struct file_operations fops_chip_id = {
703 .read = ath10k_read_chip_id,
705 .owner = THIS_MODULE,
706 .llseek = default_llseek,
709 struct ath10k_fw_crash_data *
710 ath10k_debug_get_new_fw_crash_data(struct ath10k *ar)
712 struct ath10k_fw_crash_data *crash_data = ar->debug.fw_crash_data;
714 lockdep_assert_held(&ar->data_lock);
716 crash_data->crashed_since_read = true;
717 uuid_le_gen(&crash_data->uuid);
718 getnstimeofday(&crash_data->timestamp);
722 EXPORT_SYMBOL(ath10k_debug_get_new_fw_crash_data);
724 static struct ath10k_dump_file_data *ath10k_build_dump_file(struct ath10k *ar)
726 struct ath10k_fw_crash_data *crash_data = ar->debug.fw_crash_data;
727 struct ath10k_dump_file_data *dump_data;
728 struct ath10k_tlv_dump_data *dump_tlv;
729 int hdr_len = sizeof(*dump_data);
730 unsigned int len, sofar = 0;
734 len += sizeof(*dump_tlv) + sizeof(crash_data->registers);
738 /* This is going to get big when we start dumping FW RAM and such,
739 * so go ahead and use vmalloc.
745 spin_lock_bh(&ar->data_lock);
747 if (!crash_data->crashed_since_read) {
748 spin_unlock_bh(&ar->data_lock);
753 dump_data = (struct ath10k_dump_file_data *)(buf);
754 strlcpy(dump_data->df_magic, "ATH10K-FW-DUMP",
755 sizeof(dump_data->df_magic));
756 dump_data->len = cpu_to_le32(len);
758 dump_data->version = cpu_to_le32(ATH10K_FW_CRASH_DUMP_VERSION);
760 memcpy(dump_data->uuid, &crash_data->uuid, sizeof(dump_data->uuid));
761 dump_data->chip_id = cpu_to_le32(ar->chip_id);
762 dump_data->bus_type = cpu_to_le32(0);
763 dump_data->target_version = cpu_to_le32(ar->target_version);
764 dump_data->fw_version_major = cpu_to_le32(ar->fw_version_major);
765 dump_data->fw_version_minor = cpu_to_le32(ar->fw_version_minor);
766 dump_data->fw_version_release = cpu_to_le32(ar->fw_version_release);
767 dump_data->fw_version_build = cpu_to_le32(ar->fw_version_build);
768 dump_data->phy_capability = cpu_to_le32(ar->phy_capability);
769 dump_data->hw_min_tx_power = cpu_to_le32(ar->hw_min_tx_power);
770 dump_data->hw_max_tx_power = cpu_to_le32(ar->hw_max_tx_power);
771 dump_data->ht_cap_info = cpu_to_le32(ar->ht_cap_info);
772 dump_data->vht_cap_info = cpu_to_le32(ar->vht_cap_info);
773 dump_data->num_rf_chains = cpu_to_le32(ar->num_rf_chains);
775 strlcpy(dump_data->fw_ver, ar->hw->wiphy->fw_version,
776 sizeof(dump_data->fw_ver));
778 dump_data->kernel_ver_code = 0;
779 strlcpy(dump_data->kernel_ver, init_utsname()->release,
780 sizeof(dump_data->kernel_ver));
782 dump_data->tv_sec = cpu_to_le64(crash_data->timestamp.tv_sec);
783 dump_data->tv_nsec = cpu_to_le64(crash_data->timestamp.tv_nsec);
785 /* Gather crash-dump */
786 dump_tlv = (struct ath10k_tlv_dump_data *)(buf + sofar);
787 dump_tlv->type = cpu_to_le32(ATH10K_FW_CRASH_DUMP_REGISTERS);
788 dump_tlv->tlv_len = cpu_to_le32(sizeof(crash_data->registers));
789 memcpy(dump_tlv->tlv_data, &crash_data->registers,
790 sizeof(crash_data->registers));
791 sofar += sizeof(*dump_tlv) + sizeof(crash_data->registers);
793 ar->debug.fw_crash_data->crashed_since_read = false;
795 spin_unlock_bh(&ar->data_lock);
800 static int ath10k_fw_crash_dump_open(struct inode *inode, struct file *file)
802 struct ath10k *ar = inode->i_private;
803 struct ath10k_dump_file_data *dump;
805 dump = ath10k_build_dump_file(ar);
809 file->private_data = dump;
814 static ssize_t ath10k_fw_crash_dump_read(struct file *file,
815 char __user *user_buf,
816 size_t count, loff_t *ppos)
818 struct ath10k_dump_file_data *dump_file = file->private_data;
820 return simple_read_from_buffer(user_buf, count, ppos,
822 le32_to_cpu(dump_file->len));
825 static int ath10k_fw_crash_dump_release(struct inode *inode,
828 vfree(file->private_data);
833 static const struct file_operations fops_fw_crash_dump = {
834 .open = ath10k_fw_crash_dump_open,
835 .read = ath10k_fw_crash_dump_read,
836 .release = ath10k_fw_crash_dump_release,
837 .owner = THIS_MODULE,
838 .llseek = default_llseek,
841 static ssize_t ath10k_reg_addr_read(struct file *file,
842 char __user *user_buf,
843 size_t count, loff_t *ppos)
845 struct ath10k *ar = file->private_data;
847 unsigned int len = 0;
850 mutex_lock(&ar->conf_mutex);
851 reg_addr = ar->debug.reg_addr;
852 mutex_unlock(&ar->conf_mutex);
854 len += scnprintf(buf + len, sizeof(buf) - len, "0x%x\n", reg_addr);
856 return simple_read_from_buffer(user_buf, count, ppos, buf, len);
859 static ssize_t ath10k_reg_addr_write(struct file *file,
860 const char __user *user_buf,
861 size_t count, loff_t *ppos)
863 struct ath10k *ar = file->private_data;
867 ret = kstrtou32_from_user(user_buf, count, 0, ®_addr);
871 if (!IS_ALIGNED(reg_addr, 4))
874 mutex_lock(&ar->conf_mutex);
875 ar->debug.reg_addr = reg_addr;
876 mutex_unlock(&ar->conf_mutex);
881 static const struct file_operations fops_reg_addr = {
882 .read = ath10k_reg_addr_read,
883 .write = ath10k_reg_addr_write,
885 .owner = THIS_MODULE,
886 .llseek = default_llseek,
889 static ssize_t ath10k_reg_value_read(struct file *file,
890 char __user *user_buf,
891 size_t count, loff_t *ppos)
893 struct ath10k *ar = file->private_data;
896 u32 reg_addr, reg_val;
899 mutex_lock(&ar->conf_mutex);
901 if (ar->state != ATH10K_STATE_ON &&
902 ar->state != ATH10K_STATE_UTF) {
907 reg_addr = ar->debug.reg_addr;
909 reg_val = ath10k_hif_read32(ar, reg_addr);
910 len = scnprintf(buf, sizeof(buf), "0x%08x:0x%08x\n", reg_addr, reg_val);
912 ret = simple_read_from_buffer(user_buf, count, ppos, buf, len);
915 mutex_unlock(&ar->conf_mutex);
920 static ssize_t ath10k_reg_value_write(struct file *file,
921 const char __user *user_buf,
922 size_t count, loff_t *ppos)
924 struct ath10k *ar = file->private_data;
925 u32 reg_addr, reg_val;
928 mutex_lock(&ar->conf_mutex);
930 if (ar->state != ATH10K_STATE_ON &&
931 ar->state != ATH10K_STATE_UTF) {
936 reg_addr = ar->debug.reg_addr;
938 ret = kstrtou32_from_user(user_buf, count, 0, ®_val);
942 ath10k_hif_write32(ar, reg_addr, reg_val);
947 mutex_unlock(&ar->conf_mutex);
952 static const struct file_operations fops_reg_value = {
953 .read = ath10k_reg_value_read,
954 .write = ath10k_reg_value_write,
956 .owner = THIS_MODULE,
957 .llseek = default_llseek,
960 static ssize_t ath10k_mem_value_read(struct file *file,
961 char __user *user_buf,
962 size_t count, loff_t *ppos)
964 struct ath10k *ar = file->private_data;
974 mutex_lock(&ar->conf_mutex);
976 buf = vmalloc(count);
982 if (ar->state != ATH10K_STATE_ON &&
983 ar->state != ATH10K_STATE_UTF) {
988 ret = ath10k_hif_diag_read(ar, *ppos, buf, count);
990 ath10k_warn(ar, "failed to read address 0x%08x via diagnose window fnrom debugfs: %d\n",
995 ret = copy_to_user(user_buf, buf, count);
1007 mutex_unlock(&ar->conf_mutex);
1012 static ssize_t ath10k_mem_value_write(struct file *file,
1013 const char __user *user_buf,
1014 size_t count, loff_t *ppos)
1016 struct ath10k *ar = file->private_data;
1026 mutex_lock(&ar->conf_mutex);
1028 buf = vmalloc(count);
1034 if (ar->state != ATH10K_STATE_ON &&
1035 ar->state != ATH10K_STATE_UTF) {
1040 ret = copy_from_user(buf, user_buf, count);
1046 ret = ath10k_hif_diag_write(ar, *ppos, buf, count);
1048 ath10k_warn(ar, "failed to write address 0x%08x via diagnose window from debugfs: %d\n",
1058 mutex_unlock(&ar->conf_mutex);
1063 static const struct file_operations fops_mem_value = {
1064 .read = ath10k_mem_value_read,
1065 .write = ath10k_mem_value_write,
1066 .open = simple_open,
1067 .owner = THIS_MODULE,
1068 .llseek = default_llseek,
1071 static int ath10k_debug_htt_stats_req(struct ath10k *ar)
1076 lockdep_assert_held(&ar->conf_mutex);
1078 if (ar->debug.htt_stats_mask == 0)
1079 /* htt stats are disabled */
1082 if (ar->state != ATH10K_STATE_ON)
1085 cookie = get_jiffies_64();
1087 ret = ath10k_htt_h2t_stats_req(&ar->htt, ar->debug.htt_stats_mask,
1090 ath10k_warn(ar, "failed to send htt stats request: %d\n", ret);
1094 queue_delayed_work(ar->workqueue, &ar->debug.htt_stats_dwork,
1095 msecs_to_jiffies(ATH10K_DEBUG_HTT_STATS_INTERVAL));
1100 static void ath10k_debug_htt_stats_dwork(struct work_struct *work)
1102 struct ath10k *ar = container_of(work, struct ath10k,
1103 debug.htt_stats_dwork.work);
1105 mutex_lock(&ar->conf_mutex);
1107 ath10k_debug_htt_stats_req(ar);
1109 mutex_unlock(&ar->conf_mutex);
1112 static ssize_t ath10k_read_htt_stats_mask(struct file *file,
1113 char __user *user_buf,
1114 size_t count, loff_t *ppos)
1116 struct ath10k *ar = file->private_data;
1120 len = scnprintf(buf, sizeof(buf), "%lu\n", ar->debug.htt_stats_mask);
1122 return simple_read_from_buffer(user_buf, count, ppos, buf, len);
1125 static ssize_t ath10k_write_htt_stats_mask(struct file *file,
1126 const char __user *user_buf,
1127 size_t count, loff_t *ppos)
1129 struct ath10k *ar = file->private_data;
1133 ret = kstrtoul_from_user(user_buf, count, 0, &mask);
1137 /* max 8 bit masks (for now) */
1141 mutex_lock(&ar->conf_mutex);
1143 ar->debug.htt_stats_mask = mask;
1145 ret = ath10k_debug_htt_stats_req(ar);
1152 mutex_unlock(&ar->conf_mutex);
1157 static const struct file_operations fops_htt_stats_mask = {
1158 .read = ath10k_read_htt_stats_mask,
1159 .write = ath10k_write_htt_stats_mask,
1160 .open = simple_open,
1161 .owner = THIS_MODULE,
1162 .llseek = default_llseek,
1165 static ssize_t ath10k_read_htt_max_amsdu_ampdu(struct file *file,
1166 char __user *user_buf,
1167 size_t count, loff_t *ppos)
1169 struct ath10k *ar = file->private_data;
1174 mutex_lock(&ar->conf_mutex);
1176 amsdu = ar->htt.max_num_amsdu;
1177 ampdu = ar->htt.max_num_ampdu;
1178 mutex_unlock(&ar->conf_mutex);
1180 len = scnprintf(buf, sizeof(buf), "%u %u\n", amsdu, ampdu);
1182 return simple_read_from_buffer(user_buf, count, ppos, buf, len);
1185 static ssize_t ath10k_write_htt_max_amsdu_ampdu(struct file *file,
1186 const char __user *user_buf,
1187 size_t count, loff_t *ppos)
1189 struct ath10k *ar = file->private_data;
1192 unsigned int amsdu, ampdu;
1194 simple_write_to_buffer(buf, sizeof(buf) - 1, ppos, user_buf, count);
1196 /* make sure that buf is null terminated */
1197 buf[sizeof(buf) - 1] = 0;
1199 res = sscanf(buf, "%u %u", &amsdu, &du);
1204 mutex_lock(&ar->conf_mutex);
1206 res = ath10k_htt_h2t_aggr_cfg_msg(&ar->htt, ampdu, amsdu);
1211 ar->htt.max_num_amsdu = amsdu;
1212 ar->htt.max_num_ampdu = ampdu;
1215 mutex_unlock(&ar->conf_mutex);
1219 static const struct file_operations fops_htt_max_amsdu_ampdu = {
1220 .read = ath10k_read_htt_max_amsdu_ampdu,
1221 .write = ath10k_write_htt_max_amsdu_ampdu,
1222 .open = simple_open,
1223 .owner = THIS_MODULE,
1224 .llseek = default_llseek,
1227 static ssize_t ath10k_read_fw_dbglog(struct file *file,
1228 char __user *user_buf,
1229 size_t count, loff_t *ppos)
1231 struct ath10k *ar = file->private_data;
1235 len = scnprintf(buf, sizeof(buf), "0x%16llx %u\n",
1236 ar->debug.fw_dbglog_mask, ar->debug.fw_dbglog_level);
1238 return simple_read_from_buffer(user_buf, count, ppos, buf, len);
1241 static ssize_t ath10k_write_fw_dbglog(struct file *file,
1242 const char __user *user_buf,
1243 size_t count, loff_t *ppos)
1245 struct ath10k *ar = file->private_data;
1248 unsigned int log_level;
1251 simple_write_to_buffer(buf, sizeof(buf) - 1, ppos, user_buf, count);
1253 /* make sure that buf is null terminated */
1254 buf[sizeof(buf) - 1] = 0;
1256 ret = sscanf(buf, "%llx %u", &mask, &log_level);
1262 /* default if user did not specify */
1263 log_level = ATH10K_DBGLOG_LEVEL_WARN;
1265 mutex_lock(&ar->conf_mutex);
1267 ar->debug.fw_dbglog_mask = mask;
1268 ar->debug.fw_dbglog_level = log_level;
1270 if (ar->state == ATH10K_STATE_ON) {
1271 ret = ath10k_wmi_dbglog_cfg(ar, ar->debug.fw_dbglog_mask,
1272 ar->debug.fw_dbglog_level);
1274 ath10k_warn(ar, "dbglog cfg failed from debugfs: %d\n",
1283 mutex_unlock(&ar->conf_mutex);
1288 /* TODO: Would be nice to always support ethtool stats, would need to
1289 * move the stats storage out of ath10k_debug, or always have ath10k_debug
1290 * struct available..
1293 /* This generally cooresponds to the debugfs fw_stats file */
1294 static const char ath10k_gstrings_stats[][ETH_GSTRING_LEN] = {
1304 "d_tx_power", /* in .5 dbM I think */
1305 "d_rx_crc_err", /* fcs_bad */
1307 "d_tx_mpdus_queued",
1309 "d_tx_msdu_dropped",
1312 "d_tx_ppdu_hw_queued",
1314 "d_tx_fifo_underrun",
1317 "d_tx_excessive_retries",
1319 "d_tx_dropped_sw_retries",
1320 "d_tx_illegal_rate",
1321 "d_tx_continuous_xretries",
1323 "d_tx_mpdu_txop_limit",
1325 "d_rx_mid_ppdu_route_change",
1327 "d_rx_extra_frags_ring0",
1328 "d_rx_extra_frags_ring1",
1329 "d_rx_extra_frags_ring2",
1330 "d_rx_extra_frags_ring3",
1336 "d_rx_phy_err_drops",
1337 "d_rx_mpdu_errors", /* FCS, MIC, ENC */
1339 "d_fw_warm_reset_count",
1340 "d_fw_cold_reset_count",
1343 #define ATH10K_SSTATS_LEN ARRAY_SIZE(ath10k_gstrings_stats)
1345 void ath10k_debug_get_et_strings(struct ieee80211_hw *hw,
1346 struct ieee80211_vif *vif,
1349 if (sset == ETH_SS_STATS)
1350 memcpy(data, *ath10k_gstrings_stats,
1351 sizeof(ath10k_gstrings_stats));
1354 int ath10k_debug_get_et_sset_count(struct ieee80211_hw *hw,
1355 struct ieee80211_vif *vif, int sset)
1357 if (sset == ETH_SS_STATS)
1358 return ATH10K_SSTATS_LEN;
1363 void ath10k_debug_get_et_stats(struct ieee80211_hw *hw,
1364 struct ieee80211_vif *vif,
1365 struct ethtool_stats *stats, u64 *data)
1367 struct ath10k *ar = hw->priv;
1368 static const struct ath10k_fw_stats_pdev zero_stats = {};
1369 const struct ath10k_fw_stats_pdev *pdev_stats;
1372 mutex_lock(&ar->conf_mutex);
1374 if (ar->state == ATH10K_STATE_ON) {
1375 ret = ath10k_debug_fw_stats_request(ar);
1377 /* just print a warning and try to use older results */
1379 "failed to get fw stats for ethtool: %d\n",
1384 pdev_stats = list_first_entry_or_null(&ar->debug.fw_stats.pdevs,
1385 struct ath10k_fw_stats_pdev,
1388 /* no results available so just return zeroes */
1389 pdev_stats = &zero_stats;
1392 spin_lock_bh(&ar->data_lock);
1394 data[i++] = pdev_stats->hw_reaped; /* ppdu reaped */
1395 data[i++] = 0; /* tx bytes */
1396 data[i++] = pdev_stats->htt_mpdus;
1397 data[i++] = 0; /* rx bytes */
1398 data[i++] = pdev_stats->ch_noise_floor;
1399 data[i++] = pdev_stats->cycle_count;
1400 data[i++] = pdev_stats->phy_err_count;
1401 data[i++] = pdev_stats->rts_bad;
1402 data[i++] = pdev_stats->rts_good;
1403 data[i++] = pdev_stats->chan_tx_power;
1404 data[i++] = pdev_stats->fcs_bad;
1405 data[i++] = pdev_stats->no_beacons;
1406 data[i++] = pdev_stats->mpdu_enqued;
1407 data[i++] = pdev_stats->msdu_enqued;
1408 data[i++] = pdev_stats->wmm_drop;
1409 data[i++] = pdev_stats->local_enqued;
1410 data[i++] = pdev_stats->local_freed;
1411 data[i++] = pdev_stats->hw_queued;
1412 data[i++] = pdev_stats->hw_reaped;
1413 data[i++] = pdev_stats->underrun;
1414 data[i++] = pdev_stats->tx_abort;
1415 data[i++] = pdev_stats->mpdus_requed;
1416 data[i++] = pdev_stats->tx_ko;
1417 data[i++] = pdev_stats->data_rc;
1418 data[i++] = pdev_stats->sw_retry_failure;
1419 data[i++] = pdev_stats->illgl_rate_phy_err;
1420 data[i++] = pdev_stats->pdev_cont_xretry;
1421 data[i++] = pdev_stats->pdev_tx_timeout;
1422 data[i++] = pdev_stats->txop_ovf;
1423 data[i++] = pdev_stats->pdev_resets;
1424 data[i++] = pdev_stats->mid_ppdu_route_change;
1425 data[i++] = pdev_stats->status_rcvd;
1426 data[i++] = pdev_stats->r0_frags;
1427 data[i++] = pdev_stats->r1_frags;
1428 data[i++] = pdev_stats->r2_frags;
1429 data[i++] = pdev_stats->r3_frags;
1430 data[i++] = pdev_stats->htt_msdus;
1431 data[i++] = pdev_stats->htt_mpdus;
1432 data[i++] = pdev_stats->loc_msdus;
1433 data[i++] = pdev_stats->loc_mpdus;
1434 data[i++] = pdev_stats->phy_errs;
1435 data[i++] = pdev_stats->phy_err_drop;
1436 data[i++] = pdev_stats->mpdu_errs;
1437 data[i++] = ar->stats.fw_crash_counter;
1438 data[i++] = ar->stats.fw_warm_reset_counter;
1439 data[i++] = ar->stats.fw_cold_reset_counter;
1441 spin_unlock_bh(&ar->data_lock);
1443 mutex_unlock(&ar->conf_mutex);
1445 WARN_ON(i != ATH10K_SSTATS_LEN);
1448 static const struct file_operations fops_fw_dbglog = {
1449 .read = ath10k_read_fw_dbglog,
1450 .write = ath10k_write_fw_dbglog,
1451 .open = simple_open,
1452 .owner = THIS_MODULE,
1453 .llseek = default_llseek,
1456 static int ath10k_debug_cal_data_fetch(struct ath10k *ar)
1462 lockdep_assert_held(&ar->conf_mutex);
1464 if (WARN_ON(ar->hw_params.cal_data_len > ATH10K_DEBUG_CAL_DATA_LEN))
1467 hi_addr = host_interest_item_address(HI_ITEM(hi_board_data));
1469 ret = ath10k_hif_diag_read(ar, hi_addr, &addr, sizeof(addr));
1471 ath10k_warn(ar, "failed to read hi_board_data address: %d\n",
1476 ret = ath10k_hif_diag_read(ar, le32_to_cpu(addr), ar->debug.cal_data,
1477 ar->hw_params.cal_data_len);
1479 ath10k_warn(ar, "failed to read calibration data: %d\n", ret);
1486 static int ath10k_debug_cal_data_open(struct inode *inode, struct file *file)
1488 struct ath10k *ar = inode->i_private;
1490 mutex_lock(&ar->conf_mutex);
1492 if (ar->state == ATH10K_STATE_ON ||
1493 ar->state == ATH10K_STATE_UTF) {
1494 ath10k_debug_cal_data_fetch(ar);
1497 file->private_data = ar;
1498 mutex_unlock(&ar->conf_mutex);
1503 static ssize_t ath10k_debug_cal_data_read(struct file *file,
1504 char __user *user_buf,
1505 size_t count, loff_t *ppos)
1507 struct ath10k *ar = file->private_data;
1509 mutex_lock(&ar->conf_mutex);
1511 count = simple_read_from_buffer(user_buf, count, ppos,
1513 ar->hw_params.cal_data_len);
1515 mutex_unlock(&ar->conf_mutex);
1520 static ssize_t ath10k_write_ani_enable(struct file *file,
1521 const char __user *user_buf,
1522 size_t count, loff_t *ppos)
1524 struct ath10k *ar = file->private_data;
1528 if (kstrtou8_from_user(user_buf, count, 0, &enable))
1531 mutex_lock(&ar->conf_mutex);
1533 if (ar->ani_enabled == enable) {
1538 ret = ath10k_wmi_pdev_set_param(ar, ar->wmi.pdev_param->ani_enable,
1541 ath10k_warn(ar, "ani_enable failed from debugfs: %d\n", ret);
1544 ar->ani_enabled = enable;
1549 mutex_unlock(&ar->conf_mutex);
1554 static ssize_t ath10k_read_ani_enable(struct file *file, char __user *user_buf,
1555 size_t count, loff_t *ppos)
1557 struct ath10k *ar = file->private_data;
1561 len = scnprintf(buf, sizeof(buf) - len, "%d\n",
1564 return simple_read_from_buffer(user_buf, count, ppos, buf, len);
1567 static const struct file_operations fops_ani_enable = {
1568 .read = ath10k_read_ani_enable,
1569 .write = ath10k_write_ani_enable,
1570 .open = simple_open,
1571 .owner = THIS_MODULE,
1572 .llseek = default_llseek,
1575 static const struct file_operations fops_cal_data = {
1576 .open = ath10k_debug_cal_data_open,
1577 .read = ath10k_debug_cal_data_read,
1578 .owner = THIS_MODULE,
1579 .llseek = default_llseek,
1582 static ssize_t ath10k_read_nf_cal_period(struct file *file,
1583 char __user *user_buf,
1584 size_t count, loff_t *ppos)
1586 struct ath10k *ar = file->private_data;
1590 len = scnprintf(buf, sizeof(buf), "%d\n",
1591 ar->debug.nf_cal_period);
1593 return simple_read_from_buffer(user_buf, count, ppos, buf, len);
1596 static ssize_t ath10k_write_nf_cal_period(struct file *file,
1597 const char __user *user_buf,
1598 size_t count, loff_t *ppos)
1600 struct ath10k *ar = file->private_data;
1601 unsigned long period;
1604 ret = kstrtoul_from_user(user_buf, count, 0, &period);
1608 if (period > WMI_PDEV_PARAM_CAL_PERIOD_MAX)
1611 /* there's no way to switch back to the firmware default */
1615 mutex_lock(&ar->conf_mutex);
1617 ar->debug.nf_cal_period = period;
1619 if (ar->state != ATH10K_STATE_ON) {
1620 /* firmware is not running, nothing else to do */
1625 ret = ath10k_wmi_pdev_set_param(ar, ar->wmi.pdev_param->cal_period,
1626 ar->debug.nf_cal_period);
1628 ath10k_warn(ar, "cal period cfg failed from debugfs: %d\n",
1636 mutex_unlock(&ar->conf_mutex);
1641 static const struct file_operations fops_nf_cal_period = {
1642 .read = ath10k_read_nf_cal_period,
1643 .write = ath10k_write_nf_cal_period,
1644 .open = simple_open,
1645 .owner = THIS_MODULE,
1646 .llseek = default_llseek,
1649 #define ATH10K_TPC_CONFIG_BUF_SIZE (1024 * 1024)
1651 static int ath10k_debug_tpc_stats_request(struct ath10k *ar)
1654 unsigned long time_left;
1656 lockdep_assert_held(&ar->conf_mutex);
1658 reinit_completion(&ar->debug.tpc_complete);
1660 ret = ath10k_wmi_pdev_get_tpc_config(ar, WMI_TPC_CONFIG_PARAM);
1662 ath10k_warn(ar, "failed to request tpc config: %d\n", ret);
1666 time_left = wait_for_completion_timeout(&ar->debug.tpc_complete,
1674 void ath10k_debug_tpc_stats_process(struct ath10k *ar,
1675 struct ath10k_tpc_stats *tpc_stats)
1677 spin_lock_bh(&ar->data_lock);
1679 kfree(ar->debug.tpc_stats);
1680 ar->debug.tpc_stats = tpc_stats;
1681 complete(&ar->debug.tpc_complete);
1683 spin_unlock_bh(&ar->data_lock);
1686 static void ath10k_tpc_stats_print(struct ath10k_tpc_stats *tpc_stats,
1687 unsigned int j, char *buf, unsigned int *len)
1689 unsigned int i, buf_len;
1690 static const char table_str[][5] = { "CDD",
1693 static const char pream_str[][6] = { "CCK",
1702 buf_len = ATH10K_TPC_CONFIG_BUF_SIZE;
1703 *len += scnprintf(buf + *len, buf_len - *len,
1704 "********************************\n");
1705 *len += scnprintf(buf + *len, buf_len - *len,
1706 "******************* %s POWER TABLE ****************\n",
1708 *len += scnprintf(buf + *len, buf_len - *len,
1709 "********************************\n");
1710 *len += scnprintf(buf + *len, buf_len - *len,
1711 "No. Preamble Rate_code tpc_value1 tpc_value2 tpc_value3\n");
1713 for (i = 0; i < tpc_stats->rate_max; i++) {
1714 *len += scnprintf(buf + *len, buf_len - *len,
1715 "%8d %s 0x%2x %s\n", i,
1716 pream_str[tpc_stats->tpc_table[j].pream_idx[i]],
1717 tpc_stats->tpc_table[j].rate_code[i],
1718 tpc_stats->tpc_table[j].tpc_value[i]);
1721 *len += scnprintf(buf + *len, buf_len - *len,
1722 "***********************************\n");
1725 static void ath10k_tpc_stats_fill(struct ath10k *ar,
1726 struct ath10k_tpc_stats *tpc_stats,
1729 unsigned int len, j, buf_len;
1732 buf_len = ATH10K_TPC_CONFIG_BUF_SIZE;
1734 spin_lock_bh(&ar->data_lock);
1737 ath10k_warn(ar, "failed to get tpc stats\n");
1741 len += scnprintf(buf + len, buf_len - len, "\n");
1742 len += scnprintf(buf + len, buf_len - len,
1743 "*************************************\n");
1744 len += scnprintf(buf + len, buf_len - len,
1745 "TPC config for channel %4d mode %d\n",
1746 tpc_stats->chan_freq,
1747 tpc_stats->phy_mode);
1748 len += scnprintf(buf + len, buf_len - len,
1749 "*************************************\n");
1750 len += scnprintf(buf + len, buf_len - len,
1751 "CTL = 0x%2x Reg. Domain = %2d\n",
1753 tpc_stats->reg_domain);
1754 len += scnprintf(buf + len, buf_len - len,
1755 "Antenna Gain = %2d Reg. Max Antenna Gain = %2d\n",
1756 tpc_stats->twice_antenna_gain,
1757 tpc_stats->twice_antenna_reduction);
1758 len += scnprintf(buf + len, buf_len - len,
1759 "Power Limit = %2d Reg. Max Power = %2d\n",
1760 tpc_stats->power_limit,
1761 tpc_stats->twice_max_rd_power / 2);
1762 len += scnprintf(buf + len, buf_len - len,
1763 "Num tx chains = %2d Num supported rates = %2d\n",
1764 tpc_stats->num_tx_chain,
1765 tpc_stats->rate_max);
1767 for (j = 0; j < tpc_stats->num_tx_chain ; j++) {
1769 case WMI_TPC_TABLE_TYPE_CDD:
1770 if (tpc_stats->flag[j] == ATH10K_TPC_TABLE_TYPE_FLAG) {
1771 len += scnprintf(buf + len, buf_len - len,
1772 "CDD not supported\n");
1776 ath10k_tpc_stats_print(tpc_stats, j, buf, &len);
1778 case WMI_TPC_TABLE_TYPE_STBC:
1779 if (tpc_stats->flag[j] == ATH10K_TPC_TABLE_TYPE_FLAG) {
1780 len += scnprintf(buf + len, buf_len - len,
1781 "STBC not supported\n");
1785 ath10k_tpc_stats_print(tpc_stats, j, buf, &len);
1787 case WMI_TPC_TABLE_TYPE_TXBF:
1788 if (tpc_stats->flag[j] == ATH10K_TPC_TABLE_TYPE_FLAG) {
1789 len += scnprintf(buf + len, buf_len - len,
1790 "TXBF not supported\n***************************\n");
1794 ath10k_tpc_stats_print(tpc_stats, j, buf, &len);
1797 len += scnprintf(buf + len, buf_len - len,
1804 spin_unlock_bh(&ar->data_lock);
1812 static int ath10k_tpc_stats_open(struct inode *inode, struct file *file)
1814 struct ath10k *ar = inode->i_private;
1818 mutex_lock(&ar->conf_mutex);
1820 if (ar->state != ATH10K_STATE_ON) {
1825 buf = vmalloc(ATH10K_TPC_CONFIG_BUF_SIZE);
1831 ret = ath10k_debug_tpc_stats_request(ar);
1833 ath10k_warn(ar, "failed to request tpc config stats: %d\n",
1838 ath10k_tpc_stats_fill(ar, ar->debug.tpc_stats, buf);
1839 file->private_data = buf;
1841 mutex_unlock(&ar->conf_mutex);
1848 mutex_unlock(&ar->conf_mutex);
1852 static int ath10k_tpc_stats_release(struct inode *inode, struct file *file)
1854 vfree(file->private_data);
1859 static ssize_t ath10k_tpc_stats_read(struct file *file, char __user *user_buf,
1860 size_t count, loff_t *ppos)
1862 const char *buf = file->private_data;
1863 unsigned int len = strlen(buf);
1865 return simple_read_from_buffer(user_buf, count, ppos, buf, len);
1868 static const struct file_operations fops_tpc_stats = {
1869 .open = ath10k_tpc_stats_open,
1870 .release = ath10k_tpc_stats_release,
1871 .read = ath10k_tpc_stats_read,
1872 .owner = THIS_MODULE,
1873 .llseek = default_llseek,
1876 int ath10k_debug_start(struct ath10k *ar)
1880 lockdep_assert_held(&ar->conf_mutex);
1882 ret = ath10k_debug_htt_stats_req(ar);
1884 /* continue normally anyway, this isn't serious */
1885 ath10k_warn(ar, "failed to start htt stats workqueue: %d\n",
1888 if (ar->debug.fw_dbglog_mask) {
1889 ret = ath10k_wmi_dbglog_cfg(ar, ar->debug.fw_dbglog_mask,
1890 ATH10K_DBGLOG_LEVEL_WARN);
1893 ath10k_warn(ar, "failed to enable dbglog during start: %d",
1897 if (ar->debug.pktlog_filter) {
1898 ret = ath10k_wmi_pdev_pktlog_enable(ar,
1899 ar->debug.pktlog_filter);
1903 "failed to enable pktlog filter %x: %d\n",
1904 ar->debug.pktlog_filter, ret);
1906 ret = ath10k_wmi_pdev_pktlog_disable(ar);
1909 ath10k_warn(ar, "failed to disable pktlog: %d\n", ret);
1912 if (ar->debug.nf_cal_period) {
1913 ret = ath10k_wmi_pdev_set_param(ar,
1914 ar->wmi.pdev_param->cal_period,
1915 ar->debug.nf_cal_period);
1918 ath10k_warn(ar, "cal period cfg failed from debug start: %d\n",
1925 void ath10k_debug_stop(struct ath10k *ar)
1927 lockdep_assert_held(&ar->conf_mutex);
1929 ath10k_debug_cal_data_fetch(ar);
1931 /* Must not use _sync to avoid deadlock, we do that in
1932 * ath10k_debug_destroy(). The check for htt_stats_mask is to avoid
1933 * warning from del_timer(). */
1934 if (ar->debug.htt_stats_mask != 0)
1935 cancel_delayed_work(&ar->debug.htt_stats_dwork);
1937 ath10k_wmi_pdev_pktlog_disable(ar);
1940 static ssize_t ath10k_write_simulate_radar(struct file *file,
1941 const char __user *user_buf,
1942 size_t count, loff_t *ppos)
1944 struct ath10k *ar = file->private_data;
1946 ieee80211_radar_detected(ar->hw);
1951 static const struct file_operations fops_simulate_radar = {
1952 .write = ath10k_write_simulate_radar,
1953 .open = simple_open,
1954 .owner = THIS_MODULE,
1955 .llseek = default_llseek,
1958 #define ATH10K_DFS_STAT(s, p) (\
1959 len += scnprintf(buf + len, size - len, "%-28s : %10u\n", s, \
1960 ar->debug.dfs_stats.p))
1962 #define ATH10K_DFS_POOL_STAT(s, p) (\
1963 len += scnprintf(buf + len, size - len, "%-28s : %10u\n", s, \
1964 ar->debug.dfs_pool_stats.p))
1966 static ssize_t ath10k_read_dfs_stats(struct file *file, char __user *user_buf,
1967 size_t count, loff_t *ppos)
1969 int retval = 0, len = 0;
1970 const int size = 8000;
1971 struct ath10k *ar = file->private_data;
1974 buf = kzalloc(size, GFP_KERNEL);
1978 if (!ar->dfs_detector) {
1979 len += scnprintf(buf + len, size - len, "DFS not enabled\n");
1983 ar->debug.dfs_pool_stats =
1984 ar->dfs_detector->get_stats(ar->dfs_detector);
1986 len += scnprintf(buf + len, size - len, "Pulse detector statistics:\n");
1988 ATH10K_DFS_STAT("reported phy errors", phy_errors);
1989 ATH10K_DFS_STAT("pulse events reported", pulses_total);
1990 ATH10K_DFS_STAT("DFS pulses detected", pulses_detected);
1991 ATH10K_DFS_STAT("DFS pulses discarded", pulses_discarded);
1992 ATH10K_DFS_STAT("Radars detected", radar_detected);
1994 len += scnprintf(buf + len, size - len, "Global Pool statistics:\n");
1995 ATH10K_DFS_POOL_STAT("Pool references", pool_reference);
1996 ATH10K_DFS_POOL_STAT("Pulses allocated", pulse_allocated);
1997 ATH10K_DFS_POOL_STAT("Pulses alloc error", pulse_alloc_error);
1998 ATH10K_DFS_POOL_STAT("Pulses in use", pulse_used);
1999 ATH10K_DFS_POOL_STAT("Seqs. allocated", pseq_allocated);
2000 ATH10K_DFS_POOL_STAT("Seqs. alloc error", pseq_alloc_error);
2001 ATH10K_DFS_POOL_STAT("Seqs. in use", pseq_used);
2007 retval = simple_read_from_buffer(user_buf, count, ppos, buf, len);
2013 static const struct file_operations fops_dfs_stats = {
2014 .read = ath10k_read_dfs_stats,
2015 .open = simple_open,
2016 .owner = THIS_MODULE,
2017 .llseek = default_llseek,
2020 static ssize_t ath10k_write_pktlog_filter(struct file *file,
2021 const char __user *ubuf,
2022 size_t count, loff_t *ppos)
2024 struct ath10k *ar = file->private_data;
2028 if (kstrtouint_from_user(ubuf, count, 0, &filter))
2031 mutex_lock(&ar->conf_mutex);
2033 if (ar->state != ATH10K_STATE_ON) {
2034 ar->debug.pktlog_filter = filter;
2039 if (filter == ar->debug.pktlog_filter) {
2045 ret = ath10k_wmi_pdev_pktlog_enable(ar, filter);
2047 ath10k_warn(ar, "failed to enable pktlog filter %x: %d\n",
2048 ar->debug.pktlog_filter, ret);
2052 ret = ath10k_wmi_pdev_pktlog_disable(ar);
2054 ath10k_warn(ar, "failed to disable pktlog: %d\n", ret);
2059 ar->debug.pktlog_filter = filter;
2063 mutex_unlock(&ar->conf_mutex);
2067 static ssize_t ath10k_read_pktlog_filter(struct file *file, char __user *ubuf,
2068 size_t count, loff_t *ppos)
2071 struct ath10k *ar = file->private_data;
2074 mutex_lock(&ar->conf_mutex);
2075 len = scnprintf(buf, sizeof(buf) - len, "%08x\n",
2076 ar->debug.pktlog_filter);
2077 mutex_unlock(&ar->conf_mutex);
2079 return simple_read_from_buffer(ubuf, count, ppos, buf, len);
2082 static const struct file_operations fops_pktlog_filter = {
2083 .read = ath10k_read_pktlog_filter,
2084 .write = ath10k_write_pktlog_filter,
2088 static ssize_t ath10k_write_quiet_period(struct file *file,
2089 const char __user *ubuf,
2090 size_t count, loff_t *ppos)
2092 struct ath10k *ar = file->private_data;
2095 if (kstrtouint_from_user(ubuf, count, 0, &period))
2098 if (period < ATH10K_QUIET_PERIOD_MIN) {
2099 ath10k_warn(ar, "Quiet period %u can not be lesser than 25ms\n",
2103 mutex_lock(&ar->conf_mutex);
2104 ar->thermal.quiet_period = period;
2105 ath10k_thermal_set_throttling(ar);
2106 mutex_unlock(&ar->conf_mutex);
2111 static ssize_t ath10k_read_quiet_period(struct file *file, char __user *ubuf,
2112 size_t count, loff_t *ppos)
2115 struct ath10k *ar = file->private_data;
2118 mutex_lock(&ar->conf_mutex);
2119 len = scnprintf(buf, sizeof(buf) - len, "%d\n",
2120 ar->thermal.quiet_period);
2121 mutex_unlock(&ar->conf_mutex);
2123 return simple_read_from_buffer(ubuf, count, ppos, buf, len);
2126 static const struct file_operations fops_quiet_period = {
2127 .read = ath10k_read_quiet_period,
2128 .write = ath10k_write_quiet_period,
2132 static ssize_t ath10k_write_btcoex(struct file *file,
2133 const char __user *ubuf,
2134 size_t count, loff_t *ppos)
2136 struct ath10k *ar = file->private_data;
2143 buf_size = min(count, (sizeof(buf) - 1));
2144 if (copy_from_user(buf, ubuf, buf_size))
2147 buf[buf_size] = '\0';
2149 if (strtobool(buf, &val) != 0)
2152 mutex_lock(&ar->conf_mutex);
2154 if (ar->state != ATH10K_STATE_ON &&
2155 ar->state != ATH10K_STATE_RESTARTED) {
2160 if (!(test_bit(ATH10K_FLAG_BTCOEX, &ar->dev_flags) ^ val)) {
2165 pdev_param = ar->wmi.pdev_param->enable_btcoex;
2166 if (test_bit(ATH10K_FW_FEATURE_BTCOEX_PARAM,
2167 ar->running_fw->fw_file.fw_features)) {
2168 ret = ath10k_wmi_pdev_set_param(ar, pdev_param, val);
2170 ath10k_warn(ar, "failed to enable btcoex: %d\n", ret);
2175 ath10k_info(ar, "restarting firmware due to btcoex change");
2176 queue_work(ar->workqueue, &ar->restart_work);
2180 set_bit(ATH10K_FLAG_BTCOEX, &ar->dev_flags);
2182 clear_bit(ATH10K_FLAG_BTCOEX, &ar->dev_flags);
2187 mutex_unlock(&ar->conf_mutex);
2192 static ssize_t ath10k_read_btcoex(struct file *file, char __user *ubuf,
2193 size_t count, loff_t *ppos)
2196 struct ath10k *ar = file->private_data;
2199 mutex_lock(&ar->conf_mutex);
2200 len = scnprintf(buf, sizeof(buf) - len, "%d\n",
2201 test_bit(ATH10K_FLAG_BTCOEX, &ar->dev_flags));
2202 mutex_unlock(&ar->conf_mutex);
2204 return simple_read_from_buffer(ubuf, count, ppos, buf, len);
2207 static const struct file_operations fops_btcoex = {
2208 .read = ath10k_read_btcoex,
2209 .write = ath10k_write_btcoex,
2213 static ssize_t ath10k_write_peer_stats(struct file *file,
2214 const char __user *ubuf,
2215 size_t count, loff_t *ppos)
2217 struct ath10k *ar = file->private_data;
2223 buf_size = min(count, (sizeof(buf) - 1));
2224 if (copy_from_user(buf, ubuf, buf_size))
2227 buf[buf_size] = '\0';
2229 if (strtobool(buf, &val) != 0)
2232 mutex_lock(&ar->conf_mutex);
2234 if (ar->state != ATH10K_STATE_ON &&
2235 ar->state != ATH10K_STATE_RESTARTED) {
2240 if (!(test_bit(ATH10K_FLAG_PEER_STATS, &ar->dev_flags) ^ val)) {
2246 set_bit(ATH10K_FLAG_PEER_STATS, &ar->dev_flags);
2248 clear_bit(ATH10K_FLAG_PEER_STATS, &ar->dev_flags);
2250 ath10k_info(ar, "restarting firmware due to Peer stats change");
2252 queue_work(ar->workqueue, &ar->restart_work);
2256 mutex_unlock(&ar->conf_mutex);
2260 static ssize_t ath10k_read_peer_stats(struct file *file, char __user *ubuf,
2261 size_t count, loff_t *ppos)
2265 struct ath10k *ar = file->private_data;
2268 mutex_lock(&ar->conf_mutex);
2269 len = scnprintf(buf, sizeof(buf) - len, "%d\n",
2270 test_bit(ATH10K_FLAG_PEER_STATS, &ar->dev_flags));
2271 mutex_unlock(&ar->conf_mutex);
2273 return simple_read_from_buffer(ubuf, count, ppos, buf, len);
2276 static const struct file_operations fops_peer_stats = {
2277 .read = ath10k_read_peer_stats,
2278 .write = ath10k_write_peer_stats,
2282 static ssize_t ath10k_debug_fw_checksums_read(struct file *file,
2283 char __user *user_buf,
2284 size_t count, loff_t *ppos)
2286 struct ath10k *ar = file->private_data;
2287 unsigned int len = 0, buf_len = 4096;
2291 buf = kzalloc(buf_len, GFP_KERNEL);
2295 mutex_lock(&ar->conf_mutex);
2297 len += scnprintf(buf + len, buf_len - len,
2298 "firmware-N.bin\t\t%08x\n",
2299 crc32_le(0, ar->normal_mode_fw.fw_file.firmware->data,
2300 ar->normal_mode_fw.fw_file.firmware->size));
2301 len += scnprintf(buf + len, buf_len - len,
2302 "athwlan\t\t\t%08x\n",
2303 crc32_le(0, ar->normal_mode_fw.fw_file.firmware_data,
2304 ar->normal_mode_fw.fw_file.firmware_len));
2305 len += scnprintf(buf + len, buf_len - len,
2307 crc32_le(0, ar->normal_mode_fw.fw_file.otp_data,
2308 ar->normal_mode_fw.fw_file.otp_len));
2309 len += scnprintf(buf + len, buf_len - len,
2310 "codeswap\t\t%08x\n",
2311 crc32_le(0, ar->normal_mode_fw.fw_file.codeswap_data,
2312 ar->normal_mode_fw.fw_file.codeswap_len));
2313 len += scnprintf(buf + len, buf_len - len,
2314 "board-N.bin\t\t%08x\n",
2315 crc32_le(0, ar->normal_mode_fw.board->data,
2316 ar->normal_mode_fw.board->size));
2317 len += scnprintf(buf + len, buf_len - len,
2318 "board\t\t\t%08x\n",
2319 crc32_le(0, ar->normal_mode_fw.board_data,
2320 ar->normal_mode_fw.board_len));
2322 ret_cnt = simple_read_from_buffer(user_buf, count, ppos, buf, len);
2324 mutex_unlock(&ar->conf_mutex);
2330 static const struct file_operations fops_fw_checksums = {
2331 .read = ath10k_debug_fw_checksums_read,
2332 .open = simple_open,
2333 .owner = THIS_MODULE,
2334 .llseek = default_llseek,
2337 int ath10k_debug_create(struct ath10k *ar)
2339 ar->debug.fw_crash_data = vzalloc(sizeof(*ar->debug.fw_crash_data));
2340 if (!ar->debug.fw_crash_data)
2343 ar->debug.cal_data = vzalloc(ATH10K_DEBUG_CAL_DATA_LEN);
2344 if (!ar->debug.cal_data)
2347 INIT_LIST_HEAD(&ar->debug.fw_stats.pdevs);
2348 INIT_LIST_HEAD(&ar->debug.fw_stats.vdevs);
2349 INIT_LIST_HEAD(&ar->debug.fw_stats.peers);
2350 INIT_LIST_HEAD(&ar->debug.fw_stats.peers_extd);
2355 void ath10k_debug_destroy(struct ath10k *ar)
2357 vfree(ar->debug.fw_crash_data);
2358 ar->debug.fw_crash_data = NULL;
2360 vfree(ar->debug.cal_data);
2361 ar->debug.cal_data = NULL;
2363 ath10k_debug_fw_stats_reset(ar);
2365 kfree(ar->debug.tpc_stats);
2368 int ath10k_debug_register(struct ath10k *ar)
2370 ar->debug.debugfs_phy = debugfs_create_dir("ath10k",
2371 ar->hw->wiphy->debugfsdir);
2372 if (IS_ERR_OR_NULL(ar->debug.debugfs_phy)) {
2373 if (IS_ERR(ar->debug.debugfs_phy))
2374 return PTR_ERR(ar->debug.debugfs_phy);
2379 INIT_DELAYED_WORK(&ar->debug.htt_stats_dwork,
2380 ath10k_debug_htt_stats_dwork);
2382 init_completion(&ar->debug.tpc_complete);
2383 init_completion(&ar->debug.fw_stats_complete);
2385 debugfs_create_file("fw_stats", S_IRUSR, ar->debug.debugfs_phy, ar,
2388 debugfs_create_file("fw_reset_stats", S_IRUSR, ar->debug.debugfs_phy,
2389 ar, &fops_fw_reset_stats);
2391 debugfs_create_file("wmi_services", S_IRUSR, ar->debug.debugfs_phy, ar,
2392 &fops_wmi_services);
2394 debugfs_create_file("simulate_fw_crash", S_IRUSR | S_IWUSR,
2395 ar->debug.debugfs_phy, ar, &fops_simulate_fw_crash);
2397 debugfs_create_file("fw_crash_dump", S_IRUSR, ar->debug.debugfs_phy,
2398 ar, &fops_fw_crash_dump);
2400 debugfs_create_file("reg_addr", S_IRUSR | S_IWUSR,
2401 ar->debug.debugfs_phy, ar, &fops_reg_addr);
2403 debugfs_create_file("reg_value", S_IRUSR | S_IWUSR,
2404 ar->debug.debugfs_phy, ar, &fops_reg_value);
2406 debugfs_create_file("mem_value", S_IRUSR | S_IWUSR,
2407 ar->debug.debugfs_phy, ar, &fops_mem_value);
2409 debugfs_create_file("chip_id", S_IRUSR, ar->debug.debugfs_phy,
2412 debugfs_create_file("htt_stats_mask", S_IRUSR | S_IWUSR,
2413 ar->debug.debugfs_phy, ar, &fops_htt_stats_mask);
2415 debugfs_create_file("htt_max_amsdu_ampdu", S_IRUSR | S_IWUSR,
2416 ar->debug.debugfs_phy, ar,
2417 &fops_htt_max_amsdu_ampdu);
2419 debugfs_create_file("fw_dbglog", S_IRUSR | S_IWUSR,
2420 ar->debug.debugfs_phy, ar, &fops_fw_dbglog);
2422 debugfs_create_file("cal_data", S_IRUSR, ar->debug.debugfs_phy,
2423 ar, &fops_cal_data);
2425 debugfs_create_file("ani_enable", S_IRUSR | S_IWUSR,
2426 ar->debug.debugfs_phy, ar, &fops_ani_enable);
2428 debugfs_create_file("nf_cal_period", S_IRUSR | S_IWUSR,
2429 ar->debug.debugfs_phy, ar, &fops_nf_cal_period);
2431 if (IS_ENABLED(CONFIG_ATH10K_DFS_CERTIFIED)) {
2432 debugfs_create_file("dfs_simulate_radar", S_IWUSR,
2433 ar->debug.debugfs_phy, ar,
2434 &fops_simulate_radar);
2436 debugfs_create_bool("dfs_block_radar_events", S_IWUSR,
2437 ar->debug.debugfs_phy,
2438 &ar->dfs_block_radar_events);
2440 debugfs_create_file("dfs_stats", S_IRUSR,
2441 ar->debug.debugfs_phy, ar,
2445 debugfs_create_file("pktlog_filter", S_IRUGO | S_IWUSR,
2446 ar->debug.debugfs_phy, ar, &fops_pktlog_filter);
2448 debugfs_create_file("quiet_period", S_IRUGO | S_IWUSR,
2449 ar->debug.debugfs_phy, ar, &fops_quiet_period);
2451 debugfs_create_file("tpc_stats", S_IRUSR,
2452 ar->debug.debugfs_phy, ar, &fops_tpc_stats);
2454 if (test_bit(WMI_SERVICE_COEX_GPIO, ar->wmi.svc_map))
2455 debugfs_create_file("btcoex", S_IRUGO | S_IWUSR,
2456 ar->debug.debugfs_phy, ar, &fops_btcoex);
2458 if (test_bit(WMI_SERVICE_PEER_STATS, ar->wmi.svc_map))
2459 debugfs_create_file("peer_stats", S_IRUGO | S_IWUSR,
2460 ar->debug.debugfs_phy, ar,
2463 debugfs_create_file("fw_checksums", S_IRUSR,
2464 ar->debug.debugfs_phy, ar, &fops_fw_checksums);
2469 void ath10k_debug_unregister(struct ath10k *ar)
2471 cancel_delayed_work_sync(&ar->debug.htt_stats_dwork);
2474 #endif /* CONFIG_ATH10K_DEBUGFS */
2476 #ifdef CONFIG_ATH10K_DEBUG
2477 void ath10k_dbg(struct ath10k *ar, enum ath10k_debug_mask mask,
2478 const char *fmt, ...)
2480 struct va_format vaf;
2483 va_start(args, fmt);
2488 if (ath10k_debug_mask & mask)
2489 dev_printk(KERN_DEBUG, ar->dev, "%pV", &vaf);
2491 trace_ath10k_log_dbg(ar, mask, &vaf);
2495 EXPORT_SYMBOL(ath10k_dbg);
2497 void ath10k_dbg_dump(struct ath10k *ar,
2498 enum ath10k_debug_mask mask,
2499 const char *msg, const char *prefix,
2500 const void *buf, size_t len)
2503 unsigned int linebuflen;
2506 if (ath10k_debug_mask & mask) {
2508 ath10k_dbg(ar, mask, "%s\n", msg);
2510 for (ptr = buf; (ptr - buf) < len; ptr += 16) {
2512 linebuflen += scnprintf(linebuf + linebuflen,
2513 sizeof(linebuf) - linebuflen,
2515 (prefix ? prefix : ""),
2516 (unsigned int)(ptr - buf));
2517 hex_dump_to_buffer(ptr, len - (ptr - buf), 16, 1,
2518 linebuf + linebuflen,
2519 sizeof(linebuf) - linebuflen, true);
2520 dev_printk(KERN_DEBUG, ar->dev, "%s\n", linebuf);
2524 /* tracing code doesn't like null strings :/ */
2525 trace_ath10k_log_dbg_dump(ar, msg ? msg : "", prefix ? prefix : "",
2528 EXPORT_SYMBOL(ath10k_dbg_dump);
2530 #endif /* CONFIG_ATH10K_DEBUG */