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.
24 #include "wmi-ops.h"
41 dev_info(ar->dev, "%pV", &vaf); in ath10k_info()
46 dev_printk(KERN_DEBUG, ar->dev, "%s", str); in ath10k_info()
68 ar->hw_params.name, in ath10k_debug_print_hwfw_info()
69 ar->target_version, in ath10k_debug_print_hwfw_info()
70 ar->bus_param.chip_id, in ath10k_debug_print_hwfw_info()
71 ar->id.subsystem_vendor, ar->id.subsystem_device); in ath10k_debug_print_hwfw_info()
80 firmware = ar->normal_mode_fw.fw_file.firmware; in ath10k_debug_print_hwfw_info()
82 crc = crc32_le(0, firmware->data, firmware->size); in ath10k_debug_print_hwfw_info()
85 ar->hw->wiphy->fw_version, in ath10k_debug_print_hwfw_info()
86 ar->fw_api, in ath10k_debug_print_hwfw_info()
97 if (ar->id.bmi_ids_valid) in ath10k_debug_print_board_info()
99 ar->id.bmi_chip_id, ar->id.bmi_board_id); in ath10k_debug_print_board_info()
103 board = ar->normal_mode_fw.board; in ath10k_debug_print_board_info()
105 crc = crc32_le(0, board->data, board->size); in ath10k_debug_print_board_info()
114 ar->bd_api, in ath10k_debug_print_board_info()
121 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()
122 ar->htt.target_version_major, in ath10k_debug_print_boot_info()
123 ar->htt.target_version_minor, in ath10k_debug_print_boot_info()
124 ar->normal_mode_fw.fw_file.wmi_op_version, in ath10k_debug_print_boot_info()
125 ar->normal_mode_fw.fw_file.htt_op_version, in ath10k_debug_print_boot_info()
126 ath10k_cal_mode_str(ar->cal_mode), in ath10k_debug_print_boot_info()
127 ar->max_num_stations, in ath10k_debug_print_boot_info()
128 test_bit(ATH10K_FLAG_RAW_MODE, &ar->dev_flags), in ath10k_debug_print_boot_info()
129 !test_bit(ATH10K_FLAG_HW_CRYPTO_DISABLED, &ar->dev_flags)); in ath10k_debug_print_boot_info()
150 dev_err(ar->dev, "%pV", &vaf); in ath10k_err()
155 dev_err(ar->dev, "%s", str); in ath10k_err()
174 dev_warn_ratelimited(ar->dev, "%pV", &vaf); in ath10k_warn()
179 dev_warn_ratelimited(ar->dev, "%s", str); in ath10k_warn()
195 struct ath10k *ar = file->private_data; in ath10k_read_wmi_services()
205 return -ENOMEM; in ath10k_read_wmi_services()
207 mutex_lock(&ar->conf_mutex); in ath10k_read_wmi_services()
209 spin_lock_bh(&ar->data_lock); in ath10k_read_wmi_services()
211 enabled = test_bit(i, ar->wmi.svc_map); in ath10k_read_wmi_services()
216 len += scnprintf(buf + len, buf_len - len, in ath10k_read_wmi_services()
217 "%-40s %s (bit %d)\n", in ath10k_read_wmi_services()
223 len += scnprintf(buf + len, buf_len - len, in ath10k_read_wmi_services()
224 "%-40s %s\n", in ath10k_read_wmi_services()
225 name, enabled ? "enabled" : "-"); in ath10k_read_wmi_services()
227 spin_unlock_bh(&ar->data_lock); in ath10k_read_wmi_services()
231 mutex_unlock(&ar->conf_mutex); in ath10k_read_wmi_services()
249 list_del(&i->list); in ath10k_fw_stats_pdevs_free()
259 list_del(&i->list); in ath10k_fw_stats_vdevs_free()
269 list_del(&i->list); in ath10k_fw_stats_peers_free()
279 list_del(&i->list); in ath10k_fw_extd_stats_peers_free()
286 spin_lock_bh(&ar->data_lock); in ath10k_debug_fw_stats_reset()
287 ar->debug.fw_stats_done = false; in ath10k_debug_fw_stats_reset()
288 ar->debug.fw_stats.extended = false; in ath10k_debug_fw_stats_reset()
289 ath10k_fw_stats_pdevs_free(&ar->debug.fw_stats.pdevs); in ath10k_debug_fw_stats_reset()
290 ath10k_fw_stats_vdevs_free(&ar->debug.fw_stats.vdevs); in ath10k_debug_fw_stats_reset()
291 ath10k_fw_stats_peers_free(&ar->debug.fw_stats.peers); in ath10k_debug_fw_stats_reset()
292 ath10k_fw_extd_stats_peers_free(&ar->debug.fw_stats.peers_extd); in ath10k_debug_fw_stats_reset()
293 spin_unlock_bh(&ar->data_lock); in ath10k_debug_fw_stats_reset()
309 spin_lock_bh(&ar->data_lock); in ath10k_debug_fw_stats_process()
316 /* Stat data may exceed htc-wmi buffer limit. In such case firmware in ath10k_debug_fw_stats_process()
317 * splits the stats data and delivers it in a ping-pong fashion of in ath10k_debug_fw_stats_process()
318 * request cmd-update event. in ath10k_debug_fw_stats_process()
320 * However there is no explicit end-of-data. Instead start-of-data is in ath10k_debug_fw_stats_process()
323 * delivered - this skips session started at end of (b) in ath10k_debug_fw_stats_process()
325 * delivered which is treated as end-of-data and is itself discarded in ath10k_debug_fw_stats_process()
330 if (ar->debug.fw_stats_done) { in ath10k_debug_fw_stats_process()
337 num_peers = list_count_nodes(&ar->debug.fw_stats.peers); in ath10k_debug_fw_stats_process()
338 num_vdevs = list_count_nodes(&ar->debug.fw_stats.vdevs); in ath10k_debug_fw_stats_process()
339 is_start = (list_empty(&ar->debug.fw_stats.pdevs) && in ath10k_debug_fw_stats_process()
341 is_end = (!list_empty(&ar->debug.fw_stats.pdevs) && in ath10k_debug_fw_stats_process()
345 list_splice_tail_init(&stats.pdevs, &ar->debug.fw_stats.pdevs); in ath10k_debug_fw_stats_process()
348 ar->debug.fw_stats_done = true; in ath10k_debug_fw_stats_process()
351 ar->debug.fw_stats.extended = true; in ath10k_debug_fw_stats_process()
353 is_started = !list_empty(&ar->debug.fw_stats.pdevs); in ath10k_debug_fw_stats_process()
358 * prevent firmware from DoS-ing the host. in ath10k_debug_fw_stats_process()
360 ath10k_fw_stats_peers_free(&ar->debug.fw_stats.peers); in ath10k_debug_fw_stats_process()
361 ath10k_fw_extd_stats_peers_free(&ar->debug.fw_stats.peers_extd); in ath10k_debug_fw_stats_process()
367 ath10k_fw_stats_vdevs_free(&ar->debug.fw_stats.vdevs); in ath10k_debug_fw_stats_process()
374 &ar->debug.fw_stats.peers_extd); in ath10k_debug_fw_stats_process()
376 list_splice_tail_init(&stats.peers, &ar->debug.fw_stats.peers); in ath10k_debug_fw_stats_process()
377 list_splice_tail_init(&stats.vdevs, &ar->debug.fw_stats.vdevs); in ath10k_debug_fw_stats_process()
380 complete(&ar->debug.fw_stats_complete); in ath10k_debug_fw_stats_process()
391 spin_unlock_bh(&ar->data_lock); in ath10k_debug_fw_stats_process()
399 lockdep_assert_held(&ar->conf_mutex); in ath10k_debug_fw_stats_request()
407 return -ETIMEDOUT; in ath10k_debug_fw_stats_request()
409 reinit_completion(&ar->debug.fw_stats_complete); in ath10k_debug_fw_stats_request()
411 ret = ath10k_wmi_request_stats(ar, ar->fw_stats_req_mask); in ath10k_debug_fw_stats_request()
418 wait_for_completion_timeout(&ar->debug.fw_stats_complete, in ath10k_debug_fw_stats_request()
421 return -ETIMEDOUT; in ath10k_debug_fw_stats_request()
423 spin_lock_bh(&ar->data_lock); in ath10k_debug_fw_stats_request()
424 if (ar->debug.fw_stats_done) { in ath10k_debug_fw_stats_request()
425 spin_unlock_bh(&ar->data_lock); in ath10k_debug_fw_stats_request()
428 spin_unlock_bh(&ar->data_lock); in ath10k_debug_fw_stats_request()
436 struct ath10k *ar = inode->i_private; in ath10k_fw_stats_open()
440 mutex_lock(&ar->conf_mutex); in ath10k_fw_stats_open()
442 if (ar->state != ATH10K_STATE_ON) { in ath10k_fw_stats_open()
443 ret = -ENETDOWN; in ath10k_fw_stats_open()
449 ret = -ENOMEM; in ath10k_fw_stats_open()
459 ret = ath10k_wmi_fw_stats_fill(ar, &ar->debug.fw_stats, buf); in ath10k_fw_stats_open()
465 file->private_data = buf; in ath10k_fw_stats_open()
467 mutex_unlock(&ar->conf_mutex); in ath10k_fw_stats_open()
474 mutex_unlock(&ar->conf_mutex); in ath10k_fw_stats_open()
480 vfree(file->private_data); in ath10k_fw_stats_release()
488 const char *buf = file->private_data; in ath10k_fw_stats_read()
506 struct ath10k *ar = file->private_data; in ath10k_debug_fw_reset_stats_read()
513 return -ENOMEM; in ath10k_debug_fw_reset_stats_read()
515 spin_lock_bh(&ar->data_lock); in ath10k_debug_fw_reset_stats_read()
517 len += scnprintf(buf + len, buf_len - len, in ath10k_debug_fw_reset_stats_read()
518 "fw_crash_counter\t\t%d\n", ar->stats.fw_crash_counter); in ath10k_debug_fw_reset_stats_read()
519 len += scnprintf(buf + len, buf_len - len, in ath10k_debug_fw_reset_stats_read()
521 ar->stats.fw_warm_reset_counter); in ath10k_debug_fw_reset_stats_read()
522 len += scnprintf(buf + len, buf_len - len, in ath10k_debug_fw_reset_stats_read()
524 ar->stats.fw_cold_reset_counter); in ath10k_debug_fw_reset_stats_read()
526 spin_unlock_bh(&ar->data_lock); in ath10k_debug_fw_reset_stats_read()
550 return -ENOMEM; in ath10k_debug_fw_assert()
552 cmd = (struct wmi_vdev_install_key_cmd *)skb->data; in ath10k_debug_fw_assert()
556 cmd->vdev_id = __cpu_to_le32(0x7ffe); in ath10k_debug_fw_assert()
559 ar->wmi.cmd->vdev_install_key_cmdid); in ath10k_debug_fw_assert()
568 "`soft` - this will send WMI_FORCE_FW_HANG_ASSERT to firmware if FW supports that command.\n" in ath10k_read_simulate_fw_crash()
569 "`hard` - this will send to firmware command with illegal parameters causing firmware crash.\n" in ath10k_read_simulate_fw_crash()
570 …"`assert` - this will send special illegal parameter to firmware to cause assert failure and crash… in ath10k_read_simulate_fw_crash()
571 "`hw-restart` - this will simply queue hw restart without fw/hw actually crashing.\n"; in ath10k_read_simulate_fw_crash()
587 struct ath10k *ar = file->private_data; in ath10k_write_simulate_fw_crash()
594 return -EINVAL; in ath10k_write_simulate_fw_crash()
596 rc = simple_write_to_buffer(buf, sizeof(buf) - 1, ppos, user_buf, count); in ath10k_write_simulate_fw_crash()
601 if (buf[*ppos - 1] == '\n') in ath10k_write_simulate_fw_crash()
602 buf[*ppos - 1] = '\0'; in ath10k_write_simulate_fw_crash()
604 mutex_lock(&ar->conf_mutex); in ath10k_write_simulate_fw_crash()
606 if (ar->state != ATH10K_STATE_ON && in ath10k_write_simulate_fw_crash()
607 ar->state != ATH10K_STATE_RESTARTED) { in ath10k_write_simulate_fw_crash()
608 ret = -ENETDOWN; in ath10k_write_simulate_fw_crash()
621 ar->wmi.vdev_param->rts_threshold, in ath10k_write_simulate_fw_crash()
626 } else if (!strcmp(buf, "hw-restart")) { in ath10k_write_simulate_fw_crash()
631 ret = -EINVAL; in ath10k_write_simulate_fw_crash()
643 mutex_unlock(&ar->conf_mutex); in ath10k_write_simulate_fw_crash()
658 struct ath10k *ar = file->private_data; in ath10k_read_chip_id()
662 len = scnprintf(buf, sizeof(buf), "0x%08x\n", ar->bus_param.chip_id); in ath10k_read_chip_id()
678 struct ath10k *ar = file->private_data; in ath10k_reg_addr_read()
683 mutex_lock(&ar->conf_mutex); in ath10k_reg_addr_read()
684 reg_addr = ar->debug.reg_addr; in ath10k_reg_addr_read()
685 mutex_unlock(&ar->conf_mutex); in ath10k_reg_addr_read()
687 len += scnprintf(buf + len, sizeof(buf) - len, "0x%x\n", reg_addr); in ath10k_reg_addr_read()
696 struct ath10k *ar = file->private_data; in ath10k_reg_addr_write()
705 return -EFAULT; in ath10k_reg_addr_write()
707 mutex_lock(&ar->conf_mutex); in ath10k_reg_addr_write()
708 ar->debug.reg_addr = reg_addr; in ath10k_reg_addr_write()
709 mutex_unlock(&ar->conf_mutex); in ath10k_reg_addr_write()
726 struct ath10k *ar = file->private_data; in ath10k_reg_value_read()
732 mutex_lock(&ar->conf_mutex); in ath10k_reg_value_read()
734 if (ar->state != ATH10K_STATE_ON && in ath10k_reg_value_read()
735 ar->state != ATH10K_STATE_UTF) { in ath10k_reg_value_read()
736 ret = -ENETDOWN; in ath10k_reg_value_read()
740 reg_addr = ar->debug.reg_addr; in ath10k_reg_value_read()
748 mutex_unlock(&ar->conf_mutex); in ath10k_reg_value_read()
757 struct ath10k *ar = file->private_data; in ath10k_reg_value_write()
761 mutex_lock(&ar->conf_mutex); in ath10k_reg_value_write()
763 if (ar->state != ATH10K_STATE_ON && in ath10k_reg_value_write()
764 ar->state != ATH10K_STATE_UTF) { in ath10k_reg_value_write()
765 ret = -ENETDOWN; in ath10k_reg_value_write()
769 reg_addr = ar->debug.reg_addr; in ath10k_reg_value_write()
780 mutex_unlock(&ar->conf_mutex); in ath10k_reg_value_write()
797 struct ath10k *ar = file->private_data; in ath10k_mem_value_read()
802 return -EINVAL; in ath10k_mem_value_read()
807 mutex_lock(&ar->conf_mutex); in ath10k_mem_value_read()
811 ret = -ENOMEM; in ath10k_mem_value_read()
815 if (ar->state != ATH10K_STATE_ON && in ath10k_mem_value_read()
816 ar->state != ATH10K_STATE_UTF) { in ath10k_mem_value_read()
817 ret = -ENETDOWN; in ath10k_mem_value_read()
830 ret = -EFAULT; in ath10k_mem_value_read()
834 count -= ret; in ath10k_mem_value_read()
840 mutex_unlock(&ar->conf_mutex); in ath10k_mem_value_read()
849 struct ath10k *ar = file->private_data; in ath10k_mem_value_write()
854 return -EINVAL; in ath10k_mem_value_write()
859 mutex_lock(&ar->conf_mutex); in ath10k_mem_value_write()
863 ret = -ENOMEM; in ath10k_mem_value_write()
867 if (ar->state != ATH10K_STATE_ON && in ath10k_mem_value_write()
868 ar->state != ATH10K_STATE_UTF) { in ath10k_mem_value_write()
869 ret = -ENETDOWN; in ath10k_mem_value_write()
875 ret = -EFAULT; in ath10k_mem_value_write()
891 mutex_unlock(&ar->conf_mutex); in ath10k_mem_value_write()
909 lockdep_assert_held(&ar->conf_mutex); in ath10k_debug_htt_stats_req()
911 if (ar->debug.htt_stats_mask == 0) in ath10k_debug_htt_stats_req()
915 if (ar->state != ATH10K_STATE_ON) in ath10k_debug_htt_stats_req()
920 ret = ath10k_htt_h2t_stats_req(&ar->htt, ar->debug.htt_stats_mask, in ath10k_debug_htt_stats_req()
921 ar->debug.reset_htt_stats, cookie); in ath10k_debug_htt_stats_req()
927 queue_delayed_work(ar->workqueue, &ar->debug.htt_stats_dwork, in ath10k_debug_htt_stats_req()
938 mutex_lock(&ar->conf_mutex); in ath10k_debug_htt_stats_dwork()
942 mutex_unlock(&ar->conf_mutex); in ath10k_debug_htt_stats_dwork()
949 struct ath10k *ar = file->private_data; in ath10k_read_htt_stats_mask()
953 len = scnprintf(buf, sizeof(buf), "%lu\n", ar->debug.htt_stats_mask); in ath10k_read_htt_stats_mask()
962 struct ath10k *ar = file->private_data; in ath10k_write_htt_stats_mask()
972 return -E2BIG; in ath10k_write_htt_stats_mask()
974 mutex_lock(&ar->conf_mutex); in ath10k_write_htt_stats_mask()
976 ar->debug.htt_stats_mask = mask; in ath10k_write_htt_stats_mask()
985 mutex_unlock(&ar->conf_mutex); in ath10k_write_htt_stats_mask()
1002 struct ath10k *ar = file->private_data; in ath10k_read_htt_max_amsdu_ampdu()
1007 mutex_lock(&ar->conf_mutex); in ath10k_read_htt_max_amsdu_ampdu()
1009 amsdu = ar->htt.max_num_amsdu; in ath10k_read_htt_max_amsdu_ampdu()
1010 ampdu = ar->htt.max_num_ampdu; in ath10k_read_htt_max_amsdu_ampdu()
1011 mutex_unlock(&ar->conf_mutex); in ath10k_read_htt_max_amsdu_ampdu()
1022 struct ath10k *ar = file->private_data; in ath10k_write_htt_max_amsdu_ampdu()
1027 res = simple_write_to_buffer(buf, sizeof(buf) - 1, ppos, in ath10k_write_htt_max_amsdu_ampdu()
1035 return -EINVAL; in ath10k_write_htt_max_amsdu_ampdu()
1037 mutex_lock(&ar->conf_mutex); in ath10k_write_htt_max_amsdu_ampdu()
1039 res = ath10k_htt_h2t_aggr_cfg_msg(&ar->htt, ampdu, amsdu); in ath10k_write_htt_max_amsdu_ampdu()
1044 ar->htt.max_num_amsdu = amsdu; in ath10k_write_htt_max_amsdu_ampdu()
1045 ar->htt.max_num_ampdu = ampdu; in ath10k_write_htt_max_amsdu_ampdu()
1048 mutex_unlock(&ar->conf_mutex); in ath10k_write_htt_max_amsdu_ampdu()
1064 struct ath10k *ar = file->private_data; in ath10k_read_fw_dbglog()
1069 ar->debug.fw_dbglog_mask, ar->debug.fw_dbglog_level); in ath10k_read_fw_dbglog()
1078 struct ath10k *ar = file->private_data; in ath10k_write_fw_dbglog()
1084 ret = simple_write_to_buffer(buf, sizeof(buf) - 1, ppos, in ath10k_write_fw_dbglog()
1092 return -EINVAL; in ath10k_write_fw_dbglog()
1098 mutex_lock(&ar->conf_mutex); in ath10k_write_fw_dbglog()
1100 ar->debug.fw_dbglog_mask = mask; in ath10k_write_fw_dbglog()
1101 ar->debug.fw_dbglog_level = log_level; in ath10k_write_fw_dbglog()
1103 if (ar->state == ATH10K_STATE_ON) { in ath10k_write_fw_dbglog()
1104 ret = ath10k_wmi_dbglog_cfg(ar, ar->debug.fw_dbglog_mask, in ath10k_write_fw_dbglog()
1105 ar->debug.fw_dbglog_level); in ath10k_write_fw_dbglog()
1116 mutex_unlock(&ar->conf_mutex); in ath10k_write_fw_dbglog()
1201 struct ath10k *ar = hw->priv; in ath10k_debug_get_et_stats()
1206 mutex_lock(&ar->conf_mutex); in ath10k_debug_get_et_stats()
1208 if (ar->state == ATH10K_STATE_ON) { in ath10k_debug_get_et_stats()
1218 pdev_stats = list_first_entry_or_null(&ar->debug.fw_stats.pdevs, in ath10k_debug_get_et_stats()
1226 spin_lock_bh(&ar->data_lock); in ath10k_debug_get_et_stats()
1228 data[i++] = pdev_stats->hw_reaped; /* ppdu reaped */ in ath10k_debug_get_et_stats()
1229 data[i++] = 0; /* tx bytes */ in ath10k_debug_get_et_stats()
1230 data[i++] = pdev_stats->htt_mpdus; in ath10k_debug_get_et_stats()
1232 data[i++] = pdev_stats->ch_noise_floor; in ath10k_debug_get_et_stats()
1233 data[i++] = pdev_stats->cycle_count; in ath10k_debug_get_et_stats()
1234 data[i++] = pdev_stats->phy_err_count; in ath10k_debug_get_et_stats()
1235 data[i++] = pdev_stats->rts_bad; in ath10k_debug_get_et_stats()
1236 data[i++] = pdev_stats->rts_good; in ath10k_debug_get_et_stats()
1237 data[i++] = pdev_stats->chan_tx_power; in ath10k_debug_get_et_stats()
1238 data[i++] = pdev_stats->fcs_bad; in ath10k_debug_get_et_stats()
1239 data[i++] = ar->stats.rx_crc_err_drop; in ath10k_debug_get_et_stats()
1240 data[i++] = pdev_stats->no_beacons; in ath10k_debug_get_et_stats()
1241 data[i++] = pdev_stats->mpdu_enqued; in ath10k_debug_get_et_stats()
1242 data[i++] = pdev_stats->msdu_enqued; in ath10k_debug_get_et_stats()
1243 data[i++] = pdev_stats->wmm_drop; in ath10k_debug_get_et_stats()
1244 data[i++] = pdev_stats->local_enqued; in ath10k_debug_get_et_stats()
1245 data[i++] = pdev_stats->local_freed; in ath10k_debug_get_et_stats()
1246 data[i++] = pdev_stats->hw_queued; in ath10k_debug_get_et_stats()
1247 data[i++] = pdev_stats->hw_reaped; in ath10k_debug_get_et_stats()
1248 data[i++] = pdev_stats->underrun; in ath10k_debug_get_et_stats()
1249 data[i++] = pdev_stats->tx_abort; in ath10k_debug_get_et_stats()
1250 data[i++] = pdev_stats->mpdus_requeued; in ath10k_debug_get_et_stats()
1251 data[i++] = pdev_stats->tx_ko; in ath10k_debug_get_et_stats()
1252 data[i++] = pdev_stats->data_rc; in ath10k_debug_get_et_stats()
1253 data[i++] = pdev_stats->sw_retry_failure; in ath10k_debug_get_et_stats()
1254 data[i++] = pdev_stats->illgl_rate_phy_err; in ath10k_debug_get_et_stats()
1255 data[i++] = pdev_stats->pdev_cont_xretry; in ath10k_debug_get_et_stats()
1256 data[i++] = pdev_stats->pdev_tx_timeout; in ath10k_debug_get_et_stats()
1257 data[i++] = pdev_stats->txop_ovf; in ath10k_debug_get_et_stats()
1258 data[i++] = pdev_stats->pdev_resets; in ath10k_debug_get_et_stats()
1259 data[i++] = pdev_stats->mid_ppdu_route_change; in ath10k_debug_get_et_stats()
1260 data[i++] = pdev_stats->status_rcvd; in ath10k_debug_get_et_stats()
1261 data[i++] = pdev_stats->r0_frags; in ath10k_debug_get_et_stats()
1262 data[i++] = pdev_stats->r1_frags; in ath10k_debug_get_et_stats()
1263 data[i++] = pdev_stats->r2_frags; in ath10k_debug_get_et_stats()
1264 data[i++] = pdev_stats->r3_frags; in ath10k_debug_get_et_stats()
1265 data[i++] = pdev_stats->htt_msdus; in ath10k_debug_get_et_stats()
1266 data[i++] = pdev_stats->htt_mpdus; in ath10k_debug_get_et_stats()
1267 data[i++] = pdev_stats->loc_msdus; in ath10k_debug_get_et_stats()
1268 data[i++] = pdev_stats->loc_mpdus; in ath10k_debug_get_et_stats()
1269 data[i++] = pdev_stats->phy_errs; in ath10k_debug_get_et_stats()
1270 data[i++] = pdev_stats->phy_err_drop; in ath10k_debug_get_et_stats()
1271 data[i++] = pdev_stats->mpdu_errs; in ath10k_debug_get_et_stats()
1272 data[i++] = ar->stats.fw_crash_counter; in ath10k_debug_get_et_stats()
1273 data[i++] = ar->stats.fw_warm_reset_counter; in ath10k_debug_get_et_stats()
1274 data[i++] = ar->stats.fw_cold_reset_counter; in ath10k_debug_get_et_stats()
1276 spin_unlock_bh(&ar->data_lock); in ath10k_debug_get_et_stats()
1278 mutex_unlock(&ar->conf_mutex); in ath10k_debug_get_et_stats()
1297 lockdep_assert_held(&ar->conf_mutex); in ath10k_debug_cal_data_fetch()
1299 if (WARN_ON(ar->hw_params.cal_data_len > ATH10K_DEBUG_CAL_DATA_LEN)) in ath10k_debug_cal_data_fetch()
1300 return -EINVAL; in ath10k_debug_cal_data_fetch()
1302 if (ar->hw_params.cal_data_len == 0) in ath10k_debug_cal_data_fetch()
1303 return -EOPNOTSUPP; in ath10k_debug_cal_data_fetch()
1314 ret = ath10k_hif_diag_read(ar, le32_to_cpu(addr), ar->debug.cal_data, in ath10k_debug_cal_data_fetch()
1315 ar->hw_params.cal_data_len); in ath10k_debug_cal_data_fetch()
1326 struct ath10k *ar = inode->i_private; in ath10k_debug_cal_data_open()
1328 mutex_lock(&ar->conf_mutex); in ath10k_debug_cal_data_open()
1330 if (ar->state == ATH10K_STATE_ON || in ath10k_debug_cal_data_open()
1331 ar->state == ATH10K_STATE_UTF) { in ath10k_debug_cal_data_open()
1335 file->private_data = ar; in ath10k_debug_cal_data_open()
1336 mutex_unlock(&ar->conf_mutex); in ath10k_debug_cal_data_open()
1345 struct ath10k *ar = file->private_data; in ath10k_debug_cal_data_read()
1347 mutex_lock(&ar->conf_mutex); in ath10k_debug_cal_data_read()
1350 ar->debug.cal_data, in ath10k_debug_cal_data_read()
1351 ar->hw_params.cal_data_len); in ath10k_debug_cal_data_read()
1353 mutex_unlock(&ar->conf_mutex); in ath10k_debug_cal_data_read()
1362 struct ath10k *ar = file->private_data; in ath10k_write_ani_enable()
1367 return -EINVAL; in ath10k_write_ani_enable()
1369 mutex_lock(&ar->conf_mutex); in ath10k_write_ani_enable()
1371 if (ar->ani_enabled == enable) { in ath10k_write_ani_enable()
1376 ret = ath10k_wmi_pdev_set_param(ar, ar->wmi.pdev_param->ani_enable, in ath10k_write_ani_enable()
1382 ar->ani_enabled = enable; in ath10k_write_ani_enable()
1387 mutex_unlock(&ar->conf_mutex); in ath10k_write_ani_enable()
1395 struct ath10k *ar = file->private_data; in ath10k_read_ani_enable()
1399 len = scnprintf(buf, sizeof(buf), "%d\n", ar->ani_enabled); in ath10k_read_ani_enable()
1423 struct ath10k *ar = file->private_data; in ath10k_read_nf_cal_period()
1427 len = scnprintf(buf, sizeof(buf), "%d\n", ar->debug.nf_cal_period); in ath10k_read_nf_cal_period()
1436 struct ath10k *ar = file->private_data; in ath10k_write_nf_cal_period()
1445 return -EINVAL; in ath10k_write_nf_cal_period()
1449 return -EINVAL; in ath10k_write_nf_cal_period()
1451 mutex_lock(&ar->conf_mutex); in ath10k_write_nf_cal_period()
1453 ar->debug.nf_cal_period = period; in ath10k_write_nf_cal_period()
1455 if (ar->state != ATH10K_STATE_ON) { in ath10k_write_nf_cal_period()
1461 ret = ath10k_wmi_pdev_set_param(ar, ar->wmi.pdev_param->cal_period, in ath10k_write_nf_cal_period()
1462 ar->debug.nf_cal_period); in ath10k_write_nf_cal_period()
1472 mutex_unlock(&ar->conf_mutex); in ath10k_write_nf_cal_period()
1492 lockdep_assert_held(&ar->conf_mutex); in ath10k_debug_tpc_stats_request()
1494 reinit_completion(&ar->debug.tpc_complete); in ath10k_debug_tpc_stats_request()
1502 time_left = wait_for_completion_timeout(&ar->debug.tpc_complete, in ath10k_debug_tpc_stats_request()
1505 return -ETIMEDOUT; in ath10k_debug_tpc_stats_request()
1513 spin_lock_bh(&ar->data_lock); in ath10k_debug_tpc_stats_process()
1515 kfree(ar->debug.tpc_stats); in ath10k_debug_tpc_stats_process()
1516 ar->debug.tpc_stats = tpc_stats; in ath10k_debug_tpc_stats_process()
1517 complete(&ar->debug.tpc_complete); in ath10k_debug_tpc_stats_process()
1519 spin_unlock_bh(&ar->data_lock); in ath10k_debug_tpc_stats_process()
1526 spin_lock_bh(&ar->data_lock); in ath10k_debug_tpc_stats_final_process()
1528 kfree(ar->debug.tpc_stats_final); in ath10k_debug_tpc_stats_final_process()
1529 ar->debug.tpc_stats_final = tpc_stats; in ath10k_debug_tpc_stats_final_process()
1530 complete(&ar->debug.tpc_complete); in ath10k_debug_tpc_stats_final_process()
1532 spin_unlock_bh(&ar->data_lock); in ath10k_debug_tpc_stats_final_process()
1553 *len += scnprintf(buf + *len, buf_len - *len, in ath10k_tpc_stats_print()
1555 *len += scnprintf(buf + *len, buf_len - *len, in ath10k_tpc_stats_print()
1558 *len += scnprintf(buf + *len, buf_len - *len, in ath10k_tpc_stats_print()
1560 *len += scnprintf(buf + *len, buf_len - *len, in ath10k_tpc_stats_print()
1563 for (i = 0; i < tpc_stats->num_tx_chain; i++) in ath10k_tpc_stats_print()
1564 *len += scnprintf(buf + *len, buf_len - *len, in ath10k_tpc_stats_print()
1567 *len += scnprintf(buf + *len, buf_len - *len, "\n"); in ath10k_tpc_stats_print()
1569 for (i = 0; i < tpc_stats->rate_max; i++) { in ath10k_tpc_stats_print()
1570 *len += scnprintf(buf + *len, buf_len - *len, in ath10k_tpc_stats_print()
1572 pream_str[tpc_stats->tpc_table[j].pream_idx[i]], in ath10k_tpc_stats_print()
1573 tpc_stats->tpc_table[j].rate_code[i], in ath10k_tpc_stats_print()
1574 tpc_stats->tpc_table[j].tpc_value[i]); in ath10k_tpc_stats_print()
1577 *len += scnprintf(buf + *len, buf_len - *len, in ath10k_tpc_stats_print()
1591 spin_lock_bh(&ar->data_lock); in ath10k_tpc_stats_fill()
1598 len += scnprintf(buf + len, buf_len - len, "\n"); in ath10k_tpc_stats_fill()
1599 len += scnprintf(buf + len, buf_len - len, in ath10k_tpc_stats_fill()
1601 len += scnprintf(buf + len, buf_len - len, in ath10k_tpc_stats_fill()
1603 tpc_stats->chan_freq, in ath10k_tpc_stats_fill()
1604 tpc_stats->phy_mode); in ath10k_tpc_stats_fill()
1605 len += scnprintf(buf + len, buf_len - len, in ath10k_tpc_stats_fill()
1607 len += scnprintf(buf + len, buf_len - len, in ath10k_tpc_stats_fill()
1609 tpc_stats->ctl, in ath10k_tpc_stats_fill()
1610 tpc_stats->reg_domain); in ath10k_tpc_stats_fill()
1611 len += scnprintf(buf + len, buf_len - len, in ath10k_tpc_stats_fill()
1613 tpc_stats->twice_antenna_gain, in ath10k_tpc_stats_fill()
1614 tpc_stats->twice_antenna_reduction); in ath10k_tpc_stats_fill()
1615 len += scnprintf(buf + len, buf_len - len, in ath10k_tpc_stats_fill()
1617 tpc_stats->power_limit, in ath10k_tpc_stats_fill()
1618 tpc_stats->twice_max_rd_power / 2); in ath10k_tpc_stats_fill()
1619 len += scnprintf(buf + len, buf_len - len, in ath10k_tpc_stats_fill()
1620 "Num tx chains = %2d Num supported rates = %2d\n", in ath10k_tpc_stats_fill()
1621 tpc_stats->num_tx_chain, in ath10k_tpc_stats_fill()
1622 tpc_stats->rate_max); in ath10k_tpc_stats_fill()
1627 if (tpc_stats->flag[j] == ATH10K_TPC_TABLE_TYPE_FLAG) { in ath10k_tpc_stats_fill()
1628 len += scnprintf(buf + len, buf_len - len, in ath10k_tpc_stats_fill()
1636 if (tpc_stats->flag[j] == ATH10K_TPC_TABLE_TYPE_FLAG) { in ath10k_tpc_stats_fill()
1637 len += scnprintf(buf + len, buf_len - len, in ath10k_tpc_stats_fill()
1645 if (tpc_stats->flag[j] == ATH10K_TPC_TABLE_TYPE_FLAG) { in ath10k_tpc_stats_fill()
1646 len += scnprintf(buf + len, buf_len - len, in ath10k_tpc_stats_fill()
1654 len += scnprintf(buf + len, buf_len - len, in ath10k_tpc_stats_fill()
1661 spin_unlock_bh(&ar->data_lock); in ath10k_tpc_stats_fill()
1664 buf[len - 1] = 0; in ath10k_tpc_stats_fill()
1671 struct ath10k *ar = inode->i_private; in ath10k_tpc_stats_open()
1675 mutex_lock(&ar->conf_mutex); in ath10k_tpc_stats_open()
1677 if (ar->state != ATH10K_STATE_ON) { in ath10k_tpc_stats_open()
1678 ret = -ENETDOWN; in ath10k_tpc_stats_open()
1684 ret = -ENOMEM; in ath10k_tpc_stats_open()
1695 ath10k_tpc_stats_fill(ar, ar->debug.tpc_stats, buf); in ath10k_tpc_stats_open()
1696 file->private_data = buf; in ath10k_tpc_stats_open()
1698 mutex_unlock(&ar->conf_mutex); in ath10k_tpc_stats_open()
1705 mutex_unlock(&ar->conf_mutex); in ath10k_tpc_stats_open()
1711 vfree(file->private_data); in ath10k_tpc_stats_release()
1719 const char *buf = file->private_data; in ath10k_tpc_stats_read()
1737 lockdep_assert_held(&ar->conf_mutex); in ath10k_debug_start()
1745 if (ar->debug.fw_dbglog_mask) { in ath10k_debug_start()
1746 ret = ath10k_wmi_dbglog_cfg(ar, ar->debug.fw_dbglog_mask, in ath10k_debug_start()
1754 if (ar->pktlog_filter) { in ath10k_debug_start()
1756 ar->pktlog_filter); in ath10k_debug_start()
1761 ar->pktlog_filter, ret); in ath10k_debug_start()
1769 if (ar->debug.nf_cal_period && in ath10k_debug_start()
1771 ar->normal_mode_fw.fw_file.fw_features)) { in ath10k_debug_start()
1773 ar->wmi.pdev_param->cal_period, in ath10k_debug_start()
1774 ar->debug.nf_cal_period); in ath10k_debug_start()
1786 lockdep_assert_held(&ar->conf_mutex); in ath10k_debug_stop()
1789 ar->normal_mode_fw.fw_file.fw_features)) in ath10k_debug_stop()
1796 if (ar->debug.htt_stats_mask != 0) in ath10k_debug_stop()
1797 cancel_delayed_work(&ar->debug.htt_stats_dwork); in ath10k_debug_stop()
1806 struct ath10k *ar = file->private_data; in ath10k_write_simulate_radar()
1813 arvif = list_first_entry(&ar->arvifs, typeof(*arvif), list); in ath10k_write_simulate_radar()
1814 if (!arvif->is_started) in ath10k_write_simulate_radar()
1815 return -EINVAL; in ath10k_write_simulate_radar()
1817 ieee80211_radar_detected(ar->hw); in ath10k_write_simulate_radar()
1830 len += scnprintf(buf + len, size - len, "%-28s : %10u\n", s, \
1831 ar->debug.dfs_stats.p))
1834 len += scnprintf(buf + len, size - len, "%-28s : %10u\n", s, \
1835 ar->debug.dfs_pool_stats.p))
1842 struct ath10k *ar = file->private_data; in ath10k_read_dfs_stats()
1847 return -ENOMEM; in ath10k_read_dfs_stats()
1849 if (!ar->dfs_detector) { in ath10k_read_dfs_stats()
1850 len += scnprintf(buf + len, size - len, "DFS not enabled\n"); in ath10k_read_dfs_stats()
1854 ar->debug.dfs_pool_stats = in ath10k_read_dfs_stats()
1855 ar->dfs_detector->get_stats(ar->dfs_detector); in ath10k_read_dfs_stats()
1857 len += scnprintf(buf + len, size - len, "Pulse detector statistics:\n"); in ath10k_read_dfs_stats()
1865 len += scnprintf(buf + len, size - len, "Global Pool statistics:\n"); in ath10k_read_dfs_stats()
1895 struct ath10k *ar = file->private_data; in ath10k_write_pktlog_filter()
1900 return -EINVAL; in ath10k_write_pktlog_filter()
1902 mutex_lock(&ar->conf_mutex); in ath10k_write_pktlog_filter()
1904 if (ar->state != ATH10K_STATE_ON) { in ath10k_write_pktlog_filter()
1905 ar->pktlog_filter = filter; in ath10k_write_pktlog_filter()
1910 if (filter == ar->pktlog_filter) { in ath10k_write_pktlog_filter()
1919 ar->pktlog_filter, ret); in ath10k_write_pktlog_filter()
1930 ar->pktlog_filter = filter; in ath10k_write_pktlog_filter()
1934 mutex_unlock(&ar->conf_mutex); in ath10k_write_pktlog_filter()
1942 struct ath10k *ar = file->private_data; in ath10k_read_pktlog_filter()
1945 mutex_lock(&ar->conf_mutex); in ath10k_read_pktlog_filter()
1946 len = scnprintf(buf, sizeof(buf) - len, "%08x\n", in ath10k_read_pktlog_filter()
1947 ar->pktlog_filter); in ath10k_read_pktlog_filter()
1948 mutex_unlock(&ar->conf_mutex); in ath10k_read_pktlog_filter()
1963 struct ath10k *ar = file->private_data; in ath10k_write_quiet_period()
1967 return -EINVAL; in ath10k_write_quiet_period()
1972 return -EINVAL; in ath10k_write_quiet_period()
1974 mutex_lock(&ar->conf_mutex); in ath10k_write_quiet_period()
1975 ar->thermal.quiet_period = period; in ath10k_write_quiet_period()
1977 mutex_unlock(&ar->conf_mutex); in ath10k_write_quiet_period()
1986 struct ath10k *ar = file->private_data; in ath10k_read_quiet_period()
1989 mutex_lock(&ar->conf_mutex); in ath10k_read_quiet_period()
1990 len = scnprintf(buf, sizeof(buf) - len, "%d\n", in ath10k_read_quiet_period()
1991 ar->thermal.quiet_period); in ath10k_read_quiet_period()
1992 mutex_unlock(&ar->conf_mutex); in ath10k_read_quiet_period()
2007 struct ath10k *ar = file->private_data; in ath10k_write_btcoex()
2014 buf_size = min(count, (sizeof(buf) - 1)); in ath10k_write_btcoex()
2016 return -EFAULT; in ath10k_write_btcoex()
2021 return -EINVAL; in ath10k_write_btcoex()
2023 if (!ar->coex_support) in ath10k_write_btcoex()
2024 return -EOPNOTSUPP; in ath10k_write_btcoex()
2026 mutex_lock(&ar->conf_mutex); in ath10k_write_btcoex()
2028 if (ar->state != ATH10K_STATE_ON && in ath10k_write_btcoex()
2029 ar->state != ATH10K_STATE_RESTARTED) { in ath10k_write_btcoex()
2030 ret = -ENETDOWN; in ath10k_write_btcoex()
2034 if (!(test_bit(ATH10K_FLAG_BTCOEX, &ar->dev_flags) ^ val)) { in ath10k_write_btcoex()
2039 pdev_param = ar->wmi.pdev_param->enable_btcoex; in ath10k_write_btcoex()
2041 ar->running_fw->fw_file.fw_features)) { in ath10k_write_btcoex()
2054 set_bit(ATH10K_FLAG_BTCOEX, &ar->dev_flags); in ath10k_write_btcoex()
2056 clear_bit(ATH10K_FLAG_BTCOEX, &ar->dev_flags); in ath10k_write_btcoex()
2061 mutex_unlock(&ar->conf_mutex); in ath10k_write_btcoex()
2070 struct ath10k *ar = file->private_data; in ath10k_read_btcoex()
2073 mutex_lock(&ar->conf_mutex); in ath10k_read_btcoex()
2074 len = scnprintf(buf, sizeof(buf) - len, "%d\n", in ath10k_read_btcoex()
2075 test_bit(ATH10K_FLAG_BTCOEX, &ar->dev_flags)); in ath10k_read_btcoex()
2076 mutex_unlock(&ar->conf_mutex); in ath10k_read_btcoex()
2091 struct ath10k *ar = file->private_data; in ath10k_write_enable_extd_tx_stats()
2096 return -EINVAL; in ath10k_write_enable_extd_tx_stats()
2098 mutex_lock(&ar->conf_mutex); in ath10k_write_enable_extd_tx_stats()
2100 if (ar->state != ATH10K_STATE_ON) { in ath10k_write_enable_extd_tx_stats()
2101 ar->debug.enable_extd_tx_stats = filter; in ath10k_write_enable_extd_tx_stats()
2106 if (filter == ar->debug.enable_extd_tx_stats) { in ath10k_write_enable_extd_tx_stats()
2111 ar->debug.enable_extd_tx_stats = filter; in ath10k_write_enable_extd_tx_stats()
2115 mutex_unlock(&ar->conf_mutex); in ath10k_write_enable_extd_tx_stats()
2125 struct ath10k *ar = file->private_data; in ath10k_read_enable_extd_tx_stats()
2128 mutex_lock(&ar->conf_mutex); in ath10k_read_enable_extd_tx_stats()
2129 len = scnprintf(buf, sizeof(buf) - len, "%08x\n", in ath10k_read_enable_extd_tx_stats()
2130 ar->debug.enable_extd_tx_stats); in ath10k_read_enable_extd_tx_stats()
2131 mutex_unlock(&ar->conf_mutex); in ath10k_read_enable_extd_tx_stats()
2146 struct ath10k *ar = file->private_data; in ath10k_write_peer_stats()
2152 buf_size = min(count, (sizeof(buf) - 1)); in ath10k_write_peer_stats()
2154 return -EFAULT; in ath10k_write_peer_stats()
2159 return -EINVAL; in ath10k_write_peer_stats()
2161 mutex_lock(&ar->conf_mutex); in ath10k_write_peer_stats()
2163 if (ar->state != ATH10K_STATE_ON && in ath10k_write_peer_stats()
2164 ar->state != ATH10K_STATE_RESTARTED) { in ath10k_write_peer_stats()
2165 ret = -ENETDOWN; in ath10k_write_peer_stats()
2169 if (!(test_bit(ATH10K_FLAG_PEER_STATS, &ar->dev_flags) ^ val)) { in ath10k_write_peer_stats()
2175 set_bit(ATH10K_FLAG_PEER_STATS, &ar->dev_flags); in ath10k_write_peer_stats()
2177 clear_bit(ATH10K_FLAG_PEER_STATS, &ar->dev_flags); in ath10k_write_peer_stats()
2185 mutex_unlock(&ar->conf_mutex); in ath10k_write_peer_stats()
2194 struct ath10k *ar = file->private_data; in ath10k_read_peer_stats()
2197 mutex_lock(&ar->conf_mutex); in ath10k_read_peer_stats()
2198 len = scnprintf(buf, sizeof(buf) - len, "%d\n", in ath10k_read_peer_stats()
2199 test_bit(ATH10K_FLAG_PEER_STATS, &ar->dev_flags)); in ath10k_read_peer_stats()
2200 mutex_unlock(&ar->conf_mutex); in ath10k_read_peer_stats()
2215 struct ath10k *ar = file->private_data; in ath10k_debug_fw_checksums_read()
2222 return -ENOMEM; in ath10k_debug_fw_checksums_read()
2224 mutex_lock(&ar->conf_mutex); in ath10k_debug_fw_checksums_read()
2226 len += scnprintf(buf + len, buf_len - len, in ath10k_debug_fw_checksums_read()
2227 "firmware-N.bin\t\t%08x\n", in ath10k_debug_fw_checksums_read()
2228 crc32_le(0, ar->normal_mode_fw.fw_file.firmware->data, in ath10k_debug_fw_checksums_read()
2229 ar->normal_mode_fw.fw_file.firmware->size)); in ath10k_debug_fw_checksums_read()
2230 len += scnprintf(buf + len, buf_len - len, in ath10k_debug_fw_checksums_read()
2232 crc32_le(0, ar->normal_mode_fw.fw_file.firmware_data, in ath10k_debug_fw_checksums_read()
2233 ar->normal_mode_fw.fw_file.firmware_len)); in ath10k_debug_fw_checksums_read()
2234 len += scnprintf(buf + len, buf_len - len, in ath10k_debug_fw_checksums_read()
2236 crc32_le(0, ar->normal_mode_fw.fw_file.otp_data, in ath10k_debug_fw_checksums_read()
2237 ar->normal_mode_fw.fw_file.otp_len)); in ath10k_debug_fw_checksums_read()
2238 len += scnprintf(buf + len, buf_len - len, in ath10k_debug_fw_checksums_read()
2240 crc32_le(0, ar->normal_mode_fw.fw_file.codeswap_data, in ath10k_debug_fw_checksums_read()
2241 ar->normal_mode_fw.fw_file.codeswap_len)); in ath10k_debug_fw_checksums_read()
2242 len += scnprintf(buf + len, buf_len - len, in ath10k_debug_fw_checksums_read()
2243 "board-N.bin\t\t%08x\n", in ath10k_debug_fw_checksums_read()
2244 crc32_le(0, ar->normal_mode_fw.board->data, in ath10k_debug_fw_checksums_read()
2245 ar->normal_mode_fw.board->size)); in ath10k_debug_fw_checksums_read()
2246 len += scnprintf(buf + len, buf_len - len, in ath10k_debug_fw_checksums_read()
2248 crc32_le(0, ar->normal_mode_fw.board_data, in ath10k_debug_fw_checksums_read()
2249 ar->normal_mode_fw.board_len)); in ath10k_debug_fw_checksums_read()
2253 mutex_unlock(&ar->conf_mutex); in ath10k_debug_fw_checksums_read()
2270 struct ath10k *ar = file->private_data; in ath10k_sta_tid_stats_mask_read()
2274 len = scnprintf(buf, sizeof(buf), "0x%08x\n", ar->sta_tid_stats_mask); in ath10k_sta_tid_stats_mask_read()
2282 struct ath10k *ar = file->private_data; in ath10k_sta_tid_stats_mask_write()
2287 len = min(count, sizeof(buf) - 1); in ath10k_sta_tid_stats_mask_write()
2289 return -EFAULT; in ath10k_sta_tid_stats_mask_write()
2293 return -EINVAL; in ath10k_sta_tid_stats_mask_write()
2295 ar->sta_tid_stats_mask = mask; in ath10k_sta_tid_stats_mask_write()
2313 lockdep_assert_held(&ar->conf_mutex); in ath10k_debug_tpc_stats_final_request()
2315 reinit_completion(&ar->debug.tpc_complete); in ath10k_debug_tpc_stats_final_request()
2323 time_left = wait_for_completion_timeout(&ar->debug.tpc_complete, in ath10k_debug_tpc_stats_final_request()
2326 return -ETIMEDOUT; in ath10k_debug_tpc_stats_final_request()
2333 struct ath10k *ar = inode->i_private; in ath10k_tpc_stats_final_open()
2337 mutex_lock(&ar->conf_mutex); in ath10k_tpc_stats_final_open()
2339 if (ar->state != ATH10K_STATE_ON) { in ath10k_tpc_stats_final_open()
2340 ret = -ENETDOWN; in ath10k_tpc_stats_final_open()
2346 ret = -ENOMEM; in ath10k_tpc_stats_final_open()
2357 ath10k_tpc_stats_fill(ar, ar->debug.tpc_stats, buf); in ath10k_tpc_stats_final_open()
2358 file->private_data = buf; in ath10k_tpc_stats_final_open()
2360 mutex_unlock(&ar->conf_mutex); in ath10k_tpc_stats_final_open()
2367 mutex_unlock(&ar->conf_mutex); in ath10k_tpc_stats_final_open()
2374 vfree(file->private_data); in ath10k_tpc_stats_final_release()
2383 const char *buf = file->private_data; in ath10k_tpc_stats_final_read()
2401 struct ath10k *ar = file->private_data; in ath10k_write_warm_hw_reset()
2406 return -EFAULT; in ath10k_write_warm_hw_reset()
2409 return -EINVAL; in ath10k_write_warm_hw_reset()
2411 mutex_lock(&ar->conf_mutex); in ath10k_write_warm_hw_reset()
2413 if (ar->state != ATH10K_STATE_ON) { in ath10k_write_warm_hw_reset()
2414 ret = -ENETDOWN; in ath10k_write_warm_hw_reset()
2418 ret = ath10k_wmi_pdev_set_param(ar, ar->wmi.pdev_param->pdev_reset, in ath10k_write_warm_hw_reset()
2429 mutex_unlock(&ar->conf_mutex); in ath10k_write_warm_hw_reset()
2444 struct ath10k_sta *arsta = (struct ath10k_sta *)sta->drv_priv; in ath10k_peer_ps_state_disable()
2446 spin_lock_bh(&ar->data_lock); in ath10k_peer_ps_state_disable()
2447 arsta->peer_ps_state = WMI_PEER_PS_STATE_DISABLED; in ath10k_peer_ps_state_disable()
2448 spin_unlock_bh(&ar->data_lock); in ath10k_peer_ps_state_disable()
2455 struct ath10k *ar = file->private_data; in ath10k_write_ps_state_enable()
2461 return -EINVAL; in ath10k_write_ps_state_enable()
2464 return -EINVAL; in ath10k_write_ps_state_enable()
2466 mutex_lock(&ar->conf_mutex); in ath10k_write_ps_state_enable()
2468 if (ar->ps_state_enable == ps_state_enable) { in ath10k_write_ps_state_enable()
2473 param = ar->wmi.pdev_param->peer_sta_ps_statechg_enable; in ath10k_write_ps_state_enable()
2480 ar->ps_state_enable = ps_state_enable; in ath10k_write_ps_state_enable()
2482 if (!ar->ps_state_enable) in ath10k_write_ps_state_enable()
2483 ieee80211_iterate_stations_atomic(ar->hw, in ath10k_write_ps_state_enable()
2490 mutex_unlock(&ar->conf_mutex); in ath10k_write_ps_state_enable()
2499 struct ath10k *ar = file->private_data; in ath10k_read_ps_state_enable()
2503 mutex_lock(&ar->conf_mutex); in ath10k_read_ps_state_enable()
2504 len = scnprintf(buf, sizeof(buf) - len, "%d\n", in ath10k_read_ps_state_enable()
2505 ar->ps_state_enable); in ath10k_read_ps_state_enable()
2506 mutex_unlock(&ar->conf_mutex); in ath10k_read_ps_state_enable()
2523 struct ath10k *ar = file->private_data; in ath10k_write_reset_htt_stats()
2532 return -EINVAL; in ath10k_write_reset_htt_stats()
2534 mutex_lock(&ar->conf_mutex); in ath10k_write_reset_htt_stats()
2536 ar->debug.reset_htt_stats = reset; in ath10k_write_reset_htt_stats()
2542 ar->debug.reset_htt_stats = 0; in ath10k_write_reset_htt_stats()
2546 mutex_unlock(&ar->conf_mutex); in ath10k_write_reset_htt_stats()
2559 ar->debug.cal_data = vzalloc(ATH10K_DEBUG_CAL_DATA_LEN); in ath10k_debug_create()
2560 if (!ar->debug.cal_data) in ath10k_debug_create()
2561 return -ENOMEM; in ath10k_debug_create()
2563 INIT_LIST_HEAD(&ar->debug.fw_stats.pdevs); in ath10k_debug_create()
2564 INIT_LIST_HEAD(&ar->debug.fw_stats.vdevs); in ath10k_debug_create()
2565 INIT_LIST_HEAD(&ar->debug.fw_stats.peers); in ath10k_debug_create()
2566 INIT_LIST_HEAD(&ar->debug.fw_stats.peers_extd); in ath10k_debug_create()
2573 vfree(ar->debug.cal_data); in ath10k_debug_destroy()
2574 ar->debug.cal_data = NULL; in ath10k_debug_destroy()
2578 kfree(ar->debug.tpc_stats); in ath10k_debug_destroy()
2579 kfree(ar->debug.tpc_stats_final); in ath10k_debug_destroy()
2584 ar->debug.debugfs_phy = debugfs_create_dir("ath10k", in ath10k_debug_register()
2585 ar->hw->wiphy->debugfsdir); in ath10k_debug_register()
2586 if (IS_ERR_OR_NULL(ar->debug.debugfs_phy)) { in ath10k_debug_register()
2587 if (IS_ERR(ar->debug.debugfs_phy)) in ath10k_debug_register()
2588 return PTR_ERR(ar->debug.debugfs_phy); in ath10k_debug_register()
2590 return -ENOMEM; in ath10k_debug_register()
2593 INIT_DELAYED_WORK(&ar->debug.htt_stats_dwork, in ath10k_debug_register()
2596 init_completion(&ar->debug.tpc_complete); in ath10k_debug_register()
2597 init_completion(&ar->debug.fw_stats_complete); in ath10k_debug_register()
2599 debugfs_create_file("fw_stats", 0400, ar->debug.debugfs_phy, ar, in ath10k_debug_register()
2602 debugfs_create_file("fw_reset_stats", 0400, ar->debug.debugfs_phy, ar, in ath10k_debug_register()
2605 debugfs_create_file("wmi_services", 0400, ar->debug.debugfs_phy, ar, in ath10k_debug_register()
2608 debugfs_create_file("simulate_fw_crash", 0600, ar->debug.debugfs_phy, ar, in ath10k_debug_register()
2611 debugfs_create_file("reg_addr", 0600, ar->debug.debugfs_phy, ar, in ath10k_debug_register()
2614 debugfs_create_file("reg_value", 0600, ar->debug.debugfs_phy, ar, in ath10k_debug_register()
2617 debugfs_create_file("mem_value", 0600, ar->debug.debugfs_phy, ar, in ath10k_debug_register()
2620 debugfs_create_file("chip_id", 0400, ar->debug.debugfs_phy, ar, in ath10k_debug_register()
2623 debugfs_create_file("htt_stats_mask", 0600, ar->debug.debugfs_phy, ar, in ath10k_debug_register()
2626 debugfs_create_file("htt_max_amsdu_ampdu", 0600, ar->debug.debugfs_phy, ar, in ath10k_debug_register()
2629 debugfs_create_file("fw_dbglog", 0600, ar->debug.debugfs_phy, ar, in ath10k_debug_register()
2633 ar->normal_mode_fw.fw_file.fw_features)) { in ath10k_debug_register()
2634 debugfs_create_file("cal_data", 0400, ar->debug.debugfs_phy, ar, in ath10k_debug_register()
2637 debugfs_create_file("nf_cal_period", 0600, ar->debug.debugfs_phy, ar, in ath10k_debug_register()
2641 debugfs_create_file("ani_enable", 0600, ar->debug.debugfs_phy, ar, in ath10k_debug_register()
2645 debugfs_create_file("dfs_simulate_radar", 0200, ar->debug.debugfs_phy, in ath10k_debug_register()
2649 ar->debug.debugfs_phy, in ath10k_debug_register()
2650 &ar->dfs_block_radar_events); in ath10k_debug_register()
2652 debugfs_create_file("dfs_stats", 0400, ar->debug.debugfs_phy, ar, in ath10k_debug_register()
2656 debugfs_create_file("pktlog_filter", 0644, ar->debug.debugfs_phy, ar, in ath10k_debug_register()
2659 if (test_bit(WMI_SERVICE_THERM_THROT, ar->wmi.svc_map)) in ath10k_debug_register()
2660 debugfs_create_file("quiet_period", 0644, ar->debug.debugfs_phy, ar, in ath10k_debug_register()
2663 debugfs_create_file("tpc_stats", 0400, ar->debug.debugfs_phy, ar, in ath10k_debug_register()
2666 if (test_bit(WMI_SERVICE_COEX_GPIO, ar->wmi.svc_map)) in ath10k_debug_register()
2667 debugfs_create_file("btcoex", 0644, ar->debug.debugfs_phy, ar, in ath10k_debug_register()
2670 if (test_bit(WMI_SERVICE_PEER_STATS, ar->wmi.svc_map)) { in ath10k_debug_register()
2671 debugfs_create_file("peer_stats", 0644, ar->debug.debugfs_phy, ar, in ath10k_debug_register()
2675 ar->debug.debugfs_phy, ar, in ath10k_debug_register()
2679 debugfs_create_file("fw_checksums", 0400, ar->debug.debugfs_phy, ar, in ath10k_debug_register()
2684 ar->debug.debugfs_phy, in ath10k_debug_register()
2687 if (test_bit(WMI_SERVICE_TPC_STATS_FINAL, ar->wmi.svc_map)) in ath10k_debug_register()
2689 ar->debug.debugfs_phy, ar, in ath10k_debug_register()
2692 if (test_bit(WMI_SERVICE_RESET_CHIP, ar->wmi.svc_map)) in ath10k_debug_register()
2694 ar->debug.debugfs_phy, ar, in ath10k_debug_register()
2697 debugfs_create_file("ps_state_enable", 0600, ar->debug.debugfs_phy, ar, in ath10k_debug_register()
2700 debugfs_create_file("reset_htt_stats", 0200, ar->debug.debugfs_phy, ar, in ath10k_debug_register()
2708 cancel_delayed_work_sync(&ar->debug.htt_stats_dwork); in ath10k_debug_unregister()
2727 dev_printk(KERN_DEBUG, ar->dev, "%pV", &vaf); in __ath10k_dbg()
2732 dev_printk(KERN_DEBUG, ar->dev, "%s", str); in __ath10k_dbg()
2762 for (ptr = buf; (ptr - buf) < len; ptr += 16) { in ath10k_dbg_dump()
2765 sizeof(linebuf) - linebuflen, in ath10k_dbg_dump()
2768 (unsigned int)(ptr - buf)); in ath10k_dbg_dump()
2769 hex_dump_to_buffer(ptr, len - (ptr - buf), 16, 1, in ath10k_dbg_dump()
2771 sizeof(linebuf) - linebuflen, true); in ath10k_dbg_dump()
2772 dev_printk(KERN_DEBUG, ar->dev, "%s\n", linebuf); in ath10k_dbg_dump()
2783 dev_printk(KERN_DEBUG, ar->dev, "%s\n", sbuf_data(sb)); in ath10k_dbg_dump()