Lines Matching +full:antenna +full:- +full:config +full:- +full:file

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"
35 dev_info(ar->dev, "%pV", &vaf); in ath10k_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()
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()
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()
127 dev_err(ar->dev, "%pV", &vaf); in ath10k_err()
142 dev_warn_ratelimited(ar->dev, "%pV", &vaf); in ath10k_warn()
151 static ssize_t ath10k_read_wmi_services(struct file *file, in ath10k_read_wmi_services() argument
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()
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()
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()
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()
394 static int ath10k_fw_stats_open(struct inode *inode, struct file *file) in ath10k_fw_stats_open() argument
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()
438 static int ath10k_fw_stats_release(struct inode *inode, struct file *file) in ath10k_fw_stats_release() argument
440 vfree(file->private_data); in ath10k_fw_stats_release()
445 static ssize_t ath10k_fw_stats_read(struct file *file, char __user *user_buf, in ath10k_fw_stats_read() argument
448 const char *buf = file->private_data; in ath10k_fw_stats_read()
462 static ssize_t ath10k_debug_fw_reset_stats_read(struct file *file, in ath10k_debug_fw_reset_stats_read() argument
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()
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()
522 static ssize_t ath10k_read_simulate_fw_crash(struct file *file, in ath10k_read_simulate_fw_crash() argument
527 "To simulate firmware crash write one of the keywords to this file:\n" in ath10k_read_simulate_fw_crash()
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()
543 static ssize_t ath10k_write_simulate_fw_crash(struct file *file, in ath10k_write_simulate_fw_crash() argument
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()
615 static ssize_t ath10k_read_chip_id(struct file *file, char __user *user_buf, in ath10k_read_chip_id() argument
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()
634 static ssize_t ath10k_reg_addr_read(struct file *file, in ath10k_reg_addr_read() argument
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()
652 static ssize_t ath10k_reg_addr_write(struct file *file, in ath10k_reg_addr_write() argument
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()
682 static ssize_t ath10k_reg_value_read(struct file *file, in ath10k_reg_value_read() argument
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()
713 static ssize_t ath10k_reg_value_write(struct file *file, in ath10k_reg_value_write() argument
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()
753 static ssize_t ath10k_mem_value_read(struct file *file, in ath10k_mem_value_read() argument
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()
805 static ssize_t ath10k_mem_value_write(struct file *file, in ath10k_mem_value_write() argument
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()
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()
898 mutex_lock(&ar->conf_mutex); in ath10k_debug_htt_stats_dwork()
902 mutex_unlock(&ar->conf_mutex); in ath10k_debug_htt_stats_dwork()
905 static ssize_t ath10k_read_htt_stats_mask(struct file *file, in ath10k_read_htt_stats_mask() argument
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()
918 static ssize_t ath10k_write_htt_stats_mask(struct file *file, in ath10k_write_htt_stats_mask() argument
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()
958 static ssize_t ath10k_read_htt_max_amsdu_ampdu(struct file *file, in ath10k_read_htt_max_amsdu_ampdu() argument
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()
978 static ssize_t ath10k_write_htt_max_amsdu_ampdu(struct file *file, in ath10k_write_htt_max_amsdu_ampdu() argument
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()
1020 static ssize_t ath10k_read_fw_dbglog(struct file *file, in ath10k_read_fw_dbglog() argument
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()
1034 static ssize_t ath10k_write_fw_dbglog(struct file *file, in ath10k_write_fw_dbglog() argument
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()
1086 /* This generally corresponds to the debugfs fw_stats file */
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()
1190 data[i++] = pdev_stats->htt_mpdus; 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()
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()
1284 static int ath10k_debug_cal_data_open(struct inode *inode, struct file *file) in ath10k_debug_cal_data_open() argument
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()
1301 static ssize_t ath10k_debug_cal_data_read(struct file *file, in ath10k_debug_cal_data_read() argument
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()
1318 static ssize_t ath10k_write_ani_enable(struct file *file, in ath10k_write_ani_enable() argument
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()
1352 static ssize_t ath10k_read_ani_enable(struct file *file, char __user *user_buf, in ath10k_read_ani_enable() argument
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()
1379 static ssize_t ath10k_read_nf_cal_period(struct file *file, in ath10k_read_nf_cal_period() argument
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()
1392 static ssize_t ath10k_write_nf_cal_period(struct file *file, in ath10k_write_nf_cal_period() argument
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()
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()
1458 ath10k_warn(ar, "failed to request tpc config: %d\n", ret); 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()
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()
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()
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()
1562 "TPC config for channel %4d mode %d\n", 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()
1572 "Antenna Gain = %2d Reg. Max Antenna Gain = %2d\n", 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()
1629 static int ath10k_tpc_stats_open(struct inode *inode, struct file *file) in ath10k_tpc_stats_open() argument
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()
1650 ath10k_warn(ar, "failed to request tpc config stats: %d\n", 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()
1669 static int ath10k_tpc_stats_release(struct inode *inode, struct file *file) in ath10k_tpc_stats_release() argument
1671 vfree(file->private_data); in ath10k_tpc_stats_release()
1676 static ssize_t ath10k_tpc_stats_read(struct file *file, char __user *user_buf, in ath10k_tpc_stats_read() argument
1679 const char *buf = file->private_data; in ath10k_tpc_stats_read()
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()
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()
1762 static ssize_t ath10k_write_simulate_radar(struct file *file, in ath10k_write_simulate_radar() argument
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); 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))
1797 static ssize_t ath10k_read_dfs_stats(struct file *file, char __user *user_buf, in ath10k_read_dfs_stats() argument
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()
1851 static ssize_t ath10k_write_pktlog_filter(struct file *file, in ath10k_write_pktlog_filter() argument
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()
1898 static ssize_t ath10k_read_pktlog_filter(struct file *file, char __user *ubuf, in ath10k_read_pktlog_filter() argument
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()
1919 static ssize_t ath10k_write_quiet_period(struct file *file, in ath10k_write_quiet_period() argument
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()
1942 static ssize_t ath10k_read_quiet_period(struct file *file, char __user *ubuf, in ath10k_read_quiet_period() argument
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()
1963 static ssize_t ath10k_write_btcoex(struct file *file, in ath10k_write_btcoex() argument
1967 struct ath10k *ar = file->private_data; in ath10k_write_btcoex()
1974 buf_size = min(count, (sizeof(buf) - 1)); in ath10k_write_btcoex()
1976 return -EFAULT; in ath10k_write_btcoex()
1981 return -EINVAL; in ath10k_write_btcoex()
1983 if (!ar->coex_support) in ath10k_write_btcoex()
1984 return -EOPNOTSUPP; in ath10k_write_btcoex()
1986 mutex_lock(&ar->conf_mutex); in ath10k_write_btcoex()
1988 if (ar->state != ATH10K_STATE_ON && in ath10k_write_btcoex()
1989 ar->state != ATH10K_STATE_RESTARTED) { in ath10k_write_btcoex()
1990 ret = -ENETDOWN; in ath10k_write_btcoex()
1994 if (!(test_bit(ATH10K_FLAG_BTCOEX, &ar->dev_flags) ^ val)) { in ath10k_write_btcoex()
1999 pdev_param = ar->wmi.pdev_param->enable_btcoex; in ath10k_write_btcoex()
2001 ar->running_fw->fw_file.fw_features)) { in ath10k_write_btcoex()
2014 set_bit(ATH10K_FLAG_BTCOEX, &ar->dev_flags); in ath10k_write_btcoex()
2016 clear_bit(ATH10K_FLAG_BTCOEX, &ar->dev_flags); in ath10k_write_btcoex()
2021 mutex_unlock(&ar->conf_mutex); in ath10k_write_btcoex()
2026 static ssize_t ath10k_read_btcoex(struct file *file, char __user *ubuf, in ath10k_read_btcoex() argument
2030 struct ath10k *ar = file->private_data; in ath10k_read_btcoex()
2033 mutex_lock(&ar->conf_mutex); in ath10k_read_btcoex()
2034 len = scnprintf(buf, sizeof(buf) - len, "%d\n", in ath10k_read_btcoex()
2035 test_bit(ATH10K_FLAG_BTCOEX, &ar->dev_flags)); in ath10k_read_btcoex()
2036 mutex_unlock(&ar->conf_mutex); in ath10k_read_btcoex()
2047 static ssize_t ath10k_write_enable_extd_tx_stats(struct file *file, in ath10k_write_enable_extd_tx_stats() argument
2051 struct ath10k *ar = file->private_data; in ath10k_write_enable_extd_tx_stats()
2056 return -EINVAL; in ath10k_write_enable_extd_tx_stats()
2058 mutex_lock(&ar->conf_mutex); in ath10k_write_enable_extd_tx_stats()
2060 if (ar->state != ATH10K_STATE_ON) { in ath10k_write_enable_extd_tx_stats()
2061 ar->debug.enable_extd_tx_stats = filter; in ath10k_write_enable_extd_tx_stats()
2066 if (filter == ar->debug.enable_extd_tx_stats) { in ath10k_write_enable_extd_tx_stats()
2071 ar->debug.enable_extd_tx_stats = filter; in ath10k_write_enable_extd_tx_stats()
2075 mutex_unlock(&ar->conf_mutex); in ath10k_write_enable_extd_tx_stats()
2079 static ssize_t ath10k_read_enable_extd_tx_stats(struct file *file, in ath10k_read_enable_extd_tx_stats() argument
2085 struct ath10k *ar = file->private_data; in ath10k_read_enable_extd_tx_stats()
2088 mutex_lock(&ar->conf_mutex); in ath10k_read_enable_extd_tx_stats()
2089 len = scnprintf(buf, sizeof(buf) - len, "%08x\n", in ath10k_read_enable_extd_tx_stats()
2090 ar->debug.enable_extd_tx_stats); in ath10k_read_enable_extd_tx_stats()
2091 mutex_unlock(&ar->conf_mutex); in ath10k_read_enable_extd_tx_stats()
2102 static ssize_t ath10k_write_peer_stats(struct file *file, in ath10k_write_peer_stats() argument
2106 struct ath10k *ar = file->private_data; in ath10k_write_peer_stats()
2112 buf_size = min(count, (sizeof(buf) - 1)); in ath10k_write_peer_stats()
2114 return -EFAULT; in ath10k_write_peer_stats()
2119 return -EINVAL; in ath10k_write_peer_stats()
2121 mutex_lock(&ar->conf_mutex); in ath10k_write_peer_stats()
2123 if (ar->state != ATH10K_STATE_ON && in ath10k_write_peer_stats()
2124 ar->state != ATH10K_STATE_RESTARTED) { in ath10k_write_peer_stats()
2125 ret = -ENETDOWN; in ath10k_write_peer_stats()
2129 if (!(test_bit(ATH10K_FLAG_PEER_STATS, &ar->dev_flags) ^ val)) { in ath10k_write_peer_stats()
2135 set_bit(ATH10K_FLAG_PEER_STATS, &ar->dev_flags); in ath10k_write_peer_stats()
2137 clear_bit(ATH10K_FLAG_PEER_STATS, &ar->dev_flags); in ath10k_write_peer_stats()
2145 mutex_unlock(&ar->conf_mutex); in ath10k_write_peer_stats()
2149 static ssize_t ath10k_read_peer_stats(struct file *file, char __user *ubuf, in ath10k_read_peer_stats() argument
2154 struct ath10k *ar = file->private_data; in ath10k_read_peer_stats()
2157 mutex_lock(&ar->conf_mutex); in ath10k_read_peer_stats()
2158 len = scnprintf(buf, sizeof(buf) - len, "%d\n", in ath10k_read_peer_stats()
2159 test_bit(ATH10K_FLAG_PEER_STATS, &ar->dev_flags)); in ath10k_read_peer_stats()
2160 mutex_unlock(&ar->conf_mutex); in ath10k_read_peer_stats()
2171 static ssize_t ath10k_debug_fw_checksums_read(struct file *file, in ath10k_debug_fw_checksums_read() argument
2175 struct ath10k *ar = file->private_data; in ath10k_debug_fw_checksums_read()
2182 return -ENOMEM; in ath10k_debug_fw_checksums_read()
2184 mutex_lock(&ar->conf_mutex); in ath10k_debug_fw_checksums_read()
2186 len += scnprintf(buf + len, buf_len - len, in ath10k_debug_fw_checksums_read()
2187 "firmware-N.bin\t\t%08x\n", in ath10k_debug_fw_checksums_read()
2188 crc32_le(0, ar->normal_mode_fw.fw_file.firmware->data, in ath10k_debug_fw_checksums_read()
2189 ar->normal_mode_fw.fw_file.firmware->size)); in ath10k_debug_fw_checksums_read()
2190 len += scnprintf(buf + len, buf_len - len, in ath10k_debug_fw_checksums_read()
2192 crc32_le(0, ar->normal_mode_fw.fw_file.firmware_data, in ath10k_debug_fw_checksums_read()
2193 ar->normal_mode_fw.fw_file.firmware_len)); in ath10k_debug_fw_checksums_read()
2194 len += scnprintf(buf + len, buf_len - len, in ath10k_debug_fw_checksums_read()
2196 crc32_le(0, ar->normal_mode_fw.fw_file.otp_data, in ath10k_debug_fw_checksums_read()
2197 ar->normal_mode_fw.fw_file.otp_len)); in ath10k_debug_fw_checksums_read()
2198 len += scnprintf(buf + len, buf_len - len, in ath10k_debug_fw_checksums_read()
2200 crc32_le(0, ar->normal_mode_fw.fw_file.codeswap_data, in ath10k_debug_fw_checksums_read()
2201 ar->normal_mode_fw.fw_file.codeswap_len)); in ath10k_debug_fw_checksums_read()
2202 len += scnprintf(buf + len, buf_len - len, in ath10k_debug_fw_checksums_read()
2203 "board-N.bin\t\t%08x\n", in ath10k_debug_fw_checksums_read()
2204 crc32_le(0, ar->normal_mode_fw.board->data, in ath10k_debug_fw_checksums_read()
2205 ar->normal_mode_fw.board->size)); in ath10k_debug_fw_checksums_read()
2206 len += scnprintf(buf + len, buf_len - len, in ath10k_debug_fw_checksums_read()
2208 crc32_le(0, ar->normal_mode_fw.board_data, in ath10k_debug_fw_checksums_read()
2209 ar->normal_mode_fw.board_len)); in ath10k_debug_fw_checksums_read()
2213 mutex_unlock(&ar->conf_mutex); in ath10k_debug_fw_checksums_read()
2226 static ssize_t ath10k_sta_tid_stats_mask_read(struct file *file, in ath10k_sta_tid_stats_mask_read() argument
2230 struct ath10k *ar = file->private_data; in ath10k_sta_tid_stats_mask_read()
2234 len = scnprintf(buf, sizeof(buf), "0x%08x\n", ar->sta_tid_stats_mask); in ath10k_sta_tid_stats_mask_read()
2238 static ssize_t ath10k_sta_tid_stats_mask_write(struct file *file, in ath10k_sta_tid_stats_mask_write() argument
2242 struct ath10k *ar = file->private_data; in ath10k_sta_tid_stats_mask_write()
2247 len = min(count, sizeof(buf) - 1); in ath10k_sta_tid_stats_mask_write()
2249 return -EFAULT; in ath10k_sta_tid_stats_mask_write()
2253 return -EINVAL; in ath10k_sta_tid_stats_mask_write()
2255 ar->sta_tid_stats_mask = mask; in ath10k_sta_tid_stats_mask_write()
2273 lockdep_assert_held(&ar->conf_mutex); in ath10k_debug_tpc_stats_final_request()
2275 reinit_completion(&ar->debug.tpc_complete); in ath10k_debug_tpc_stats_final_request()
2283 time_left = wait_for_completion_timeout(&ar->debug.tpc_complete, in ath10k_debug_tpc_stats_final_request()
2286 return -ETIMEDOUT; in ath10k_debug_tpc_stats_final_request()
2291 static int ath10k_tpc_stats_final_open(struct inode *inode, struct file *file) in ath10k_tpc_stats_final_open() argument
2293 struct ath10k *ar = inode->i_private; in ath10k_tpc_stats_final_open()
2297 mutex_lock(&ar->conf_mutex); in ath10k_tpc_stats_final_open()
2299 if (ar->state != ATH10K_STATE_ON) { in ath10k_tpc_stats_final_open()
2300 ret = -ENETDOWN; in ath10k_tpc_stats_final_open()
2306 ret = -ENOMEM; in ath10k_tpc_stats_final_open()
2317 ath10k_tpc_stats_fill(ar, ar->debug.tpc_stats, buf); in ath10k_tpc_stats_final_open()
2318 file->private_data = buf; in ath10k_tpc_stats_final_open()
2320 mutex_unlock(&ar->conf_mutex); in ath10k_tpc_stats_final_open()
2327 mutex_unlock(&ar->conf_mutex); in ath10k_tpc_stats_final_open()
2332 struct file *file) in ath10k_tpc_stats_final_release() argument
2334 vfree(file->private_data); in ath10k_tpc_stats_final_release()
2339 static ssize_t ath10k_tpc_stats_final_read(struct file *file, in ath10k_tpc_stats_final_read() argument
2343 const char *buf = file->private_data; in ath10k_tpc_stats_final_read()
2357 static ssize_t ath10k_write_warm_hw_reset(struct file *file, in ath10k_write_warm_hw_reset() argument
2361 struct ath10k *ar = file->private_data; in ath10k_write_warm_hw_reset()
2366 return -EFAULT; in ath10k_write_warm_hw_reset()
2369 return -EINVAL; in ath10k_write_warm_hw_reset()
2371 mutex_lock(&ar->conf_mutex); in ath10k_write_warm_hw_reset()
2373 if (ar->state != ATH10K_STATE_ON) { in ath10k_write_warm_hw_reset()
2374 ret = -ENETDOWN; in ath10k_write_warm_hw_reset()
2378 ret = ath10k_wmi_pdev_set_param(ar, ar->wmi.pdev_param->pdev_reset, in ath10k_write_warm_hw_reset()
2389 mutex_unlock(&ar->conf_mutex); in ath10k_write_warm_hw_reset()
2404 struct ath10k_sta *arsta = (struct ath10k_sta *)sta->drv_priv; in ath10k_peer_ps_state_disable()
2406 spin_lock_bh(&ar->data_lock); in ath10k_peer_ps_state_disable()
2407 arsta->peer_ps_state = WMI_PEER_PS_STATE_DISABLED; in ath10k_peer_ps_state_disable()
2408 spin_unlock_bh(&ar->data_lock); in ath10k_peer_ps_state_disable()
2411 static ssize_t ath10k_write_ps_state_enable(struct file *file, in ath10k_write_ps_state_enable() argument
2415 struct ath10k *ar = file->private_data; in ath10k_write_ps_state_enable()
2421 return -EINVAL; in ath10k_write_ps_state_enable()
2424 return -EINVAL; in ath10k_write_ps_state_enable()
2426 mutex_lock(&ar->conf_mutex); in ath10k_write_ps_state_enable()
2428 if (ar->ps_state_enable == ps_state_enable) { in ath10k_write_ps_state_enable()
2433 param = ar->wmi.pdev_param->peer_sta_ps_statechg_enable; in ath10k_write_ps_state_enable()
2440 ar->ps_state_enable = ps_state_enable; in ath10k_write_ps_state_enable()
2442 if (!ar->ps_state_enable) in ath10k_write_ps_state_enable()
2443 ieee80211_iterate_stations_atomic(ar->hw, in ath10k_write_ps_state_enable()
2450 mutex_unlock(&ar->conf_mutex); in ath10k_write_ps_state_enable()
2455 static ssize_t ath10k_read_ps_state_enable(struct file *file, in ath10k_read_ps_state_enable() argument
2459 struct ath10k *ar = file->private_data; in ath10k_read_ps_state_enable()
2463 mutex_lock(&ar->conf_mutex); in ath10k_read_ps_state_enable()
2464 len = scnprintf(buf, sizeof(buf) - len, "%d\n", in ath10k_read_ps_state_enable()
2465 ar->ps_state_enable); in ath10k_read_ps_state_enable()
2466 mutex_unlock(&ar->conf_mutex); in ath10k_read_ps_state_enable()
2479 static ssize_t ath10k_write_reset_htt_stats(struct file *file, in ath10k_write_reset_htt_stats() argument
2483 struct ath10k *ar = file->private_data; in ath10k_write_reset_htt_stats()
2492 return -EINVAL; in ath10k_write_reset_htt_stats()
2494 mutex_lock(&ar->conf_mutex); in ath10k_write_reset_htt_stats()
2496 ar->debug.reset_htt_stats = reset; in ath10k_write_reset_htt_stats()
2502 ar->debug.reset_htt_stats = 0; in ath10k_write_reset_htt_stats()
2506 mutex_unlock(&ar->conf_mutex); in ath10k_write_reset_htt_stats()
2519 ar->debug.cal_data = vzalloc(ATH10K_DEBUG_CAL_DATA_LEN); in ath10k_debug_create()
2520 if (!ar->debug.cal_data) in ath10k_debug_create()
2521 return -ENOMEM; in ath10k_debug_create()
2523 INIT_LIST_HEAD(&ar->debug.fw_stats.pdevs); in ath10k_debug_create()
2524 INIT_LIST_HEAD(&ar->debug.fw_stats.vdevs); in ath10k_debug_create()
2525 INIT_LIST_HEAD(&ar->debug.fw_stats.peers); in ath10k_debug_create()
2526 INIT_LIST_HEAD(&ar->debug.fw_stats.peers_extd); in ath10k_debug_create()
2533 vfree(ar->debug.cal_data); in ath10k_debug_destroy()
2534 ar->debug.cal_data = NULL; in ath10k_debug_destroy()
2538 kfree(ar->debug.tpc_stats); in ath10k_debug_destroy()
2539 kfree(ar->debug.tpc_stats_final); in ath10k_debug_destroy()
2544 ar->debug.debugfs_phy = debugfs_create_dir("ath10k", in ath10k_debug_register()
2545 ar->hw->wiphy->debugfsdir); in ath10k_debug_register()
2546 if (IS_ERR_OR_NULL(ar->debug.debugfs_phy)) { in ath10k_debug_register()
2547 if (IS_ERR(ar->debug.debugfs_phy)) in ath10k_debug_register()
2548 return PTR_ERR(ar->debug.debugfs_phy); in ath10k_debug_register()
2550 return -ENOMEM; in ath10k_debug_register()
2553 INIT_DELAYED_WORK(&ar->debug.htt_stats_dwork, in ath10k_debug_register()
2556 init_completion(&ar->debug.tpc_complete); in ath10k_debug_register()
2557 init_completion(&ar->debug.fw_stats_complete); in ath10k_debug_register()
2559 debugfs_create_file("fw_stats", 0400, ar->debug.debugfs_phy, ar, in ath10k_debug_register()
2562 debugfs_create_file("fw_reset_stats", 0400, ar->debug.debugfs_phy, ar, in ath10k_debug_register()
2565 debugfs_create_file("wmi_services", 0400, ar->debug.debugfs_phy, ar, in ath10k_debug_register()
2568 debugfs_create_file("simulate_fw_crash", 0600, ar->debug.debugfs_phy, ar, in ath10k_debug_register()
2571 debugfs_create_file("reg_addr", 0600, ar->debug.debugfs_phy, ar, in ath10k_debug_register()
2574 debugfs_create_file("reg_value", 0600, ar->debug.debugfs_phy, ar, in ath10k_debug_register()
2577 debugfs_create_file("mem_value", 0600, ar->debug.debugfs_phy, ar, in ath10k_debug_register()
2580 debugfs_create_file("chip_id", 0400, ar->debug.debugfs_phy, ar, in ath10k_debug_register()
2583 debugfs_create_file("htt_stats_mask", 0600, ar->debug.debugfs_phy, ar, in ath10k_debug_register()
2586 debugfs_create_file("htt_max_amsdu_ampdu", 0600, ar->debug.debugfs_phy, ar, in ath10k_debug_register()
2589 debugfs_create_file("fw_dbglog", 0600, ar->debug.debugfs_phy, ar, in ath10k_debug_register()
2593 ar->normal_mode_fw.fw_file.fw_features)) { in ath10k_debug_register()
2594 debugfs_create_file("cal_data", 0400, ar->debug.debugfs_phy, ar, in ath10k_debug_register()
2597 debugfs_create_file("nf_cal_period", 0600, ar->debug.debugfs_phy, ar, in ath10k_debug_register()
2601 debugfs_create_file("ani_enable", 0600, ar->debug.debugfs_phy, ar, in ath10k_debug_register()
2605 debugfs_create_file("dfs_simulate_radar", 0200, ar->debug.debugfs_phy, in ath10k_debug_register()
2609 ar->debug.debugfs_phy, in ath10k_debug_register()
2610 &ar->dfs_block_radar_events); in ath10k_debug_register()
2612 debugfs_create_file("dfs_stats", 0400, ar->debug.debugfs_phy, ar, in ath10k_debug_register()
2616 debugfs_create_file("pktlog_filter", 0644, ar->debug.debugfs_phy, ar, in ath10k_debug_register()
2619 if (test_bit(WMI_SERVICE_THERM_THROT, ar->wmi.svc_map)) in ath10k_debug_register()
2620 debugfs_create_file("quiet_period", 0644, ar->debug.debugfs_phy, ar, in ath10k_debug_register()
2623 debugfs_create_file("tpc_stats", 0400, ar->debug.debugfs_phy, ar, in ath10k_debug_register()
2626 if (test_bit(WMI_SERVICE_COEX_GPIO, ar->wmi.svc_map)) in ath10k_debug_register()
2627 debugfs_create_file("btcoex", 0644, ar->debug.debugfs_phy, ar, in ath10k_debug_register()
2630 if (test_bit(WMI_SERVICE_PEER_STATS, ar->wmi.svc_map)) { in ath10k_debug_register()
2631 debugfs_create_file("peer_stats", 0644, ar->debug.debugfs_phy, ar, in ath10k_debug_register()
2635 ar->debug.debugfs_phy, ar, in ath10k_debug_register()
2639 debugfs_create_file("fw_checksums", 0400, ar->debug.debugfs_phy, ar, in ath10k_debug_register()
2644 ar->debug.debugfs_phy, in ath10k_debug_register()
2647 if (test_bit(WMI_SERVICE_TPC_STATS_FINAL, ar->wmi.svc_map)) in ath10k_debug_register()
2649 ar->debug.debugfs_phy, ar, in ath10k_debug_register()
2652 if (test_bit(WMI_SERVICE_RESET_CHIP, ar->wmi.svc_map)) in ath10k_debug_register()
2654 ar->debug.debugfs_phy, ar, in ath10k_debug_register()
2657 debugfs_create_file("ps_state_enable", 0600, ar->debug.debugfs_phy, ar, in ath10k_debug_register()
2660 debugfs_create_file("reset_htt_stats", 0200, ar->debug.debugfs_phy, ar, in ath10k_debug_register()
2668 cancel_delayed_work_sync(&ar->debug.htt_stats_dwork); in ath10k_debug_unregister()
2686 dev_printk(KERN_DEBUG, ar->dev, "%pV", &vaf); in __ath10k_dbg()
2707 for (ptr = buf; (ptr - buf) < len; ptr += 16) { in ath10k_dbg_dump()
2710 sizeof(linebuf) - linebuflen, in ath10k_dbg_dump()
2713 (unsigned int)(ptr - buf)); in ath10k_dbg_dump()
2714 hex_dump_to_buffer(ptr, len - (ptr - buf), 16, 1, in ath10k_dbg_dump()
2716 sizeof(linebuf) - linebuflen, true); in ath10k_dbg_dump()
2717 dev_printk(KERN_DEBUG, ar->dev, "%s\n", linebuf); in ath10k_dbg_dump()