Lines Matching +full:ath10k +full:- +full:calibration +full:- +full:data

1 // SPDX-License-Identifier: ISC
3 * Copyright (c) 2005-2011 Atheros Communications Inc.
4 * Copyright (c) 2011-2017 Qualcomm Atheros, Inc.
19 #include "wmi-ops.h"
26 void ath10k_info(struct ath10k *ar, const char *fmt, ...) in ath10k_info()
35 dev_info(ar->dev, "%pV", &vaf); in ath10k_info()
41 void ath10k_debug_print_hwfw_info(struct ath10k *ar) in ath10k_debug_print_hwfw_info()
50 ar->hw_params.name, in ath10k_debug_print_hwfw_info()
51 ar->target_version, in ath10k_debug_print_hwfw_info()
52 ar->bus_param.chip_id, in ath10k_debug_print_hwfw_info()
53 ar->id.subsystem_vendor, ar->id.subsystem_device); in ath10k_debug_print_hwfw_info()
62 firmware = ar->normal_mode_fw.fw_file.firmware; in ath10k_debug_print_hwfw_info()
64 crc = crc32_le(0, firmware->data, firmware->size); in ath10k_debug_print_hwfw_info()
67 ar->hw->wiphy->fw_version, in ath10k_debug_print_hwfw_info()
68 ar->fw_api, in ath10k_debug_print_hwfw_info()
73 void ath10k_debug_print_board_info(struct ath10k *ar) in ath10k_debug_print_board_info()
79 if (ar->id.bmi_ids_valid) in ath10k_debug_print_board_info()
81 ar->id.bmi_chip_id, ar->id.bmi_board_id); in ath10k_debug_print_board_info()
85 board = ar->normal_mode_fw.board; in ath10k_debug_print_board_info()
87 crc = crc32_le(0, board->data, board->size); in ath10k_debug_print_board_info()
92 ar->bd_api, in ath10k_debug_print_board_info()
97 void ath10k_debug_print_boot_info(struct ath10k *ar) in ath10k_debug_print_boot_info()
99 ath10k_info(ar, "htt-ver %d.%d wmi-op %d htt-op %d cal %s max-sta %d raw %d hwcrypto %d\n", in ath10k_debug_print_boot_info()
100 ar->htt.target_version_major, in ath10k_debug_print_boot_info()
101 ar->htt.target_version_minor, in ath10k_debug_print_boot_info()
102 ar->normal_mode_fw.fw_file.wmi_op_version, in ath10k_debug_print_boot_info()
103 ar->normal_mode_fw.fw_file.htt_op_version, in ath10k_debug_print_boot_info()
104 ath10k_cal_mode_str(ar->cal_mode), in ath10k_debug_print_boot_info()
105 ar->max_num_stations, in ath10k_debug_print_boot_info()
106 test_bit(ATH10K_FLAG_RAW_MODE, &ar->dev_flags), in ath10k_debug_print_boot_info()
107 !test_bit(ATH10K_FLAG_HW_CRYPTO_DISABLED, &ar->dev_flags)); in ath10k_debug_print_boot_info()
110 void ath10k_print_driver_info(struct ath10k *ar) in ath10k_print_driver_info()
118 void ath10k_err(struct ath10k *ar, const char *fmt, ...) in ath10k_err()
127 dev_err(ar->dev, "%pV", &vaf); in ath10k_err()
133 void ath10k_warn(struct ath10k *ar, const char *fmt, ...) in ath10k_warn()
142 dev_warn_ratelimited(ar->dev, "%pV", &vaf); in ath10k_warn()
155 struct ath10k *ar = file->private_data; in ath10k_read_wmi_services()
165 return -ENOMEM; in ath10k_read_wmi_services()
167 mutex_lock(&ar->conf_mutex); in ath10k_read_wmi_services()
169 spin_lock_bh(&ar->data_lock); in ath10k_read_wmi_services()
171 enabled = test_bit(i, ar->wmi.svc_map); in ath10k_read_wmi_services()
176 len += scnprintf(buf + len, buf_len - len, in ath10k_read_wmi_services()
177 "%-40s %s (bit %d)\n", in ath10k_read_wmi_services()
183 len += scnprintf(buf + len, buf_len - len, in ath10k_read_wmi_services()
184 "%-40s %s\n", in ath10k_read_wmi_services()
185 name, enabled ? "enabled" : "-"); in ath10k_read_wmi_services()
187 spin_unlock_bh(&ar->data_lock); in ath10k_read_wmi_services()
191 mutex_unlock(&ar->conf_mutex); in ath10k_read_wmi_services()
209 list_del(&i->list); in ath10k_fw_stats_pdevs_free()
219 list_del(&i->list); in ath10k_fw_stats_vdevs_free()
229 list_del(&i->list); in ath10k_fw_stats_peers_free()
239 list_del(&i->list); in ath10k_fw_extd_stats_peers_free()
244 static void ath10k_debug_fw_stats_reset(struct ath10k *ar) in ath10k_debug_fw_stats_reset()
246 spin_lock_bh(&ar->data_lock); in ath10k_debug_fw_stats_reset()
247 ar->debug.fw_stats_done = false; in ath10k_debug_fw_stats_reset()
248 ar->debug.fw_stats.extended = false; in ath10k_debug_fw_stats_reset()
249 ath10k_fw_stats_pdevs_free(&ar->debug.fw_stats.pdevs); in ath10k_debug_fw_stats_reset()
250 ath10k_fw_stats_vdevs_free(&ar->debug.fw_stats.vdevs); in ath10k_debug_fw_stats_reset()
251 ath10k_fw_stats_peers_free(&ar->debug.fw_stats.peers); in ath10k_debug_fw_stats_reset()
252 ath10k_fw_extd_stats_peers_free(&ar->debug.fw_stats.peers_extd); in ath10k_debug_fw_stats_reset()
253 spin_unlock_bh(&ar->data_lock); in ath10k_debug_fw_stats_reset()
256 void ath10k_debug_fw_stats_process(struct ath10k *ar, struct sk_buff *skb) in ath10k_debug_fw_stats_process()
269 spin_lock_bh(&ar->data_lock); in ath10k_debug_fw_stats_process()
276 /* Stat data may exceed htc-wmi buffer limit. In such case firmware in ath10k_debug_fw_stats_process()
277 * splits the stats data and delivers it in a ping-pong fashion of in ath10k_debug_fw_stats_process()
278 * request cmd-update event. in ath10k_debug_fw_stats_process()
280 * However there is no explicit end-of-data. Instead start-of-data is in ath10k_debug_fw_stats_process()
283 * delivered - this skips session started at end of (b) in ath10k_debug_fw_stats_process()
285 * delivered which is treated as end-of-data and is itself discarded in ath10k_debug_fw_stats_process()
290 if (ar->debug.fw_stats_done) { in ath10k_debug_fw_stats_process()
297 num_peers = list_count_nodes(&ar->debug.fw_stats.peers); in ath10k_debug_fw_stats_process()
298 num_vdevs = list_count_nodes(&ar->debug.fw_stats.vdevs); in ath10k_debug_fw_stats_process()
299 is_start = (list_empty(&ar->debug.fw_stats.pdevs) && in ath10k_debug_fw_stats_process()
301 is_end = (!list_empty(&ar->debug.fw_stats.pdevs) && in ath10k_debug_fw_stats_process()
305 list_splice_tail_init(&stats.pdevs, &ar->debug.fw_stats.pdevs); in ath10k_debug_fw_stats_process()
308 ar->debug.fw_stats_done = true; in ath10k_debug_fw_stats_process()
311 ar->debug.fw_stats.extended = true; in ath10k_debug_fw_stats_process()
313 is_started = !list_empty(&ar->debug.fw_stats.pdevs); in ath10k_debug_fw_stats_process()
318 * prevent firmware from DoS-ing the host. in ath10k_debug_fw_stats_process()
320 ath10k_fw_stats_peers_free(&ar->debug.fw_stats.peers); in ath10k_debug_fw_stats_process()
321 ath10k_fw_extd_stats_peers_free(&ar->debug.fw_stats.peers_extd); in ath10k_debug_fw_stats_process()
327 ath10k_fw_stats_vdevs_free(&ar->debug.fw_stats.vdevs); in ath10k_debug_fw_stats_process()
334 &ar->debug.fw_stats.peers_extd); in ath10k_debug_fw_stats_process()
336 list_splice_tail_init(&stats.peers, &ar->debug.fw_stats.peers); in ath10k_debug_fw_stats_process()
337 list_splice_tail_init(&stats.vdevs, &ar->debug.fw_stats.vdevs); in ath10k_debug_fw_stats_process()
340 complete(&ar->debug.fw_stats_complete); in ath10k_debug_fw_stats_process()
351 spin_unlock_bh(&ar->data_lock); in ath10k_debug_fw_stats_process()
354 int ath10k_debug_fw_stats_request(struct ath10k *ar) in ath10k_debug_fw_stats_request()
359 lockdep_assert_held(&ar->conf_mutex); in ath10k_debug_fw_stats_request()
367 return -ETIMEDOUT; in ath10k_debug_fw_stats_request()
369 reinit_completion(&ar->debug.fw_stats_complete); in ath10k_debug_fw_stats_request()
371 ret = ath10k_wmi_request_stats(ar, ar->fw_stats_req_mask); in ath10k_debug_fw_stats_request()
378 wait_for_completion_timeout(&ar->debug.fw_stats_complete, in ath10k_debug_fw_stats_request()
381 return -ETIMEDOUT; in ath10k_debug_fw_stats_request()
383 spin_lock_bh(&ar->data_lock); in ath10k_debug_fw_stats_request()
384 if (ar->debug.fw_stats_done) { in ath10k_debug_fw_stats_request()
385 spin_unlock_bh(&ar->data_lock); in ath10k_debug_fw_stats_request()
388 spin_unlock_bh(&ar->data_lock); in ath10k_debug_fw_stats_request()
396 struct ath10k *ar = inode->i_private; in ath10k_fw_stats_open()
400 mutex_lock(&ar->conf_mutex); in ath10k_fw_stats_open()
402 if (ar->state != ATH10K_STATE_ON) { in ath10k_fw_stats_open()
403 ret = -ENETDOWN; in ath10k_fw_stats_open()
409 ret = -ENOMEM; in ath10k_fw_stats_open()
419 ret = ath10k_wmi_fw_stats_fill(ar, &ar->debug.fw_stats, buf); in ath10k_fw_stats_open()
425 file->private_data = buf; in ath10k_fw_stats_open()
427 mutex_unlock(&ar->conf_mutex); in ath10k_fw_stats_open()
434 mutex_unlock(&ar->conf_mutex); in ath10k_fw_stats_open()
440 vfree(file->private_data); in ath10k_fw_stats_release()
448 const char *buf = file->private_data; in ath10k_fw_stats_read()
466 struct ath10k *ar = file->private_data; in ath10k_debug_fw_reset_stats_read()
473 return -ENOMEM; in ath10k_debug_fw_reset_stats_read()
475 spin_lock_bh(&ar->data_lock); in ath10k_debug_fw_reset_stats_read()
477 len += scnprintf(buf + len, buf_len - len, in ath10k_debug_fw_reset_stats_read()
478 "fw_crash_counter\t\t%d\n", ar->stats.fw_crash_counter); in ath10k_debug_fw_reset_stats_read()
479 len += scnprintf(buf + len, buf_len - len, in ath10k_debug_fw_reset_stats_read()
481 ar->stats.fw_warm_reset_counter); in ath10k_debug_fw_reset_stats_read()
482 len += scnprintf(buf + len, buf_len - len, in ath10k_debug_fw_reset_stats_read()
484 ar->stats.fw_cold_reset_counter); in ath10k_debug_fw_reset_stats_read()
486 spin_unlock_bh(&ar->data_lock); in ath10k_debug_fw_reset_stats_read()
503 static int ath10k_debug_fw_assert(struct ath10k *ar) in ath10k_debug_fw_assert()
510 return -ENOMEM; in ath10k_debug_fw_assert()
512 cmd = (struct wmi_vdev_install_key_cmd *)skb->data; in ath10k_debug_fw_assert()
516 cmd->vdev_id = __cpu_to_le32(0x7ffe); in ath10k_debug_fw_assert()
519 ar->wmi.cmd->vdev_install_key_cmdid); in ath10k_debug_fw_assert()
528 "`soft` - this will send WMI_FORCE_FW_HANG_ASSERT to firmware if FW supports that command.\n" in ath10k_read_simulate_fw_crash()
529 "`hard` - this will send to firmware command with illegal parameters causing firmware crash.\n" in ath10k_read_simulate_fw_crash()
530 …"`assert` - this will send special illegal parameter to firmware to cause assert failure and crash… in ath10k_read_simulate_fw_crash()
531 "`hw-restart` - this will simply queue hw restart without fw/hw actually crashing.\n"; in ath10k_read_simulate_fw_crash()
547 struct ath10k *ar = file->private_data; in ath10k_write_simulate_fw_crash()
554 return -EINVAL; in ath10k_write_simulate_fw_crash()
556 rc = simple_write_to_buffer(buf, sizeof(buf) - 1, ppos, user_buf, count); in ath10k_write_simulate_fw_crash()
561 if (buf[*ppos - 1] == '\n') in ath10k_write_simulate_fw_crash()
562 buf[*ppos - 1] = '\0'; in ath10k_write_simulate_fw_crash()
564 mutex_lock(&ar->conf_mutex); in ath10k_write_simulate_fw_crash()
566 if (ar->state != ATH10K_STATE_ON && in ath10k_write_simulate_fw_crash()
567 ar->state != ATH10K_STATE_RESTARTED) { in ath10k_write_simulate_fw_crash()
568 ret = -ENETDOWN; in ath10k_write_simulate_fw_crash()
581 ar->wmi.vdev_param->rts_threshold, in ath10k_write_simulate_fw_crash()
586 } else if (!strcmp(buf, "hw-restart")) { in ath10k_write_simulate_fw_crash()
591 ret = -EINVAL; in ath10k_write_simulate_fw_crash()
603 mutex_unlock(&ar->conf_mutex); in ath10k_write_simulate_fw_crash()
618 struct ath10k *ar = file->private_data; in ath10k_read_chip_id()
622 len = scnprintf(buf, sizeof(buf), "0x%08x\n", ar->bus_param.chip_id); in ath10k_read_chip_id()
638 struct ath10k *ar = file->private_data; in ath10k_reg_addr_read()
643 mutex_lock(&ar->conf_mutex); in ath10k_reg_addr_read()
644 reg_addr = ar->debug.reg_addr; in ath10k_reg_addr_read()
645 mutex_unlock(&ar->conf_mutex); in ath10k_reg_addr_read()
647 len += scnprintf(buf + len, sizeof(buf) - len, "0x%x\n", reg_addr); in ath10k_reg_addr_read()
656 struct ath10k *ar = file->private_data; in ath10k_reg_addr_write()
665 return -EFAULT; in ath10k_reg_addr_write()
667 mutex_lock(&ar->conf_mutex); in ath10k_reg_addr_write()
668 ar->debug.reg_addr = reg_addr; in ath10k_reg_addr_write()
669 mutex_unlock(&ar->conf_mutex); in ath10k_reg_addr_write()
686 struct ath10k *ar = file->private_data; in ath10k_reg_value_read()
692 mutex_lock(&ar->conf_mutex); in ath10k_reg_value_read()
694 if (ar->state != ATH10K_STATE_ON && in ath10k_reg_value_read()
695 ar->state != ATH10K_STATE_UTF) { in ath10k_reg_value_read()
696 ret = -ENETDOWN; in ath10k_reg_value_read()
700 reg_addr = ar->debug.reg_addr; in ath10k_reg_value_read()
708 mutex_unlock(&ar->conf_mutex); in ath10k_reg_value_read()
717 struct ath10k *ar = file->private_data; in ath10k_reg_value_write()
721 mutex_lock(&ar->conf_mutex); in ath10k_reg_value_write()
723 if (ar->state != ATH10K_STATE_ON && in ath10k_reg_value_write()
724 ar->state != ATH10K_STATE_UTF) { in ath10k_reg_value_write()
725 ret = -ENETDOWN; in ath10k_reg_value_write()
729 reg_addr = ar->debug.reg_addr; in ath10k_reg_value_write()
740 mutex_unlock(&ar->conf_mutex); in ath10k_reg_value_write()
757 struct ath10k *ar = file->private_data; in ath10k_mem_value_read()
762 return -EINVAL; in ath10k_mem_value_read()
767 mutex_lock(&ar->conf_mutex); in ath10k_mem_value_read()
771 ret = -ENOMEM; in ath10k_mem_value_read()
775 if (ar->state != ATH10K_STATE_ON && in ath10k_mem_value_read()
776 ar->state != ATH10K_STATE_UTF) { in ath10k_mem_value_read()
777 ret = -ENETDOWN; in ath10k_mem_value_read()
790 ret = -EFAULT; in ath10k_mem_value_read()
794 count -= ret; in ath10k_mem_value_read()
800 mutex_unlock(&ar->conf_mutex); in ath10k_mem_value_read()
809 struct ath10k *ar = file->private_data; in ath10k_mem_value_write()
814 return -EINVAL; in ath10k_mem_value_write()
819 mutex_lock(&ar->conf_mutex); in ath10k_mem_value_write()
823 ret = -ENOMEM; in ath10k_mem_value_write()
827 if (ar->state != ATH10K_STATE_ON && in ath10k_mem_value_write()
828 ar->state != ATH10K_STATE_UTF) { in ath10k_mem_value_write()
829 ret = -ENETDOWN; in ath10k_mem_value_write()
835 ret = -EFAULT; in ath10k_mem_value_write()
851 mutex_unlock(&ar->conf_mutex); in ath10k_mem_value_write()
864 static int ath10k_debug_htt_stats_req(struct ath10k *ar) in ath10k_debug_htt_stats_req()
869 lockdep_assert_held(&ar->conf_mutex); in ath10k_debug_htt_stats_req()
871 if (ar->debug.htt_stats_mask == 0) in ath10k_debug_htt_stats_req()
875 if (ar->state != ATH10K_STATE_ON) in ath10k_debug_htt_stats_req()
880 ret = ath10k_htt_h2t_stats_req(&ar->htt, ar->debug.htt_stats_mask, in ath10k_debug_htt_stats_req()
881 ar->debug.reset_htt_stats, cookie); in ath10k_debug_htt_stats_req()
887 queue_delayed_work(ar->workqueue, &ar->debug.htt_stats_dwork, in ath10k_debug_htt_stats_req()
895 struct ath10k *ar = container_of(work, struct ath10k, in ath10k_debug_htt_stats_dwork()
898 mutex_lock(&ar->conf_mutex); in ath10k_debug_htt_stats_dwork()
902 mutex_unlock(&ar->conf_mutex); in ath10k_debug_htt_stats_dwork()
909 struct ath10k *ar = file->private_data; in ath10k_read_htt_stats_mask()
913 len = scnprintf(buf, sizeof(buf), "%lu\n", ar->debug.htt_stats_mask); in ath10k_read_htt_stats_mask()
922 struct ath10k *ar = file->private_data; in ath10k_write_htt_stats_mask()
932 return -E2BIG; in ath10k_write_htt_stats_mask()
934 mutex_lock(&ar->conf_mutex); in ath10k_write_htt_stats_mask()
936 ar->debug.htt_stats_mask = mask; in ath10k_write_htt_stats_mask()
945 mutex_unlock(&ar->conf_mutex); in ath10k_write_htt_stats_mask()
962 struct ath10k *ar = file->private_data; in ath10k_read_htt_max_amsdu_ampdu()
967 mutex_lock(&ar->conf_mutex); in ath10k_read_htt_max_amsdu_ampdu()
969 amsdu = ar->htt.max_num_amsdu; in ath10k_read_htt_max_amsdu_ampdu()
970 ampdu = ar->htt.max_num_ampdu; in ath10k_read_htt_max_amsdu_ampdu()
971 mutex_unlock(&ar->conf_mutex); in ath10k_read_htt_max_amsdu_ampdu()
982 struct ath10k *ar = file->private_data; in ath10k_write_htt_max_amsdu_ampdu()
987 res = simple_write_to_buffer(buf, sizeof(buf) - 1, ppos, in ath10k_write_htt_max_amsdu_ampdu()
995 return -EINVAL; in ath10k_write_htt_max_amsdu_ampdu()
997 mutex_lock(&ar->conf_mutex); in ath10k_write_htt_max_amsdu_ampdu()
999 res = ath10k_htt_h2t_aggr_cfg_msg(&ar->htt, ampdu, amsdu); in ath10k_write_htt_max_amsdu_ampdu()
1004 ar->htt.max_num_amsdu = amsdu; in ath10k_write_htt_max_amsdu_ampdu()
1005 ar->htt.max_num_ampdu = ampdu; in ath10k_write_htt_max_amsdu_ampdu()
1008 mutex_unlock(&ar->conf_mutex); in ath10k_write_htt_max_amsdu_ampdu()
1024 struct ath10k *ar = file->private_data; in ath10k_read_fw_dbglog()
1029 ar->debug.fw_dbglog_mask, ar->debug.fw_dbglog_level); in ath10k_read_fw_dbglog()
1038 struct ath10k *ar = file->private_data; in ath10k_write_fw_dbglog()
1044 ret = simple_write_to_buffer(buf, sizeof(buf) - 1, ppos, in ath10k_write_fw_dbglog()
1052 return -EINVAL; in ath10k_write_fw_dbglog()
1058 mutex_lock(&ar->conf_mutex); in ath10k_write_fw_dbglog()
1060 ar->debug.fw_dbglog_mask = mask; in ath10k_write_fw_dbglog()
1061 ar->debug.fw_dbglog_level = log_level; in ath10k_write_fw_dbglog()
1063 if (ar->state == ATH10K_STATE_ON) { in ath10k_write_fw_dbglog()
1064 ret = ath10k_wmi_dbglog_cfg(ar, ar->debug.fw_dbglog_mask, in ath10k_write_fw_dbglog()
1065 ar->debug.fw_dbglog_level); in ath10k_write_fw_dbglog()
1076 mutex_unlock(&ar->conf_mutex); in ath10k_write_fw_dbglog()
1141 u32 sset, u8 *data) in ath10k_debug_get_et_strings() argument
1144 memcpy(data, ath10k_gstrings_stats, in ath10k_debug_get_et_strings()
1159 struct ethtool_stats *stats, u64 *data) in ath10k_debug_get_et_stats() argument
1161 struct ath10k *ar = hw->priv; in ath10k_debug_get_et_stats()
1166 mutex_lock(&ar->conf_mutex); in ath10k_debug_get_et_stats()
1168 if (ar->state == ATH10K_STATE_ON) { in ath10k_debug_get_et_stats()
1178 pdev_stats = list_first_entry_or_null(&ar->debug.fw_stats.pdevs, in ath10k_debug_get_et_stats()
1186 spin_lock_bh(&ar->data_lock); in ath10k_debug_get_et_stats()
1188 data[i++] = pdev_stats->hw_reaped; /* ppdu reaped */ in ath10k_debug_get_et_stats()
1189 data[i++] = 0; /* tx bytes */ in ath10k_debug_get_et_stats()
1190 data[i++] = pdev_stats->htt_mpdus; in ath10k_debug_get_et_stats()
1191 data[i++] = 0; /* rx bytes */ in ath10k_debug_get_et_stats()
1192 data[i++] = pdev_stats->ch_noise_floor; in ath10k_debug_get_et_stats()
1193 data[i++] = pdev_stats->cycle_count; in ath10k_debug_get_et_stats()
1194 data[i++] = pdev_stats->phy_err_count; in ath10k_debug_get_et_stats()
1195 data[i++] = pdev_stats->rts_bad; in ath10k_debug_get_et_stats()
1196 data[i++] = pdev_stats->rts_good; in ath10k_debug_get_et_stats()
1197 data[i++] = pdev_stats->chan_tx_power; in ath10k_debug_get_et_stats()
1198 data[i++] = pdev_stats->fcs_bad; in ath10k_debug_get_et_stats()
1199 data[i++] = ar->stats.rx_crc_err_drop; in ath10k_debug_get_et_stats()
1200 data[i++] = pdev_stats->no_beacons; in ath10k_debug_get_et_stats()
1201 data[i++] = pdev_stats->mpdu_enqued; in ath10k_debug_get_et_stats()
1202 data[i++] = pdev_stats->msdu_enqued; in ath10k_debug_get_et_stats()
1203 data[i++] = pdev_stats->wmm_drop; in ath10k_debug_get_et_stats()
1204 data[i++] = pdev_stats->local_enqued; in ath10k_debug_get_et_stats()
1205 data[i++] = pdev_stats->local_freed; in ath10k_debug_get_et_stats()
1206 data[i++] = pdev_stats->hw_queued; in ath10k_debug_get_et_stats()
1207 data[i++] = pdev_stats->hw_reaped; in ath10k_debug_get_et_stats()
1208 data[i++] = pdev_stats->underrun; in ath10k_debug_get_et_stats()
1209 data[i++] = pdev_stats->tx_abort; in ath10k_debug_get_et_stats()
1210 data[i++] = pdev_stats->mpdus_requeued; in ath10k_debug_get_et_stats()
1211 data[i++] = pdev_stats->tx_ko; in ath10k_debug_get_et_stats()
1212 data[i++] = pdev_stats->data_rc; in ath10k_debug_get_et_stats()
1213 data[i++] = pdev_stats->sw_retry_failure; in ath10k_debug_get_et_stats()
1214 data[i++] = pdev_stats->illgl_rate_phy_err; in ath10k_debug_get_et_stats()
1215 data[i++] = pdev_stats->pdev_cont_xretry; in ath10k_debug_get_et_stats()
1216 data[i++] = pdev_stats->pdev_tx_timeout; in ath10k_debug_get_et_stats()
1217 data[i++] = pdev_stats->txop_ovf; in ath10k_debug_get_et_stats()
1218 data[i++] = pdev_stats->pdev_resets; in ath10k_debug_get_et_stats()
1219 data[i++] = pdev_stats->mid_ppdu_route_change; in ath10k_debug_get_et_stats()
1220 data[i++] = pdev_stats->status_rcvd; in ath10k_debug_get_et_stats()
1221 data[i++] = pdev_stats->r0_frags; in ath10k_debug_get_et_stats()
1222 data[i++] = pdev_stats->r1_frags; in ath10k_debug_get_et_stats()
1223 data[i++] = pdev_stats->r2_frags; in ath10k_debug_get_et_stats()
1224 data[i++] = pdev_stats->r3_frags; in ath10k_debug_get_et_stats()
1225 data[i++] = pdev_stats->htt_msdus; in ath10k_debug_get_et_stats()
1226 data[i++] = pdev_stats->htt_mpdus; in ath10k_debug_get_et_stats()
1227 data[i++] = pdev_stats->loc_msdus; in ath10k_debug_get_et_stats()
1228 data[i++] = pdev_stats->loc_mpdus; in ath10k_debug_get_et_stats()
1229 data[i++] = pdev_stats->phy_errs; in ath10k_debug_get_et_stats()
1230 data[i++] = pdev_stats->phy_err_drop; in ath10k_debug_get_et_stats()
1231 data[i++] = pdev_stats->mpdu_errs; in ath10k_debug_get_et_stats()
1232 data[i++] = ar->stats.fw_crash_counter; in ath10k_debug_get_et_stats()
1233 data[i++] = ar->stats.fw_warm_reset_counter; in ath10k_debug_get_et_stats()
1234 data[i++] = ar->stats.fw_cold_reset_counter; in ath10k_debug_get_et_stats()
1236 spin_unlock_bh(&ar->data_lock); in ath10k_debug_get_et_stats()
1238 mutex_unlock(&ar->conf_mutex); in ath10k_debug_get_et_stats()
1251 static int ath10k_debug_cal_data_fetch(struct ath10k *ar) in ath10k_debug_cal_data_fetch()
1257 lockdep_assert_held(&ar->conf_mutex); in ath10k_debug_cal_data_fetch()
1259 if (WARN_ON(ar->hw_params.cal_data_len > ATH10K_DEBUG_CAL_DATA_LEN)) in ath10k_debug_cal_data_fetch()
1260 return -EINVAL; in ath10k_debug_cal_data_fetch()
1262 if (ar->hw_params.cal_data_len == 0) in ath10k_debug_cal_data_fetch()
1263 return -EOPNOTSUPP; in ath10k_debug_cal_data_fetch()
1274 ret = ath10k_hif_diag_read(ar, le32_to_cpu(addr), ar->debug.cal_data, in ath10k_debug_cal_data_fetch()
1275 ar->hw_params.cal_data_len); in ath10k_debug_cal_data_fetch()
1277 ath10k_warn(ar, "failed to read calibration data: %d\n", ret); in ath10k_debug_cal_data_fetch()
1286 struct ath10k *ar = inode->i_private; in ath10k_debug_cal_data_open()
1288 mutex_lock(&ar->conf_mutex); in ath10k_debug_cal_data_open()
1290 if (ar->state == ATH10K_STATE_ON || in ath10k_debug_cal_data_open()
1291 ar->state == ATH10K_STATE_UTF) { in ath10k_debug_cal_data_open()
1295 file->private_data = ar; in ath10k_debug_cal_data_open()
1296 mutex_unlock(&ar->conf_mutex); in ath10k_debug_cal_data_open()
1305 struct ath10k *ar = file->private_data; in ath10k_debug_cal_data_read()
1307 mutex_lock(&ar->conf_mutex); in ath10k_debug_cal_data_read()
1310 ar->debug.cal_data, in ath10k_debug_cal_data_read()
1311 ar->hw_params.cal_data_len); in ath10k_debug_cal_data_read()
1313 mutex_unlock(&ar->conf_mutex); in ath10k_debug_cal_data_read()
1322 struct ath10k *ar = file->private_data; in ath10k_write_ani_enable()
1327 return -EINVAL; in ath10k_write_ani_enable()
1329 mutex_lock(&ar->conf_mutex); in ath10k_write_ani_enable()
1331 if (ar->ani_enabled == enable) { in ath10k_write_ani_enable()
1336 ret = ath10k_wmi_pdev_set_param(ar, ar->wmi.pdev_param->ani_enable, in ath10k_write_ani_enable()
1342 ar->ani_enabled = enable; in ath10k_write_ani_enable()
1347 mutex_unlock(&ar->conf_mutex); in ath10k_write_ani_enable()
1355 struct ath10k *ar = file->private_data; in ath10k_read_ani_enable()
1359 len = scnprintf(buf, sizeof(buf), "%d\n", ar->ani_enabled); in ath10k_read_ani_enable()
1383 struct ath10k *ar = file->private_data; in ath10k_read_nf_cal_period()
1387 len = scnprintf(buf, sizeof(buf), "%d\n", ar->debug.nf_cal_period); in ath10k_read_nf_cal_period()
1396 struct ath10k *ar = file->private_data; in ath10k_write_nf_cal_period()
1405 return -EINVAL; in ath10k_write_nf_cal_period()
1409 return -EINVAL; in ath10k_write_nf_cal_period()
1411 mutex_lock(&ar->conf_mutex); in ath10k_write_nf_cal_period()
1413 ar->debug.nf_cal_period = period; in ath10k_write_nf_cal_period()
1415 if (ar->state != ATH10K_STATE_ON) { in ath10k_write_nf_cal_period()
1421 ret = ath10k_wmi_pdev_set_param(ar, ar->wmi.pdev_param->cal_period, in ath10k_write_nf_cal_period()
1422 ar->debug.nf_cal_period); in ath10k_write_nf_cal_period()
1432 mutex_unlock(&ar->conf_mutex); in ath10k_write_nf_cal_period()
1447 static int ath10k_debug_tpc_stats_request(struct ath10k *ar) in ath10k_debug_tpc_stats_request()
1452 lockdep_assert_held(&ar->conf_mutex); in ath10k_debug_tpc_stats_request()
1454 reinit_completion(&ar->debug.tpc_complete); in ath10k_debug_tpc_stats_request()
1462 time_left = wait_for_completion_timeout(&ar->debug.tpc_complete, in ath10k_debug_tpc_stats_request()
1465 return -ETIMEDOUT; in ath10k_debug_tpc_stats_request()
1470 void ath10k_debug_tpc_stats_process(struct ath10k *ar, in ath10k_debug_tpc_stats_process()
1473 spin_lock_bh(&ar->data_lock); in ath10k_debug_tpc_stats_process()
1475 kfree(ar->debug.tpc_stats); in ath10k_debug_tpc_stats_process()
1476 ar->debug.tpc_stats = tpc_stats; in ath10k_debug_tpc_stats_process()
1477 complete(&ar->debug.tpc_complete); in ath10k_debug_tpc_stats_process()
1479 spin_unlock_bh(&ar->data_lock); in ath10k_debug_tpc_stats_process()
1483 ath10k_debug_tpc_stats_final_process(struct ath10k *ar, in ath10k_debug_tpc_stats_final_process()
1486 spin_lock_bh(&ar->data_lock); in ath10k_debug_tpc_stats_final_process()
1488 kfree(ar->debug.tpc_stats_final); in ath10k_debug_tpc_stats_final_process()
1489 ar->debug.tpc_stats_final = tpc_stats; in ath10k_debug_tpc_stats_final_process()
1490 complete(&ar->debug.tpc_complete); in ath10k_debug_tpc_stats_final_process()
1492 spin_unlock_bh(&ar->data_lock); in ath10k_debug_tpc_stats_final_process()
1513 *len += scnprintf(buf + *len, buf_len - *len, in ath10k_tpc_stats_print()
1515 *len += scnprintf(buf + *len, buf_len - *len, in ath10k_tpc_stats_print()
1518 *len += scnprintf(buf + *len, buf_len - *len, in ath10k_tpc_stats_print()
1520 *len += scnprintf(buf + *len, buf_len - *len, in ath10k_tpc_stats_print()
1523 for (i = 0; i < tpc_stats->num_tx_chain; i++) in ath10k_tpc_stats_print()
1524 *len += scnprintf(buf + *len, buf_len - *len, in ath10k_tpc_stats_print()
1527 *len += scnprintf(buf + *len, buf_len - *len, "\n"); in ath10k_tpc_stats_print()
1529 for (i = 0; i < tpc_stats->rate_max; i++) { in ath10k_tpc_stats_print()
1530 *len += scnprintf(buf + *len, buf_len - *len, in ath10k_tpc_stats_print()
1532 pream_str[tpc_stats->tpc_table[j].pream_idx[i]], in ath10k_tpc_stats_print()
1533 tpc_stats->tpc_table[j].rate_code[i], in ath10k_tpc_stats_print()
1534 tpc_stats->tpc_table[j].tpc_value[i]); in ath10k_tpc_stats_print()
1537 *len += scnprintf(buf + *len, buf_len - *len, in ath10k_tpc_stats_print()
1541 static void ath10k_tpc_stats_fill(struct ath10k *ar, in ath10k_tpc_stats_fill()
1551 spin_lock_bh(&ar->data_lock); in ath10k_tpc_stats_fill()
1558 len += scnprintf(buf + len, buf_len - len, "\n"); in ath10k_tpc_stats_fill()
1559 len += scnprintf(buf + len, buf_len - len, in ath10k_tpc_stats_fill()
1561 len += scnprintf(buf + len, buf_len - len, in ath10k_tpc_stats_fill()
1563 tpc_stats->chan_freq, in ath10k_tpc_stats_fill()
1564 tpc_stats->phy_mode); in ath10k_tpc_stats_fill()
1565 len += scnprintf(buf + len, buf_len - len, in ath10k_tpc_stats_fill()
1567 len += scnprintf(buf + len, buf_len - len, in ath10k_tpc_stats_fill()
1569 tpc_stats->ctl, in ath10k_tpc_stats_fill()
1570 tpc_stats->reg_domain); in ath10k_tpc_stats_fill()
1571 len += scnprintf(buf + len, buf_len - len, in ath10k_tpc_stats_fill()
1573 tpc_stats->twice_antenna_gain, in ath10k_tpc_stats_fill()
1574 tpc_stats->twice_antenna_reduction); in ath10k_tpc_stats_fill()
1575 len += scnprintf(buf + len, buf_len - len, in ath10k_tpc_stats_fill()
1577 tpc_stats->power_limit, in ath10k_tpc_stats_fill()
1578 tpc_stats->twice_max_rd_power / 2); in ath10k_tpc_stats_fill()
1579 len += scnprintf(buf + len, buf_len - len, in ath10k_tpc_stats_fill()
1581 tpc_stats->num_tx_chain, in ath10k_tpc_stats_fill()
1582 tpc_stats->rate_max); in ath10k_tpc_stats_fill()
1587 if (tpc_stats->flag[j] == ATH10K_TPC_TABLE_TYPE_FLAG) { in ath10k_tpc_stats_fill()
1588 len += scnprintf(buf + len, buf_len - len, in ath10k_tpc_stats_fill()
1596 if (tpc_stats->flag[j] == ATH10K_TPC_TABLE_TYPE_FLAG) { in ath10k_tpc_stats_fill()
1597 len += scnprintf(buf + len, buf_len - len, in ath10k_tpc_stats_fill()
1605 if (tpc_stats->flag[j] == ATH10K_TPC_TABLE_TYPE_FLAG) { in ath10k_tpc_stats_fill()
1606 len += scnprintf(buf + len, buf_len - len, in ath10k_tpc_stats_fill()
1614 len += scnprintf(buf + len, buf_len - len, in ath10k_tpc_stats_fill()
1621 spin_unlock_bh(&ar->data_lock); in ath10k_tpc_stats_fill()
1624 buf[len - 1] = 0; in ath10k_tpc_stats_fill()
1631 struct ath10k *ar = inode->i_private; in ath10k_tpc_stats_open()
1635 mutex_lock(&ar->conf_mutex); in ath10k_tpc_stats_open()
1637 if (ar->state != ATH10K_STATE_ON) { in ath10k_tpc_stats_open()
1638 ret = -ENETDOWN; in ath10k_tpc_stats_open()
1644 ret = -ENOMEM; in ath10k_tpc_stats_open()
1655 ath10k_tpc_stats_fill(ar, ar->debug.tpc_stats, buf); in ath10k_tpc_stats_open()
1656 file->private_data = buf; in ath10k_tpc_stats_open()
1658 mutex_unlock(&ar->conf_mutex); in ath10k_tpc_stats_open()
1665 mutex_unlock(&ar->conf_mutex); in ath10k_tpc_stats_open()
1671 vfree(file->private_data); in ath10k_tpc_stats_release()
1679 const char *buf = file->private_data; in ath10k_tpc_stats_read()
1693 int ath10k_debug_start(struct ath10k *ar) in ath10k_debug_start()
1697 lockdep_assert_held(&ar->conf_mutex); in ath10k_debug_start()
1705 if (ar->debug.fw_dbglog_mask) { in ath10k_debug_start()
1706 ret = ath10k_wmi_dbglog_cfg(ar, ar->debug.fw_dbglog_mask, in ath10k_debug_start()
1714 if (ar->pktlog_filter) { in ath10k_debug_start()
1716 ar->pktlog_filter); in ath10k_debug_start()
1721 ar->pktlog_filter, ret); in ath10k_debug_start()
1729 if (ar->debug.nf_cal_period && in ath10k_debug_start()
1731 ar->normal_mode_fw.fw_file.fw_features)) { in ath10k_debug_start()
1733 ar->wmi.pdev_param->cal_period, in ath10k_debug_start()
1734 ar->debug.nf_cal_period); in ath10k_debug_start()
1744 void ath10k_debug_stop(struct ath10k *ar) in ath10k_debug_stop()
1746 lockdep_assert_held(&ar->conf_mutex); in ath10k_debug_stop()
1749 ar->normal_mode_fw.fw_file.fw_features)) in ath10k_debug_stop()
1756 if (ar->debug.htt_stats_mask != 0) in ath10k_debug_stop()
1757 cancel_delayed_work(&ar->debug.htt_stats_dwork); in ath10k_debug_stop()
1766 struct ath10k *ar = file->private_data; in ath10k_write_simulate_radar()
1773 arvif = list_first_entry(&ar->arvifs, typeof(*arvif), list); in ath10k_write_simulate_radar()
1774 if (!arvif->is_started) in ath10k_write_simulate_radar()
1775 return -EINVAL; in ath10k_write_simulate_radar()
1777 ieee80211_radar_detected(ar->hw, NULL); in ath10k_write_simulate_radar()
1790 len += scnprintf(buf + len, size - len, "%-28s : %10u\n", s, \
1791 ar->debug.dfs_stats.p))
1794 len += scnprintf(buf + len, size - len, "%-28s : %10u\n", s, \
1795 ar->debug.dfs_pool_stats.p))
1802 struct ath10k *ar = file->private_data; in ath10k_read_dfs_stats()
1807 return -ENOMEM; in ath10k_read_dfs_stats()
1809 if (!ar->dfs_detector) { in ath10k_read_dfs_stats()
1810 len += scnprintf(buf + len, size - len, "DFS not enabled\n"); in ath10k_read_dfs_stats()
1814 ar->debug.dfs_pool_stats = in ath10k_read_dfs_stats()
1815 ar->dfs_detector->get_stats(ar->dfs_detector); in ath10k_read_dfs_stats()
1817 len += scnprintf(buf + len, size - len, "Pulse detector statistics:\n"); in ath10k_read_dfs_stats()
1825 len += scnprintf(buf + len, size - len, "Global Pool statistics:\n"); in ath10k_read_dfs_stats()
1855 struct ath10k *ar = file->private_data; in ath10k_write_pktlog_filter()
1860 return -EINVAL; in ath10k_write_pktlog_filter()
1862 mutex_lock(&ar->conf_mutex); in ath10k_write_pktlog_filter()
1864 if (ar->state != ATH10K_STATE_ON) { in ath10k_write_pktlog_filter()
1865 ar->pktlog_filter = filter; in ath10k_write_pktlog_filter()
1870 if (filter == ar->pktlog_filter) { in ath10k_write_pktlog_filter()
1879 ar->pktlog_filter, ret); in ath10k_write_pktlog_filter()
1890 ar->pktlog_filter = filter; in ath10k_write_pktlog_filter()
1894 mutex_unlock(&ar->conf_mutex); in ath10k_write_pktlog_filter()
1902 struct ath10k *ar = file->private_data; in ath10k_read_pktlog_filter()
1905 mutex_lock(&ar->conf_mutex); in ath10k_read_pktlog_filter()
1906 len = scnprintf(buf, sizeof(buf) - len, "%08x\n", in ath10k_read_pktlog_filter()
1907 ar->pktlog_filter); in ath10k_read_pktlog_filter()
1908 mutex_unlock(&ar->conf_mutex); in ath10k_read_pktlog_filter()
1923 struct ath10k *ar = file->private_data; in ath10k_write_quiet_period()
1927 return -EINVAL; in ath10k_write_quiet_period()
1932 return -EINVAL; in ath10k_write_quiet_period()
1934 mutex_lock(&ar->conf_mutex); in ath10k_write_quiet_period()
1935 ar->thermal.quiet_period = period; in ath10k_write_quiet_period()
1937 mutex_unlock(&ar->conf_mutex); in ath10k_write_quiet_period()
1946 struct ath10k *ar = file->private_data; in ath10k_read_quiet_period()
1949 mutex_lock(&ar->conf_mutex); in ath10k_read_quiet_period()
1950 len = scnprintf(buf, sizeof(buf) - len, "%d\n", in ath10k_read_quiet_period()
1951 ar->thermal.quiet_period); in ath10k_read_quiet_period()
1952 mutex_unlock(&ar->conf_mutex); in ath10k_read_quiet_period()
1967 struct ath10k *ar = file->private_data; in ath10k_write_btcoex()
1976 if (!ar->coex_support) in ath10k_write_btcoex()
1977 return -EOPNOTSUPP; in ath10k_write_btcoex()
1979 mutex_lock(&ar->conf_mutex); in ath10k_write_btcoex()
1981 if (ar->state != ATH10K_STATE_ON && in ath10k_write_btcoex()
1982 ar->state != ATH10K_STATE_RESTARTED) { in ath10k_write_btcoex()
1983 ret = -ENETDOWN; in ath10k_write_btcoex()
1987 if (!(test_bit(ATH10K_FLAG_BTCOEX, &ar->dev_flags) ^ val)) { in ath10k_write_btcoex()
1992 pdev_param = ar->wmi.pdev_param->enable_btcoex; in ath10k_write_btcoex()
1994 ar->running_fw->fw_file.fw_features)) { in ath10k_write_btcoex()
2007 set_bit(ATH10K_FLAG_BTCOEX, &ar->dev_flags); in ath10k_write_btcoex()
2009 clear_bit(ATH10K_FLAG_BTCOEX, &ar->dev_flags); in ath10k_write_btcoex()
2014 mutex_unlock(&ar->conf_mutex); in ath10k_write_btcoex()
2023 struct ath10k *ar = file->private_data; in ath10k_read_btcoex()
2026 mutex_lock(&ar->conf_mutex); in ath10k_read_btcoex()
2027 len = scnprintf(buf, sizeof(buf) - len, "%d\n", in ath10k_read_btcoex()
2028 test_bit(ATH10K_FLAG_BTCOEX, &ar->dev_flags)); in ath10k_read_btcoex()
2029 mutex_unlock(&ar->conf_mutex); in ath10k_read_btcoex()
2044 struct ath10k *ar = file->private_data; in ath10k_write_enable_extd_tx_stats()
2049 return -EINVAL; in ath10k_write_enable_extd_tx_stats()
2051 mutex_lock(&ar->conf_mutex); in ath10k_write_enable_extd_tx_stats()
2053 if (ar->state != ATH10K_STATE_ON) { in ath10k_write_enable_extd_tx_stats()
2054 ar->debug.enable_extd_tx_stats = filter; in ath10k_write_enable_extd_tx_stats()
2059 if (filter == ar->debug.enable_extd_tx_stats) { in ath10k_write_enable_extd_tx_stats()
2064 ar->debug.enable_extd_tx_stats = filter; in ath10k_write_enable_extd_tx_stats()
2068 mutex_unlock(&ar->conf_mutex); in ath10k_write_enable_extd_tx_stats()
2078 struct ath10k *ar = file->private_data; in ath10k_read_enable_extd_tx_stats()
2081 mutex_lock(&ar->conf_mutex); in ath10k_read_enable_extd_tx_stats()
2082 len = scnprintf(buf, sizeof(buf) - len, "%08x\n", in ath10k_read_enable_extd_tx_stats()
2083 ar->debug.enable_extd_tx_stats); in ath10k_read_enable_extd_tx_stats()
2084 mutex_unlock(&ar->conf_mutex); in ath10k_read_enable_extd_tx_stats()
2099 struct ath10k *ar = file->private_data; in ath10k_write_peer_stats()
2107 mutex_lock(&ar->conf_mutex); in ath10k_write_peer_stats()
2109 if (ar->state != ATH10K_STATE_ON && in ath10k_write_peer_stats()
2110 ar->state != ATH10K_STATE_RESTARTED) { in ath10k_write_peer_stats()
2111 ret = -ENETDOWN; in ath10k_write_peer_stats()
2115 if (!(test_bit(ATH10K_FLAG_PEER_STATS, &ar->dev_flags) ^ val)) { in ath10k_write_peer_stats()
2121 set_bit(ATH10K_FLAG_PEER_STATS, &ar->dev_flags); in ath10k_write_peer_stats()
2123 clear_bit(ATH10K_FLAG_PEER_STATS, &ar->dev_flags); in ath10k_write_peer_stats()
2131 mutex_unlock(&ar->conf_mutex); in ath10k_write_peer_stats()
2140 struct ath10k *ar = file->private_data; in ath10k_read_peer_stats()
2143 mutex_lock(&ar->conf_mutex); in ath10k_read_peer_stats()
2144 len = scnprintf(buf, sizeof(buf) - len, "%d\n", in ath10k_read_peer_stats()
2145 test_bit(ATH10K_FLAG_PEER_STATS, &ar->dev_flags)); in ath10k_read_peer_stats()
2146 mutex_unlock(&ar->conf_mutex); in ath10k_read_peer_stats()
2161 struct ath10k *ar = file->private_data; in ath10k_debug_fw_checksums_read()
2168 return -ENOMEM; in ath10k_debug_fw_checksums_read()
2170 mutex_lock(&ar->conf_mutex); in ath10k_debug_fw_checksums_read()
2172 len += scnprintf(buf + len, buf_len - len, in ath10k_debug_fw_checksums_read()
2173 "firmware-N.bin\t\t%08x\n", in ath10k_debug_fw_checksums_read()
2174 crc32_le(0, ar->normal_mode_fw.fw_file.firmware->data, in ath10k_debug_fw_checksums_read()
2175 ar->normal_mode_fw.fw_file.firmware->size)); in ath10k_debug_fw_checksums_read()
2176 len += scnprintf(buf + len, buf_len - len, in ath10k_debug_fw_checksums_read()
2178 crc32_le(0, ar->normal_mode_fw.fw_file.firmware_data, in ath10k_debug_fw_checksums_read()
2179 ar->normal_mode_fw.fw_file.firmware_len)); in ath10k_debug_fw_checksums_read()
2180 len += scnprintf(buf + len, buf_len - len, in ath10k_debug_fw_checksums_read()
2182 crc32_le(0, ar->normal_mode_fw.fw_file.otp_data, in ath10k_debug_fw_checksums_read()
2183 ar->normal_mode_fw.fw_file.otp_len)); in ath10k_debug_fw_checksums_read()
2184 len += scnprintf(buf + len, buf_len - len, in ath10k_debug_fw_checksums_read()
2186 crc32_le(0, ar->normal_mode_fw.fw_file.codeswap_data, in ath10k_debug_fw_checksums_read()
2187 ar->normal_mode_fw.fw_file.codeswap_len)); in ath10k_debug_fw_checksums_read()
2188 len += scnprintf(buf + len, buf_len - len, in ath10k_debug_fw_checksums_read()
2189 "board-N.bin\t\t%08x\n", in ath10k_debug_fw_checksums_read()
2190 crc32_le(0, ar->normal_mode_fw.board->data, in ath10k_debug_fw_checksums_read()
2191 ar->normal_mode_fw.board->size)); in ath10k_debug_fw_checksums_read()
2192 len += scnprintf(buf + len, buf_len - len, in ath10k_debug_fw_checksums_read()
2194 crc32_le(0, ar->normal_mode_fw.board_data, in ath10k_debug_fw_checksums_read()
2195 ar->normal_mode_fw.board_len)); in ath10k_debug_fw_checksums_read()
2199 mutex_unlock(&ar->conf_mutex); in ath10k_debug_fw_checksums_read()
2216 struct ath10k *ar = file->private_data; in ath10k_sta_tid_stats_mask_read()
2220 len = scnprintf(buf, sizeof(buf), "0x%08x\n", ar->sta_tid_stats_mask); in ath10k_sta_tid_stats_mask_read()
2228 struct ath10k *ar = file->private_data; in ath10k_sta_tid_stats_mask_write()
2236 ar->sta_tid_stats_mask = mask; in ath10k_sta_tid_stats_mask_write()
2249 static int ath10k_debug_tpc_stats_final_request(struct ath10k *ar) in ath10k_debug_tpc_stats_final_request()
2254 lockdep_assert_held(&ar->conf_mutex); in ath10k_debug_tpc_stats_final_request()
2256 reinit_completion(&ar->debug.tpc_complete); in ath10k_debug_tpc_stats_final_request()
2264 time_left = wait_for_completion_timeout(&ar->debug.tpc_complete, in ath10k_debug_tpc_stats_final_request()
2267 return -ETIMEDOUT; in ath10k_debug_tpc_stats_final_request()
2274 struct ath10k *ar = inode->i_private; in ath10k_tpc_stats_final_open()
2278 mutex_lock(&ar->conf_mutex); in ath10k_tpc_stats_final_open()
2280 if (ar->state != ATH10K_STATE_ON) { in ath10k_tpc_stats_final_open()
2281 ret = -ENETDOWN; in ath10k_tpc_stats_final_open()
2287 ret = -ENOMEM; in ath10k_tpc_stats_final_open()
2298 ath10k_tpc_stats_fill(ar, ar->debug.tpc_stats, buf); in ath10k_tpc_stats_final_open()
2299 file->private_data = buf; in ath10k_tpc_stats_final_open()
2301 mutex_unlock(&ar->conf_mutex); in ath10k_tpc_stats_final_open()
2308 mutex_unlock(&ar->conf_mutex); in ath10k_tpc_stats_final_open()
2315 vfree(file->private_data); in ath10k_tpc_stats_final_release()
2324 const char *buf = file->private_data; in ath10k_tpc_stats_final_read()
2342 struct ath10k *ar = file->private_data; in ath10k_write_warm_hw_reset()
2347 return -EFAULT; in ath10k_write_warm_hw_reset()
2350 return -EINVAL; in ath10k_write_warm_hw_reset()
2352 mutex_lock(&ar->conf_mutex); in ath10k_write_warm_hw_reset()
2354 if (ar->state != ATH10K_STATE_ON) { in ath10k_write_warm_hw_reset()
2355 ret = -ENETDOWN; in ath10k_write_warm_hw_reset()
2359 ret = ath10k_wmi_pdev_set_param(ar, ar->wmi.pdev_param->pdev_reset, in ath10k_write_warm_hw_reset()
2370 mutex_unlock(&ar->conf_mutex); in ath10k_write_warm_hw_reset()
2381 static void ath10k_peer_ps_state_disable(void *data, in ath10k_peer_ps_state_disable() argument
2384 struct ath10k *ar = data; in ath10k_peer_ps_state_disable()
2385 struct ath10k_sta *arsta = (struct ath10k_sta *)sta->drv_priv; in ath10k_peer_ps_state_disable()
2387 spin_lock_bh(&ar->data_lock); in ath10k_peer_ps_state_disable()
2388 arsta->peer_ps_state = WMI_PEER_PS_STATE_DISABLED; in ath10k_peer_ps_state_disable()
2389 spin_unlock_bh(&ar->data_lock); in ath10k_peer_ps_state_disable()
2396 struct ath10k *ar = file->private_data; in ath10k_write_ps_state_enable()
2402 return -EINVAL; in ath10k_write_ps_state_enable()
2405 return -EINVAL; in ath10k_write_ps_state_enable()
2407 mutex_lock(&ar->conf_mutex); in ath10k_write_ps_state_enable()
2409 if (ar->ps_state_enable == ps_state_enable) { in ath10k_write_ps_state_enable()
2414 param = ar->wmi.pdev_param->peer_sta_ps_statechg_enable; in ath10k_write_ps_state_enable()
2421 ar->ps_state_enable = ps_state_enable; in ath10k_write_ps_state_enable()
2423 if (!ar->ps_state_enable) in ath10k_write_ps_state_enable()
2424 ieee80211_iterate_stations_atomic(ar->hw, in ath10k_write_ps_state_enable()
2431 mutex_unlock(&ar->conf_mutex); in ath10k_write_ps_state_enable()
2440 struct ath10k *ar = file->private_data; in ath10k_read_ps_state_enable()
2444 mutex_lock(&ar->conf_mutex); in ath10k_read_ps_state_enable()
2445 len = scnprintf(buf, sizeof(buf) - len, "%d\n", in ath10k_read_ps_state_enable()
2446 ar->ps_state_enable); in ath10k_read_ps_state_enable()
2447 mutex_unlock(&ar->conf_mutex); in ath10k_read_ps_state_enable()
2464 struct ath10k *ar = file->private_data; in ath10k_write_reset_htt_stats()
2473 return -EINVAL; in ath10k_write_reset_htt_stats()
2475 mutex_lock(&ar->conf_mutex); in ath10k_write_reset_htt_stats()
2477 ar->debug.reset_htt_stats = reset; in ath10k_write_reset_htt_stats()
2483 ar->debug.reset_htt_stats = 0; in ath10k_write_reset_htt_stats()
2487 mutex_unlock(&ar->conf_mutex); in ath10k_write_reset_htt_stats()
2498 int ath10k_debug_create(struct ath10k *ar) in ath10k_debug_create()
2500 ar->debug.cal_data = vzalloc(ATH10K_DEBUG_CAL_DATA_LEN); in ath10k_debug_create()
2501 if (!ar->debug.cal_data) in ath10k_debug_create()
2502 return -ENOMEM; in ath10k_debug_create()
2504 INIT_LIST_HEAD(&ar->debug.fw_stats.pdevs); in ath10k_debug_create()
2505 INIT_LIST_HEAD(&ar->debug.fw_stats.vdevs); in ath10k_debug_create()
2506 INIT_LIST_HEAD(&ar->debug.fw_stats.peers); in ath10k_debug_create()
2507 INIT_LIST_HEAD(&ar->debug.fw_stats.peers_extd); in ath10k_debug_create()
2512 void ath10k_debug_destroy(struct ath10k *ar) in ath10k_debug_destroy()
2514 vfree(ar->debug.cal_data); in ath10k_debug_destroy()
2515 ar->debug.cal_data = NULL; in ath10k_debug_destroy()
2519 kfree(ar->debug.tpc_stats); in ath10k_debug_destroy()
2520 kfree(ar->debug.tpc_stats_final); in ath10k_debug_destroy()
2523 int ath10k_debug_register(struct ath10k *ar) in ath10k_debug_register()
2525 ar->debug.debugfs_phy = debugfs_create_dir("ath10k", in ath10k_debug_register()
2526 ar->hw->wiphy->debugfsdir); in ath10k_debug_register()
2527 if (IS_ERR_OR_NULL(ar->debug.debugfs_phy)) { in ath10k_debug_register()
2528 if (IS_ERR(ar->debug.debugfs_phy)) in ath10k_debug_register()
2529 return PTR_ERR(ar->debug.debugfs_phy); in ath10k_debug_register()
2531 return -ENOMEM; in ath10k_debug_register()
2534 INIT_DELAYED_WORK(&ar->debug.htt_stats_dwork, in ath10k_debug_register()
2537 init_completion(&ar->debug.tpc_complete); in ath10k_debug_register()
2538 init_completion(&ar->debug.fw_stats_complete); in ath10k_debug_register()
2540 debugfs_create_file("fw_stats", 0400, ar->debug.debugfs_phy, ar, in ath10k_debug_register()
2543 debugfs_create_file("fw_reset_stats", 0400, ar->debug.debugfs_phy, ar, in ath10k_debug_register()
2546 debugfs_create_file("wmi_services", 0400, ar->debug.debugfs_phy, ar, in ath10k_debug_register()
2549 debugfs_create_file("simulate_fw_crash", 0600, ar->debug.debugfs_phy, ar, in ath10k_debug_register()
2552 debugfs_create_file("reg_addr", 0600, ar->debug.debugfs_phy, ar, in ath10k_debug_register()
2555 debugfs_create_file("reg_value", 0600, ar->debug.debugfs_phy, ar, in ath10k_debug_register()
2558 debugfs_create_file("mem_value", 0600, ar->debug.debugfs_phy, ar, in ath10k_debug_register()
2561 debugfs_create_file("chip_id", 0400, ar->debug.debugfs_phy, ar, in ath10k_debug_register()
2564 debugfs_create_file("htt_stats_mask", 0600, ar->debug.debugfs_phy, ar, in ath10k_debug_register()
2567 debugfs_create_file("htt_max_amsdu_ampdu", 0600, ar->debug.debugfs_phy, ar, in ath10k_debug_register()
2570 debugfs_create_file("fw_dbglog", 0600, ar->debug.debugfs_phy, ar, in ath10k_debug_register()
2574 ar->normal_mode_fw.fw_file.fw_features)) { in ath10k_debug_register()
2575 debugfs_create_file("cal_data", 0400, ar->debug.debugfs_phy, ar, in ath10k_debug_register()
2578 debugfs_create_file("nf_cal_period", 0600, ar->debug.debugfs_phy, ar, in ath10k_debug_register()
2582 debugfs_create_file("ani_enable", 0600, ar->debug.debugfs_phy, ar, in ath10k_debug_register()
2586 debugfs_create_file("dfs_simulate_radar", 0200, ar->debug.debugfs_phy, in ath10k_debug_register()
2590 ar->debug.debugfs_phy, in ath10k_debug_register()
2591 &ar->dfs_block_radar_events); in ath10k_debug_register()
2593 debugfs_create_file("dfs_stats", 0400, ar->debug.debugfs_phy, ar, in ath10k_debug_register()
2597 debugfs_create_file("pktlog_filter", 0644, ar->debug.debugfs_phy, ar, in ath10k_debug_register()
2600 if (test_bit(WMI_SERVICE_THERM_THROT, ar->wmi.svc_map)) in ath10k_debug_register()
2601 debugfs_create_file("quiet_period", 0644, ar->debug.debugfs_phy, ar, in ath10k_debug_register()
2604 debugfs_create_file("tpc_stats", 0400, ar->debug.debugfs_phy, ar, in ath10k_debug_register()
2607 if (test_bit(WMI_SERVICE_COEX_GPIO, ar->wmi.svc_map)) in ath10k_debug_register()
2608 debugfs_create_file("btcoex", 0644, ar->debug.debugfs_phy, ar, in ath10k_debug_register()
2611 if (test_bit(WMI_SERVICE_PEER_STATS, ar->wmi.svc_map)) { in ath10k_debug_register()
2612 debugfs_create_file("peer_stats", 0644, ar->debug.debugfs_phy, ar, in ath10k_debug_register()
2616 ar->debug.debugfs_phy, ar, in ath10k_debug_register()
2620 debugfs_create_file("fw_checksums", 0400, ar->debug.debugfs_phy, ar, in ath10k_debug_register()
2625 ar->debug.debugfs_phy, in ath10k_debug_register()
2628 if (test_bit(WMI_SERVICE_TPC_STATS_FINAL, ar->wmi.svc_map)) in ath10k_debug_register()
2630 ar->debug.debugfs_phy, ar, in ath10k_debug_register()
2633 if (test_bit(WMI_SERVICE_RESET_CHIP, ar->wmi.svc_map)) in ath10k_debug_register()
2635 ar->debug.debugfs_phy, ar, in ath10k_debug_register()
2638 debugfs_create_file("ps_state_enable", 0600, ar->debug.debugfs_phy, ar, in ath10k_debug_register()
2641 debugfs_create_file("reset_htt_stats", 0200, ar->debug.debugfs_phy, ar, in ath10k_debug_register()
2647 void ath10k_debug_unregister(struct ath10k *ar) in ath10k_debug_unregister()
2649 cancel_delayed_work_sync(&ar->debug.htt_stats_dwork); in ath10k_debug_unregister()
2655 void __ath10k_dbg(struct ath10k *ar, enum ath10k_debug_mask mask, in __ath10k_dbg()
2667 dev_printk(KERN_DEBUG, ar->dev, "%pV", &vaf); in __ath10k_dbg()
2675 void ath10k_dbg_dump(struct ath10k *ar, in ath10k_dbg_dump()
2688 for (ptr = buf; (ptr - buf) < len; ptr += 16) { in ath10k_dbg_dump()
2691 sizeof(linebuf) - linebuflen, in ath10k_dbg_dump()
2694 (unsigned int)(ptr - buf)); in ath10k_dbg_dump()
2695 hex_dump_to_buffer(ptr, len - (ptr - buf), 16, 1, in ath10k_dbg_dump()
2697 sizeof(linebuf) - linebuflen, true); in ath10k_dbg_dump()
2698 dev_printk(KERN_DEBUG, ar->dev, "%s\n", linebuf); in ath10k_dbg_dump()