1 // SPDX-License-Identifier: GPL-2.0-only 2 /* 3 * This file is part of wl12xx 4 * 5 * Copyright (C) 2009 Nokia Corporation 6 * Copyright (C) 2011-2012 Texas Instruments 7 */ 8 9 #include "../wlcore/debugfs.h" 10 #include "../wlcore/wlcore.h" 11 12 #include "wl12xx.h" 13 #include "acx.h" 14 #include "debugfs.h" 15 16 #define WL12XX_DEBUGFS_FWSTATS_FILE(a, b, c) \ 17 DEBUGFS_FWSTATS_FILE(a, b, c, wl12xx_acx_statistics) 18 19 WL12XX_DEBUGFS_FWSTATS_FILE(tx, internal_desc_overflow, "%u"); 20 21 WL12XX_DEBUGFS_FWSTATS_FILE(rx, out_of_mem, "%u"); 22 WL12XX_DEBUGFS_FWSTATS_FILE(rx, hdr_overflow, "%u"); 23 WL12XX_DEBUGFS_FWSTATS_FILE(rx, hw_stuck, "%u"); 24 WL12XX_DEBUGFS_FWSTATS_FILE(rx, dropped, "%u"); 25 WL12XX_DEBUGFS_FWSTATS_FILE(rx, fcs_err, "%u"); 26 WL12XX_DEBUGFS_FWSTATS_FILE(rx, xfr_hint_trig, "%u"); 27 WL12XX_DEBUGFS_FWSTATS_FILE(rx, path_reset, "%u"); 28 WL12XX_DEBUGFS_FWSTATS_FILE(rx, reset_counter, "%u"); 29 30 WL12XX_DEBUGFS_FWSTATS_FILE(dma, rx_requested, "%u"); 31 WL12XX_DEBUGFS_FWSTATS_FILE(dma, rx_errors, "%u"); 32 WL12XX_DEBUGFS_FWSTATS_FILE(dma, tx_requested, "%u"); 33 WL12XX_DEBUGFS_FWSTATS_FILE(dma, tx_errors, "%u"); 34 35 WL12XX_DEBUGFS_FWSTATS_FILE(isr, cmd_cmplt, "%u"); 36 WL12XX_DEBUGFS_FWSTATS_FILE(isr, fiqs, "%u"); 37 WL12XX_DEBUGFS_FWSTATS_FILE(isr, rx_headers, "%u"); 38 WL12XX_DEBUGFS_FWSTATS_FILE(isr, rx_mem_overflow, "%u"); 39 WL12XX_DEBUGFS_FWSTATS_FILE(isr, rx_rdys, "%u"); 40 WL12XX_DEBUGFS_FWSTATS_FILE(isr, irqs, "%u"); 41 WL12XX_DEBUGFS_FWSTATS_FILE(isr, tx_procs, "%u"); 42 WL12XX_DEBUGFS_FWSTATS_FILE(isr, decrypt_done, "%u"); 43 WL12XX_DEBUGFS_FWSTATS_FILE(isr, dma0_done, "%u"); 44 WL12XX_DEBUGFS_FWSTATS_FILE(isr, dma1_done, "%u"); 45 WL12XX_DEBUGFS_FWSTATS_FILE(isr, tx_exch_complete, "%u"); 46 WL12XX_DEBUGFS_FWSTATS_FILE(isr, commands, "%u"); 47 WL12XX_DEBUGFS_FWSTATS_FILE(isr, rx_procs, "%u"); 48 WL12XX_DEBUGFS_FWSTATS_FILE(isr, hw_pm_mode_changes, "%u"); 49 WL12XX_DEBUGFS_FWSTATS_FILE(isr, host_acknowledges, "%u"); 50 WL12XX_DEBUGFS_FWSTATS_FILE(isr, pci_pm, "%u"); 51 WL12XX_DEBUGFS_FWSTATS_FILE(isr, wakeups, "%u"); 52 WL12XX_DEBUGFS_FWSTATS_FILE(isr, low_rssi, "%u"); 53 54 WL12XX_DEBUGFS_FWSTATS_FILE(wep, addr_key_count, "%u"); 55 WL12XX_DEBUGFS_FWSTATS_FILE(wep, default_key_count, "%u"); 56 /* skipping wep.reserved */ 57 WL12XX_DEBUGFS_FWSTATS_FILE(wep, key_not_found, "%u"); 58 WL12XX_DEBUGFS_FWSTATS_FILE(wep, decrypt_fail, "%u"); 59 WL12XX_DEBUGFS_FWSTATS_FILE(wep, packets, "%u"); 60 WL12XX_DEBUGFS_FWSTATS_FILE(wep, interrupt, "%u"); 61 62 WL12XX_DEBUGFS_FWSTATS_FILE(pwr, ps_enter, "%u"); 63 WL12XX_DEBUGFS_FWSTATS_FILE(pwr, elp_enter, "%u"); 64 WL12XX_DEBUGFS_FWSTATS_FILE(pwr, missing_bcns, "%u"); 65 WL12XX_DEBUGFS_FWSTATS_FILE(pwr, wake_on_host, "%u"); 66 WL12XX_DEBUGFS_FWSTATS_FILE(pwr, wake_on_timer_exp, "%u"); 67 WL12XX_DEBUGFS_FWSTATS_FILE(pwr, tx_with_ps, "%u"); 68 WL12XX_DEBUGFS_FWSTATS_FILE(pwr, tx_without_ps, "%u"); 69 WL12XX_DEBUGFS_FWSTATS_FILE(pwr, rcvd_beacons, "%u"); 70 WL12XX_DEBUGFS_FWSTATS_FILE(pwr, power_save_off, "%u"); 71 WL12XX_DEBUGFS_FWSTATS_FILE(pwr, enable_ps, "%u"); 72 WL12XX_DEBUGFS_FWSTATS_FILE(pwr, disable_ps, "%u"); 73 WL12XX_DEBUGFS_FWSTATS_FILE(pwr, fix_tsf_ps, "%u"); 74 /* skipping cont_miss_bcns_spread for now */ 75 WL12XX_DEBUGFS_FWSTATS_FILE(pwr, rcvd_awake_beacons, "%u"); 76 77 WL12XX_DEBUGFS_FWSTATS_FILE(mic, rx_pkts, "%u"); 78 WL12XX_DEBUGFS_FWSTATS_FILE(mic, calc_failure, "%u"); 79 80 WL12XX_DEBUGFS_FWSTATS_FILE(aes, encrypt_fail, "%u"); 81 WL12XX_DEBUGFS_FWSTATS_FILE(aes, decrypt_fail, "%u"); 82 WL12XX_DEBUGFS_FWSTATS_FILE(aes, encrypt_packets, "%u"); 83 WL12XX_DEBUGFS_FWSTATS_FILE(aes, decrypt_packets, "%u"); 84 WL12XX_DEBUGFS_FWSTATS_FILE(aes, encrypt_interrupt, "%u"); 85 WL12XX_DEBUGFS_FWSTATS_FILE(aes, decrypt_interrupt, "%u"); 86 87 WL12XX_DEBUGFS_FWSTATS_FILE(event, heart_beat, "%u"); 88 WL12XX_DEBUGFS_FWSTATS_FILE(event, calibration, "%u"); 89 WL12XX_DEBUGFS_FWSTATS_FILE(event, rx_mismatch, "%u"); 90 WL12XX_DEBUGFS_FWSTATS_FILE(event, rx_mem_empty, "%u"); 91 WL12XX_DEBUGFS_FWSTATS_FILE(event, rx_pool, "%u"); 92 WL12XX_DEBUGFS_FWSTATS_FILE(event, oom_late, "%u"); 93 WL12XX_DEBUGFS_FWSTATS_FILE(event, phy_transmit_error, "%u"); 94 WL12XX_DEBUGFS_FWSTATS_FILE(event, tx_stuck, "%u"); 95 96 WL12XX_DEBUGFS_FWSTATS_FILE(ps, pspoll_timeouts, "%u"); 97 WL12XX_DEBUGFS_FWSTATS_FILE(ps, upsd_timeouts, "%u"); 98 WL12XX_DEBUGFS_FWSTATS_FILE(ps, upsd_max_sptime, "%u"); 99 WL12XX_DEBUGFS_FWSTATS_FILE(ps, upsd_max_apturn, "%u"); 100 WL12XX_DEBUGFS_FWSTATS_FILE(ps, pspoll_max_apturn, "%u"); 101 WL12XX_DEBUGFS_FWSTATS_FILE(ps, pspoll_utilization, "%u"); 102 WL12XX_DEBUGFS_FWSTATS_FILE(ps, upsd_utilization, "%u"); 103 104 WL12XX_DEBUGFS_FWSTATS_FILE(rxpipe, rx_prep_beacon_drop, "%u"); 105 WL12XX_DEBUGFS_FWSTATS_FILE(rxpipe, descr_host_int_trig_rx_data, "%u"); 106 WL12XX_DEBUGFS_FWSTATS_FILE(rxpipe, beacon_buffer_thres_host_int_trig_rx_data, 107 "%u"); 108 WL12XX_DEBUGFS_FWSTATS_FILE(rxpipe, missed_beacon_host_int_trig_rx_data, "%u"); 109 WL12XX_DEBUGFS_FWSTATS_FILE(rxpipe, tx_xfr_host_int_trig_rx_data, "%u"); 110 111 int wl12xx_debugfs_add_files(struct wl1271 *wl, 112 struct dentry *rootdir) 113 { 114 struct dentry *stats, *moddir; 115 116 moddir = debugfs_create_dir(KBUILD_MODNAME, rootdir); 117 stats = debugfs_create_dir("fw_stats", moddir); 118 119 DEBUGFS_FWSTATS_ADD(tx, internal_desc_overflow); 120 121 DEBUGFS_FWSTATS_ADD(rx, out_of_mem); 122 DEBUGFS_FWSTATS_ADD(rx, hdr_overflow); 123 DEBUGFS_FWSTATS_ADD(rx, hw_stuck); 124 DEBUGFS_FWSTATS_ADD(rx, dropped); 125 DEBUGFS_FWSTATS_ADD(rx, fcs_err); 126 DEBUGFS_FWSTATS_ADD(rx, xfr_hint_trig); 127 DEBUGFS_FWSTATS_ADD(rx, path_reset); 128 DEBUGFS_FWSTATS_ADD(rx, reset_counter); 129 130 DEBUGFS_FWSTATS_ADD(dma, rx_requested); 131 DEBUGFS_FWSTATS_ADD(dma, rx_errors); 132 DEBUGFS_FWSTATS_ADD(dma, tx_requested); 133 DEBUGFS_FWSTATS_ADD(dma, tx_errors); 134 135 DEBUGFS_FWSTATS_ADD(isr, cmd_cmplt); 136 DEBUGFS_FWSTATS_ADD(isr, fiqs); 137 DEBUGFS_FWSTATS_ADD(isr, rx_headers); 138 DEBUGFS_FWSTATS_ADD(isr, rx_mem_overflow); 139 DEBUGFS_FWSTATS_ADD(isr, rx_rdys); 140 DEBUGFS_FWSTATS_ADD(isr, irqs); 141 DEBUGFS_FWSTATS_ADD(isr, tx_procs); 142 DEBUGFS_FWSTATS_ADD(isr, decrypt_done); 143 DEBUGFS_FWSTATS_ADD(isr, dma0_done); 144 DEBUGFS_FWSTATS_ADD(isr, dma1_done); 145 DEBUGFS_FWSTATS_ADD(isr, tx_exch_complete); 146 DEBUGFS_FWSTATS_ADD(isr, commands); 147 DEBUGFS_FWSTATS_ADD(isr, rx_procs); 148 DEBUGFS_FWSTATS_ADD(isr, hw_pm_mode_changes); 149 DEBUGFS_FWSTATS_ADD(isr, host_acknowledges); 150 DEBUGFS_FWSTATS_ADD(isr, pci_pm); 151 DEBUGFS_FWSTATS_ADD(isr, wakeups); 152 DEBUGFS_FWSTATS_ADD(isr, low_rssi); 153 154 DEBUGFS_FWSTATS_ADD(wep, addr_key_count); 155 DEBUGFS_FWSTATS_ADD(wep, default_key_count); 156 /* skipping wep.reserved */ 157 DEBUGFS_FWSTATS_ADD(wep, key_not_found); 158 DEBUGFS_FWSTATS_ADD(wep, decrypt_fail); 159 DEBUGFS_FWSTATS_ADD(wep, packets); 160 DEBUGFS_FWSTATS_ADD(wep, interrupt); 161 162 DEBUGFS_FWSTATS_ADD(pwr, ps_enter); 163 DEBUGFS_FWSTATS_ADD(pwr, elp_enter); 164 DEBUGFS_FWSTATS_ADD(pwr, missing_bcns); 165 DEBUGFS_FWSTATS_ADD(pwr, wake_on_host); 166 DEBUGFS_FWSTATS_ADD(pwr, wake_on_timer_exp); 167 DEBUGFS_FWSTATS_ADD(pwr, tx_with_ps); 168 DEBUGFS_FWSTATS_ADD(pwr, tx_without_ps); 169 DEBUGFS_FWSTATS_ADD(pwr, rcvd_beacons); 170 DEBUGFS_FWSTATS_ADD(pwr, power_save_off); 171 DEBUGFS_FWSTATS_ADD(pwr, enable_ps); 172 DEBUGFS_FWSTATS_ADD(pwr, disable_ps); 173 DEBUGFS_FWSTATS_ADD(pwr, fix_tsf_ps); 174 /* skipping cont_miss_bcns_spread for now */ 175 DEBUGFS_FWSTATS_ADD(pwr, rcvd_awake_beacons); 176 177 DEBUGFS_FWSTATS_ADD(mic, rx_pkts); 178 DEBUGFS_FWSTATS_ADD(mic, calc_failure); 179 180 DEBUGFS_FWSTATS_ADD(aes, encrypt_fail); 181 DEBUGFS_FWSTATS_ADD(aes, decrypt_fail); 182 DEBUGFS_FWSTATS_ADD(aes, encrypt_packets); 183 DEBUGFS_FWSTATS_ADD(aes, decrypt_packets); 184 DEBUGFS_FWSTATS_ADD(aes, encrypt_interrupt); 185 DEBUGFS_FWSTATS_ADD(aes, decrypt_interrupt); 186 187 DEBUGFS_FWSTATS_ADD(event, heart_beat); 188 DEBUGFS_FWSTATS_ADD(event, calibration); 189 DEBUGFS_FWSTATS_ADD(event, rx_mismatch); 190 DEBUGFS_FWSTATS_ADD(event, rx_mem_empty); 191 DEBUGFS_FWSTATS_ADD(event, rx_pool); 192 DEBUGFS_FWSTATS_ADD(event, oom_late); 193 DEBUGFS_FWSTATS_ADD(event, phy_transmit_error); 194 DEBUGFS_FWSTATS_ADD(event, tx_stuck); 195 196 DEBUGFS_FWSTATS_ADD(ps, pspoll_timeouts); 197 DEBUGFS_FWSTATS_ADD(ps, upsd_timeouts); 198 DEBUGFS_FWSTATS_ADD(ps, upsd_max_sptime); 199 DEBUGFS_FWSTATS_ADD(ps, upsd_max_apturn); 200 DEBUGFS_FWSTATS_ADD(ps, pspoll_max_apturn); 201 DEBUGFS_FWSTATS_ADD(ps, pspoll_utilization); 202 DEBUGFS_FWSTATS_ADD(ps, upsd_utilization); 203 204 DEBUGFS_FWSTATS_ADD(rxpipe, rx_prep_beacon_drop); 205 DEBUGFS_FWSTATS_ADD(rxpipe, descr_host_int_trig_rx_data); 206 DEBUGFS_FWSTATS_ADD(rxpipe, beacon_buffer_thres_host_int_trig_rx_data); 207 DEBUGFS_FWSTATS_ADD(rxpipe, missed_beacon_host_int_trig_rx_data); 208 DEBUGFS_FWSTATS_ADD(rxpipe, tx_xfr_host_int_trig_rx_data); 209 210 return 0; 211 } 212