Lines Matching +full:tx +full:- +full:ping +full:- +full:pong

1 // SPDX-License-Identifier: ISC
3 * Copyright (c) 2005-2011 Atheros Communications Inc.
4 * Copyright (c) 2011-2017 Qualcomm Atheros, Inc.
17 #include "wmi-ops.h"
33 dev_info(ar->dev, "%pV", &vaf); in ath10k_info()
48 ar->hw_params.name, in ath10k_debug_print_hwfw_info()
49 ar->target_version, in ath10k_debug_print_hwfw_info()
50 ar->bus_param.chip_id, in ath10k_debug_print_hwfw_info()
51 ar->id.subsystem_vendor, ar->id.subsystem_device); in ath10k_debug_print_hwfw_info()
60 firmware = ar->normal_mode_fw.fw_file.firmware; in ath10k_debug_print_hwfw_info()
62 crc = crc32_le(0, firmware->data, firmware->size); in ath10k_debug_print_hwfw_info()
65 ar->hw->wiphy->fw_version, in ath10k_debug_print_hwfw_info()
66 ar->fw_api, in ath10k_debug_print_hwfw_info()
77 if (ar->id.bmi_ids_valid) in ath10k_debug_print_board_info()
79 ar->id.bmi_chip_id, ar->id.bmi_board_id); in ath10k_debug_print_board_info()
83 board = ar->normal_mode_fw.board; in ath10k_debug_print_board_info()
85 crc = crc32_le(0, board->data, board->size); in ath10k_debug_print_board_info()
90 ar->bd_api, in ath10k_debug_print_board_info()
97 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()
98 ar->htt.target_version_major, in ath10k_debug_print_boot_info()
99 ar->htt.target_version_minor, in ath10k_debug_print_boot_info()
100 ar->normal_mode_fw.fw_file.wmi_op_version, in ath10k_debug_print_boot_info()
101 ar->normal_mode_fw.fw_file.htt_op_version, in ath10k_debug_print_boot_info()
102 ath10k_cal_mode_str(ar->cal_mode), in ath10k_debug_print_boot_info()
103 ar->max_num_stations, in ath10k_debug_print_boot_info()
104 test_bit(ATH10K_FLAG_RAW_MODE, &ar->dev_flags), in ath10k_debug_print_boot_info()
105 !test_bit(ATH10K_FLAG_HW_CRYPTO_DISABLED, &ar->dev_flags)); in ath10k_debug_print_boot_info()
125 dev_err(ar->dev, "%pV", &vaf); in ath10k_err()
140 dev_warn_ratelimited(ar->dev, "%pV", &vaf); in ath10k_warn()
153 struct ath10k *ar = file->private_data; in ath10k_read_wmi_services()
163 return -ENOMEM; in ath10k_read_wmi_services()
165 mutex_lock(&ar->conf_mutex); in ath10k_read_wmi_services()
167 spin_lock_bh(&ar->data_lock); in ath10k_read_wmi_services()
169 enabled = test_bit(i, ar->wmi.svc_map); in ath10k_read_wmi_services()
174 len += scnprintf(buf + len, buf_len - len, in ath10k_read_wmi_services()
175 "%-40s %s (bit %d)\n", in ath10k_read_wmi_services()
181 len += scnprintf(buf + len, buf_len - len, in ath10k_read_wmi_services()
182 "%-40s %s\n", in ath10k_read_wmi_services()
183 name, enabled ? "enabled" : "-"); in ath10k_read_wmi_services()
185 spin_unlock_bh(&ar->data_lock); in ath10k_read_wmi_services()
189 mutex_unlock(&ar->conf_mutex); in ath10k_read_wmi_services()
207 list_del(&i->list); in ath10k_fw_stats_pdevs_free()
217 list_del(&i->list); in ath10k_fw_stats_vdevs_free()
227 list_del(&i->list); in ath10k_fw_stats_peers_free()
237 list_del(&i->list); in ath10k_fw_extd_stats_peers_free()
244 spin_lock_bh(&ar->data_lock); in ath10k_debug_fw_stats_reset()
245 ar->debug.fw_stats_done = false; in ath10k_debug_fw_stats_reset()
246 ar->debug.fw_stats.extended = false; in ath10k_debug_fw_stats_reset()
247 ath10k_fw_stats_pdevs_free(&ar->debug.fw_stats.pdevs); in ath10k_debug_fw_stats_reset()
248 ath10k_fw_stats_vdevs_free(&ar->debug.fw_stats.vdevs); in ath10k_debug_fw_stats_reset()
249 ath10k_fw_stats_peers_free(&ar->debug.fw_stats.peers); in ath10k_debug_fw_stats_reset()
250 ath10k_fw_extd_stats_peers_free(&ar->debug.fw_stats.peers_extd); in ath10k_debug_fw_stats_reset()
251 spin_unlock_bh(&ar->data_lock); in ath10k_debug_fw_stats_reset()
267 spin_lock_bh(&ar->data_lock); in ath10k_debug_fw_stats_process()
274 /* Stat data may exceed htc-wmi buffer limit. In such case firmware in ath10k_debug_fw_stats_process()
275 * splits the stats data and delivers it in a ping-pong fashion of in ath10k_debug_fw_stats_process()
276 * request cmd-update event. in ath10k_debug_fw_stats_process()
278 * However there is no explicit end-of-data. Instead start-of-data is in ath10k_debug_fw_stats_process()
281 * delivered - this skips session started at end of (b) in ath10k_debug_fw_stats_process()
283 * delivered which is treated as end-of-data and is itself discarded in ath10k_debug_fw_stats_process()
288 if (ar->debug.fw_stats_done) { in ath10k_debug_fw_stats_process()
295 num_peers = ath10k_wmi_fw_stats_num_peers(&ar->debug.fw_stats.peers); in ath10k_debug_fw_stats_process()
296 num_vdevs = ath10k_wmi_fw_stats_num_vdevs(&ar->debug.fw_stats.vdevs); in ath10k_debug_fw_stats_process()
297 is_start = (list_empty(&ar->debug.fw_stats.pdevs) && in ath10k_debug_fw_stats_process()
299 is_end = (!list_empty(&ar->debug.fw_stats.pdevs) && in ath10k_debug_fw_stats_process()
303 list_splice_tail_init(&stats.pdevs, &ar->debug.fw_stats.pdevs); in ath10k_debug_fw_stats_process()
306 ar->debug.fw_stats_done = true; in ath10k_debug_fw_stats_process()
309 ar->debug.fw_stats.extended = true; in ath10k_debug_fw_stats_process()
311 is_started = !list_empty(&ar->debug.fw_stats.pdevs); in ath10k_debug_fw_stats_process()
316 * prevent firmware from DoS-ing the host. in ath10k_debug_fw_stats_process()
318 ath10k_fw_stats_peers_free(&ar->debug.fw_stats.peers); in ath10k_debug_fw_stats_process()
319 ath10k_fw_extd_stats_peers_free(&ar->debug.fw_stats.peers_extd); in ath10k_debug_fw_stats_process()
325 ath10k_fw_stats_vdevs_free(&ar->debug.fw_stats.vdevs); in ath10k_debug_fw_stats_process()
332 &ar->debug.fw_stats.peers_extd); in ath10k_debug_fw_stats_process()
334 list_splice_tail_init(&stats.peers, &ar->debug.fw_stats.peers); in ath10k_debug_fw_stats_process()
335 list_splice_tail_init(&stats.vdevs, &ar->debug.fw_stats.vdevs); in ath10k_debug_fw_stats_process()
338 complete(&ar->debug.fw_stats_complete); in ath10k_debug_fw_stats_process()
349 spin_unlock_bh(&ar->data_lock); in ath10k_debug_fw_stats_process()
357 lockdep_assert_held(&ar->conf_mutex); in ath10k_debug_fw_stats_request()
365 return -ETIMEDOUT; in ath10k_debug_fw_stats_request()
367 reinit_completion(&ar->debug.fw_stats_complete); in ath10k_debug_fw_stats_request()
369 ret = ath10k_wmi_request_stats(ar, ar->fw_stats_req_mask); in ath10k_debug_fw_stats_request()
376 wait_for_completion_timeout(&ar->debug.fw_stats_complete, in ath10k_debug_fw_stats_request()
379 return -ETIMEDOUT; in ath10k_debug_fw_stats_request()
381 spin_lock_bh(&ar->data_lock); in ath10k_debug_fw_stats_request()
382 if (ar->debug.fw_stats_done) { in ath10k_debug_fw_stats_request()
383 spin_unlock_bh(&ar->data_lock); in ath10k_debug_fw_stats_request()
386 spin_unlock_bh(&ar->data_lock); in ath10k_debug_fw_stats_request()
394 struct ath10k *ar = inode->i_private; in ath10k_fw_stats_open()
398 mutex_lock(&ar->conf_mutex); in ath10k_fw_stats_open()
400 if (ar->state != ATH10K_STATE_ON) { in ath10k_fw_stats_open()
401 ret = -ENETDOWN; in ath10k_fw_stats_open()
407 ret = -ENOMEM; in ath10k_fw_stats_open()
417 ret = ath10k_wmi_fw_stats_fill(ar, &ar->debug.fw_stats, buf); in ath10k_fw_stats_open()
423 file->private_data = buf; in ath10k_fw_stats_open()
425 mutex_unlock(&ar->conf_mutex); in ath10k_fw_stats_open()
432 mutex_unlock(&ar->conf_mutex); in ath10k_fw_stats_open()
438 vfree(file->private_data); in ath10k_fw_stats_release()
446 const char *buf = file->private_data; in ath10k_fw_stats_read()
464 struct ath10k *ar = file->private_data; in ath10k_debug_fw_reset_stats_read()
471 return -ENOMEM; in ath10k_debug_fw_reset_stats_read()
473 spin_lock_bh(&ar->data_lock); in ath10k_debug_fw_reset_stats_read()
475 len += scnprintf(buf + len, buf_len - len, in ath10k_debug_fw_reset_stats_read()
476 "fw_crash_counter\t\t%d\n", ar->stats.fw_crash_counter); in ath10k_debug_fw_reset_stats_read()
477 len += scnprintf(buf + len, buf_len - len, in ath10k_debug_fw_reset_stats_read()
479 ar->stats.fw_warm_reset_counter); in ath10k_debug_fw_reset_stats_read()
480 len += scnprintf(buf + len, buf_len - len, in ath10k_debug_fw_reset_stats_read()
482 ar->stats.fw_cold_reset_counter); in ath10k_debug_fw_reset_stats_read()
484 spin_unlock_bh(&ar->data_lock); in ath10k_debug_fw_reset_stats_read()
508 return -ENOMEM; in ath10k_debug_fw_assert()
510 cmd = (struct wmi_vdev_install_key_cmd *)skb->data; in ath10k_debug_fw_assert()
514 cmd->vdev_id = __cpu_to_le32(0x7ffe); in ath10k_debug_fw_assert()
517 ar->wmi.cmd->vdev_install_key_cmdid); in ath10k_debug_fw_assert()
526 "`soft` - this will send WMI_FORCE_FW_HANG_ASSERT to firmware if FW supports that command.\n" in ath10k_read_simulate_fw_crash()
527 "`hard` - this will send to firmware command with illegal parameters causing firmware crash.\n" in ath10k_read_simulate_fw_crash()
528 …"`assert` - this will send special illegal parameter to firmware to cause assert failure and crash… in ath10k_read_simulate_fw_crash()
529 "`hw-restart` - this will simply queue hw restart without fw/hw actually crashing.\n"; in ath10k_read_simulate_fw_crash()
545 struct ath10k *ar = file->private_data; in ath10k_write_simulate_fw_crash()
552 return -EINVAL; in ath10k_write_simulate_fw_crash()
554 rc = simple_write_to_buffer(buf, sizeof(buf) - 1, ppos, user_buf, count); in ath10k_write_simulate_fw_crash()
559 if (buf[*ppos - 1] == '\n') in ath10k_write_simulate_fw_crash()
560 buf[*ppos - 1] = '\0'; in ath10k_write_simulate_fw_crash()
562 mutex_lock(&ar->conf_mutex); in ath10k_write_simulate_fw_crash()
564 if (ar->state != ATH10K_STATE_ON && in ath10k_write_simulate_fw_crash()
565 ar->state != ATH10K_STATE_RESTARTED) { in ath10k_write_simulate_fw_crash()
566 ret = -ENETDOWN; in ath10k_write_simulate_fw_crash()
579 ar->wmi.vdev_param->rts_threshold, in ath10k_write_simulate_fw_crash()
584 } else if (!strcmp(buf, "hw-restart")) { in ath10k_write_simulate_fw_crash()
589 ret = -EINVAL; in ath10k_write_simulate_fw_crash()
601 mutex_unlock(&ar->conf_mutex); in ath10k_write_simulate_fw_crash()
616 struct ath10k *ar = file->private_data; in ath10k_read_chip_id()
620 len = scnprintf(buf, sizeof(buf), "0x%08x\n", ar->bus_param.chip_id); in ath10k_read_chip_id()
636 struct ath10k *ar = file->private_data; in ath10k_reg_addr_read()
641 mutex_lock(&ar->conf_mutex); in ath10k_reg_addr_read()
642 reg_addr = ar->debug.reg_addr; in ath10k_reg_addr_read()
643 mutex_unlock(&ar->conf_mutex); in ath10k_reg_addr_read()
645 len += scnprintf(buf + len, sizeof(buf) - len, "0x%x\n", reg_addr); in ath10k_reg_addr_read()
654 struct ath10k *ar = file->private_data; in ath10k_reg_addr_write()
663 return -EFAULT; in ath10k_reg_addr_write()
665 mutex_lock(&ar->conf_mutex); in ath10k_reg_addr_write()
666 ar->debug.reg_addr = reg_addr; in ath10k_reg_addr_write()
667 mutex_unlock(&ar->conf_mutex); in ath10k_reg_addr_write()
684 struct ath10k *ar = file->private_data; in ath10k_reg_value_read()
690 mutex_lock(&ar->conf_mutex); in ath10k_reg_value_read()
692 if (ar->state != ATH10K_STATE_ON && in ath10k_reg_value_read()
693 ar->state != ATH10K_STATE_UTF) { in ath10k_reg_value_read()
694 ret = -ENETDOWN; in ath10k_reg_value_read()
698 reg_addr = ar->debug.reg_addr; in ath10k_reg_value_read()
706 mutex_unlock(&ar->conf_mutex); in ath10k_reg_value_read()
715 struct ath10k *ar = file->private_data; in ath10k_reg_value_write()
719 mutex_lock(&ar->conf_mutex); in ath10k_reg_value_write()
721 if (ar->state != ATH10K_STATE_ON && in ath10k_reg_value_write()
722 ar->state != ATH10K_STATE_UTF) { in ath10k_reg_value_write()
723 ret = -ENETDOWN; in ath10k_reg_value_write()
727 reg_addr = ar->debug.reg_addr; in ath10k_reg_value_write()
738 mutex_unlock(&ar->conf_mutex); in ath10k_reg_value_write()
755 struct ath10k *ar = file->private_data; in ath10k_mem_value_read()
760 return -EINVAL; in ath10k_mem_value_read()
765 mutex_lock(&ar->conf_mutex); in ath10k_mem_value_read()
769 ret = -ENOMEM; in ath10k_mem_value_read()
773 if (ar->state != ATH10K_STATE_ON && in ath10k_mem_value_read()
774 ar->state != ATH10K_STATE_UTF) { in ath10k_mem_value_read()
775 ret = -ENETDOWN; in ath10k_mem_value_read()
788 ret = -EFAULT; in ath10k_mem_value_read()
792 count -= ret; in ath10k_mem_value_read()
798 mutex_unlock(&ar->conf_mutex); in ath10k_mem_value_read()
807 struct ath10k *ar = file->private_data; in ath10k_mem_value_write()
812 return -EINVAL; in ath10k_mem_value_write()
817 mutex_lock(&ar->conf_mutex); in ath10k_mem_value_write()
821 ret = -ENOMEM; in ath10k_mem_value_write()
825 if (ar->state != ATH10K_STATE_ON && in ath10k_mem_value_write()
826 ar->state != ATH10K_STATE_UTF) { in ath10k_mem_value_write()
827 ret = -ENETDOWN; in ath10k_mem_value_write()
833 ret = -EFAULT; in ath10k_mem_value_write()
849 mutex_unlock(&ar->conf_mutex); in ath10k_mem_value_write()
867 lockdep_assert_held(&ar->conf_mutex); in ath10k_debug_htt_stats_req()
869 if (ar->debug.htt_stats_mask == 0) in ath10k_debug_htt_stats_req()
873 if (ar->state != ATH10K_STATE_ON) in ath10k_debug_htt_stats_req()
878 ret = ath10k_htt_h2t_stats_req(&ar->htt, ar->debug.htt_stats_mask, in ath10k_debug_htt_stats_req()
879 ar->debug.reset_htt_stats, cookie); in ath10k_debug_htt_stats_req()
885 queue_delayed_work(ar->workqueue, &ar->debug.htt_stats_dwork, in ath10k_debug_htt_stats_req()
896 mutex_lock(&ar->conf_mutex); in ath10k_debug_htt_stats_dwork()
900 mutex_unlock(&ar->conf_mutex); in ath10k_debug_htt_stats_dwork()
907 struct ath10k *ar = file->private_data; in ath10k_read_htt_stats_mask()
911 len = scnprintf(buf, sizeof(buf), "%lu\n", ar->debug.htt_stats_mask); in ath10k_read_htt_stats_mask()
920 struct ath10k *ar = file->private_data; in ath10k_write_htt_stats_mask()
930 return -E2BIG; in ath10k_write_htt_stats_mask()
932 mutex_lock(&ar->conf_mutex); in ath10k_write_htt_stats_mask()
934 ar->debug.htt_stats_mask = mask; in ath10k_write_htt_stats_mask()
943 mutex_unlock(&ar->conf_mutex); in ath10k_write_htt_stats_mask()
960 struct ath10k *ar = file->private_data; in ath10k_read_htt_max_amsdu_ampdu()
965 mutex_lock(&ar->conf_mutex); in ath10k_read_htt_max_amsdu_ampdu()
967 amsdu = ar->htt.max_num_amsdu; in ath10k_read_htt_max_amsdu_ampdu()
968 ampdu = ar->htt.max_num_ampdu; in ath10k_read_htt_max_amsdu_ampdu()
969 mutex_unlock(&ar->conf_mutex); in ath10k_read_htt_max_amsdu_ampdu()
980 struct ath10k *ar = file->private_data; in ath10k_write_htt_max_amsdu_ampdu()
985 res = simple_write_to_buffer(buf, sizeof(buf) - 1, ppos, in ath10k_write_htt_max_amsdu_ampdu()
993 return -EINVAL; in ath10k_write_htt_max_amsdu_ampdu()
995 mutex_lock(&ar->conf_mutex); in ath10k_write_htt_max_amsdu_ampdu()
997 res = ath10k_htt_h2t_aggr_cfg_msg(&ar->htt, ampdu, amsdu); in ath10k_write_htt_max_amsdu_ampdu()
1002 ar->htt.max_num_amsdu = amsdu; in ath10k_write_htt_max_amsdu_ampdu()
1003 ar->htt.max_num_ampdu = ampdu; in ath10k_write_htt_max_amsdu_ampdu()
1006 mutex_unlock(&ar->conf_mutex); in ath10k_write_htt_max_amsdu_ampdu()
1022 struct ath10k *ar = file->private_data; in ath10k_read_fw_dbglog()
1027 ar->debug.fw_dbglog_mask, ar->debug.fw_dbglog_level); in ath10k_read_fw_dbglog()
1036 struct ath10k *ar = file->private_data; in ath10k_write_fw_dbglog()
1042 ret = simple_write_to_buffer(buf, sizeof(buf) - 1, ppos, in ath10k_write_fw_dbglog()
1050 return -EINVAL; in ath10k_write_fw_dbglog()
1056 mutex_lock(&ar->conf_mutex); in ath10k_write_fw_dbglog()
1058 ar->debug.fw_dbglog_mask = mask; in ath10k_write_fw_dbglog()
1059 ar->debug.fw_dbglog_level = log_level; in ath10k_write_fw_dbglog()
1061 if (ar->state == ATH10K_STATE_ON) { in ath10k_write_fw_dbglog()
1062 ret = ath10k_wmi_dbglog_cfg(ar, ar->debug.fw_dbglog_mask, in ath10k_write_fw_dbglog()
1063 ar->debug.fw_dbglog_level); in ath10k_write_fw_dbglog()
1074 mutex_unlock(&ar->conf_mutex); in ath10k_write_fw_dbglog()
1159 struct ath10k *ar = hw->priv; in ath10k_debug_get_et_stats()
1164 mutex_lock(&ar->conf_mutex); in ath10k_debug_get_et_stats()
1166 if (ar->state == ATH10K_STATE_ON) { in ath10k_debug_get_et_stats()
1176 pdev_stats = list_first_entry_or_null(&ar->debug.fw_stats.pdevs, in ath10k_debug_get_et_stats()
1184 spin_lock_bh(&ar->data_lock); in ath10k_debug_get_et_stats()
1186 data[i++] = pdev_stats->hw_reaped; /* ppdu reaped */ in ath10k_debug_get_et_stats()
1187 data[i++] = 0; /* tx bytes */ in ath10k_debug_get_et_stats()
1188 data[i++] = pdev_stats->htt_mpdus; in ath10k_debug_get_et_stats()
1190 data[i++] = pdev_stats->ch_noise_floor; in ath10k_debug_get_et_stats()
1191 data[i++] = pdev_stats->cycle_count; in ath10k_debug_get_et_stats()
1192 data[i++] = pdev_stats->phy_err_count; in ath10k_debug_get_et_stats()
1193 data[i++] = pdev_stats->rts_bad; in ath10k_debug_get_et_stats()
1194 data[i++] = pdev_stats->rts_good; in ath10k_debug_get_et_stats()
1195 data[i++] = pdev_stats->chan_tx_power; in ath10k_debug_get_et_stats()
1196 data[i++] = pdev_stats->fcs_bad; in ath10k_debug_get_et_stats()
1197 data[i++] = ar->stats.rx_crc_err_drop; in ath10k_debug_get_et_stats()
1198 data[i++] = pdev_stats->no_beacons; in ath10k_debug_get_et_stats()
1199 data[i++] = pdev_stats->mpdu_enqued; in ath10k_debug_get_et_stats()
1200 data[i++] = pdev_stats->msdu_enqued; in ath10k_debug_get_et_stats()
1201 data[i++] = pdev_stats->wmm_drop; in ath10k_debug_get_et_stats()
1202 data[i++] = pdev_stats->local_enqued; in ath10k_debug_get_et_stats()
1203 data[i++] = pdev_stats->local_freed; in ath10k_debug_get_et_stats()
1204 data[i++] = pdev_stats->hw_queued; in ath10k_debug_get_et_stats()
1205 data[i++] = pdev_stats->hw_reaped; in ath10k_debug_get_et_stats()
1206 data[i++] = pdev_stats->underrun; in ath10k_debug_get_et_stats()
1207 data[i++] = pdev_stats->tx_abort; in ath10k_debug_get_et_stats()
1208 data[i++] = pdev_stats->mpdus_requeued; in ath10k_debug_get_et_stats()
1209 data[i++] = pdev_stats->tx_ko; in ath10k_debug_get_et_stats()
1210 data[i++] = pdev_stats->data_rc; in ath10k_debug_get_et_stats()
1211 data[i++] = pdev_stats->sw_retry_failure; in ath10k_debug_get_et_stats()
1212 data[i++] = pdev_stats->illgl_rate_phy_err; in ath10k_debug_get_et_stats()
1213 data[i++] = pdev_stats->pdev_cont_xretry; in ath10k_debug_get_et_stats()
1214 data[i++] = pdev_stats->pdev_tx_timeout; in ath10k_debug_get_et_stats()
1215 data[i++] = pdev_stats->txop_ovf; in ath10k_debug_get_et_stats()
1216 data[i++] = pdev_stats->pdev_resets; in ath10k_debug_get_et_stats()
1217 data[i++] = pdev_stats->mid_ppdu_route_change; in ath10k_debug_get_et_stats()
1218 data[i++] = pdev_stats->status_rcvd; in ath10k_debug_get_et_stats()
1219 data[i++] = pdev_stats->r0_frags; in ath10k_debug_get_et_stats()
1220 data[i++] = pdev_stats->r1_frags; in ath10k_debug_get_et_stats()
1221 data[i++] = pdev_stats->r2_frags; in ath10k_debug_get_et_stats()
1222 data[i++] = pdev_stats->r3_frags; in ath10k_debug_get_et_stats()
1223 data[i++] = pdev_stats->htt_msdus; in ath10k_debug_get_et_stats()
1224 data[i++] = pdev_stats->htt_mpdus; in ath10k_debug_get_et_stats()
1225 data[i++] = pdev_stats->loc_msdus; in ath10k_debug_get_et_stats()
1226 data[i++] = pdev_stats->loc_mpdus; in ath10k_debug_get_et_stats()
1227 data[i++] = pdev_stats->phy_errs; in ath10k_debug_get_et_stats()
1228 data[i++] = pdev_stats->phy_err_drop; in ath10k_debug_get_et_stats()
1229 data[i++] = pdev_stats->mpdu_errs; in ath10k_debug_get_et_stats()
1230 data[i++] = ar->stats.fw_crash_counter; in ath10k_debug_get_et_stats()
1231 data[i++] = ar->stats.fw_warm_reset_counter; in ath10k_debug_get_et_stats()
1232 data[i++] = ar->stats.fw_cold_reset_counter; in ath10k_debug_get_et_stats()
1234 spin_unlock_bh(&ar->data_lock); in ath10k_debug_get_et_stats()
1236 mutex_unlock(&ar->conf_mutex); in ath10k_debug_get_et_stats()
1255 lockdep_assert_held(&ar->conf_mutex); in ath10k_debug_cal_data_fetch()
1257 if (WARN_ON(ar->hw_params.cal_data_len > ATH10K_DEBUG_CAL_DATA_LEN)) in ath10k_debug_cal_data_fetch()
1258 return -EINVAL; in ath10k_debug_cal_data_fetch()
1260 if (ar->hw_params.cal_data_len == 0) in ath10k_debug_cal_data_fetch()
1261 return -EOPNOTSUPP; in ath10k_debug_cal_data_fetch()
1272 ret = ath10k_hif_diag_read(ar, le32_to_cpu(addr), ar->debug.cal_data, in ath10k_debug_cal_data_fetch()
1273 ar->hw_params.cal_data_len); in ath10k_debug_cal_data_fetch()
1284 struct ath10k *ar = inode->i_private; in ath10k_debug_cal_data_open()
1286 mutex_lock(&ar->conf_mutex); in ath10k_debug_cal_data_open()
1288 if (ar->state == ATH10K_STATE_ON || in ath10k_debug_cal_data_open()
1289 ar->state == ATH10K_STATE_UTF) { in ath10k_debug_cal_data_open()
1293 file->private_data = ar; in ath10k_debug_cal_data_open()
1294 mutex_unlock(&ar->conf_mutex); in ath10k_debug_cal_data_open()
1303 struct ath10k *ar = file->private_data; in ath10k_debug_cal_data_read()
1305 mutex_lock(&ar->conf_mutex); in ath10k_debug_cal_data_read()
1308 ar->debug.cal_data, in ath10k_debug_cal_data_read()
1309 ar->hw_params.cal_data_len); in ath10k_debug_cal_data_read()
1311 mutex_unlock(&ar->conf_mutex); in ath10k_debug_cal_data_read()
1320 struct ath10k *ar = file->private_data; in ath10k_write_ani_enable()
1325 return -EINVAL; in ath10k_write_ani_enable()
1327 mutex_lock(&ar->conf_mutex); in ath10k_write_ani_enable()
1329 if (ar->ani_enabled == enable) { in ath10k_write_ani_enable()
1334 ret = ath10k_wmi_pdev_set_param(ar, ar->wmi.pdev_param->ani_enable, in ath10k_write_ani_enable()
1340 ar->ani_enabled = enable; in ath10k_write_ani_enable()
1345 mutex_unlock(&ar->conf_mutex); in ath10k_write_ani_enable()
1353 struct ath10k *ar = file->private_data; in ath10k_read_ani_enable()
1357 len = scnprintf(buf, sizeof(buf), "%d\n", ar->ani_enabled); in ath10k_read_ani_enable()
1381 struct ath10k *ar = file->private_data; in ath10k_read_nf_cal_period()
1385 len = scnprintf(buf, sizeof(buf), "%d\n", ar->debug.nf_cal_period); in ath10k_read_nf_cal_period()
1394 struct ath10k *ar = file->private_data; in ath10k_write_nf_cal_period()
1403 return -EINVAL; in ath10k_write_nf_cal_period()
1407 return -EINVAL; in ath10k_write_nf_cal_period()
1409 mutex_lock(&ar->conf_mutex); in ath10k_write_nf_cal_period()
1411 ar->debug.nf_cal_period = period; in ath10k_write_nf_cal_period()
1413 if (ar->state != ATH10K_STATE_ON) { in ath10k_write_nf_cal_period()
1419 ret = ath10k_wmi_pdev_set_param(ar, ar->wmi.pdev_param->cal_period, in ath10k_write_nf_cal_period()
1420 ar->debug.nf_cal_period); in ath10k_write_nf_cal_period()
1430 mutex_unlock(&ar->conf_mutex); in ath10k_write_nf_cal_period()
1450 lockdep_assert_held(&ar->conf_mutex); in ath10k_debug_tpc_stats_request()
1452 reinit_completion(&ar->debug.tpc_complete); in ath10k_debug_tpc_stats_request()
1460 time_left = wait_for_completion_timeout(&ar->debug.tpc_complete, in ath10k_debug_tpc_stats_request()
1463 return -ETIMEDOUT; in ath10k_debug_tpc_stats_request()
1471 spin_lock_bh(&ar->data_lock); in ath10k_debug_tpc_stats_process()
1473 kfree(ar->debug.tpc_stats); in ath10k_debug_tpc_stats_process()
1474 ar->debug.tpc_stats = tpc_stats; in ath10k_debug_tpc_stats_process()
1475 complete(&ar->debug.tpc_complete); in ath10k_debug_tpc_stats_process()
1477 spin_unlock_bh(&ar->data_lock); in ath10k_debug_tpc_stats_process()
1484 spin_lock_bh(&ar->data_lock); in ath10k_debug_tpc_stats_final_process()
1486 kfree(ar->debug.tpc_stats_final); in ath10k_debug_tpc_stats_final_process()
1487 ar->debug.tpc_stats_final = tpc_stats; in ath10k_debug_tpc_stats_final_process()
1488 complete(&ar->debug.tpc_complete); in ath10k_debug_tpc_stats_final_process()
1490 spin_unlock_bh(&ar->data_lock); in ath10k_debug_tpc_stats_final_process()
1511 *len += scnprintf(buf + *len, buf_len - *len, in ath10k_tpc_stats_print()
1513 *len += scnprintf(buf + *len, buf_len - *len, in ath10k_tpc_stats_print()
1516 *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()
1521 for (i = 0; i < tpc_stats->num_tx_chain; i++) in ath10k_tpc_stats_print()
1522 *len += scnprintf(buf + *len, buf_len - *len, in ath10k_tpc_stats_print()
1525 *len += scnprintf(buf + *len, buf_len - *len, "\n"); in ath10k_tpc_stats_print()
1527 for (i = 0; i < tpc_stats->rate_max; i++) { in ath10k_tpc_stats_print()
1528 *len += scnprintf(buf + *len, buf_len - *len, in ath10k_tpc_stats_print()
1530 pream_str[tpc_stats->tpc_table[j].pream_idx[i]], in ath10k_tpc_stats_print()
1531 tpc_stats->tpc_table[j].rate_code[i], in ath10k_tpc_stats_print()
1532 tpc_stats->tpc_table[j].tpc_value[i]); in ath10k_tpc_stats_print()
1535 *len += scnprintf(buf + *len, buf_len - *len, in ath10k_tpc_stats_print()
1549 spin_lock_bh(&ar->data_lock); in ath10k_tpc_stats_fill()
1556 len += scnprintf(buf + len, buf_len - len, "\n"); in ath10k_tpc_stats_fill()
1557 len += scnprintf(buf + len, buf_len - len, in ath10k_tpc_stats_fill()
1559 len += scnprintf(buf + len, buf_len - len, in ath10k_tpc_stats_fill()
1561 tpc_stats->chan_freq, in ath10k_tpc_stats_fill()
1562 tpc_stats->phy_mode); in ath10k_tpc_stats_fill()
1563 len += scnprintf(buf + len, buf_len - len, in ath10k_tpc_stats_fill()
1565 len += scnprintf(buf + len, buf_len - len, in ath10k_tpc_stats_fill()
1567 tpc_stats->ctl, in ath10k_tpc_stats_fill()
1568 tpc_stats->reg_domain); in ath10k_tpc_stats_fill()
1569 len += scnprintf(buf + len, buf_len - len, in ath10k_tpc_stats_fill()
1571 tpc_stats->twice_antenna_gain, in ath10k_tpc_stats_fill()
1572 tpc_stats->twice_antenna_reduction); in ath10k_tpc_stats_fill()
1573 len += scnprintf(buf + len, buf_len - len, in ath10k_tpc_stats_fill()
1575 tpc_stats->power_limit, in ath10k_tpc_stats_fill()
1576 tpc_stats->twice_max_rd_power / 2); in ath10k_tpc_stats_fill()
1577 len += scnprintf(buf + len, buf_len - len, in ath10k_tpc_stats_fill()
1578 "Num tx chains = %2d Num supported rates = %2d\n", in ath10k_tpc_stats_fill()
1579 tpc_stats->num_tx_chain, in ath10k_tpc_stats_fill()
1580 tpc_stats->rate_max); in ath10k_tpc_stats_fill()
1585 if (tpc_stats->flag[j] == ATH10K_TPC_TABLE_TYPE_FLAG) { in ath10k_tpc_stats_fill()
1586 len += scnprintf(buf + len, buf_len - len, in ath10k_tpc_stats_fill()
1594 if (tpc_stats->flag[j] == ATH10K_TPC_TABLE_TYPE_FLAG) { in ath10k_tpc_stats_fill()
1595 len += scnprintf(buf + len, buf_len - len, in ath10k_tpc_stats_fill()
1603 if (tpc_stats->flag[j] == ATH10K_TPC_TABLE_TYPE_FLAG) { in ath10k_tpc_stats_fill()
1604 len += scnprintf(buf + len, buf_len - len, in ath10k_tpc_stats_fill()
1612 len += scnprintf(buf + len, buf_len - len, in ath10k_tpc_stats_fill()
1619 spin_unlock_bh(&ar->data_lock); in ath10k_tpc_stats_fill()
1622 buf[len - 1] = 0; in ath10k_tpc_stats_fill()
1629 struct ath10k *ar = inode->i_private; in ath10k_tpc_stats_open()
1633 mutex_lock(&ar->conf_mutex); in ath10k_tpc_stats_open()
1635 if (ar->state != ATH10K_STATE_ON) { in ath10k_tpc_stats_open()
1636 ret = -ENETDOWN; in ath10k_tpc_stats_open()
1642 ret = -ENOMEM; in ath10k_tpc_stats_open()
1653 ath10k_tpc_stats_fill(ar, ar->debug.tpc_stats, buf); in ath10k_tpc_stats_open()
1654 file->private_data = buf; in ath10k_tpc_stats_open()
1656 mutex_unlock(&ar->conf_mutex); in ath10k_tpc_stats_open()
1663 mutex_unlock(&ar->conf_mutex); in ath10k_tpc_stats_open()
1669 vfree(file->private_data); in ath10k_tpc_stats_release()
1677 const char *buf = file->private_data; in ath10k_tpc_stats_read()
1695 lockdep_assert_held(&ar->conf_mutex); in ath10k_debug_start()
1703 if (ar->debug.fw_dbglog_mask) { in ath10k_debug_start()
1704 ret = ath10k_wmi_dbglog_cfg(ar, ar->debug.fw_dbglog_mask, in ath10k_debug_start()
1712 if (ar->pktlog_filter) { in ath10k_debug_start()
1714 ar->pktlog_filter); in ath10k_debug_start()
1719 ar->pktlog_filter, ret); in ath10k_debug_start()
1727 if (ar->debug.nf_cal_period && in ath10k_debug_start()
1729 ar->normal_mode_fw.fw_file.fw_features)) { in ath10k_debug_start()
1731 ar->wmi.pdev_param->cal_period, in ath10k_debug_start()
1732 ar->debug.nf_cal_period); in ath10k_debug_start()
1744 lockdep_assert_held(&ar->conf_mutex); in ath10k_debug_stop()
1747 ar->normal_mode_fw.fw_file.fw_features)) in ath10k_debug_stop()
1754 if (ar->debug.htt_stats_mask != 0) in ath10k_debug_stop()
1755 cancel_delayed_work(&ar->debug.htt_stats_dwork); in ath10k_debug_stop()
1764 struct ath10k *ar = file->private_data; in ath10k_write_simulate_radar()
1771 arvif = list_first_entry(&ar->arvifs, typeof(*arvif), list); in ath10k_write_simulate_radar()
1772 if (!arvif->is_started) in ath10k_write_simulate_radar()
1773 return -EINVAL; in ath10k_write_simulate_radar()
1775 ieee80211_radar_detected(ar->hw); in ath10k_write_simulate_radar()
1788 len += scnprintf(buf + len, size - len, "%-28s : %10u\n", s, \
1789 ar->debug.dfs_stats.p))
1792 len += scnprintf(buf + len, size - len, "%-28s : %10u\n", s, \
1793 ar->debug.dfs_pool_stats.p))
1800 struct ath10k *ar = file->private_data; in ath10k_read_dfs_stats()
1805 return -ENOMEM; in ath10k_read_dfs_stats()
1807 if (!ar->dfs_detector) { in ath10k_read_dfs_stats()
1808 len += scnprintf(buf + len, size - len, "DFS not enabled\n"); in ath10k_read_dfs_stats()
1812 ar->debug.dfs_pool_stats = in ath10k_read_dfs_stats()
1813 ar->dfs_detector->get_stats(ar->dfs_detector); in ath10k_read_dfs_stats()
1815 len += scnprintf(buf + len, size - len, "Pulse detector statistics:\n"); in ath10k_read_dfs_stats()
1823 len += scnprintf(buf + len, size - len, "Global Pool statistics:\n"); in ath10k_read_dfs_stats()
1853 struct ath10k *ar = file->private_data; in ath10k_write_pktlog_filter()
1858 return -EINVAL; in ath10k_write_pktlog_filter()
1860 mutex_lock(&ar->conf_mutex); in ath10k_write_pktlog_filter()
1862 if (ar->state != ATH10K_STATE_ON) { in ath10k_write_pktlog_filter()
1863 ar->pktlog_filter = filter; in ath10k_write_pktlog_filter()
1868 if (filter == ar->pktlog_filter) { in ath10k_write_pktlog_filter()
1877 ar->pktlog_filter, ret); in ath10k_write_pktlog_filter()
1888 ar->pktlog_filter = filter; in ath10k_write_pktlog_filter()
1892 mutex_unlock(&ar->conf_mutex); in ath10k_write_pktlog_filter()
1900 struct ath10k *ar = file->private_data; in ath10k_read_pktlog_filter()
1903 mutex_lock(&ar->conf_mutex); in ath10k_read_pktlog_filter()
1904 len = scnprintf(buf, sizeof(buf) - len, "%08x\n", in ath10k_read_pktlog_filter()
1905 ar->pktlog_filter); in ath10k_read_pktlog_filter()
1906 mutex_unlock(&ar->conf_mutex); in ath10k_read_pktlog_filter()
1921 struct ath10k *ar = file->private_data; in ath10k_write_quiet_period()
1925 return -EINVAL; in ath10k_write_quiet_period()
1930 return -EINVAL; in ath10k_write_quiet_period()
1932 mutex_lock(&ar->conf_mutex); in ath10k_write_quiet_period()
1933 ar->thermal.quiet_period = period; in ath10k_write_quiet_period()
1935 mutex_unlock(&ar->conf_mutex); in ath10k_write_quiet_period()
1944 struct ath10k *ar = file->private_data; in ath10k_read_quiet_period()
1947 mutex_lock(&ar->conf_mutex); in ath10k_read_quiet_period()
1948 len = scnprintf(buf, sizeof(buf) - len, "%d\n", in ath10k_read_quiet_period()
1949 ar->thermal.quiet_period); in ath10k_read_quiet_period()
1950 mutex_unlock(&ar->conf_mutex); in ath10k_read_quiet_period()
1965 struct ath10k *ar = file->private_data; in ath10k_write_btcoex()
1972 buf_size = min(count, (sizeof(buf) - 1)); in ath10k_write_btcoex()
1974 return -EFAULT; in ath10k_write_btcoex()
1979 return -EINVAL; in ath10k_write_btcoex()
1981 if (!ar->coex_support) in ath10k_write_btcoex()
1982 return -EOPNOTSUPP; in ath10k_write_btcoex()
1984 mutex_lock(&ar->conf_mutex); in ath10k_write_btcoex()
1986 if (ar->state != ATH10K_STATE_ON && in ath10k_write_btcoex()
1987 ar->state != ATH10K_STATE_RESTARTED) { in ath10k_write_btcoex()
1988 ret = -ENETDOWN; in ath10k_write_btcoex()
1992 if (!(test_bit(ATH10K_FLAG_BTCOEX, &ar->dev_flags) ^ val)) { in ath10k_write_btcoex()
1997 pdev_param = ar->wmi.pdev_param->enable_btcoex; in ath10k_write_btcoex()
1999 ar->running_fw->fw_file.fw_features)) { in ath10k_write_btcoex()
2012 set_bit(ATH10K_FLAG_BTCOEX, &ar->dev_flags); in ath10k_write_btcoex()
2014 clear_bit(ATH10K_FLAG_BTCOEX, &ar->dev_flags); in ath10k_write_btcoex()
2019 mutex_unlock(&ar->conf_mutex); in ath10k_write_btcoex()
2028 struct ath10k *ar = file->private_data; in ath10k_read_btcoex()
2031 mutex_lock(&ar->conf_mutex); in ath10k_read_btcoex()
2032 len = scnprintf(buf, sizeof(buf) - len, "%d\n", in ath10k_read_btcoex()
2033 test_bit(ATH10K_FLAG_BTCOEX, &ar->dev_flags)); in ath10k_read_btcoex()
2034 mutex_unlock(&ar->conf_mutex); in ath10k_read_btcoex()
2049 struct ath10k *ar = file->private_data; in ath10k_write_enable_extd_tx_stats()
2054 return -EINVAL; in ath10k_write_enable_extd_tx_stats()
2056 mutex_lock(&ar->conf_mutex); in ath10k_write_enable_extd_tx_stats()
2058 if (ar->state != ATH10K_STATE_ON) { in ath10k_write_enable_extd_tx_stats()
2059 ar->debug.enable_extd_tx_stats = filter; in ath10k_write_enable_extd_tx_stats()
2064 if (filter == ar->debug.enable_extd_tx_stats) { in ath10k_write_enable_extd_tx_stats()
2069 ar->debug.enable_extd_tx_stats = filter; in ath10k_write_enable_extd_tx_stats()
2073 mutex_unlock(&ar->conf_mutex); in ath10k_write_enable_extd_tx_stats()
2083 struct ath10k *ar = file->private_data; in ath10k_read_enable_extd_tx_stats()
2086 mutex_lock(&ar->conf_mutex); in ath10k_read_enable_extd_tx_stats()
2087 len = scnprintf(buf, sizeof(buf) - len, "%08x\n", in ath10k_read_enable_extd_tx_stats()
2088 ar->debug.enable_extd_tx_stats); in ath10k_read_enable_extd_tx_stats()
2089 mutex_unlock(&ar->conf_mutex); in ath10k_read_enable_extd_tx_stats()
2104 struct ath10k *ar = file->private_data; in ath10k_write_peer_stats()
2110 buf_size = min(count, (sizeof(buf) - 1)); in ath10k_write_peer_stats()
2112 return -EFAULT; in ath10k_write_peer_stats()
2117 return -EINVAL; in ath10k_write_peer_stats()
2119 mutex_lock(&ar->conf_mutex); in ath10k_write_peer_stats()
2121 if (ar->state != ATH10K_STATE_ON && in ath10k_write_peer_stats()
2122 ar->state != ATH10K_STATE_RESTARTED) { in ath10k_write_peer_stats()
2123 ret = -ENETDOWN; in ath10k_write_peer_stats()
2127 if (!(test_bit(ATH10K_FLAG_PEER_STATS, &ar->dev_flags) ^ val)) { in ath10k_write_peer_stats()
2133 set_bit(ATH10K_FLAG_PEER_STATS, &ar->dev_flags); in ath10k_write_peer_stats()
2135 clear_bit(ATH10K_FLAG_PEER_STATS, &ar->dev_flags); in ath10k_write_peer_stats()
2143 mutex_unlock(&ar->conf_mutex); in ath10k_write_peer_stats()
2152 struct ath10k *ar = file->private_data; in ath10k_read_peer_stats()
2155 mutex_lock(&ar->conf_mutex); in ath10k_read_peer_stats()
2156 len = scnprintf(buf, sizeof(buf) - len, "%d\n", in ath10k_read_peer_stats()
2157 test_bit(ATH10K_FLAG_PEER_STATS, &ar->dev_flags)); in ath10k_read_peer_stats()
2158 mutex_unlock(&ar->conf_mutex); in ath10k_read_peer_stats()
2173 struct ath10k *ar = file->private_data; in ath10k_debug_fw_checksums_read()
2180 return -ENOMEM; in ath10k_debug_fw_checksums_read()
2182 mutex_lock(&ar->conf_mutex); in ath10k_debug_fw_checksums_read()
2184 len += scnprintf(buf + len, buf_len - len, in ath10k_debug_fw_checksums_read()
2185 "firmware-N.bin\t\t%08x\n", in ath10k_debug_fw_checksums_read()
2186 crc32_le(0, ar->normal_mode_fw.fw_file.firmware->data, in ath10k_debug_fw_checksums_read()
2187 ar->normal_mode_fw.fw_file.firmware->size)); in ath10k_debug_fw_checksums_read()
2188 len += scnprintf(buf + len, buf_len - len, in ath10k_debug_fw_checksums_read()
2190 crc32_le(0, ar->normal_mode_fw.fw_file.firmware_data, in ath10k_debug_fw_checksums_read()
2191 ar->normal_mode_fw.fw_file.firmware_len)); 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.fw_file.otp_data, in ath10k_debug_fw_checksums_read()
2195 ar->normal_mode_fw.fw_file.otp_len)); in ath10k_debug_fw_checksums_read()
2196 len += scnprintf(buf + len, buf_len - len, in ath10k_debug_fw_checksums_read()
2198 crc32_le(0, ar->normal_mode_fw.fw_file.codeswap_data, in ath10k_debug_fw_checksums_read()
2199 ar->normal_mode_fw.fw_file.codeswap_len)); in ath10k_debug_fw_checksums_read()
2200 len += scnprintf(buf + len, buf_len - len, in ath10k_debug_fw_checksums_read()
2201 "board-N.bin\t\t%08x\n", in ath10k_debug_fw_checksums_read()
2202 crc32_le(0, ar->normal_mode_fw.board->data, in ath10k_debug_fw_checksums_read()
2203 ar->normal_mode_fw.board->size)); in ath10k_debug_fw_checksums_read()
2204 len += scnprintf(buf + len, buf_len - len, in ath10k_debug_fw_checksums_read()
2206 crc32_le(0, ar->normal_mode_fw.board_data, in ath10k_debug_fw_checksums_read()
2207 ar->normal_mode_fw.board_len)); in ath10k_debug_fw_checksums_read()
2211 mutex_unlock(&ar->conf_mutex); in ath10k_debug_fw_checksums_read()
2228 struct ath10k *ar = file->private_data; in ath10k_sta_tid_stats_mask_read()
2232 len = scnprintf(buf, sizeof(buf), "0x%08x\n", ar->sta_tid_stats_mask); in ath10k_sta_tid_stats_mask_read()
2240 struct ath10k *ar = file->private_data; in ath10k_sta_tid_stats_mask_write()
2245 len = min(count, sizeof(buf) - 1); in ath10k_sta_tid_stats_mask_write()
2247 return -EFAULT; in ath10k_sta_tid_stats_mask_write()
2251 return -EINVAL; in ath10k_sta_tid_stats_mask_write()
2253 ar->sta_tid_stats_mask = mask; in ath10k_sta_tid_stats_mask_write()
2271 lockdep_assert_held(&ar->conf_mutex); in ath10k_debug_tpc_stats_final_request()
2273 reinit_completion(&ar->debug.tpc_complete); in ath10k_debug_tpc_stats_final_request()
2281 time_left = wait_for_completion_timeout(&ar->debug.tpc_complete, in ath10k_debug_tpc_stats_final_request()
2284 return -ETIMEDOUT; in ath10k_debug_tpc_stats_final_request()
2291 struct ath10k *ar = inode->i_private; in ath10k_tpc_stats_final_open()
2295 mutex_lock(&ar->conf_mutex); in ath10k_tpc_stats_final_open()
2297 if (ar->state != ATH10K_STATE_ON) { in ath10k_tpc_stats_final_open()
2298 ret = -ENETDOWN; in ath10k_tpc_stats_final_open()
2304 ret = -ENOMEM; in ath10k_tpc_stats_final_open()
2315 ath10k_tpc_stats_fill(ar, ar->debug.tpc_stats, buf); in ath10k_tpc_stats_final_open()
2316 file->private_data = buf; in ath10k_tpc_stats_final_open()
2318 mutex_unlock(&ar->conf_mutex); in ath10k_tpc_stats_final_open()
2325 mutex_unlock(&ar->conf_mutex); in ath10k_tpc_stats_final_open()
2332 vfree(file->private_data); in ath10k_tpc_stats_final_release()
2341 const char *buf = file->private_data; in ath10k_tpc_stats_final_read()
2359 struct ath10k *ar = file->private_data; in ath10k_write_warm_hw_reset()
2364 return -EFAULT; in ath10k_write_warm_hw_reset()
2367 return -EINVAL; in ath10k_write_warm_hw_reset()
2369 mutex_lock(&ar->conf_mutex); in ath10k_write_warm_hw_reset()
2371 if (ar->state != ATH10K_STATE_ON) { in ath10k_write_warm_hw_reset()
2372 ret = -ENETDOWN; in ath10k_write_warm_hw_reset()
2376 ret = ath10k_wmi_pdev_set_param(ar, ar->wmi.pdev_param->pdev_reset, in ath10k_write_warm_hw_reset()
2387 mutex_unlock(&ar->conf_mutex); in ath10k_write_warm_hw_reset()
2402 struct ath10k_sta *arsta = (struct ath10k_sta *)sta->drv_priv; in ath10k_peer_ps_state_disable()
2404 spin_lock_bh(&ar->data_lock); in ath10k_peer_ps_state_disable()
2405 arsta->peer_ps_state = WMI_PEER_PS_STATE_DISABLED; in ath10k_peer_ps_state_disable()
2406 spin_unlock_bh(&ar->data_lock); in ath10k_peer_ps_state_disable()
2413 struct ath10k *ar = file->private_data; in ath10k_write_ps_state_enable()
2419 return -EINVAL; in ath10k_write_ps_state_enable()
2422 return -EINVAL; in ath10k_write_ps_state_enable()
2424 mutex_lock(&ar->conf_mutex); in ath10k_write_ps_state_enable()
2426 if (ar->ps_state_enable == ps_state_enable) { in ath10k_write_ps_state_enable()
2431 param = ar->wmi.pdev_param->peer_sta_ps_statechg_enable; in ath10k_write_ps_state_enable()
2438 ar->ps_state_enable = ps_state_enable; in ath10k_write_ps_state_enable()
2440 if (!ar->ps_state_enable) in ath10k_write_ps_state_enable()
2441 ieee80211_iterate_stations_atomic(ar->hw, in ath10k_write_ps_state_enable()
2448 mutex_unlock(&ar->conf_mutex); in ath10k_write_ps_state_enable()
2457 struct ath10k *ar = file->private_data; in ath10k_read_ps_state_enable()
2461 mutex_lock(&ar->conf_mutex); in ath10k_read_ps_state_enable()
2462 len = scnprintf(buf, sizeof(buf) - len, "%d\n", in ath10k_read_ps_state_enable()
2463 ar->ps_state_enable); in ath10k_read_ps_state_enable()
2464 mutex_unlock(&ar->conf_mutex); in ath10k_read_ps_state_enable()
2481 struct ath10k *ar = file->private_data; in ath10k_write_reset_htt_stats()
2490 return -EINVAL; in ath10k_write_reset_htt_stats()
2492 mutex_lock(&ar->conf_mutex); in ath10k_write_reset_htt_stats()
2494 ar->debug.reset_htt_stats = reset; in ath10k_write_reset_htt_stats()
2500 ar->debug.reset_htt_stats = 0; in ath10k_write_reset_htt_stats()
2504 mutex_unlock(&ar->conf_mutex); in ath10k_write_reset_htt_stats()
2517 ar->debug.cal_data = vzalloc(ATH10K_DEBUG_CAL_DATA_LEN); in ath10k_debug_create()
2518 if (!ar->debug.cal_data) in ath10k_debug_create()
2519 return -ENOMEM; in ath10k_debug_create()
2521 INIT_LIST_HEAD(&ar->debug.fw_stats.pdevs); in ath10k_debug_create()
2522 INIT_LIST_HEAD(&ar->debug.fw_stats.vdevs); in ath10k_debug_create()
2523 INIT_LIST_HEAD(&ar->debug.fw_stats.peers); in ath10k_debug_create()
2524 INIT_LIST_HEAD(&ar->debug.fw_stats.peers_extd); in ath10k_debug_create()
2531 vfree(ar->debug.cal_data); in ath10k_debug_destroy()
2532 ar->debug.cal_data = NULL; in ath10k_debug_destroy()
2536 kfree(ar->debug.tpc_stats); in ath10k_debug_destroy()
2537 kfree(ar->debug.tpc_stats_final); in ath10k_debug_destroy()
2542 ar->debug.debugfs_phy = debugfs_create_dir("ath10k", in ath10k_debug_register()
2543 ar->hw->wiphy->debugfsdir); in ath10k_debug_register()
2544 if (IS_ERR_OR_NULL(ar->debug.debugfs_phy)) { in ath10k_debug_register()
2545 if (IS_ERR(ar->debug.debugfs_phy)) in ath10k_debug_register()
2546 return PTR_ERR(ar->debug.debugfs_phy); in ath10k_debug_register()
2548 return -ENOMEM; in ath10k_debug_register()
2551 INIT_DELAYED_WORK(&ar->debug.htt_stats_dwork, in ath10k_debug_register()
2554 init_completion(&ar->debug.tpc_complete); in ath10k_debug_register()
2555 init_completion(&ar->debug.fw_stats_complete); in ath10k_debug_register()
2557 debugfs_create_file("fw_stats", 0400, ar->debug.debugfs_phy, ar, in ath10k_debug_register()
2560 debugfs_create_file("fw_reset_stats", 0400, ar->debug.debugfs_phy, ar, in ath10k_debug_register()
2563 debugfs_create_file("wmi_services", 0400, ar->debug.debugfs_phy, ar, in ath10k_debug_register()
2566 debugfs_create_file("simulate_fw_crash", 0600, ar->debug.debugfs_phy, ar, in ath10k_debug_register()
2569 debugfs_create_file("reg_addr", 0600, ar->debug.debugfs_phy, ar, in ath10k_debug_register()
2572 debugfs_create_file("reg_value", 0600, ar->debug.debugfs_phy, ar, in ath10k_debug_register()
2575 debugfs_create_file("mem_value", 0600, ar->debug.debugfs_phy, ar, in ath10k_debug_register()
2578 debugfs_create_file("chip_id", 0400, ar->debug.debugfs_phy, ar, in ath10k_debug_register()
2581 debugfs_create_file("htt_stats_mask", 0600, ar->debug.debugfs_phy, ar, in ath10k_debug_register()
2584 debugfs_create_file("htt_max_amsdu_ampdu", 0600, ar->debug.debugfs_phy, ar, in ath10k_debug_register()
2587 debugfs_create_file("fw_dbglog", 0600, ar->debug.debugfs_phy, ar, in ath10k_debug_register()
2591 ar->normal_mode_fw.fw_file.fw_features)) { in ath10k_debug_register()
2592 debugfs_create_file("cal_data", 0400, ar->debug.debugfs_phy, ar, in ath10k_debug_register()
2595 debugfs_create_file("nf_cal_period", 0600, ar->debug.debugfs_phy, ar, in ath10k_debug_register()
2599 debugfs_create_file("ani_enable", 0600, ar->debug.debugfs_phy, ar, in ath10k_debug_register()
2603 debugfs_create_file("dfs_simulate_radar", 0200, ar->debug.debugfs_phy, in ath10k_debug_register()
2607 ar->debug.debugfs_phy, in ath10k_debug_register()
2608 &ar->dfs_block_radar_events); in ath10k_debug_register()
2610 debugfs_create_file("dfs_stats", 0400, ar->debug.debugfs_phy, ar, in ath10k_debug_register()
2614 debugfs_create_file("pktlog_filter", 0644, ar->debug.debugfs_phy, ar, in ath10k_debug_register()
2617 if (test_bit(WMI_SERVICE_THERM_THROT, ar->wmi.svc_map)) in ath10k_debug_register()
2618 debugfs_create_file("quiet_period", 0644, ar->debug.debugfs_phy, ar, in ath10k_debug_register()
2621 debugfs_create_file("tpc_stats", 0400, ar->debug.debugfs_phy, ar, in ath10k_debug_register()
2624 if (test_bit(WMI_SERVICE_COEX_GPIO, ar->wmi.svc_map)) in ath10k_debug_register()
2625 debugfs_create_file("btcoex", 0644, ar->debug.debugfs_phy, ar, in ath10k_debug_register()
2628 if (test_bit(WMI_SERVICE_PEER_STATS, ar->wmi.svc_map)) { in ath10k_debug_register()
2629 debugfs_create_file("peer_stats", 0644, ar->debug.debugfs_phy, ar, in ath10k_debug_register()
2633 ar->debug.debugfs_phy, ar, in ath10k_debug_register()
2637 debugfs_create_file("fw_checksums", 0400, ar->debug.debugfs_phy, ar, in ath10k_debug_register()
2642 ar->debug.debugfs_phy, in ath10k_debug_register()
2645 if (test_bit(WMI_SERVICE_TPC_STATS_FINAL, ar->wmi.svc_map)) in ath10k_debug_register()
2647 ar->debug.debugfs_phy, ar, in ath10k_debug_register()
2650 if (test_bit(WMI_SERVICE_RESET_CHIP, ar->wmi.svc_map)) in ath10k_debug_register()
2652 ar->debug.debugfs_phy, ar, in ath10k_debug_register()
2655 debugfs_create_file("ps_state_enable", 0600, ar->debug.debugfs_phy, ar, in ath10k_debug_register()
2658 debugfs_create_file("reset_htt_stats", 0200, ar->debug.debugfs_phy, ar, in ath10k_debug_register()
2666 cancel_delayed_work_sync(&ar->debug.htt_stats_dwork); in ath10k_debug_unregister()
2684 dev_printk(KERN_DEBUG, ar->dev, "%pV", &vaf); in __ath10k_dbg()
2705 for (ptr = buf; (ptr - buf) < len; ptr += 16) { in ath10k_dbg_dump()
2708 sizeof(linebuf) - linebuflen, in ath10k_dbg_dump()
2711 (unsigned int)(ptr - buf)); in ath10k_dbg_dump()
2712 hex_dump_to_buffer(ptr, len - (ptr - buf), 16, 1, in ath10k_dbg_dump()
2714 sizeof(linebuf) - linebuflen, true); in ath10k_dbg_dump()
2715 dev_printk(KERN_DEBUG, ar->dev, "%s\n", linebuf); in ath10k_dbg_dump()