Wey-Yi Guy | 4bc85c1 | 2011-02-21 11:11:05 -0800 | [diff] [blame] | 1 | /****************************************************************************** |
| 2 | * |
| 3 | * GPL LICENSE SUMMARY |
| 4 | * |
Wey-Yi Guy | be663ab | 2011-02-21 11:27:26 -0800 | [diff] [blame] | 5 | * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved. |
Wey-Yi Guy | 4bc85c1 | 2011-02-21 11:11:05 -0800 | [diff] [blame] | 6 | * |
| 7 | * This program is free software; you can redistribute it and/or modify |
| 8 | * it under the terms of version 2 of the GNU General Public License as |
| 9 | * published by the Free Software Foundation. |
| 10 | * |
| 11 | * This program is distributed in the hope that it will be useful, but |
| 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 14 | * General Public License for more details. |
| 15 | * |
| 16 | * You should have received a copy of the GNU General Public License |
| 17 | * along with this program; if not, write to the Free Software |
| 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, |
| 19 | * USA |
| 20 | * |
| 21 | * The full GNU General Public License is included in this distribution |
| 22 | * in the file called LICENSE.GPL. |
| 23 | * |
| 24 | * Contact Information: |
| 25 | * Intel Linux Wireless <ilw@linux.intel.com> |
| 26 | * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 |
| 27 | *****************************************************************************/ |
| 28 | |
Stanislaw Gruszka | 6bbb137 | 2011-08-30 14:12:12 +0200 | [diff] [blame^] | 29 | #include "iwl-dev.h" |
| 30 | #include "iwl-core.h" |
| 31 | #include "3945.h" |
Wey-Yi Guy | 4bc85c1 | 2011-02-21 11:11:05 -0800 | [diff] [blame] | 32 | |
Stanislaw Gruszka | ebf0d90 | 2011-08-26 15:43:47 +0200 | [diff] [blame] | 33 | static int il3945_stats_flag(struct il_priv *il, char *buf, int bufsz) |
Wey-Yi Guy | 4bc85c1 | 2011-02-21 11:11:05 -0800 | [diff] [blame] | 34 | { |
| 35 | int p = 0; |
| 36 | |
| 37 | p += scnprintf(buf + p, bufsz - p, "Statistics Flag(0x%X):\n", |
Stanislaw Gruszka | ebf0d90 | 2011-08-26 15:43:47 +0200 | [diff] [blame] | 38 | le32_to_cpu(il->_3945.stats.flag)); |
| 39 | if (le32_to_cpu(il->_3945.stats.flag) & |
Wey-Yi Guy | 4bc85c1 | 2011-02-21 11:11:05 -0800 | [diff] [blame] | 40 | UCODE_STATISTICS_CLEAR_MSK) |
| 41 | p += scnprintf(buf + p, bufsz - p, |
| 42 | "\tStatistics have been cleared\n"); |
| 43 | p += scnprintf(buf + p, bufsz - p, "\tOperational Frequency: %s\n", |
Stanislaw Gruszka | ebf0d90 | 2011-08-26 15:43:47 +0200 | [diff] [blame] | 44 | (le32_to_cpu(il->_3945.stats.flag) & |
Wey-Yi Guy | 4bc85c1 | 2011-02-21 11:11:05 -0800 | [diff] [blame] | 45 | UCODE_STATISTICS_FREQUENCY_MSK) |
| 46 | ? "2.4 GHz" : "5.2 GHz"); |
| 47 | p += scnprintf(buf + p, bufsz - p, "\tTGj Narrow Band: %s\n", |
Stanislaw Gruszka | ebf0d90 | 2011-08-26 15:43:47 +0200 | [diff] [blame] | 48 | (le32_to_cpu(il->_3945.stats.flag) & |
Wey-Yi Guy | 4bc85c1 | 2011-02-21 11:11:05 -0800 | [diff] [blame] | 49 | UCODE_STATISTICS_NARROW_BAND_MSK) |
| 50 | ? "enabled" : "disabled"); |
| 51 | return p; |
| 52 | } |
| 53 | |
Stanislaw Gruszka | e2ebc83 | 2011-10-24 15:41:30 +0200 | [diff] [blame] | 54 | ssize_t il3945_ucode_rx_stats_read(struct file *file, |
Wey-Yi Guy | 4bc85c1 | 2011-02-21 11:11:05 -0800 | [diff] [blame] | 55 | char __user *user_buf, |
| 56 | size_t count, loff_t *ppos) |
| 57 | { |
Stanislaw Gruszka | 46bc8d4 | 2011-10-24 16:49:25 +0200 | [diff] [blame] | 58 | struct il_priv *il = file->private_data; |
Wey-Yi Guy | 4bc85c1 | 2011-02-21 11:11:05 -0800 | [diff] [blame] | 59 | int pos = 0; |
| 60 | char *buf; |
Stanislaw Gruszka | ebf0d90 | 2011-08-26 15:43:47 +0200 | [diff] [blame] | 61 | int bufsz = sizeof(struct iwl39_stats_rx_phy) * 40 + |
| 62 | sizeof(struct iwl39_stats_rx_non_phy) * 40 + 400; |
Wey-Yi Guy | 4bc85c1 | 2011-02-21 11:11:05 -0800 | [diff] [blame] | 63 | ssize_t ret; |
Stanislaw Gruszka | ebf0d90 | 2011-08-26 15:43:47 +0200 | [diff] [blame] | 64 | struct iwl39_stats_rx_phy *ofdm, *accum_ofdm, *delta_ofdm, |
Wey-Yi Guy | be663ab | 2011-02-21 11:27:26 -0800 | [diff] [blame] | 65 | *max_ofdm; |
Stanislaw Gruszka | ebf0d90 | 2011-08-26 15:43:47 +0200 | [diff] [blame] | 66 | struct iwl39_stats_rx_phy *cck, *accum_cck, *delta_cck, *max_cck; |
| 67 | struct iwl39_stats_rx_non_phy *general, *accum_general; |
| 68 | struct iwl39_stats_rx_non_phy *delta_general, *max_general; |
Wey-Yi Guy | 4bc85c1 | 2011-02-21 11:11:05 -0800 | [diff] [blame] | 69 | |
Stanislaw Gruszka | 46bc8d4 | 2011-10-24 16:49:25 +0200 | [diff] [blame] | 70 | if (!il_is_alive(il)) |
Wey-Yi Guy | 4bc85c1 | 2011-02-21 11:11:05 -0800 | [diff] [blame] | 71 | return -EAGAIN; |
| 72 | |
| 73 | buf = kzalloc(bufsz, GFP_KERNEL); |
| 74 | if (!buf) { |
Stanislaw Gruszka | 9406f79 | 2011-08-18 22:07:57 +0200 | [diff] [blame] | 75 | IL_ERR("Can not allocate Buffer\n"); |
Wey-Yi Guy | 4bc85c1 | 2011-02-21 11:11:05 -0800 | [diff] [blame] | 76 | return -ENOMEM; |
| 77 | } |
| 78 | |
| 79 | /* |
| 80 | * The statistic information display here is based on |
Stanislaw Gruszka | ebf0d90 | 2011-08-26 15:43:47 +0200 | [diff] [blame] | 81 | * the last stats notification from uCode |
Wey-Yi Guy | 4bc85c1 | 2011-02-21 11:11:05 -0800 | [diff] [blame] | 82 | * might not reflect the current uCode activity |
| 83 | */ |
Stanislaw Gruszka | ebf0d90 | 2011-08-26 15:43:47 +0200 | [diff] [blame] | 84 | ofdm = &il->_3945.stats.rx.ofdm; |
| 85 | cck = &il->_3945.stats.rx.cck; |
| 86 | general = &il->_3945.stats.rx.general; |
| 87 | accum_ofdm = &il->_3945.accum_stats.rx.ofdm; |
| 88 | accum_cck = &il->_3945.accum_stats.rx.cck; |
| 89 | accum_general = &il->_3945.accum_stats.rx.general; |
| 90 | delta_ofdm = &il->_3945.delta_stats.rx.ofdm; |
| 91 | delta_cck = &il->_3945.delta_stats.rx.cck; |
| 92 | delta_general = &il->_3945.delta_stats.rx.general; |
Stanislaw Gruszka | 46bc8d4 | 2011-10-24 16:49:25 +0200 | [diff] [blame] | 93 | max_ofdm = &il->_3945.max_delta.rx.ofdm; |
| 94 | max_cck = &il->_3945.max_delta.rx.cck; |
| 95 | max_general = &il->_3945.max_delta.rx.general; |
Wey-Yi Guy | 4bc85c1 | 2011-02-21 11:11:05 -0800 | [diff] [blame] | 96 | |
Stanislaw Gruszka | ebf0d90 | 2011-08-26 15:43:47 +0200 | [diff] [blame] | 97 | pos += il3945_stats_flag(il, buf, bufsz); |
Wey-Yi Guy | 4bc85c1 | 2011-02-21 11:11:05 -0800 | [diff] [blame] | 98 | pos += scnprintf(buf + pos, bufsz - pos, "%-32s current" |
| 99 | "acumulative delta max\n", |
| 100 | "Statistics_Rx - OFDM:"); |
| 101 | pos += scnprintf(buf + pos, bufsz - pos, |
| 102 | " %-30s %10u %10u %10u %10u\n", |
| 103 | "ina_cnt:", le32_to_cpu(ofdm->ina_cnt), |
| 104 | accum_ofdm->ina_cnt, |
| 105 | delta_ofdm->ina_cnt, max_ofdm->ina_cnt); |
| 106 | pos += scnprintf(buf + pos, bufsz - pos, |
| 107 | " %-30s %10u %10u %10u %10u\n", |
| 108 | "fina_cnt:", |
| 109 | le32_to_cpu(ofdm->fina_cnt), accum_ofdm->fina_cnt, |
| 110 | delta_ofdm->fina_cnt, max_ofdm->fina_cnt); |
| 111 | pos += scnprintf(buf + pos, bufsz - pos, |
| 112 | " %-30s %10u %10u %10u %10u\n", "plcp_err:", |
| 113 | le32_to_cpu(ofdm->plcp_err), accum_ofdm->plcp_err, |
| 114 | delta_ofdm->plcp_err, max_ofdm->plcp_err); |
| 115 | pos += scnprintf(buf + pos, bufsz - pos, |
| 116 | " %-30s %10u %10u %10u %10u\n", "crc32_err:", |
| 117 | le32_to_cpu(ofdm->crc32_err), accum_ofdm->crc32_err, |
| 118 | delta_ofdm->crc32_err, max_ofdm->crc32_err); |
| 119 | pos += scnprintf(buf + pos, bufsz - pos, |
| 120 | " %-30s %10u %10u %10u %10u\n", "overrun_err:", |
| 121 | le32_to_cpu(ofdm->overrun_err), |
| 122 | accum_ofdm->overrun_err, delta_ofdm->overrun_err, |
| 123 | max_ofdm->overrun_err); |
| 124 | pos += scnprintf(buf + pos, bufsz - pos, |
| 125 | " %-30s %10u %10u %10u %10u\n", |
| 126 | "early_overrun_err:", |
| 127 | le32_to_cpu(ofdm->early_overrun_err), |
| 128 | accum_ofdm->early_overrun_err, |
| 129 | delta_ofdm->early_overrun_err, |
| 130 | max_ofdm->early_overrun_err); |
| 131 | pos += scnprintf(buf + pos, bufsz - pos, |
| 132 | " %-30s %10u %10u %10u %10u\n", |
| 133 | "crc32_good:", le32_to_cpu(ofdm->crc32_good), |
| 134 | accum_ofdm->crc32_good, delta_ofdm->crc32_good, |
| 135 | max_ofdm->crc32_good); |
| 136 | pos += scnprintf(buf + pos, bufsz - pos, |
| 137 | " %-30s %10u %10u %10u %10u\n", "false_alarm_cnt:", |
| 138 | le32_to_cpu(ofdm->false_alarm_cnt), |
| 139 | accum_ofdm->false_alarm_cnt, |
| 140 | delta_ofdm->false_alarm_cnt, |
| 141 | max_ofdm->false_alarm_cnt); |
| 142 | pos += scnprintf(buf + pos, bufsz - pos, |
| 143 | " %-30s %10u %10u %10u %10u\n", |
| 144 | "fina_sync_err_cnt:", |
| 145 | le32_to_cpu(ofdm->fina_sync_err_cnt), |
| 146 | accum_ofdm->fina_sync_err_cnt, |
| 147 | delta_ofdm->fina_sync_err_cnt, |
| 148 | max_ofdm->fina_sync_err_cnt); |
| 149 | pos += scnprintf(buf + pos, bufsz - pos, |
| 150 | " %-30s %10u %10u %10u %10u\n", |
| 151 | "sfd_timeout:", |
| 152 | le32_to_cpu(ofdm->sfd_timeout), |
| 153 | accum_ofdm->sfd_timeout, |
| 154 | delta_ofdm->sfd_timeout, |
| 155 | max_ofdm->sfd_timeout); |
| 156 | pos += scnprintf(buf + pos, bufsz - pos, |
| 157 | " %-30s %10u %10u %10u %10u\n", |
| 158 | "fina_timeout:", |
| 159 | le32_to_cpu(ofdm->fina_timeout), |
| 160 | accum_ofdm->fina_timeout, |
| 161 | delta_ofdm->fina_timeout, |
| 162 | max_ofdm->fina_timeout); |
| 163 | pos += scnprintf(buf + pos, bufsz - pos, |
| 164 | " %-30s %10u %10u %10u %10u\n", |
| 165 | "unresponded_rts:", |
| 166 | le32_to_cpu(ofdm->unresponded_rts), |
| 167 | accum_ofdm->unresponded_rts, |
| 168 | delta_ofdm->unresponded_rts, |
| 169 | max_ofdm->unresponded_rts); |
| 170 | pos += scnprintf(buf + pos, bufsz - pos, |
| 171 | " %-30s %10u %10u %10u %10u\n", |
| 172 | "rxe_frame_lmt_ovrun:", |
| 173 | le32_to_cpu(ofdm->rxe_frame_limit_overrun), |
| 174 | accum_ofdm->rxe_frame_limit_overrun, |
| 175 | delta_ofdm->rxe_frame_limit_overrun, |
| 176 | max_ofdm->rxe_frame_limit_overrun); |
| 177 | pos += scnprintf(buf + pos, bufsz - pos, |
| 178 | " %-30s %10u %10u %10u %10u\n", |
| 179 | "sent_ack_cnt:", |
| 180 | le32_to_cpu(ofdm->sent_ack_cnt), |
| 181 | accum_ofdm->sent_ack_cnt, |
| 182 | delta_ofdm->sent_ack_cnt, |
| 183 | max_ofdm->sent_ack_cnt); |
| 184 | pos += scnprintf(buf + pos, bufsz - pos, |
| 185 | " %-30s %10u %10u %10u %10u\n", |
| 186 | "sent_cts_cnt:", |
| 187 | le32_to_cpu(ofdm->sent_cts_cnt), |
| 188 | accum_ofdm->sent_cts_cnt, |
| 189 | delta_ofdm->sent_cts_cnt, max_ofdm->sent_cts_cnt); |
| 190 | |
| 191 | pos += scnprintf(buf + pos, bufsz - pos, "%-32s current" |
| 192 | "acumulative delta max\n", |
| 193 | "Statistics_Rx - CCK:"); |
| 194 | pos += scnprintf(buf + pos, bufsz - pos, |
| 195 | " %-30s %10u %10u %10u %10u\n", |
| 196 | "ina_cnt:", |
| 197 | le32_to_cpu(cck->ina_cnt), accum_cck->ina_cnt, |
| 198 | delta_cck->ina_cnt, max_cck->ina_cnt); |
| 199 | pos += scnprintf(buf + pos, bufsz - pos, |
| 200 | " %-30s %10u %10u %10u %10u\n", |
| 201 | "fina_cnt:", |
| 202 | le32_to_cpu(cck->fina_cnt), accum_cck->fina_cnt, |
| 203 | delta_cck->fina_cnt, max_cck->fina_cnt); |
| 204 | pos += scnprintf(buf + pos, bufsz - pos, |
| 205 | " %-30s %10u %10u %10u %10u\n", |
| 206 | "plcp_err:", |
| 207 | le32_to_cpu(cck->plcp_err), accum_cck->plcp_err, |
| 208 | delta_cck->plcp_err, max_cck->plcp_err); |
| 209 | pos += scnprintf(buf + pos, bufsz - pos, |
| 210 | " %-30s %10u %10u %10u %10u\n", |
| 211 | "crc32_err:", |
| 212 | le32_to_cpu(cck->crc32_err), accum_cck->crc32_err, |
| 213 | delta_cck->crc32_err, max_cck->crc32_err); |
| 214 | pos += scnprintf(buf + pos, bufsz - pos, |
| 215 | " %-30s %10u %10u %10u %10u\n", |
| 216 | "overrun_err:", |
| 217 | le32_to_cpu(cck->overrun_err), |
| 218 | accum_cck->overrun_err, |
| 219 | delta_cck->overrun_err, max_cck->overrun_err); |
| 220 | pos += scnprintf(buf + pos, bufsz - pos, |
| 221 | " %-30s %10u %10u %10u %10u\n", |
| 222 | "early_overrun_err:", |
| 223 | le32_to_cpu(cck->early_overrun_err), |
| 224 | accum_cck->early_overrun_err, |
| 225 | delta_cck->early_overrun_err, |
| 226 | max_cck->early_overrun_err); |
| 227 | pos += scnprintf(buf + pos, bufsz - pos, |
| 228 | " %-30s %10u %10u %10u %10u\n", |
| 229 | "crc32_good:", |
| 230 | le32_to_cpu(cck->crc32_good), accum_cck->crc32_good, |
| 231 | delta_cck->crc32_good, |
| 232 | max_cck->crc32_good); |
| 233 | pos += scnprintf(buf + pos, bufsz - pos, |
| 234 | " %-30s %10u %10u %10u %10u\n", |
| 235 | "false_alarm_cnt:", |
| 236 | le32_to_cpu(cck->false_alarm_cnt), |
| 237 | accum_cck->false_alarm_cnt, |
| 238 | delta_cck->false_alarm_cnt, max_cck->false_alarm_cnt); |
| 239 | pos += scnprintf(buf + pos, bufsz - pos, |
| 240 | " %-30s %10u %10u %10u %10u\n", |
| 241 | "fina_sync_err_cnt:", |
| 242 | le32_to_cpu(cck->fina_sync_err_cnt), |
| 243 | accum_cck->fina_sync_err_cnt, |
| 244 | delta_cck->fina_sync_err_cnt, |
| 245 | max_cck->fina_sync_err_cnt); |
| 246 | pos += scnprintf(buf + pos, bufsz - pos, |
| 247 | " %-30s %10u %10u %10u %10u\n", |
| 248 | "sfd_timeout:", |
| 249 | le32_to_cpu(cck->sfd_timeout), |
| 250 | accum_cck->sfd_timeout, |
| 251 | delta_cck->sfd_timeout, max_cck->sfd_timeout); |
| 252 | pos += scnprintf(buf + pos, bufsz - pos, |
| 253 | " %-30s %10u %10u %10u %10u\n", |
| 254 | "fina_timeout:", |
| 255 | le32_to_cpu(cck->fina_timeout), |
| 256 | accum_cck->fina_timeout, |
| 257 | delta_cck->fina_timeout, max_cck->fina_timeout); |
| 258 | pos += scnprintf(buf + pos, bufsz - pos, |
| 259 | " %-30s %10u %10u %10u %10u\n", |
| 260 | "unresponded_rts:", |
| 261 | le32_to_cpu(cck->unresponded_rts), |
| 262 | accum_cck->unresponded_rts, |
| 263 | delta_cck->unresponded_rts, |
| 264 | max_cck->unresponded_rts); |
| 265 | pos += scnprintf(buf + pos, bufsz - pos, |
| 266 | " %-30s %10u %10u %10u %10u\n", |
| 267 | "rxe_frame_lmt_ovrun:", |
| 268 | le32_to_cpu(cck->rxe_frame_limit_overrun), |
| 269 | accum_cck->rxe_frame_limit_overrun, |
| 270 | delta_cck->rxe_frame_limit_overrun, |
| 271 | max_cck->rxe_frame_limit_overrun); |
| 272 | pos += scnprintf(buf + pos, bufsz - pos, |
| 273 | " %-30s %10u %10u %10u %10u\n", |
| 274 | "sent_ack_cnt:", |
| 275 | le32_to_cpu(cck->sent_ack_cnt), |
| 276 | accum_cck->sent_ack_cnt, |
| 277 | delta_cck->sent_ack_cnt, |
| 278 | max_cck->sent_ack_cnt); |
| 279 | pos += scnprintf(buf + pos, bufsz - pos, |
| 280 | " %-30s %10u %10u %10u %10u\n", |
| 281 | "sent_cts_cnt:", |
| 282 | le32_to_cpu(cck->sent_cts_cnt), |
| 283 | accum_cck->sent_cts_cnt, |
| 284 | delta_cck->sent_cts_cnt, |
| 285 | max_cck->sent_cts_cnt); |
| 286 | |
| 287 | pos += scnprintf(buf + pos, bufsz - pos, "%-32s current" |
| 288 | "acumulative delta max\n", |
| 289 | "Statistics_Rx - GENERAL:"); |
| 290 | pos += scnprintf(buf + pos, bufsz - pos, |
| 291 | " %-30s %10u %10u %10u %10u\n", |
| 292 | "bogus_cts:", |
| 293 | le32_to_cpu(general->bogus_cts), |
| 294 | accum_general->bogus_cts, |
| 295 | delta_general->bogus_cts, max_general->bogus_cts); |
| 296 | pos += scnprintf(buf + pos, bufsz - pos, |
| 297 | " %-30s %10u %10u %10u %10u\n", |
| 298 | "bogus_ack:", |
| 299 | le32_to_cpu(general->bogus_ack), |
| 300 | accum_general->bogus_ack, |
| 301 | delta_general->bogus_ack, max_general->bogus_ack); |
| 302 | pos += scnprintf(buf + pos, bufsz - pos, |
| 303 | " %-30s %10u %10u %10u %10u\n", |
| 304 | "non_bssid_frames:", |
| 305 | le32_to_cpu(general->non_bssid_frames), |
| 306 | accum_general->non_bssid_frames, |
| 307 | delta_general->non_bssid_frames, |
| 308 | max_general->non_bssid_frames); |
| 309 | pos += scnprintf(buf + pos, bufsz - pos, |
| 310 | " %-30s %10u %10u %10u %10u\n", |
| 311 | "filtered_frames:", |
| 312 | le32_to_cpu(general->filtered_frames), |
| 313 | accum_general->filtered_frames, |
| 314 | delta_general->filtered_frames, |
| 315 | max_general->filtered_frames); |
| 316 | pos += scnprintf(buf + pos, bufsz - pos, |
| 317 | " %-30s %10u %10u %10u %10u\n", |
| 318 | "non_channel_beacons:", |
| 319 | le32_to_cpu(general->non_channel_beacons), |
| 320 | accum_general->non_channel_beacons, |
| 321 | delta_general->non_channel_beacons, |
| 322 | max_general->non_channel_beacons); |
| 323 | |
| 324 | ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos); |
| 325 | kfree(buf); |
| 326 | return ret; |
| 327 | } |
| 328 | |
Stanislaw Gruszka | e2ebc83 | 2011-10-24 15:41:30 +0200 | [diff] [blame] | 329 | ssize_t il3945_ucode_tx_stats_read(struct file *file, |
Wey-Yi Guy | 4bc85c1 | 2011-02-21 11:11:05 -0800 | [diff] [blame] | 330 | char __user *user_buf, |
| 331 | size_t count, loff_t *ppos) |
| 332 | { |
Stanislaw Gruszka | 46bc8d4 | 2011-10-24 16:49:25 +0200 | [diff] [blame] | 333 | struct il_priv *il = file->private_data; |
Wey-Yi Guy | 4bc85c1 | 2011-02-21 11:11:05 -0800 | [diff] [blame] | 334 | int pos = 0; |
| 335 | char *buf; |
Stanislaw Gruszka | ebf0d90 | 2011-08-26 15:43:47 +0200 | [diff] [blame] | 336 | int bufsz = (sizeof(struct iwl39_stats_tx) * 48) + 250; |
Wey-Yi Guy | 4bc85c1 | 2011-02-21 11:11:05 -0800 | [diff] [blame] | 337 | ssize_t ret; |
Stanislaw Gruszka | ebf0d90 | 2011-08-26 15:43:47 +0200 | [diff] [blame] | 338 | struct iwl39_stats_tx *tx, *accum_tx, *delta_tx, *max_tx; |
Wey-Yi Guy | 4bc85c1 | 2011-02-21 11:11:05 -0800 | [diff] [blame] | 339 | |
Stanislaw Gruszka | 46bc8d4 | 2011-10-24 16:49:25 +0200 | [diff] [blame] | 340 | if (!il_is_alive(il)) |
Wey-Yi Guy | 4bc85c1 | 2011-02-21 11:11:05 -0800 | [diff] [blame] | 341 | return -EAGAIN; |
| 342 | |
| 343 | buf = kzalloc(bufsz, GFP_KERNEL); |
| 344 | if (!buf) { |
Stanislaw Gruszka | 9406f79 | 2011-08-18 22:07:57 +0200 | [diff] [blame] | 345 | IL_ERR("Can not allocate Buffer\n"); |
Wey-Yi Guy | 4bc85c1 | 2011-02-21 11:11:05 -0800 | [diff] [blame] | 346 | return -ENOMEM; |
| 347 | } |
| 348 | |
| 349 | /* |
| 350 | * The statistic information display here is based on |
Stanislaw Gruszka | ebf0d90 | 2011-08-26 15:43:47 +0200 | [diff] [blame] | 351 | * the last stats notification from uCode |
Wey-Yi Guy | 4bc85c1 | 2011-02-21 11:11:05 -0800 | [diff] [blame] | 352 | * might not reflect the current uCode activity |
| 353 | */ |
Stanislaw Gruszka | ebf0d90 | 2011-08-26 15:43:47 +0200 | [diff] [blame] | 354 | tx = &il->_3945.stats.tx; |
| 355 | accum_tx = &il->_3945.accum_stats.tx; |
| 356 | delta_tx = &il->_3945.delta_stats.tx; |
Stanislaw Gruszka | 46bc8d4 | 2011-10-24 16:49:25 +0200 | [diff] [blame] | 357 | max_tx = &il->_3945.max_delta.tx; |
Stanislaw Gruszka | ebf0d90 | 2011-08-26 15:43:47 +0200 | [diff] [blame] | 358 | pos += il3945_stats_flag(il, buf, bufsz); |
Wey-Yi Guy | 4bc85c1 | 2011-02-21 11:11:05 -0800 | [diff] [blame] | 359 | pos += scnprintf(buf + pos, bufsz - pos, "%-32s current" |
| 360 | "acumulative delta max\n", |
| 361 | "Statistics_Tx:"); |
| 362 | pos += scnprintf(buf + pos, bufsz - pos, |
| 363 | " %-30s %10u %10u %10u %10u\n", |
| 364 | "preamble:", |
| 365 | le32_to_cpu(tx->preamble_cnt), |
| 366 | accum_tx->preamble_cnt, |
| 367 | delta_tx->preamble_cnt, max_tx->preamble_cnt); |
| 368 | pos += scnprintf(buf + pos, bufsz - pos, |
| 369 | " %-30s %10u %10u %10u %10u\n", |
| 370 | "rx_detected_cnt:", |
| 371 | le32_to_cpu(tx->rx_detected_cnt), |
| 372 | accum_tx->rx_detected_cnt, |
| 373 | delta_tx->rx_detected_cnt, max_tx->rx_detected_cnt); |
| 374 | pos += scnprintf(buf + pos, bufsz - pos, |
| 375 | " %-30s %10u %10u %10u %10u\n", |
| 376 | "bt_prio_defer_cnt:", |
| 377 | le32_to_cpu(tx->bt_prio_defer_cnt), |
| 378 | accum_tx->bt_prio_defer_cnt, |
| 379 | delta_tx->bt_prio_defer_cnt, |
| 380 | max_tx->bt_prio_defer_cnt); |
| 381 | pos += scnprintf(buf + pos, bufsz - pos, |
| 382 | " %-30s %10u %10u %10u %10u\n", |
| 383 | "bt_prio_kill_cnt:", |
| 384 | le32_to_cpu(tx->bt_prio_kill_cnt), |
| 385 | accum_tx->bt_prio_kill_cnt, |
| 386 | delta_tx->bt_prio_kill_cnt, |
| 387 | max_tx->bt_prio_kill_cnt); |
| 388 | pos += scnprintf(buf + pos, bufsz - pos, |
| 389 | " %-30s %10u %10u %10u %10u\n", |
| 390 | "few_bytes_cnt:", |
| 391 | le32_to_cpu(tx->few_bytes_cnt), |
| 392 | accum_tx->few_bytes_cnt, |
| 393 | delta_tx->few_bytes_cnt, max_tx->few_bytes_cnt); |
| 394 | pos += scnprintf(buf + pos, bufsz - pos, |
| 395 | " %-30s %10u %10u %10u %10u\n", |
| 396 | "cts_timeout:", |
| 397 | le32_to_cpu(tx->cts_timeout), accum_tx->cts_timeout, |
| 398 | delta_tx->cts_timeout, max_tx->cts_timeout); |
| 399 | pos += scnprintf(buf + pos, bufsz - pos, |
| 400 | " %-30s %10u %10u %10u %10u\n", |
| 401 | "ack_timeout:", |
| 402 | le32_to_cpu(tx->ack_timeout), |
| 403 | accum_tx->ack_timeout, |
| 404 | delta_tx->ack_timeout, max_tx->ack_timeout); |
| 405 | pos += scnprintf(buf + pos, bufsz - pos, |
| 406 | " %-30s %10u %10u %10u %10u\n", |
| 407 | "expected_ack_cnt:", |
| 408 | le32_to_cpu(tx->expected_ack_cnt), |
| 409 | accum_tx->expected_ack_cnt, |
| 410 | delta_tx->expected_ack_cnt, |
| 411 | max_tx->expected_ack_cnt); |
| 412 | pos += scnprintf(buf + pos, bufsz - pos, |
| 413 | " %-30s %10u %10u %10u %10u\n", |
| 414 | "actual_ack_cnt:", |
| 415 | le32_to_cpu(tx->actual_ack_cnt), |
| 416 | accum_tx->actual_ack_cnt, |
| 417 | delta_tx->actual_ack_cnt, |
| 418 | max_tx->actual_ack_cnt); |
| 419 | |
| 420 | ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos); |
| 421 | kfree(buf); |
| 422 | return ret; |
| 423 | } |
| 424 | |
Stanislaw Gruszka | e2ebc83 | 2011-10-24 15:41:30 +0200 | [diff] [blame] | 425 | ssize_t il3945_ucode_general_stats_read(struct file *file, |
Wey-Yi Guy | 4bc85c1 | 2011-02-21 11:11:05 -0800 | [diff] [blame] | 426 | char __user *user_buf, |
| 427 | size_t count, loff_t *ppos) |
| 428 | { |
Stanislaw Gruszka | 46bc8d4 | 2011-10-24 16:49:25 +0200 | [diff] [blame] | 429 | struct il_priv *il = file->private_data; |
Wey-Yi Guy | 4bc85c1 | 2011-02-21 11:11:05 -0800 | [diff] [blame] | 430 | int pos = 0; |
| 431 | char *buf; |
Stanislaw Gruszka | ebf0d90 | 2011-08-26 15:43:47 +0200 | [diff] [blame] | 432 | int bufsz = sizeof(struct iwl39_stats_general) * 10 + 300; |
Wey-Yi Guy | 4bc85c1 | 2011-02-21 11:11:05 -0800 | [diff] [blame] | 433 | ssize_t ret; |
Stanislaw Gruszka | ebf0d90 | 2011-08-26 15:43:47 +0200 | [diff] [blame] | 434 | struct iwl39_stats_general *general, *accum_general; |
| 435 | struct iwl39_stats_general *delta_general, *max_general; |
| 436 | struct stats_dbg *dbg, *accum_dbg, *delta_dbg, *max_dbg; |
| 437 | struct iwl39_stats_div *div, *accum_div, *delta_div, *max_div; |
Wey-Yi Guy | 4bc85c1 | 2011-02-21 11:11:05 -0800 | [diff] [blame] | 438 | |
Stanislaw Gruszka | 46bc8d4 | 2011-10-24 16:49:25 +0200 | [diff] [blame] | 439 | if (!il_is_alive(il)) |
Wey-Yi Guy | 4bc85c1 | 2011-02-21 11:11:05 -0800 | [diff] [blame] | 440 | return -EAGAIN; |
| 441 | |
| 442 | buf = kzalloc(bufsz, GFP_KERNEL); |
| 443 | if (!buf) { |
Stanislaw Gruszka | 9406f79 | 2011-08-18 22:07:57 +0200 | [diff] [blame] | 444 | IL_ERR("Can not allocate Buffer\n"); |
Wey-Yi Guy | 4bc85c1 | 2011-02-21 11:11:05 -0800 | [diff] [blame] | 445 | return -ENOMEM; |
| 446 | } |
| 447 | |
| 448 | /* |
| 449 | * The statistic information display here is based on |
Stanislaw Gruszka | ebf0d90 | 2011-08-26 15:43:47 +0200 | [diff] [blame] | 450 | * the last stats notification from uCode |
Wey-Yi Guy | 4bc85c1 | 2011-02-21 11:11:05 -0800 | [diff] [blame] | 451 | * might not reflect the current uCode activity |
| 452 | */ |
Stanislaw Gruszka | ebf0d90 | 2011-08-26 15:43:47 +0200 | [diff] [blame] | 453 | general = &il->_3945.stats.general; |
| 454 | dbg = &il->_3945.stats.general.dbg; |
| 455 | div = &il->_3945.stats.general.div; |
| 456 | accum_general = &il->_3945.accum_stats.general; |
| 457 | delta_general = &il->_3945.delta_stats.general; |
Stanislaw Gruszka | 46bc8d4 | 2011-10-24 16:49:25 +0200 | [diff] [blame] | 458 | max_general = &il->_3945.max_delta.general; |
Stanislaw Gruszka | ebf0d90 | 2011-08-26 15:43:47 +0200 | [diff] [blame] | 459 | accum_dbg = &il->_3945.accum_stats.general.dbg; |
| 460 | delta_dbg = &il->_3945.delta_stats.general.dbg; |
Stanislaw Gruszka | 46bc8d4 | 2011-10-24 16:49:25 +0200 | [diff] [blame] | 461 | max_dbg = &il->_3945.max_delta.general.dbg; |
Stanislaw Gruszka | ebf0d90 | 2011-08-26 15:43:47 +0200 | [diff] [blame] | 462 | accum_div = &il->_3945.accum_stats.general.div; |
| 463 | delta_div = &il->_3945.delta_stats.general.div; |
Stanislaw Gruszka | 46bc8d4 | 2011-10-24 16:49:25 +0200 | [diff] [blame] | 464 | max_div = &il->_3945.max_delta.general.div; |
Stanislaw Gruszka | ebf0d90 | 2011-08-26 15:43:47 +0200 | [diff] [blame] | 465 | pos += il3945_stats_flag(il, buf, bufsz); |
Wey-Yi Guy | 4bc85c1 | 2011-02-21 11:11:05 -0800 | [diff] [blame] | 466 | pos += scnprintf(buf + pos, bufsz - pos, "%-32s current" |
| 467 | "acumulative delta max\n", |
| 468 | "Statistics_General:"); |
| 469 | pos += scnprintf(buf + pos, bufsz - pos, |
| 470 | " %-30s %10u %10u %10u %10u\n", |
| 471 | "burst_check:", |
| 472 | le32_to_cpu(dbg->burst_check), |
| 473 | accum_dbg->burst_check, |
| 474 | delta_dbg->burst_check, max_dbg->burst_check); |
| 475 | pos += scnprintf(buf + pos, bufsz - pos, |
| 476 | " %-30s %10u %10u %10u %10u\n", |
| 477 | "burst_count:", |
| 478 | le32_to_cpu(dbg->burst_count), |
| 479 | accum_dbg->burst_count, |
| 480 | delta_dbg->burst_count, max_dbg->burst_count); |
| 481 | pos += scnprintf(buf + pos, bufsz - pos, |
| 482 | " %-30s %10u %10u %10u %10u\n", |
| 483 | "sleep_time:", |
| 484 | le32_to_cpu(general->sleep_time), |
| 485 | accum_general->sleep_time, |
| 486 | delta_general->sleep_time, max_general->sleep_time); |
| 487 | pos += scnprintf(buf + pos, bufsz - pos, |
| 488 | " %-30s %10u %10u %10u %10u\n", |
| 489 | "slots_out:", |
| 490 | le32_to_cpu(general->slots_out), |
| 491 | accum_general->slots_out, |
| 492 | delta_general->slots_out, max_general->slots_out); |
| 493 | pos += scnprintf(buf + pos, bufsz - pos, |
| 494 | " %-30s %10u %10u %10u %10u\n", |
| 495 | "slots_idle:", |
| 496 | le32_to_cpu(general->slots_idle), |
| 497 | accum_general->slots_idle, |
| 498 | delta_general->slots_idle, max_general->slots_idle); |
| 499 | pos += scnprintf(buf + pos, bufsz - pos, "ttl_timestamp:\t\t\t%u\n", |
| 500 | le32_to_cpu(general->ttl_timestamp)); |
| 501 | pos += scnprintf(buf + pos, bufsz - pos, |
| 502 | " %-30s %10u %10u %10u %10u\n", |
| 503 | "tx_on_a:", |
| 504 | le32_to_cpu(div->tx_on_a), accum_div->tx_on_a, |
| 505 | delta_div->tx_on_a, max_div->tx_on_a); |
| 506 | pos += scnprintf(buf + pos, bufsz - pos, |
| 507 | " %-30s %10u %10u %10u %10u\n", |
| 508 | "tx_on_b:", |
| 509 | le32_to_cpu(div->tx_on_b), accum_div->tx_on_b, |
| 510 | delta_div->tx_on_b, max_div->tx_on_b); |
| 511 | pos += scnprintf(buf + pos, bufsz - pos, |
| 512 | " %-30s %10u %10u %10u %10u\n", |
| 513 | "exec_time:", |
| 514 | le32_to_cpu(div->exec_time), accum_div->exec_time, |
| 515 | delta_div->exec_time, max_div->exec_time); |
| 516 | pos += scnprintf(buf + pos, bufsz - pos, |
| 517 | " %-30s %10u %10u %10u %10u\n", |
| 518 | "probe_time:", |
| 519 | le32_to_cpu(div->probe_time), accum_div->probe_time, |
| 520 | delta_div->probe_time, max_div->probe_time); |
| 521 | ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos); |
| 522 | kfree(buf); |
| 523 | return ret; |
| 524 | } |