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