Lines Matching +full:open +full:- +full:firmware

1 // SPDX-License-Identifier: BSD-3-Clause-Clear
3 * Copyright (c) 2018-2020 The Linux Foundation. All rights reserved.
4 * Copyright (c) 2021-2024 Qualcomm Innovation Center, Inc. All rights reserved.
69 dbr_debug = ar->debug.dbr_debug[id]; in ath11k_debugfs_add_dbring_entry()
73 if (!dbr_debug->dbr_debug_enabled) in ath11k_debugfs_add_dbring_entry()
76 dbr_data = &dbr_debug->dbr_dbg_data; in ath11k_debugfs_add_dbring_entry()
78 spin_lock_bh(&dbr_data->lock); in ath11k_debugfs_add_dbring_entry()
80 if (dbr_data->entries) { in ath11k_debugfs_add_dbring_entry()
81 entry = &dbr_data->entries[dbr_data->dbr_debug_idx]; in ath11k_debugfs_add_dbring_entry()
82 entry->hp = srng->u.src_ring.hp; in ath11k_debugfs_add_dbring_entry()
83 entry->tp = *srng->u.src_ring.tp_addr; in ath11k_debugfs_add_dbring_entry()
84 entry->timestamp = jiffies; in ath11k_debugfs_add_dbring_entry()
85 entry->event = event; in ath11k_debugfs_add_dbring_entry()
87 dbr_data->dbr_debug_idx++; in ath11k_debugfs_add_dbring_entry()
88 if (dbr_data->dbr_debug_idx == in ath11k_debugfs_add_dbring_entry()
89 dbr_data->num_ring_debug_entries) in ath11k_debugfs_add_dbring_entry()
90 dbr_data->dbr_debug_idx = 0; in ath11k_debugfs_add_dbring_entry()
93 spin_unlock_bh(&dbr_data->lock); in ath11k_debugfs_add_dbring_entry()
98 spin_lock_bh(&ar->data_lock); in ath11k_debugfs_fw_stats_reset()
99 ar->fw_stats_done = false; in ath11k_debugfs_fw_stats_reset()
100 ath11k_fw_stats_pdevs_free(&ar->fw_stats.pdevs); in ath11k_debugfs_fw_stats_reset()
101 ath11k_fw_stats_vdevs_free(&ar->fw_stats.vdevs); in ath11k_debugfs_fw_stats_reset()
102 spin_unlock_bh(&ar->data_lock); in ath11k_debugfs_fw_stats_reset()
107 struct ath11k_base *ab = ar->ab; in ath11k_debugfs_fw_stats_process()
116 if (stats->stats_id == WMI_REQUEST_RSSI_PER_CHAIN_STAT) { in ath11k_debugfs_fw_stats_process()
117 ar->fw_stats_done = true; in ath11k_debugfs_fw_stats_process()
121 if (stats->stats_id == WMI_REQUEST_VDEV_STAT) { in ath11k_debugfs_fw_stats_process()
122 if (list_empty(&stats->vdevs)) { in ath11k_debugfs_fw_stats_process()
129 for (i = 0; i < ab->num_radios; i++) { in ath11k_debugfs_fw_stats_process()
130 pdev = rcu_dereference(ab->pdevs_active[i]); in ath11k_debugfs_fw_stats_process()
131 if (pdev && pdev->ar) in ath11k_debugfs_fw_stats_process()
132 total_vdevs_started += ar->num_started_vdevs; in ath11k_debugfs_fw_stats_process()
137 list_splice_tail_init(&stats->vdevs, in ath11k_debugfs_fw_stats_process()
138 &ar->fw_stats.vdevs); in ath11k_debugfs_fw_stats_process()
141 ar->fw_stats_done = true; in ath11k_debugfs_fw_stats_process()
147 if (stats->stats_id == WMI_REQUEST_BCN_STAT) { in ath11k_debugfs_fw_stats_process()
148 if (list_empty(&stats->bcn)) { in ath11k_debugfs_fw_stats_process()
155 is_end = ((++num_bcn) == ar->num_started_vdevs); in ath11k_debugfs_fw_stats_process()
157 list_splice_tail_init(&stats->bcn, in ath11k_debugfs_fw_stats_process()
158 &ar->fw_stats.bcn); in ath11k_debugfs_fw_stats_process()
161 ar->fw_stats_done = true; in ath11k_debugfs_fw_stats_process()
170 struct ath11k_base *ab = ar->ab; in ath11k_debugfs_fw_stats_request()
174 lockdep_assert_held(&ar->conf_mutex); in ath11k_debugfs_fw_stats_request()
177 * In that case, since there is no end marking for the back-to-back in ath11k_debugfs_fw_stats_request()
185 reinit_completion(&ar->fw_stats_complete); in ath11k_debugfs_fw_stats_request()
195 time_left = wait_for_completion_timeout(&ar->fw_stats_complete, 1 * HZ); in ath11k_debugfs_fw_stats_request()
198 return -ETIMEDOUT; in ath11k_debugfs_fw_stats_request()
204 spin_lock_bh(&ar->data_lock); in ath11k_debugfs_fw_stats_request()
205 if (ar->fw_stats_done) { in ath11k_debugfs_fw_stats_request()
206 spin_unlock_bh(&ar->data_lock); in ath11k_debugfs_fw_stats_request()
209 spin_unlock_bh(&ar->data_lock); in ath11k_debugfs_fw_stats_request()
217 struct ath11k_base *ab = ar->ab; in ath11k_debugfs_get_fw_stats()
221 mutex_lock(&ar->conf_mutex); in ath11k_debugfs_get_fw_stats()
223 if (ar->state != ATH11K_STATE_ON) { in ath11k_debugfs_get_fw_stats()
224 ret = -ENETDOWN; in ath11k_debugfs_get_fw_stats()
241 mutex_unlock(&ar->conf_mutex); in ath11k_debugfs_get_fw_stats()
248 struct ath11k *ar = inode->i_private; in ath11k_open_pdev_stats()
249 struct ath11k_base *ab = ar->ab; in ath11k_open_pdev_stats()
254 mutex_lock(&ar->conf_mutex); in ath11k_open_pdev_stats()
256 if (ar->state != ATH11K_STATE_ON) { in ath11k_open_pdev_stats()
257 ret = -ENETDOWN; in ath11k_open_pdev_stats()
263 ret = -ENOMEM; in ath11k_open_pdev_stats()
267 req_param.pdev_id = ar->pdev->pdev_id; in ath11k_open_pdev_stats()
277 ath11k_wmi_fw_stats_fill(ar, &ar->fw_stats, req_param.stats_id, buf); in ath11k_open_pdev_stats()
279 file->private_data = buf; in ath11k_open_pdev_stats()
281 mutex_unlock(&ar->conf_mutex); in ath11k_open_pdev_stats()
288 mutex_unlock(&ar->conf_mutex); in ath11k_open_pdev_stats()
294 vfree(file->private_data); in ath11k_release_pdev_stats()
303 const char *buf = file->private_data; in ath11k_read_pdev_stats()
310 .open = ath11k_open_pdev_stats,
319 struct ath11k *ar = inode->i_private; in ath11k_open_vdev_stats()
324 mutex_lock(&ar->conf_mutex); in ath11k_open_vdev_stats()
326 if (ar->state != ATH11K_STATE_ON) { in ath11k_open_vdev_stats()
327 ret = -ENETDOWN; in ath11k_open_vdev_stats()
333 ret = -ENOMEM; in ath11k_open_vdev_stats()
337 req_param.pdev_id = ar->pdev->pdev_id; in ath11k_open_vdev_stats()
344 ath11k_warn(ar->ab, "failed to request fw vdev stats: %d\n", ret); in ath11k_open_vdev_stats()
348 ath11k_wmi_fw_stats_fill(ar, &ar->fw_stats, req_param.stats_id, buf); in ath11k_open_vdev_stats()
350 file->private_data = buf; in ath11k_open_vdev_stats()
352 mutex_unlock(&ar->conf_mutex); in ath11k_open_vdev_stats()
359 mutex_unlock(&ar->conf_mutex); in ath11k_open_vdev_stats()
365 vfree(file->private_data); in ath11k_release_vdev_stats()
374 const char *buf = file->private_data; in ath11k_read_vdev_stats()
381 .open = ath11k_open_vdev_stats,
390 struct ath11k *ar = inode->i_private; in ath11k_open_bcn_stats()
396 mutex_lock(&ar->conf_mutex); in ath11k_open_bcn_stats()
398 if (ar->state != ATH11K_STATE_ON) { in ath11k_open_bcn_stats()
399 ret = -ENETDOWN; in ath11k_open_bcn_stats()
405 ret = -ENOMEM; in ath11k_open_bcn_stats()
410 req_param.pdev_id = ar->pdev->pdev_id; in ath11k_open_bcn_stats()
413 list_for_each_entry(arvif, &ar->arvifs, list) { in ath11k_open_bcn_stats()
414 if (!arvif->is_up) in ath11k_open_bcn_stats()
417 req_param.vdev_id = arvif->vdev_id; in ath11k_open_bcn_stats()
420 ath11k_warn(ar->ab, "failed to request fw bcn stats: %d\n", ret); in ath11k_open_bcn_stats()
425 ath11k_wmi_fw_stats_fill(ar, &ar->fw_stats, req_param.stats_id, buf); in ath11k_open_bcn_stats()
430 spin_lock_bh(&ar->data_lock); in ath11k_open_bcn_stats()
431 ath11k_fw_stats_bcn_free(&ar->fw_stats.bcn); in ath11k_open_bcn_stats()
432 spin_unlock_bh(&ar->data_lock); in ath11k_open_bcn_stats()
434 file->private_data = buf; in ath11k_open_bcn_stats()
436 mutex_unlock(&ar->conf_mutex); in ath11k_open_bcn_stats()
443 mutex_unlock(&ar->conf_mutex); in ath11k_open_bcn_stats()
449 vfree(file->private_data); in ath11k_release_bcn_stats()
458 const char *buf = file->private_data; in ath11k_read_bcn_stats()
465 .open = ath11k_open_bcn_stats,
477 "To simulate firmware crash write one of the keywords to this file:\n" in ath11k_read_simulate_fw_crash()
478 "`assert` - this will send WMI_FORCE_FW_HANG_CMDID to firmware to cause assert.\n" in ath11k_read_simulate_fw_crash()
479 "`hw-restart` - this will simply queue hw restart without fw/hw actually crashing.\n"; in ath11k_read_simulate_fw_crash()
484 /* Simulate firmware crash:
485 * 'soft': Call wmi command causing firmware hang. This firmware hang is
486 * recoverable by warm firmware reset.
487 * 'hard': Force firmware crash by setting any vdev parameter for not allowed
488 * vdev id. This is hard firmware crash because it is recoverable only by cold
489 * firmware reset.
495 struct ath11k_base *ab = file->private_data; in ath11k_write_simulate_fw_crash()
497 struct ath11k *ar = ab->pdevs[0].ar; in ath11k_write_simulate_fw_crash()
502 for (i = 0; i < ab->num_radios; i++) { in ath11k_write_simulate_fw_crash()
503 pdev = &ab->pdevs[i]; in ath11k_write_simulate_fw_crash()
504 ar = pdev->ar; in ath11k_write_simulate_fw_crash()
505 if (ar && ar->state == ATH11K_STATE_ON) { in ath11k_write_simulate_fw_crash()
512 return -EINVAL; in ath11k_write_simulate_fw_crash()
514 rc = simple_write_to_buffer(buf, sizeof(buf) - 1, ppos, user_buf, count); in ath11k_write_simulate_fw_crash()
519 if (buf[*ppos - 1] == '\n') in ath11k_write_simulate_fw_crash()
520 buf[*ppos - 1] = '\0'; in ath11k_write_simulate_fw_crash()
523 ret = -ENETDOWN; in ath11k_write_simulate_fw_crash()
528 ath11k_info(ab, "simulating firmware assert crash\n"); in ath11k_write_simulate_fw_crash()
532 } else if (!strcmp(buf, "hw-restart")) { in ath11k_write_simulate_fw_crash()
534 queue_work(ab->workqueue_aux, &ab->reset_work); in ath11k_write_simulate_fw_crash()
537 ret = -EINVAL; in ath11k_write_simulate_fw_crash()
542 ath11k_warn(ab, "failed to simulate firmware crash: %d\n", ret); in ath11k_write_simulate_fw_crash()
555 .open = simple_open,
564 struct ath11k *ar = file->private_data; in ath11k_write_enable_extd_tx_stats()
569 return -EINVAL; in ath11k_write_enable_extd_tx_stats()
571 mutex_lock(&ar->conf_mutex); in ath11k_write_enable_extd_tx_stats()
573 if (ar->state != ATH11K_STATE_ON) { in ath11k_write_enable_extd_tx_stats()
574 ret = -ENETDOWN; in ath11k_write_enable_extd_tx_stats()
578 if (filter == ar->debug.extd_tx_stats) { in ath11k_write_enable_extd_tx_stats()
583 ar->debug.extd_tx_stats = filter; in ath11k_write_enable_extd_tx_stats()
587 mutex_unlock(&ar->conf_mutex); in ath11k_write_enable_extd_tx_stats()
597 struct ath11k *ar = file->private_data; in ath11k_read_enable_extd_tx_stats()
600 mutex_lock(&ar->conf_mutex); in ath11k_read_enable_extd_tx_stats()
601 len = scnprintf(buf, sizeof(buf) - len, "%08x\n", in ath11k_read_enable_extd_tx_stats()
602 ar->debug.extd_tx_stats); in ath11k_read_enable_extd_tx_stats()
603 mutex_unlock(&ar->conf_mutex); in ath11k_read_enable_extd_tx_stats()
611 .open = simple_open
618 struct ath11k *ar = file->private_data; in ath11k_write_extd_rx_stats()
619 struct ath11k_base *ab = ar->ab; in ath11k_write_extd_rx_stats()
626 return -EINVAL; in ath11k_write_extd_rx_stats()
628 mutex_lock(&ar->conf_mutex); in ath11k_write_extd_rx_stats()
630 if (ar->state != ATH11K_STATE_ON) { in ath11k_write_extd_rx_stats()
631 ret = -ENETDOWN; in ath11k_write_extd_rx_stats()
636 ret = -EINVAL; in ath11k_write_extd_rx_stats()
640 if (enable == ar->debug.extd_rx_stats) { in ath11k_write_extd_rx_stats()
645 if (test_bit(ATH11K_FLAG_MONITOR_STARTED, &ar->monitor_flags)) { in ath11k_write_extd_rx_stats()
646 ar->debug.extd_rx_stats = enable; in ath11k_write_extd_rx_stats()
669 ar->debug.rx_filter = tlv_filter.rx_filter; in ath11k_write_extd_rx_stats()
671 for (i = 0; i < ab->hw_params.num_rxdma_per_pdev; i++) { in ath11k_write_extd_rx_stats()
672 ring_id = ar->dp.rx_mon_status_refill_ring[i].refill_buf_ring.ring_id; in ath11k_write_extd_rx_stats()
673 ret = ath11k_dp_tx_htt_rx_filter_setup(ar->ab, ring_id, ar->dp.mac_id, in ath11k_write_extd_rx_stats()
678 ath11k_warn(ar->ab, "failed to set rx filter for monitor status ring\n"); in ath11k_write_extd_rx_stats()
683 ar->debug.extd_rx_stats = enable; in ath11k_write_extd_rx_stats()
686 mutex_unlock(&ar->conf_mutex); in ath11k_write_extd_rx_stats()
694 struct ath11k *ar = file->private_data; in ath11k_read_extd_rx_stats()
698 mutex_lock(&ar->conf_mutex); in ath11k_read_extd_rx_stats()
699 len = scnprintf(buf, sizeof(buf) - len, "%d\n", in ath11k_read_extd_rx_stats()
700 ar->debug.extd_rx_stats); in ath11k_read_extd_rx_stats()
701 mutex_unlock(&ar->conf_mutex); in ath11k_read_extd_rx_stats()
709 .open = simple_open,
716 lockdep_assert_held(&ab->base_lock); in ath11k_fill_bp_stats()
718 len += scnprintf(buf + len, size - len, "count: %u\n", in ath11k_fill_bp_stats()
719 bp_stats->count); in ath11k_fill_bp_stats()
720 len += scnprintf(buf + len, size - len, "hp: %u\n", in ath11k_fill_bp_stats()
721 bp_stats->hp); in ath11k_fill_bp_stats()
722 len += scnprintf(buf + len, size - len, "tp: %u\n", in ath11k_fill_bp_stats()
723 bp_stats->tp); in ath11k_fill_bp_stats()
724 len += scnprintf(buf + len, size - len, "seen before: %ums\n\n", in ath11k_fill_bp_stats()
725 jiffies_to_msecs(jiffies - bp_stats->jiffies)); in ath11k_fill_bp_stats()
737 len += scnprintf(buf + len, size - len, "\nBackpressure Stats\n"); in ath11k_debugfs_dump_soc_ring_bp_stats()
738 len += scnprintf(buf + len, size - len, "==================\n"); in ath11k_debugfs_dump_soc_ring_bp_stats()
740 spin_lock_bh(&ab->base_lock); in ath11k_debugfs_dump_soc_ring_bp_stats()
742 bp_stats = &ab->soc_stats.bp_stats.umac_ring_bp_stats[i]; in ath11k_debugfs_dump_soc_ring_bp_stats()
744 if (!bp_stats->count) in ath11k_debugfs_dump_soc_ring_bp_stats()
747 len += scnprintf(buf + len, size - len, "Ring: %s\n", in ath11k_debugfs_dump_soc_ring_bp_stats()
756 &ab->soc_stats.bp_stats.lmac_ring_bp_stats[i][pdev_idx]; in ath11k_debugfs_dump_soc_ring_bp_stats()
758 if (!bp_stats->count) in ath11k_debugfs_dump_soc_ring_bp_stats()
761 len += scnprintf(buf + len, size - len, "Ring: %s\n", in ath11k_debugfs_dump_soc_ring_bp_stats()
763 len += scnprintf(buf + len, size - len, "pdev: %d\n", in ath11k_debugfs_dump_soc_ring_bp_stats()
769 spin_unlock_bh(&ab->base_lock); in ath11k_debugfs_dump_soc_ring_bp_stats()
772 len += scnprintf(buf + len, size - len, in ath11k_debugfs_dump_soc_ring_bp_stats()
782 struct ath11k_base *ab = file->private_data; in ath11k_debugfs_dump_soc_dp_stats()
783 struct ath11k_soc_dp_stats *soc_stats = &ab->soc_stats; in ath11k_debugfs_dump_soc_dp_stats()
802 return -ENOMEM; in ath11k_debugfs_dump_soc_dp_stats()
804 len += scnprintf(buf + len, size - len, "SOC RX STATS:\n\n"); in ath11k_debugfs_dump_soc_dp_stats()
805 len += scnprintf(buf + len, size - len, "err ring pkts: %u\n", in ath11k_debugfs_dump_soc_dp_stats()
806 soc_stats->err_ring_pkts); in ath11k_debugfs_dump_soc_dp_stats()
807 len += scnprintf(buf + len, size - len, "Invalid RBM: %u\n\n", in ath11k_debugfs_dump_soc_dp_stats()
808 soc_stats->invalid_rbm); in ath11k_debugfs_dump_soc_dp_stats()
809 len += scnprintf(buf + len, size - len, "RXDMA errors:\n"); in ath11k_debugfs_dump_soc_dp_stats()
811 len += scnprintf(buf + len, size - len, "%s: %u\n", in ath11k_debugfs_dump_soc_dp_stats()
812 rxdma_err[i], soc_stats->rxdma_error[i]); in ath11k_debugfs_dump_soc_dp_stats()
814 len += scnprintf(buf + len, size - len, "\nREO errors:\n"); in ath11k_debugfs_dump_soc_dp_stats()
816 len += scnprintf(buf + len, size - len, "%s: %u\n", in ath11k_debugfs_dump_soc_dp_stats()
817 reo_err[i], soc_stats->reo_error[i]); in ath11k_debugfs_dump_soc_dp_stats()
819 len += scnprintf(buf + len, size - len, "\nHAL REO errors:\n"); in ath11k_debugfs_dump_soc_dp_stats()
820 len += scnprintf(buf + len, size - len, in ath11k_debugfs_dump_soc_dp_stats()
822 soc_stats->hal_reo_error[0], in ath11k_debugfs_dump_soc_dp_stats()
823 soc_stats->hal_reo_error[1], in ath11k_debugfs_dump_soc_dp_stats()
824 soc_stats->hal_reo_error[2], in ath11k_debugfs_dump_soc_dp_stats()
825 soc_stats->hal_reo_error[3]); in ath11k_debugfs_dump_soc_dp_stats()
827 len += scnprintf(buf + len, size - len, "\nSOC TX STATS:\n"); in ath11k_debugfs_dump_soc_dp_stats()
828 len += scnprintf(buf + len, size - len, "\nTCL Ring Full Failures:\n"); in ath11k_debugfs_dump_soc_dp_stats()
830 for (i = 0; i < ab->hw_params.max_tx_ring; i++) in ath11k_debugfs_dump_soc_dp_stats()
831 len += scnprintf(buf + len, size - len, "ring%d: %u\n", in ath11k_debugfs_dump_soc_dp_stats()
832 i, soc_stats->tx_err.desc_na[i]); in ath11k_debugfs_dump_soc_dp_stats()
834 len += scnprintf(buf + len, size - len, in ath11k_debugfs_dump_soc_dp_stats()
836 atomic_read(&soc_stats->tx_err.misc_fail)); in ath11k_debugfs_dump_soc_dp_stats()
838 len += ath11k_debugfs_dump_soc_ring_bp_stats(ab, buf + len, size - len); in ath11k_debugfs_dump_soc_dp_stats()
850 .open = simple_open,
859 struct ath11k *ar = file->private_data; in ath11k_write_fw_dbglog()
866 ret = simple_write_to_buffer(buf, sizeof(buf) - 1, ppos, in ath11k_write_fw_dbglog()
874 return -EINVAL; in ath11k_write_fw_dbglog()
876 mutex_lock(&ar->conf_mutex); in ath11k_write_fw_dbglog()
879 if (num != 4 || mod_id_index > (MAX_MODULE_ID_BITMAP_WORDS - 1)) { in ath11k_write_fw_dbglog()
880 ret = -EINVAL; in ath11k_write_fw_dbglog()
883 ar->debug.module_id_bitmap[mod_id_index] = upper_32_bits(value); in ath11k_write_fw_dbglog()
890 ret = -EINVAL; in ath11k_write_fw_dbglog()
897 ret = ath11k_wmi_fw_dbglog_cfg(ar, ar->debug.module_id_bitmap, &dbglog); in ath11k_write_fw_dbglog()
899 ath11k_warn(ar->ab, "fw dbglog config failed from debugfs: %d\n", in ath11k_write_fw_dbglog()
907 mutex_unlock(&ar->conf_mutex); in ath11k_write_fw_dbglog()
913 .open = simple_open,
920 struct ath11k_base *ab = inode->i_private; in ath11k_open_sram_dump()
925 start = ab->hw_params.sram_dump.start; in ath11k_open_sram_dump()
926 end = ab->hw_params.sram_dump.end; in ath11k_open_sram_dump()
928 buf = vmalloc(end - start + 1); in ath11k_open_sram_dump()
930 return -ENOMEM; in ath11k_open_sram_dump()
939 file->private_data = buf; in ath11k_open_sram_dump()
947 struct ath11k_base *ab = file->f_inode->i_private; in ath11k_read_sram_dump()
948 const char *buf = file->private_data; in ath11k_read_sram_dump()
952 start = ab->hw_params.sram_dump.start; in ath11k_read_sram_dump()
953 end = ab->hw_params.sram_dump.end; in ath11k_read_sram_dump()
954 len = end - start + 1; in ath11k_read_sram_dump()
961 vfree(file->private_data); in ath11k_release_sram_dump()
962 file->private_data = NULL; in ath11k_release_sram_dump()
968 .open = ath11k_open_sram_dump,
977 if (test_bit(ATH11K_FLAG_REGISTERED, &ab->dev_flags)) in ath11k_debugfs_pdev_create()
980 debugfs_create_file("simulate_fw_crash", 0600, ab->debugfs_soc, ab, in ath11k_debugfs_pdev_create()
983 debugfs_create_file("soc_dp_stats", 0400, ab->debugfs_soc, ab, in ath11k_debugfs_pdev_create()
986 if (ab->hw_params.sram_dump.start != 0) in ath11k_debugfs_pdev_create()
987 debugfs_create_file("sram", 0400, ab->debugfs_soc, ab, in ath11k_debugfs_pdev_create()
995 debugfs_remove_recursive(ab->debugfs_soc); in ath11k_debugfs_pdev_destroy()
996 ab->debugfs_soc = NULL; in ath11k_debugfs_pdev_destroy()
1018 scnprintf(name, sizeof(name), "%s-%s", ath11k_bus_str(ab->hif.bus), in ath11k_debugfs_soc_create()
1019 dev_name(ab->dev)); in ath11k_debugfs_soc_create()
1021 ab->debugfs_soc = debugfs_create_dir(name, root); in ath11k_debugfs_soc_create()
1022 if (IS_ERR_OR_NULL(ab->debugfs_soc)) { in ath11k_debugfs_soc_create()
1023 ret = PTR_ERR(ab->debugfs_soc); in ath11k_debugfs_soc_create()
1038 debugfs_remove_recursive(ab->debugfs_soc); in ath11k_debugfs_soc_destroy()
1039 ab->debugfs_soc = NULL; in ath11k_debugfs_soc_destroy()
1052 ar->debug.debugfs_pdev); in ath11k_debugfs_fw_stats_init()
1054 ar->fw_stats.debugfs_fwstats = fwstats_dir; in ath11k_debugfs_fw_stats_init()
1071 struct ath11k *ar = file->private_data; in ath11k_write_pktlog_filter()
1072 struct ath11k_base *ab = ar->ab; in ath11k_write_pktlog_filter()
1079 mutex_lock(&ar->conf_mutex); in ath11k_write_pktlog_filter()
1080 if (ar->state != ATH11K_STATE_ON) { in ath11k_write_pktlog_filter()
1081 ret = -ENETDOWN; in ath11k_write_pktlog_filter()
1085 rc = simple_write_to_buffer(buf, sizeof(buf) - 1, ppos, ubuf, count); in ath11k_write_pktlog_filter()
1094 ret = -EINVAL; in ath11k_write_pktlog_filter()
1101 ath11k_warn(ar->ab, in ath11k_write_pktlog_filter()
1103 ar->debug.pktlog_filter, ret); in ath11k_write_pktlog_filter()
1109 ath11k_warn(ar->ab, "failed to disable pktlog: %d\n", ret); in ath11k_write_pktlog_filter()
1115 for (i = 0; i < ab->hw_params.num_rxdma_per_pdev; i++) { in ath11k_write_pktlog_filter()
1116 ring_id = ar->dp.rx_mon_status_refill_ring[i].refill_buf_ring.ring_id; in ath11k_write_pktlog_filter()
1117 ret = ath11k_dp_tx_htt_rx_filter_setup(ar->ab, ring_id, ar->dp.mac_id, in ath11k_write_pktlog_filter()
1121 ath11k_warn(ar->ab, "failed to set rx filter for monitor status ring\n"); in ath11k_write_pktlog_filter()
1145 ath11k_err(ar->ab, "failed to enable pktlog lite: %d\n", ret); in ath11k_write_pktlog_filter()
1159 ath11k_err(ar->ab, "failed to send htt ppdu stats req: %d\n", in ath11k_write_pktlog_filter()
1174 for (i = 0; i < ab->hw_params.num_rxdma_per_pdev; i++) { in ath11k_write_pktlog_filter()
1175 ring_id = ar->dp.rx_mon_status_refill_ring[i].refill_buf_ring.ring_id; in ath11k_write_pktlog_filter()
1177 ar->dp.mac_id + i, in ath11k_write_pktlog_filter()
1190 ar->debug.pktlog_filter = filter; in ath11k_write_pktlog_filter()
1191 ar->debug.pktlog_mode = mode; in ath11k_write_pktlog_filter()
1195 mutex_unlock(&ar->conf_mutex); in ath11k_write_pktlog_filter()
1205 struct ath11k *ar = file->private_data; in ath11k_read_pktlog_filter()
1208 mutex_lock(&ar->conf_mutex); in ath11k_read_pktlog_filter()
1209 len = scnprintf(buf, sizeof(buf) - len, "%08x %08x\n", in ath11k_read_pktlog_filter()
1210 ar->debug.pktlog_filter, in ath11k_read_pktlog_filter()
1211 ar->debug.pktlog_mode); in ath11k_read_pktlog_filter()
1212 mutex_unlock(&ar->conf_mutex); in ath11k_read_pktlog_filter()
1220 .open = simple_open
1227 struct ath11k *ar = file->private_data; in ath11k_write_simulate_radar()
1239 .open = simple_open
1246 struct ath11k_dbg_dbr_data *dbr_dbg_data = file->private_data; in ath11k_debug_dump_dbr_entries()
1255 return -ENOMEM; in ath11k_debug_dump_dbr_entries()
1257 len += scnprintf(buf + len, size - len, in ath11k_debug_dump_dbr_entries()
1258 "-----------------------------------------\n"); in ath11k_debug_dump_dbr_entries()
1259 len += scnprintf(buf + len, size - len, in ath11k_debug_dump_dbr_entries()
1261 len += scnprintf(buf + len, size - len, in ath11k_debug_dump_dbr_entries()
1262 "-----------------------------------------\n"); in ath11k_debug_dump_dbr_entries()
1264 spin_lock_bh(&dbr_dbg_data->lock); in ath11k_debug_dump_dbr_entries()
1266 for (i = 0; i < dbr_dbg_data->num_ring_debug_entries; i++) { in ath11k_debug_dump_dbr_entries()
1267 len += scnprintf(buf + len, size - len, in ath11k_debug_dump_dbr_entries()
1269 dbr_dbg_data->entries[i].hp, in ath11k_debug_dump_dbr_entries()
1270 dbr_dbg_data->entries[i].tp, in ath11k_debug_dump_dbr_entries()
1271 dbr_dbg_data->entries[i].timestamp, in ath11k_debug_dump_dbr_entries()
1272 event_id_to_string[dbr_dbg_data->entries[i].event]); in ath11k_debug_dump_dbr_entries()
1275 spin_unlock_bh(&dbr_dbg_data->lock); in ath11k_debug_dump_dbr_entries()
1285 .open = simple_open,
1295 if (!ar->debug.dbr_debug[dbr_id]) in ath11k_debugfs_dbr_dbg_destroy()
1298 dbr_debug = ar->debug.dbr_debug[dbr_id]; in ath11k_debugfs_dbr_dbg_destroy()
1299 dbr_dbg_data = &dbr_debug->dbr_dbg_data; in ath11k_debugfs_dbr_dbg_destroy()
1301 debugfs_remove_recursive(dbr_debug->dbr_debugfs); in ath11k_debugfs_dbr_dbg_destroy()
1302 kfree(dbr_dbg_data->entries); in ath11k_debugfs_dbr_dbg_destroy()
1304 ar->debug.dbr_debug[dbr_id] = NULL; in ath11k_debugfs_dbr_dbg_destroy()
1313 if (ar->debug.dbr_debug[dbr_id]) in ath11k_debugfs_dbr_dbg_init()
1316 ar->debug.dbr_debug[dbr_id] = kzalloc(sizeof(*dbr_debug), in ath11k_debugfs_dbr_dbg_init()
1319 if (!ar->debug.dbr_debug[dbr_id]) in ath11k_debugfs_dbr_dbg_init()
1320 return -ENOMEM; in ath11k_debugfs_dbr_dbg_init()
1322 dbr_debug = ar->debug.dbr_debug[dbr_id]; in ath11k_debugfs_dbr_dbg_init()
1323 dbr_dbg_data = &dbr_debug->dbr_dbg_data; in ath11k_debugfs_dbr_dbg_init()
1325 if (dbr_debug->dbr_debugfs) in ath11k_debugfs_dbr_dbg_init()
1328 dbr_debug->dbr_debugfs = debugfs_create_dir(dbr_id_to_str[dbr_id], in ath11k_debugfs_dbr_dbg_init()
1329 ar->debug.debugfs_pdev); in ath11k_debugfs_dbr_dbg_init()
1330 if (IS_ERR_OR_NULL(dbr_debug->dbr_debugfs)) { in ath11k_debugfs_dbr_dbg_init()
1331 if (IS_ERR(dbr_debug->dbr_debugfs)) in ath11k_debugfs_dbr_dbg_init()
1332 return PTR_ERR(dbr_debug->dbr_debugfs); in ath11k_debugfs_dbr_dbg_init()
1333 return -ENOMEM; in ath11k_debugfs_dbr_dbg_init()
1336 dbr_debug->dbr_debug_enabled = true; in ath11k_debugfs_dbr_dbg_init()
1337 dbr_dbg_data->num_ring_debug_entries = ATH11K_DEBUG_DBR_ENTRIES_MAX; in ath11k_debugfs_dbr_dbg_init()
1338 dbr_dbg_data->dbr_debug_idx = 0; in ath11k_debugfs_dbr_dbg_init()
1339 dbr_dbg_data->entries = kcalloc(ATH11K_DEBUG_DBR_ENTRIES_MAX, in ath11k_debugfs_dbr_dbg_init()
1342 if (!dbr_dbg_data->entries) in ath11k_debugfs_dbr_dbg_init()
1343 return -ENOMEM; in ath11k_debugfs_dbr_dbg_init()
1345 spin_lock_init(&dbr_dbg_data->lock); in ath11k_debugfs_dbr_dbg_init()
1347 debugfs_create_file("dump_dbr_debug", 0444, dbr_debug->dbr_debugfs, in ath11k_debugfs_dbr_dbg_init()
1357 struct ath11k *ar = file->private_data; in ath11k_debugfs_write_enable_dbr_dbg()
1362 mutex_lock(&ar->conf_mutex); in ath11k_debugfs_write_enable_dbr_dbg()
1364 if (ar->state != ATH11K_STATE_ON) { in ath11k_debugfs_write_enable_dbr_dbg()
1365 ret = -ENETDOWN; in ath11k_debugfs_write_enable_dbr_dbg()
1369 ret = simple_write_to_buffer(buf, sizeof(buf) - 1, ppos, ubuf, count); in ath11k_debugfs_write_enable_dbr_dbg()
1376 ret = -EINVAL; in ath11k_debugfs_write_enable_dbr_dbg()
1377 …ath11k_warn(ar->ab, "usage: echo <dbr_id> <val> dbr_id:0-Spectral 1-CFR val:0-disable 1-enable\n"); in ath11k_debugfs_write_enable_dbr_dbg()
1384 ath11k_warn(ar->ab, "db ring module debugfs init failed: %d\n", in ath11k_debugfs_write_enable_dbr_dbg()
1394 mutex_unlock(&ar->conf_mutex); in ath11k_debugfs_write_enable_dbr_dbg()
1400 .open = simple_open,
1409 struct ath11k *ar = file->private_data; in ath11k_write_ps_timekeeper_enable()
1414 return -EINVAL; in ath11k_write_ps_timekeeper_enable()
1416 mutex_lock(&ar->conf_mutex); in ath11k_write_ps_timekeeper_enable()
1418 if (ar->state != ATH11K_STATE_ON) { in ath11k_write_ps_timekeeper_enable()
1419 ret = -ENETDOWN; in ath11k_write_ps_timekeeper_enable()
1423 if (!ar->ps_state_enable) { in ath11k_write_ps_timekeeper_enable()
1424 ret = -EINVAL; in ath11k_write_ps_timekeeper_enable()
1428 ar->ps_timekeeper_enable = !!ps_timekeeper_enable; in ath11k_write_ps_timekeeper_enable()
1431 mutex_unlock(&ar->conf_mutex); in ath11k_write_ps_timekeeper_enable()
1440 struct ath11k *ar = file->private_data; in ath11k_read_ps_timekeeper_enable()
1444 mutex_lock(&ar->conf_mutex); in ath11k_read_ps_timekeeper_enable()
1445 len = scnprintf(buf, sizeof(buf), "%d\n", ar->ps_timekeeper_enable); in ath11k_read_ps_timekeeper_enable()
1446 mutex_unlock(&ar->conf_mutex); in ath11k_read_ps_timekeeper_enable()
1454 .open = simple_open,
1465 spin_lock_bh(&ar->data_lock); in ath11k_reset_peer_ps_duration()
1466 arsta->ps_total_duration = 0; in ath11k_reset_peer_ps_duration()
1467 spin_unlock_bh(&ar->data_lock); in ath11k_reset_peer_ps_duration()
1474 struct ath11k *ar = file->private_data; in ath11k_write_reset_ps_duration()
1479 return -EINVAL; in ath11k_write_reset_ps_duration()
1481 mutex_lock(&ar->conf_mutex); in ath11k_write_reset_ps_duration()
1483 if (ar->state != ATH11K_STATE_ON) { in ath11k_write_reset_ps_duration()
1484 ret = -ENETDOWN; in ath11k_write_reset_ps_duration()
1488 if (!ar->ps_state_enable) { in ath11k_write_reset_ps_duration()
1489 ret = -EINVAL; in ath11k_write_reset_ps_duration()
1493 ieee80211_iterate_stations_atomic(ar->hw, in ath11k_write_reset_ps_duration()
1499 mutex_unlock(&ar->conf_mutex); in ath11k_write_reset_ps_duration()
1505 .open = simple_open,
1516 spin_lock_bh(&ar->data_lock); in ath11k_peer_ps_state_disable()
1517 arsta->peer_ps_state = WMI_PEER_PS_STATE_DISABLED; in ath11k_peer_ps_state_disable()
1518 arsta->ps_start_time = 0; in ath11k_peer_ps_state_disable()
1519 arsta->ps_total_duration = 0; in ath11k_peer_ps_state_disable()
1520 spin_unlock_bh(&ar->data_lock); in ath11k_peer_ps_state_disable()
1527 struct ath11k *ar = file->private_data; in ath11k_write_ps_state_enable()
1528 struct ath11k_pdev *pdev = ar->pdev; in ath11k_write_ps_state_enable()
1534 return -EINVAL; in ath11k_write_ps_state_enable()
1536 mutex_lock(&ar->conf_mutex); in ath11k_write_ps_state_enable()
1540 if (ar->ps_state_enable == ps_state_enable) { in ath11k_write_ps_state_enable()
1546 ret = ath11k_wmi_pdev_set_param(ar, param, ps_state_enable, pdev->pdev_id); in ath11k_write_ps_state_enable()
1548 ath11k_warn(ar->ab, "failed to enable ps_state_enable: %d\n", in ath11k_write_ps_state_enable()
1552 ar->ps_state_enable = ps_state_enable; in ath11k_write_ps_state_enable()
1554 if (!ar->ps_state_enable) { in ath11k_write_ps_state_enable()
1555 ar->ps_timekeeper_enable = false; in ath11k_write_ps_state_enable()
1556 ieee80211_iterate_stations_atomic(ar->hw, in ath11k_write_ps_state_enable()
1564 mutex_unlock(&ar->conf_mutex); in ath11k_write_ps_state_enable()
1573 struct ath11k *ar = file->private_data; in ath11k_read_ps_state_enable()
1577 mutex_lock(&ar->conf_mutex); in ath11k_read_ps_state_enable()
1578 len = scnprintf(buf, sizeof(buf), "%d\n", ar->ps_state_enable); in ath11k_read_ps_state_enable()
1579 mutex_unlock(&ar->conf_mutex); in ath11k_read_ps_state_enable()
1587 .open = simple_open,
1594 struct ath11k_base *ab = ar->ab; in ath11k_debugfs_register()
1598 snprintf(pdev_name, sizeof(pdev_name), "%s%u", "mac", ar->pdev_idx); in ath11k_debugfs_register()
1600 ar->debug.debugfs_pdev = debugfs_create_dir(pdev_name, ab->debugfs_soc); in ath11k_debugfs_register()
1601 if (IS_ERR(ar->debug.debugfs_pdev)) in ath11k_debugfs_register()
1602 return PTR_ERR(ar->debug.debugfs_pdev); in ath11k_debugfs_register()
1605 snprintf(buf, 100, "../../ath11k/%pd2", ar->debug.debugfs_pdev); in ath11k_debugfs_register()
1606 debugfs_create_symlink("ath11k", ar->hw->wiphy->debugfsdir, buf); in ath11k_debugfs_register()
1613 ar->debug.debugfs_pdev, ar, in ath11k_debugfs_register()
1616 ar->debug.debugfs_pdev, ar, in ath11k_debugfs_register()
1619 ar->debug.debugfs_pdev, ar, in ath11k_debugfs_register()
1622 ar->debug.debugfs_pdev, ar, in ath11k_debugfs_register()
1625 if (ar->hw->wiphy->bands[NL80211_BAND_5GHZ]) { in ath11k_debugfs_register()
1627 ar->debug.debugfs_pdev, ar, in ath11k_debugfs_register()
1630 ar->debug.debugfs_pdev, in ath11k_debugfs_register()
1631 &ar->dfs_block_radar_events); in ath11k_debugfs_register()
1634 if (ab->hw_params.dbr_debug_support) in ath11k_debugfs_register()
1635 debugfs_create_file("enable_dbr_debug", 0200, ar->debug.debugfs_pdev, in ath11k_debugfs_register()
1638 debugfs_create_file("ps_state_enable", 0600, ar->debug.debugfs_pdev, ar, in ath11k_debugfs_register()
1642 ar->ab->wmi_ab.svc_map)) { in ath11k_debugfs_register()
1644 ar->debug.debugfs_pdev, ar, in ath11k_debugfs_register()
1648 ar->debug.debugfs_pdev, ar, in ath11k_debugfs_register()
1662 dbr_debug = ar->debug.dbr_debug[i]; in ath11k_debugfs_unregister()
1666 dbr_dbg_data = &dbr_debug->dbr_dbg_data; in ath11k_debugfs_unregister()
1667 kfree(dbr_dbg_data->entries); in ath11k_debugfs_unregister()
1668 debugfs_remove_recursive(dbr_debug->dbr_debugfs); in ath11k_debugfs_unregister()
1670 ar->debug.dbr_debug[i] = NULL; in ath11k_debugfs_unregister()
1678 struct ath11k_vif *arvif = file->private_data; in ath11k_write_twt_add_dialog()
1681 struct ath11k *ar = arvif->ar; in ath11k_write_twt_add_dialog()
1685 if (ar->twt_enabled == 0) { in ath11k_write_twt_add_dialog()
1686 ath11k_err(ar->ab, "twt support is not enabled\n"); in ath11k_write_twt_add_dialog()
1687 return -EOPNOTSUPP; in ath11k_write_twt_add_dialog()
1690 ret = simple_write_to_buffer(buf, sizeof(buf) - 1, ppos, ubuf, count); in ath11k_write_twt_add_dialog()
1714 return -EINVAL; in ath11k_write_twt_add_dialog()
1717 * the firmware based on the input parameters in the TWT enable in ath11k_write_twt_add_dialog()
1723 if (arvif->vif->type == NL80211_IFTYPE_STATION) { in ath11k_write_twt_add_dialog()
1724 ath11k_wmi_send_twt_disable_cmd(ar, ar->pdev->pdev_id); in ath11k_write_twt_add_dialog()
1729 ath11k_wmi_send_twt_enable_cmd(ar, ar->pdev->pdev_id, &twt_params); in ath11k_write_twt_add_dialog()
1732 params.vdev_id = arvif->vdev_id; in ath11k_write_twt_add_dialog()
1734 ret = ath11k_wmi_send_twt_add_dialog_cmd(arvif->ar, &params); in ath11k_write_twt_add_dialog()
1741 if (arvif->vif->type == NL80211_IFTYPE_STATION) { in ath11k_write_twt_add_dialog()
1742 ath11k_wmi_send_twt_disable_cmd(ar, ar->pdev->pdev_id); in ath11k_write_twt_add_dialog()
1744 ath11k_wmi_send_twt_enable_cmd(ar, ar->pdev->pdev_id, &twt_params); in ath11k_write_twt_add_dialog()
1754 struct ath11k_vif *arvif = file->private_data; in ath11k_write_twt_del_dialog()
1757 struct ath11k *ar = arvif->ar; in ath11k_write_twt_del_dialog()
1761 if (ar->twt_enabled == 0) { in ath11k_write_twt_del_dialog()
1762 ath11k_err(ar->ab, "twt support is not enabled\n"); in ath11k_write_twt_del_dialog()
1763 return -EOPNOTSUPP; in ath11k_write_twt_del_dialog()
1766 ret = simple_write_to_buffer(buf, sizeof(buf) - 1, ppos, ubuf, count); in ath11k_write_twt_del_dialog()
1780 return -EINVAL; in ath11k_write_twt_del_dialog()
1782 params.vdev_id = arvif->vdev_id; in ath11k_write_twt_del_dialog()
1784 ret = ath11k_wmi_send_twt_del_dialog_cmd(arvif->ar, &params); in ath11k_write_twt_del_dialog()
1788 if (arvif->vif->type == NL80211_IFTYPE_STATION) { in ath11k_write_twt_del_dialog()
1789 ath11k_wmi_send_twt_disable_cmd(ar, ar->pdev->pdev_id); in ath11k_write_twt_del_dialog()
1791 ath11k_wmi_send_twt_enable_cmd(ar, ar->pdev->pdev_id, &twt_params); in ath11k_write_twt_del_dialog()
1801 struct ath11k_vif *arvif = file->private_data; in ath11k_write_twt_pause_dialog()
1806 if (arvif->ar->twt_enabled == 0) { in ath11k_write_twt_pause_dialog()
1807 ath11k_err(arvif->ar->ab, "twt support is not enabled\n"); in ath11k_write_twt_pause_dialog()
1808 return -EOPNOTSUPP; in ath11k_write_twt_pause_dialog()
1811 ret = simple_write_to_buffer(buf, sizeof(buf) - 1, ppos, ubuf, count); in ath11k_write_twt_pause_dialog()
1825 return -EINVAL; in ath11k_write_twt_pause_dialog()
1827 params.vdev_id = arvif->vdev_id; in ath11k_write_twt_pause_dialog()
1829 ret = ath11k_wmi_send_twt_pause_dialog_cmd(arvif->ar, &params); in ath11k_write_twt_pause_dialog()
1840 struct ath11k_vif *arvif = file->private_data; in ath11k_write_twt_resume_dialog()
1845 if (arvif->ar->twt_enabled == 0) { in ath11k_write_twt_resume_dialog()
1846 ath11k_err(arvif->ar->ab, "twt support is not enabled\n"); in ath11k_write_twt_resume_dialog()
1847 return -EOPNOTSUPP; in ath11k_write_twt_resume_dialog()
1850 ret = simple_write_to_buffer(buf, sizeof(buf) - 1, ppos, ubuf, count); in ath11k_write_twt_resume_dialog()
1866 return -EINVAL; in ath11k_write_twt_resume_dialog()
1868 params.vdev_id = arvif->vdev_id; in ath11k_write_twt_resume_dialog()
1870 ret = ath11k_wmi_send_twt_resume_dialog_cmd(arvif->ar, &params); in ath11k_write_twt_resume_dialog()
1879 .open = simple_open
1884 .open = simple_open
1889 .open = simple_open
1894 .open = simple_open
1901 struct ath11k_base *ab = arvif->ar->ab; in ath11k_debugfs_op_vif_add()
1904 if (arvif->vif->type != NL80211_IFTYPE_AP && in ath11k_debugfs_op_vif_add()
1905 !(arvif->vif->type == NL80211_IFTYPE_STATION && in ath11k_debugfs_op_vif_add()
1906 test_bit(WMI_TLV_SERVICE_STA_TWT, ab->wmi_ab.svc_map))) in ath11k_debugfs_op_vif_add()
1910 arvif->vif->debugfs_dir); in ath11k_debugfs_op_vif_add()