Wey-Yi Guy | be663ab | 2011-02-21 11:27:26 -0800 | [diff] [blame] | 1 | /****************************************************************************** |
| 2 | * |
| 3 | * GPL LICENSE SUMMARY |
| 4 | * |
| 5 | * Copyright(c) 2008 - 2011 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 | *****************************************************************************/ |
Stanislaw Gruszka | af038f4 | 2011-08-30 13:58:27 +0200 | [diff] [blame] | 28 | #include "iwl-dev.h" |
Stanislaw Gruszka | 98613be | 2011-11-15 14:19:34 +0100 | [diff] [blame^] | 29 | #include "common.h" |
Stanislaw Gruszka | af038f4 | 2011-08-30 13:58:27 +0200 | [diff] [blame] | 30 | #include "4965.h" |
Wey-Yi Guy | be663ab | 2011-02-21 11:27:26 -0800 | [diff] [blame] | 31 | |
| 32 | static const char *fmt_value = " %-30s %10u\n"; |
| 33 | static const char *fmt_table = " %-30s %10u %10u %10u %10u\n"; |
| 34 | static const char *fmt_header = |
| 35 | "%-32s current cumulative delta max\n"; |
| 36 | |
Stanislaw Gruszka | ebf0d90 | 2011-08-26 15:43:47 +0200 | [diff] [blame] | 37 | static int il4965_stats_flag(struct il_priv *il, char *buf, int bufsz) |
Wey-Yi Guy | be663ab | 2011-02-21 11:27:26 -0800 | [diff] [blame] | 38 | { |
| 39 | int p = 0; |
| 40 | u32 flag; |
| 41 | |
Stanislaw Gruszka | ebf0d90 | 2011-08-26 15:43:47 +0200 | [diff] [blame] | 42 | flag = le32_to_cpu(il->_4965.stats.flag); |
Wey-Yi Guy | be663ab | 2011-02-21 11:27:26 -0800 | [diff] [blame] | 43 | |
| 44 | p += scnprintf(buf + p, bufsz - p, "Statistics Flag(0x%X):\n", flag); |
Stanislaw Gruszka | db7746f | 2011-11-15 13:11:50 +0100 | [diff] [blame] | 45 | if (flag & UCODE_STATS_CLEAR_MSK) |
Wey-Yi Guy | be663ab | 2011-02-21 11:27:26 -0800 | [diff] [blame] | 46 | p += scnprintf(buf + p, bufsz - p, |
| 47 | "\tStatistics have been cleared\n"); |
| 48 | p += scnprintf(buf + p, bufsz - p, "\tOperational Frequency: %s\n", |
Stanislaw Gruszka | db7746f | 2011-11-15 13:11:50 +0100 | [diff] [blame] | 49 | (flag & UCODE_STATS_FREQUENCY_MSK) |
Wey-Yi Guy | be663ab | 2011-02-21 11:27:26 -0800 | [diff] [blame] | 50 | ? "2.4 GHz" : "5.2 GHz"); |
| 51 | p += scnprintf(buf + p, bufsz - p, "\tTGj Narrow Band: %s\n", |
Stanislaw Gruszka | db7746f | 2011-11-15 13:11:50 +0100 | [diff] [blame] | 52 | (flag & UCODE_STATS_NARROW_BAND_MSK) |
Wey-Yi Guy | be663ab | 2011-02-21 11:27:26 -0800 | [diff] [blame] | 53 | ? "enabled" : "disabled"); |
| 54 | |
| 55 | return p; |
| 56 | } |
| 57 | |
Stanislaw Gruszka | e2ebc83 | 2011-10-24 15:41:30 +0200 | [diff] [blame] | 58 | ssize_t il4965_ucode_rx_stats_read(struct file *file, char __user *user_buf, |
Wey-Yi Guy | be663ab | 2011-02-21 11:27:26 -0800 | [diff] [blame] | 59 | size_t count, loff_t *ppos) |
| 60 | { |
Stanislaw Gruszka | 46bc8d4 | 2011-10-24 16:49:25 +0200 | [diff] [blame] | 61 | struct il_priv *il = file->private_data; |
Wey-Yi Guy | be663ab | 2011-02-21 11:27:26 -0800 | [diff] [blame] | 62 | int pos = 0; |
| 63 | char *buf; |
Stanislaw Gruszka | ebf0d90 | 2011-08-26 15:43:47 +0200 | [diff] [blame] | 64 | int bufsz = sizeof(struct stats_rx_phy) * 40 + |
| 65 | sizeof(struct stats_rx_non_phy) * 40 + |
| 66 | sizeof(struct stats_rx_ht_phy) * 40 + 400; |
Wey-Yi Guy | be663ab | 2011-02-21 11:27:26 -0800 | [diff] [blame] | 67 | ssize_t ret; |
Stanislaw Gruszka | ebf0d90 | 2011-08-26 15:43:47 +0200 | [diff] [blame] | 68 | struct stats_rx_phy *ofdm, *accum_ofdm, *delta_ofdm, *max_ofdm; |
| 69 | struct stats_rx_phy *cck, *accum_cck, *delta_cck, *max_cck; |
| 70 | struct stats_rx_non_phy *general, *accum_general; |
| 71 | struct stats_rx_non_phy *delta_general, *max_general; |
| 72 | struct stats_rx_ht_phy *ht, *accum_ht, *delta_ht, *max_ht; |
Wey-Yi Guy | be663ab | 2011-02-21 11:27:26 -0800 | [diff] [blame] | 73 | |
Stanislaw Gruszka | 46bc8d4 | 2011-10-24 16:49:25 +0200 | [diff] [blame] | 74 | if (!il_is_alive(il)) |
Wey-Yi Guy | be663ab | 2011-02-21 11:27:26 -0800 | [diff] [blame] | 75 | return -EAGAIN; |
| 76 | |
| 77 | buf = kzalloc(bufsz, GFP_KERNEL); |
| 78 | if (!buf) { |
Stanislaw Gruszka | 9406f79 | 2011-08-18 22:07:57 +0200 | [diff] [blame] | 79 | IL_ERR("Can not allocate Buffer\n"); |
Wey-Yi Guy | be663ab | 2011-02-21 11:27:26 -0800 | [diff] [blame] | 80 | return -ENOMEM; |
| 81 | } |
| 82 | |
| 83 | /* |
| 84 | * the statistic information display here is based on |
Stanislaw Gruszka | ebf0d90 | 2011-08-26 15:43:47 +0200 | [diff] [blame] | 85 | * the last stats notification from uCode |
Wey-Yi Guy | be663ab | 2011-02-21 11:27:26 -0800 | [diff] [blame] | 86 | * might not reflect the current uCode activity |
| 87 | */ |
Stanislaw Gruszka | ebf0d90 | 2011-08-26 15:43:47 +0200 | [diff] [blame] | 88 | ofdm = &il->_4965.stats.rx.ofdm; |
| 89 | cck = &il->_4965.stats.rx.cck; |
| 90 | general = &il->_4965.stats.rx.general; |
| 91 | ht = &il->_4965.stats.rx.ofdm_ht; |
| 92 | accum_ofdm = &il->_4965.accum_stats.rx.ofdm; |
| 93 | accum_cck = &il->_4965.accum_stats.rx.cck; |
| 94 | accum_general = &il->_4965.accum_stats.rx.general; |
| 95 | accum_ht = &il->_4965.accum_stats.rx.ofdm_ht; |
| 96 | delta_ofdm = &il->_4965.delta_stats.rx.ofdm; |
| 97 | delta_cck = &il->_4965.delta_stats.rx.cck; |
| 98 | delta_general = &il->_4965.delta_stats.rx.general; |
| 99 | delta_ht = &il->_4965.delta_stats.rx.ofdm_ht; |
Stanislaw Gruszka | 46bc8d4 | 2011-10-24 16:49:25 +0200 | [diff] [blame] | 100 | max_ofdm = &il->_4965.max_delta.rx.ofdm; |
| 101 | max_cck = &il->_4965.max_delta.rx.cck; |
| 102 | max_general = &il->_4965.max_delta.rx.general; |
| 103 | max_ht = &il->_4965.max_delta.rx.ofdm_ht; |
Wey-Yi Guy | be663ab | 2011-02-21 11:27:26 -0800 | [diff] [blame] | 104 | |
Stanislaw Gruszka | ebf0d90 | 2011-08-26 15:43:47 +0200 | [diff] [blame] | 105 | pos += il4965_stats_flag(il, buf, bufsz); |
Wey-Yi Guy | be663ab | 2011-02-21 11:27:26 -0800 | [diff] [blame] | 106 | pos += scnprintf(buf + pos, bufsz - pos, |
| 107 | fmt_header, "Statistics_Rx - OFDM:"); |
| 108 | pos += scnprintf(buf + pos, bufsz - pos, |
| 109 | fmt_table, "ina_cnt:", |
| 110 | le32_to_cpu(ofdm->ina_cnt), |
| 111 | accum_ofdm->ina_cnt, |
| 112 | delta_ofdm->ina_cnt, max_ofdm->ina_cnt); |
| 113 | pos += scnprintf(buf + pos, bufsz - pos, |
| 114 | fmt_table, "fina_cnt:", |
| 115 | le32_to_cpu(ofdm->fina_cnt), accum_ofdm->fina_cnt, |
| 116 | delta_ofdm->fina_cnt, max_ofdm->fina_cnt); |
| 117 | pos += scnprintf(buf + pos, bufsz - pos, |
| 118 | fmt_table, "plcp_err:", |
| 119 | le32_to_cpu(ofdm->plcp_err), accum_ofdm->plcp_err, |
| 120 | delta_ofdm->plcp_err, max_ofdm->plcp_err); |
| 121 | pos += scnprintf(buf + pos, bufsz - pos, |
| 122 | fmt_table, "crc32_err:", |
| 123 | le32_to_cpu(ofdm->crc32_err), accum_ofdm->crc32_err, |
| 124 | delta_ofdm->crc32_err, max_ofdm->crc32_err); |
| 125 | pos += scnprintf(buf + pos, bufsz - pos, |
| 126 | fmt_table, "overrun_err:", |
| 127 | le32_to_cpu(ofdm->overrun_err), |
| 128 | accum_ofdm->overrun_err, delta_ofdm->overrun_err, |
| 129 | max_ofdm->overrun_err); |
| 130 | pos += scnprintf(buf + pos, bufsz - pos, |
| 131 | fmt_table, "early_overrun_err:", |
| 132 | le32_to_cpu(ofdm->early_overrun_err), |
| 133 | accum_ofdm->early_overrun_err, |
| 134 | delta_ofdm->early_overrun_err, |
| 135 | max_ofdm->early_overrun_err); |
| 136 | pos += scnprintf(buf + pos, bufsz - pos, |
| 137 | fmt_table, "crc32_good:", |
| 138 | le32_to_cpu(ofdm->crc32_good), |
| 139 | accum_ofdm->crc32_good, delta_ofdm->crc32_good, |
| 140 | max_ofdm->crc32_good); |
| 141 | pos += scnprintf(buf + pos, bufsz - pos, |
| 142 | fmt_table, "false_alarm_cnt:", |
| 143 | le32_to_cpu(ofdm->false_alarm_cnt), |
| 144 | accum_ofdm->false_alarm_cnt, |
| 145 | delta_ofdm->false_alarm_cnt, |
| 146 | max_ofdm->false_alarm_cnt); |
| 147 | pos += scnprintf(buf + pos, bufsz - pos, |
| 148 | fmt_table, "fina_sync_err_cnt:", |
| 149 | le32_to_cpu(ofdm->fina_sync_err_cnt), |
| 150 | accum_ofdm->fina_sync_err_cnt, |
| 151 | delta_ofdm->fina_sync_err_cnt, |
| 152 | max_ofdm->fina_sync_err_cnt); |
| 153 | pos += scnprintf(buf + pos, bufsz - pos, |
| 154 | fmt_table, "sfd_timeout:", |
| 155 | le32_to_cpu(ofdm->sfd_timeout), |
| 156 | accum_ofdm->sfd_timeout, delta_ofdm->sfd_timeout, |
| 157 | max_ofdm->sfd_timeout); |
| 158 | pos += scnprintf(buf + pos, bufsz - pos, |
| 159 | fmt_table, "fina_timeout:", |
| 160 | le32_to_cpu(ofdm->fina_timeout), |
| 161 | accum_ofdm->fina_timeout, delta_ofdm->fina_timeout, |
| 162 | max_ofdm->fina_timeout); |
| 163 | pos += scnprintf(buf + pos, bufsz - pos, |
| 164 | fmt_table, "unresponded_rts:", |
| 165 | le32_to_cpu(ofdm->unresponded_rts), |
| 166 | accum_ofdm->unresponded_rts, |
| 167 | delta_ofdm->unresponded_rts, |
| 168 | max_ofdm->unresponded_rts); |
| 169 | pos += scnprintf(buf + pos, bufsz - pos, |
| 170 | fmt_table, "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 | fmt_table, "sent_ack_cnt:", |
| 177 | le32_to_cpu(ofdm->sent_ack_cnt), |
| 178 | accum_ofdm->sent_ack_cnt, delta_ofdm->sent_ack_cnt, |
| 179 | max_ofdm->sent_ack_cnt); |
| 180 | pos += scnprintf(buf + pos, bufsz - pos, |
| 181 | fmt_table, "sent_cts_cnt:", |
| 182 | le32_to_cpu(ofdm->sent_cts_cnt), |
| 183 | accum_ofdm->sent_cts_cnt, delta_ofdm->sent_cts_cnt, |
| 184 | max_ofdm->sent_cts_cnt); |
| 185 | pos += scnprintf(buf + pos, bufsz - pos, |
| 186 | fmt_table, "sent_ba_rsp_cnt:", |
| 187 | le32_to_cpu(ofdm->sent_ba_rsp_cnt), |
| 188 | accum_ofdm->sent_ba_rsp_cnt, |
| 189 | delta_ofdm->sent_ba_rsp_cnt, |
| 190 | max_ofdm->sent_ba_rsp_cnt); |
| 191 | pos += scnprintf(buf + pos, bufsz - pos, |
| 192 | fmt_table, "dsp_self_kill:", |
| 193 | le32_to_cpu(ofdm->dsp_self_kill), |
| 194 | accum_ofdm->dsp_self_kill, |
| 195 | delta_ofdm->dsp_self_kill, |
| 196 | max_ofdm->dsp_self_kill); |
| 197 | pos += scnprintf(buf + pos, bufsz - pos, |
| 198 | fmt_table, "mh_format_err:", |
| 199 | le32_to_cpu(ofdm->mh_format_err), |
| 200 | accum_ofdm->mh_format_err, |
| 201 | delta_ofdm->mh_format_err, |
| 202 | max_ofdm->mh_format_err); |
| 203 | pos += scnprintf(buf + pos, bufsz - pos, |
| 204 | fmt_table, "re_acq_main_rssi_sum:", |
| 205 | le32_to_cpu(ofdm->re_acq_main_rssi_sum), |
| 206 | accum_ofdm->re_acq_main_rssi_sum, |
| 207 | delta_ofdm->re_acq_main_rssi_sum, |
| 208 | max_ofdm->re_acq_main_rssi_sum); |
| 209 | |
| 210 | pos += scnprintf(buf + pos, bufsz - pos, |
| 211 | fmt_header, "Statistics_Rx - CCK:"); |
| 212 | pos += scnprintf(buf + pos, bufsz - pos, |
| 213 | fmt_table, "ina_cnt:", |
| 214 | le32_to_cpu(cck->ina_cnt), accum_cck->ina_cnt, |
| 215 | delta_cck->ina_cnt, max_cck->ina_cnt); |
| 216 | pos += scnprintf(buf + pos, bufsz - pos, |
| 217 | fmt_table, "fina_cnt:", |
| 218 | le32_to_cpu(cck->fina_cnt), accum_cck->fina_cnt, |
| 219 | delta_cck->fina_cnt, max_cck->fina_cnt); |
| 220 | pos += scnprintf(buf + pos, bufsz - pos, |
| 221 | fmt_table, "plcp_err:", |
| 222 | le32_to_cpu(cck->plcp_err), accum_cck->plcp_err, |
| 223 | delta_cck->plcp_err, max_cck->plcp_err); |
| 224 | pos += scnprintf(buf + pos, bufsz - pos, |
| 225 | fmt_table, "crc32_err:", |
| 226 | le32_to_cpu(cck->crc32_err), accum_cck->crc32_err, |
| 227 | delta_cck->crc32_err, max_cck->crc32_err); |
| 228 | pos += scnprintf(buf + pos, bufsz - pos, |
| 229 | fmt_table, "overrun_err:", |
| 230 | le32_to_cpu(cck->overrun_err), |
| 231 | accum_cck->overrun_err, delta_cck->overrun_err, |
| 232 | max_cck->overrun_err); |
| 233 | pos += scnprintf(buf + pos, bufsz - pos, |
| 234 | fmt_table, "early_overrun_err:", |
| 235 | le32_to_cpu(cck->early_overrun_err), |
| 236 | accum_cck->early_overrun_err, |
| 237 | delta_cck->early_overrun_err, |
| 238 | max_cck->early_overrun_err); |
| 239 | pos += scnprintf(buf + pos, bufsz - pos, |
| 240 | fmt_table, "crc32_good:", |
| 241 | le32_to_cpu(cck->crc32_good), accum_cck->crc32_good, |
| 242 | delta_cck->crc32_good, max_cck->crc32_good); |
| 243 | pos += scnprintf(buf + pos, bufsz - pos, |
| 244 | fmt_table, "false_alarm_cnt:", |
| 245 | le32_to_cpu(cck->false_alarm_cnt), |
| 246 | accum_cck->false_alarm_cnt, |
| 247 | delta_cck->false_alarm_cnt, max_cck->false_alarm_cnt); |
| 248 | pos += scnprintf(buf + pos, bufsz - pos, |
| 249 | fmt_table, "fina_sync_err_cnt:", |
| 250 | le32_to_cpu(cck->fina_sync_err_cnt), |
| 251 | accum_cck->fina_sync_err_cnt, |
| 252 | delta_cck->fina_sync_err_cnt, |
| 253 | max_cck->fina_sync_err_cnt); |
| 254 | pos += scnprintf(buf + pos, bufsz - pos, |
| 255 | fmt_table, "sfd_timeout:", |
| 256 | le32_to_cpu(cck->sfd_timeout), |
| 257 | accum_cck->sfd_timeout, delta_cck->sfd_timeout, |
| 258 | max_cck->sfd_timeout); |
| 259 | pos += scnprintf(buf + pos, bufsz - pos, |
| 260 | fmt_table, "fina_timeout:", |
| 261 | le32_to_cpu(cck->fina_timeout), |
| 262 | accum_cck->fina_timeout, delta_cck->fina_timeout, |
| 263 | max_cck->fina_timeout); |
| 264 | pos += scnprintf(buf + pos, bufsz - pos, |
| 265 | fmt_table, "unresponded_rts:", |
| 266 | le32_to_cpu(cck->unresponded_rts), |
| 267 | accum_cck->unresponded_rts, delta_cck->unresponded_rts, |
| 268 | max_cck->unresponded_rts); |
| 269 | pos += scnprintf(buf + pos, bufsz - pos, |
| 270 | fmt_table, "rxe_frame_lmt_ovrun:", |
| 271 | le32_to_cpu(cck->rxe_frame_limit_overrun), |
| 272 | accum_cck->rxe_frame_limit_overrun, |
| 273 | delta_cck->rxe_frame_limit_overrun, |
| 274 | max_cck->rxe_frame_limit_overrun); |
| 275 | pos += scnprintf(buf + pos, bufsz - pos, |
| 276 | fmt_table, "sent_ack_cnt:", |
| 277 | le32_to_cpu(cck->sent_ack_cnt), |
| 278 | accum_cck->sent_ack_cnt, delta_cck->sent_ack_cnt, |
| 279 | max_cck->sent_ack_cnt); |
| 280 | pos += scnprintf(buf + pos, bufsz - pos, |
| 281 | fmt_table, "sent_cts_cnt:", |
| 282 | le32_to_cpu(cck->sent_cts_cnt), |
| 283 | accum_cck->sent_cts_cnt, delta_cck->sent_cts_cnt, |
| 284 | max_cck->sent_cts_cnt); |
| 285 | pos += scnprintf(buf + pos, bufsz - pos, |
| 286 | fmt_table, "sent_ba_rsp_cnt:", |
| 287 | le32_to_cpu(cck->sent_ba_rsp_cnt), |
| 288 | accum_cck->sent_ba_rsp_cnt, |
| 289 | delta_cck->sent_ba_rsp_cnt, |
| 290 | max_cck->sent_ba_rsp_cnt); |
| 291 | pos += scnprintf(buf + pos, bufsz - pos, |
| 292 | fmt_table, "dsp_self_kill:", |
| 293 | le32_to_cpu(cck->dsp_self_kill), |
| 294 | accum_cck->dsp_self_kill, delta_cck->dsp_self_kill, |
| 295 | max_cck->dsp_self_kill); |
| 296 | pos += scnprintf(buf + pos, bufsz - pos, |
| 297 | fmt_table, "mh_format_err:", |
| 298 | le32_to_cpu(cck->mh_format_err), |
| 299 | accum_cck->mh_format_err, delta_cck->mh_format_err, |
| 300 | max_cck->mh_format_err); |
| 301 | pos += scnprintf(buf + pos, bufsz - pos, |
| 302 | fmt_table, "re_acq_main_rssi_sum:", |
| 303 | le32_to_cpu(cck->re_acq_main_rssi_sum), |
| 304 | accum_cck->re_acq_main_rssi_sum, |
| 305 | delta_cck->re_acq_main_rssi_sum, |
| 306 | max_cck->re_acq_main_rssi_sum); |
| 307 | |
| 308 | pos += scnprintf(buf + pos, bufsz - pos, |
| 309 | fmt_header, "Statistics_Rx - GENERAL:"); |
| 310 | pos += scnprintf(buf + pos, bufsz - pos, |
| 311 | fmt_table, "bogus_cts:", |
| 312 | le32_to_cpu(general->bogus_cts), |
| 313 | accum_general->bogus_cts, delta_general->bogus_cts, |
| 314 | max_general->bogus_cts); |
| 315 | pos += scnprintf(buf + pos, bufsz - pos, |
| 316 | fmt_table, "bogus_ack:", |
| 317 | le32_to_cpu(general->bogus_ack), |
| 318 | accum_general->bogus_ack, delta_general->bogus_ack, |
| 319 | max_general->bogus_ack); |
| 320 | pos += scnprintf(buf + pos, bufsz - pos, |
| 321 | fmt_table, "non_bssid_frames:", |
| 322 | le32_to_cpu(general->non_bssid_frames), |
| 323 | accum_general->non_bssid_frames, |
| 324 | delta_general->non_bssid_frames, |
| 325 | max_general->non_bssid_frames); |
| 326 | pos += scnprintf(buf + pos, bufsz - pos, |
| 327 | fmt_table, "filtered_frames:", |
| 328 | le32_to_cpu(general->filtered_frames), |
| 329 | accum_general->filtered_frames, |
| 330 | delta_general->filtered_frames, |
| 331 | max_general->filtered_frames); |
| 332 | pos += scnprintf(buf + pos, bufsz - pos, |
| 333 | fmt_table, "non_channel_beacons:", |
| 334 | le32_to_cpu(general->non_channel_beacons), |
| 335 | accum_general->non_channel_beacons, |
| 336 | delta_general->non_channel_beacons, |
| 337 | max_general->non_channel_beacons); |
| 338 | pos += scnprintf(buf + pos, bufsz - pos, |
| 339 | fmt_table, "channel_beacons:", |
| 340 | le32_to_cpu(general->channel_beacons), |
| 341 | accum_general->channel_beacons, |
| 342 | delta_general->channel_beacons, |
| 343 | max_general->channel_beacons); |
| 344 | pos += scnprintf(buf + pos, bufsz - pos, |
| 345 | fmt_table, "num_missed_bcon:", |
| 346 | le32_to_cpu(general->num_missed_bcon), |
| 347 | accum_general->num_missed_bcon, |
| 348 | delta_general->num_missed_bcon, |
| 349 | max_general->num_missed_bcon); |
| 350 | pos += scnprintf(buf + pos, bufsz - pos, |
| 351 | fmt_table, "adc_rx_saturation_time:", |
| 352 | le32_to_cpu(general->adc_rx_saturation_time), |
| 353 | accum_general->adc_rx_saturation_time, |
| 354 | delta_general->adc_rx_saturation_time, |
| 355 | max_general->adc_rx_saturation_time); |
| 356 | pos += scnprintf(buf + pos, bufsz - pos, |
| 357 | fmt_table, "ina_detect_search_tm:", |
| 358 | le32_to_cpu(general->ina_detection_search_time), |
| 359 | accum_general->ina_detection_search_time, |
| 360 | delta_general->ina_detection_search_time, |
| 361 | max_general->ina_detection_search_time); |
| 362 | pos += scnprintf(buf + pos, bufsz - pos, |
| 363 | fmt_table, "beacon_silence_rssi_a:", |
| 364 | le32_to_cpu(general->beacon_silence_rssi_a), |
| 365 | accum_general->beacon_silence_rssi_a, |
| 366 | delta_general->beacon_silence_rssi_a, |
| 367 | max_general->beacon_silence_rssi_a); |
| 368 | pos += scnprintf(buf + pos, bufsz - pos, |
| 369 | fmt_table, "beacon_silence_rssi_b:", |
| 370 | le32_to_cpu(general->beacon_silence_rssi_b), |
| 371 | accum_general->beacon_silence_rssi_b, |
| 372 | delta_general->beacon_silence_rssi_b, |
| 373 | max_general->beacon_silence_rssi_b); |
| 374 | pos += scnprintf(buf + pos, bufsz - pos, |
| 375 | fmt_table, "beacon_silence_rssi_c:", |
| 376 | le32_to_cpu(general->beacon_silence_rssi_c), |
| 377 | accum_general->beacon_silence_rssi_c, |
| 378 | delta_general->beacon_silence_rssi_c, |
| 379 | max_general->beacon_silence_rssi_c); |
| 380 | pos += scnprintf(buf + pos, bufsz - pos, |
| 381 | fmt_table, "interference_data_flag:", |
| 382 | le32_to_cpu(general->interference_data_flag), |
| 383 | accum_general->interference_data_flag, |
| 384 | delta_general->interference_data_flag, |
| 385 | max_general->interference_data_flag); |
| 386 | pos += scnprintf(buf + pos, bufsz - pos, |
| 387 | fmt_table, "channel_load:", |
| 388 | le32_to_cpu(general->channel_load), |
| 389 | accum_general->channel_load, |
| 390 | delta_general->channel_load, |
| 391 | max_general->channel_load); |
| 392 | pos += scnprintf(buf + pos, bufsz - pos, |
| 393 | fmt_table, "dsp_false_alarms:", |
| 394 | le32_to_cpu(general->dsp_false_alarms), |
| 395 | accum_general->dsp_false_alarms, |
| 396 | delta_general->dsp_false_alarms, |
| 397 | max_general->dsp_false_alarms); |
| 398 | pos += scnprintf(buf + pos, bufsz - pos, |
| 399 | fmt_table, "beacon_rssi_a:", |
| 400 | le32_to_cpu(general->beacon_rssi_a), |
| 401 | accum_general->beacon_rssi_a, |
| 402 | delta_general->beacon_rssi_a, |
| 403 | max_general->beacon_rssi_a); |
| 404 | pos += scnprintf(buf + pos, bufsz - pos, |
| 405 | fmt_table, "beacon_rssi_b:", |
| 406 | le32_to_cpu(general->beacon_rssi_b), |
| 407 | accum_general->beacon_rssi_b, |
| 408 | delta_general->beacon_rssi_b, |
| 409 | max_general->beacon_rssi_b); |
| 410 | pos += scnprintf(buf + pos, bufsz - pos, |
| 411 | fmt_table, "beacon_rssi_c:", |
| 412 | le32_to_cpu(general->beacon_rssi_c), |
| 413 | accum_general->beacon_rssi_c, |
| 414 | delta_general->beacon_rssi_c, |
| 415 | max_general->beacon_rssi_c); |
| 416 | pos += scnprintf(buf + pos, bufsz - pos, |
| 417 | fmt_table, "beacon_energy_a:", |
| 418 | le32_to_cpu(general->beacon_energy_a), |
| 419 | accum_general->beacon_energy_a, |
| 420 | delta_general->beacon_energy_a, |
| 421 | max_general->beacon_energy_a); |
| 422 | pos += scnprintf(buf + pos, bufsz - pos, |
| 423 | fmt_table, "beacon_energy_b:", |
| 424 | le32_to_cpu(general->beacon_energy_b), |
| 425 | accum_general->beacon_energy_b, |
| 426 | delta_general->beacon_energy_b, |
| 427 | max_general->beacon_energy_b); |
| 428 | pos += scnprintf(buf + pos, bufsz - pos, |
| 429 | fmt_table, "beacon_energy_c:", |
| 430 | le32_to_cpu(general->beacon_energy_c), |
| 431 | accum_general->beacon_energy_c, |
| 432 | delta_general->beacon_energy_c, |
| 433 | max_general->beacon_energy_c); |
| 434 | |
| 435 | pos += scnprintf(buf + pos, bufsz - pos, |
| 436 | fmt_header, "Statistics_Rx - OFDM_HT:"); |
| 437 | pos += scnprintf(buf + pos, bufsz - pos, |
| 438 | fmt_table, "plcp_err:", |
| 439 | le32_to_cpu(ht->plcp_err), accum_ht->plcp_err, |
| 440 | delta_ht->plcp_err, max_ht->plcp_err); |
| 441 | pos += scnprintf(buf + pos, bufsz - pos, |
| 442 | fmt_table, "overrun_err:", |
| 443 | le32_to_cpu(ht->overrun_err), accum_ht->overrun_err, |
| 444 | delta_ht->overrun_err, max_ht->overrun_err); |
| 445 | pos += scnprintf(buf + pos, bufsz - pos, |
| 446 | fmt_table, "early_overrun_err:", |
| 447 | le32_to_cpu(ht->early_overrun_err), |
| 448 | accum_ht->early_overrun_err, |
| 449 | delta_ht->early_overrun_err, |
| 450 | max_ht->early_overrun_err); |
| 451 | pos += scnprintf(buf + pos, bufsz - pos, |
| 452 | fmt_table, "crc32_good:", |
| 453 | le32_to_cpu(ht->crc32_good), accum_ht->crc32_good, |
| 454 | delta_ht->crc32_good, max_ht->crc32_good); |
| 455 | pos += scnprintf(buf + pos, bufsz - pos, |
| 456 | fmt_table, "crc32_err:", |
| 457 | le32_to_cpu(ht->crc32_err), accum_ht->crc32_err, |
| 458 | delta_ht->crc32_err, max_ht->crc32_err); |
| 459 | pos += scnprintf(buf + pos, bufsz - pos, |
| 460 | fmt_table, "mh_format_err:", |
| 461 | le32_to_cpu(ht->mh_format_err), |
| 462 | accum_ht->mh_format_err, |
| 463 | delta_ht->mh_format_err, max_ht->mh_format_err); |
| 464 | pos += scnprintf(buf + pos, bufsz - pos, |
| 465 | fmt_table, "agg_crc32_good:", |
| 466 | le32_to_cpu(ht->agg_crc32_good), |
| 467 | accum_ht->agg_crc32_good, |
| 468 | delta_ht->agg_crc32_good, max_ht->agg_crc32_good); |
| 469 | pos += scnprintf(buf + pos, bufsz - pos, |
| 470 | fmt_table, "agg_mpdu_cnt:", |
| 471 | le32_to_cpu(ht->agg_mpdu_cnt), |
| 472 | accum_ht->agg_mpdu_cnt, |
| 473 | delta_ht->agg_mpdu_cnt, max_ht->agg_mpdu_cnt); |
| 474 | pos += scnprintf(buf + pos, bufsz - pos, |
| 475 | fmt_table, "agg_cnt:", |
| 476 | le32_to_cpu(ht->agg_cnt), accum_ht->agg_cnt, |
| 477 | delta_ht->agg_cnt, max_ht->agg_cnt); |
| 478 | pos += scnprintf(buf + pos, bufsz - pos, |
| 479 | fmt_table, "unsupport_mcs:", |
| 480 | le32_to_cpu(ht->unsupport_mcs), |
| 481 | accum_ht->unsupport_mcs, |
| 482 | delta_ht->unsupport_mcs, max_ht->unsupport_mcs); |
| 483 | |
| 484 | ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos); |
| 485 | kfree(buf); |
| 486 | return ret; |
| 487 | } |
| 488 | |
Stanislaw Gruszka | e2ebc83 | 2011-10-24 15:41:30 +0200 | [diff] [blame] | 489 | ssize_t il4965_ucode_tx_stats_read(struct file *file, |
Wey-Yi Guy | be663ab | 2011-02-21 11:27:26 -0800 | [diff] [blame] | 490 | char __user *user_buf, |
| 491 | size_t count, loff_t *ppos) |
| 492 | { |
Stanislaw Gruszka | 46bc8d4 | 2011-10-24 16:49:25 +0200 | [diff] [blame] | 493 | struct il_priv *il = file->private_data; |
Wey-Yi Guy | be663ab | 2011-02-21 11:27:26 -0800 | [diff] [blame] | 494 | int pos = 0; |
| 495 | char *buf; |
Stanislaw Gruszka | ebf0d90 | 2011-08-26 15:43:47 +0200 | [diff] [blame] | 496 | int bufsz = (sizeof(struct stats_tx) * 48) + 250; |
Wey-Yi Guy | be663ab | 2011-02-21 11:27:26 -0800 | [diff] [blame] | 497 | ssize_t ret; |
Stanislaw Gruszka | ebf0d90 | 2011-08-26 15:43:47 +0200 | [diff] [blame] | 498 | struct stats_tx *tx, *accum_tx, *delta_tx, *max_tx; |
Wey-Yi Guy | be663ab | 2011-02-21 11:27:26 -0800 | [diff] [blame] | 499 | |
Stanislaw Gruszka | 46bc8d4 | 2011-10-24 16:49:25 +0200 | [diff] [blame] | 500 | if (!il_is_alive(il)) |
Wey-Yi Guy | be663ab | 2011-02-21 11:27:26 -0800 | [diff] [blame] | 501 | return -EAGAIN; |
| 502 | |
| 503 | buf = kzalloc(bufsz, GFP_KERNEL); |
| 504 | if (!buf) { |
Stanislaw Gruszka | 9406f79 | 2011-08-18 22:07:57 +0200 | [diff] [blame] | 505 | IL_ERR("Can not allocate Buffer\n"); |
Wey-Yi Guy | be663ab | 2011-02-21 11:27:26 -0800 | [diff] [blame] | 506 | return -ENOMEM; |
| 507 | } |
| 508 | |
| 509 | /* the statistic information display here is based on |
Stanislaw Gruszka | ebf0d90 | 2011-08-26 15:43:47 +0200 | [diff] [blame] | 510 | * the last stats notification from uCode |
Wey-Yi Guy | be663ab | 2011-02-21 11:27:26 -0800 | [diff] [blame] | 511 | * might not reflect the current uCode activity |
| 512 | */ |
Stanislaw Gruszka | ebf0d90 | 2011-08-26 15:43:47 +0200 | [diff] [blame] | 513 | tx = &il->_4965.stats.tx; |
| 514 | accum_tx = &il->_4965.accum_stats.tx; |
| 515 | delta_tx = &il->_4965.delta_stats.tx; |
Stanislaw Gruszka | 46bc8d4 | 2011-10-24 16:49:25 +0200 | [diff] [blame] | 516 | max_tx = &il->_4965.max_delta.tx; |
Wey-Yi Guy | be663ab | 2011-02-21 11:27:26 -0800 | [diff] [blame] | 517 | |
Stanislaw Gruszka | ebf0d90 | 2011-08-26 15:43:47 +0200 | [diff] [blame] | 518 | pos += il4965_stats_flag(il, buf, bufsz); |
Wey-Yi Guy | be663ab | 2011-02-21 11:27:26 -0800 | [diff] [blame] | 519 | pos += scnprintf(buf + pos, bufsz - pos, |
| 520 | fmt_header, "Statistics_Tx:"); |
| 521 | pos += scnprintf(buf + pos, bufsz - pos, |
| 522 | fmt_table, "preamble:", |
| 523 | le32_to_cpu(tx->preamble_cnt), |
| 524 | accum_tx->preamble_cnt, |
| 525 | delta_tx->preamble_cnt, max_tx->preamble_cnt); |
| 526 | pos += scnprintf(buf + pos, bufsz - pos, |
| 527 | fmt_table, "rx_detected_cnt:", |
| 528 | le32_to_cpu(tx->rx_detected_cnt), |
| 529 | accum_tx->rx_detected_cnt, |
| 530 | delta_tx->rx_detected_cnt, max_tx->rx_detected_cnt); |
| 531 | pos += scnprintf(buf + pos, bufsz - pos, |
| 532 | fmt_table, "bt_prio_defer_cnt:", |
| 533 | le32_to_cpu(tx->bt_prio_defer_cnt), |
| 534 | accum_tx->bt_prio_defer_cnt, |
| 535 | delta_tx->bt_prio_defer_cnt, |
| 536 | max_tx->bt_prio_defer_cnt); |
| 537 | pos += scnprintf(buf + pos, bufsz - pos, |
| 538 | fmt_table, "bt_prio_kill_cnt:", |
| 539 | le32_to_cpu(tx->bt_prio_kill_cnt), |
| 540 | accum_tx->bt_prio_kill_cnt, |
| 541 | delta_tx->bt_prio_kill_cnt, |
| 542 | max_tx->bt_prio_kill_cnt); |
| 543 | pos += scnprintf(buf + pos, bufsz - pos, |
| 544 | fmt_table, "few_bytes_cnt:", |
| 545 | le32_to_cpu(tx->few_bytes_cnt), |
| 546 | accum_tx->few_bytes_cnt, |
| 547 | delta_tx->few_bytes_cnt, max_tx->few_bytes_cnt); |
| 548 | pos += scnprintf(buf + pos, bufsz - pos, |
| 549 | fmt_table, "cts_timeout:", |
| 550 | le32_to_cpu(tx->cts_timeout), accum_tx->cts_timeout, |
| 551 | delta_tx->cts_timeout, max_tx->cts_timeout); |
| 552 | pos += scnprintf(buf + pos, bufsz - pos, |
| 553 | fmt_table, "ack_timeout:", |
| 554 | le32_to_cpu(tx->ack_timeout), |
| 555 | accum_tx->ack_timeout, |
| 556 | delta_tx->ack_timeout, max_tx->ack_timeout); |
| 557 | pos += scnprintf(buf + pos, bufsz - pos, |
| 558 | fmt_table, "expected_ack_cnt:", |
| 559 | le32_to_cpu(tx->expected_ack_cnt), |
| 560 | accum_tx->expected_ack_cnt, |
| 561 | delta_tx->expected_ack_cnt, |
| 562 | max_tx->expected_ack_cnt); |
| 563 | pos += scnprintf(buf + pos, bufsz - pos, |
| 564 | fmt_table, "actual_ack_cnt:", |
| 565 | le32_to_cpu(tx->actual_ack_cnt), |
| 566 | accum_tx->actual_ack_cnt, |
| 567 | delta_tx->actual_ack_cnt, |
| 568 | max_tx->actual_ack_cnt); |
| 569 | pos += scnprintf(buf + pos, bufsz - pos, |
| 570 | fmt_table, "dump_msdu_cnt:", |
| 571 | le32_to_cpu(tx->dump_msdu_cnt), |
| 572 | accum_tx->dump_msdu_cnt, |
| 573 | delta_tx->dump_msdu_cnt, |
| 574 | max_tx->dump_msdu_cnt); |
| 575 | pos += scnprintf(buf + pos, bufsz - pos, |
| 576 | fmt_table, "abort_nxt_frame_mismatch:", |
| 577 | le32_to_cpu(tx->burst_abort_next_frame_mismatch_cnt), |
| 578 | accum_tx->burst_abort_next_frame_mismatch_cnt, |
| 579 | delta_tx->burst_abort_next_frame_mismatch_cnt, |
| 580 | max_tx->burst_abort_next_frame_mismatch_cnt); |
| 581 | pos += scnprintf(buf + pos, bufsz - pos, |
| 582 | fmt_table, "abort_missing_nxt_frame:", |
| 583 | le32_to_cpu(tx->burst_abort_missing_next_frame_cnt), |
| 584 | accum_tx->burst_abort_missing_next_frame_cnt, |
| 585 | delta_tx->burst_abort_missing_next_frame_cnt, |
| 586 | max_tx->burst_abort_missing_next_frame_cnt); |
| 587 | pos += scnprintf(buf + pos, bufsz - pos, |
| 588 | fmt_table, "cts_timeout_collision:", |
| 589 | le32_to_cpu(tx->cts_timeout_collision), |
| 590 | accum_tx->cts_timeout_collision, |
| 591 | delta_tx->cts_timeout_collision, |
| 592 | max_tx->cts_timeout_collision); |
| 593 | pos += scnprintf(buf + pos, bufsz - pos, |
| 594 | fmt_table, "ack_ba_timeout_collision:", |
| 595 | le32_to_cpu(tx->ack_or_ba_timeout_collision), |
| 596 | accum_tx->ack_or_ba_timeout_collision, |
| 597 | delta_tx->ack_or_ba_timeout_collision, |
| 598 | max_tx->ack_or_ba_timeout_collision); |
| 599 | pos += scnprintf(buf + pos, bufsz - pos, |
| 600 | fmt_table, "agg ba_timeout:", |
| 601 | le32_to_cpu(tx->agg.ba_timeout), |
| 602 | accum_tx->agg.ba_timeout, |
| 603 | delta_tx->agg.ba_timeout, |
| 604 | max_tx->agg.ba_timeout); |
| 605 | pos += scnprintf(buf + pos, bufsz - pos, |
| 606 | fmt_table, "agg ba_resched_frames:", |
| 607 | le32_to_cpu(tx->agg.ba_reschedule_frames), |
| 608 | accum_tx->agg.ba_reschedule_frames, |
| 609 | delta_tx->agg.ba_reschedule_frames, |
| 610 | max_tx->agg.ba_reschedule_frames); |
| 611 | pos += scnprintf(buf + pos, bufsz - pos, |
| 612 | fmt_table, "agg scd_query_agg_frame:", |
| 613 | le32_to_cpu(tx->agg.scd_query_agg_frame_cnt), |
| 614 | accum_tx->agg.scd_query_agg_frame_cnt, |
| 615 | delta_tx->agg.scd_query_agg_frame_cnt, |
| 616 | max_tx->agg.scd_query_agg_frame_cnt); |
| 617 | pos += scnprintf(buf + pos, bufsz - pos, |
| 618 | fmt_table, "agg scd_query_no_agg:", |
| 619 | le32_to_cpu(tx->agg.scd_query_no_agg), |
| 620 | accum_tx->agg.scd_query_no_agg, |
| 621 | delta_tx->agg.scd_query_no_agg, |
| 622 | max_tx->agg.scd_query_no_agg); |
| 623 | pos += scnprintf(buf + pos, bufsz - pos, |
| 624 | fmt_table, "agg scd_query_agg:", |
| 625 | le32_to_cpu(tx->agg.scd_query_agg), |
| 626 | accum_tx->agg.scd_query_agg, |
| 627 | delta_tx->agg.scd_query_agg, |
| 628 | max_tx->agg.scd_query_agg); |
| 629 | pos += scnprintf(buf + pos, bufsz - pos, |
| 630 | fmt_table, "agg scd_query_mismatch:", |
| 631 | le32_to_cpu(tx->agg.scd_query_mismatch), |
| 632 | accum_tx->agg.scd_query_mismatch, |
| 633 | delta_tx->agg.scd_query_mismatch, |
| 634 | max_tx->agg.scd_query_mismatch); |
| 635 | pos += scnprintf(buf + pos, bufsz - pos, |
| 636 | fmt_table, "agg frame_not_ready:", |
| 637 | le32_to_cpu(tx->agg.frame_not_ready), |
| 638 | accum_tx->agg.frame_not_ready, |
| 639 | delta_tx->agg.frame_not_ready, |
| 640 | max_tx->agg.frame_not_ready); |
| 641 | pos += scnprintf(buf + pos, bufsz - pos, |
| 642 | fmt_table, "agg underrun:", |
| 643 | le32_to_cpu(tx->agg.underrun), |
| 644 | accum_tx->agg.underrun, |
| 645 | delta_tx->agg.underrun, max_tx->agg.underrun); |
| 646 | pos += scnprintf(buf + pos, bufsz - pos, |
| 647 | fmt_table, "agg bt_prio_kill:", |
| 648 | le32_to_cpu(tx->agg.bt_prio_kill), |
| 649 | accum_tx->agg.bt_prio_kill, |
| 650 | delta_tx->agg.bt_prio_kill, |
| 651 | max_tx->agg.bt_prio_kill); |
| 652 | pos += scnprintf(buf + pos, bufsz - pos, |
| 653 | fmt_table, "agg rx_ba_rsp_cnt:", |
| 654 | le32_to_cpu(tx->agg.rx_ba_rsp_cnt), |
| 655 | accum_tx->agg.rx_ba_rsp_cnt, |
| 656 | delta_tx->agg.rx_ba_rsp_cnt, |
| 657 | max_tx->agg.rx_ba_rsp_cnt); |
| 658 | |
| 659 | ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos); |
| 660 | kfree(buf); |
| 661 | return ret; |
| 662 | } |
| 663 | |
| 664 | ssize_t |
Stanislaw Gruszka | e2ebc83 | 2011-10-24 15:41:30 +0200 | [diff] [blame] | 665 | il4965_ucode_general_stats_read(struct file *file, char __user *user_buf, |
Wey-Yi Guy | be663ab | 2011-02-21 11:27:26 -0800 | [diff] [blame] | 666 | size_t count, loff_t *ppos) |
| 667 | { |
Stanislaw Gruszka | 46bc8d4 | 2011-10-24 16:49:25 +0200 | [diff] [blame] | 668 | struct il_priv *il = file->private_data; |
Wey-Yi Guy | be663ab | 2011-02-21 11:27:26 -0800 | [diff] [blame] | 669 | int pos = 0; |
| 670 | char *buf; |
Stanislaw Gruszka | ebf0d90 | 2011-08-26 15:43:47 +0200 | [diff] [blame] | 671 | int bufsz = sizeof(struct stats_general) * 10 + 300; |
Wey-Yi Guy | be663ab | 2011-02-21 11:27:26 -0800 | [diff] [blame] | 672 | ssize_t ret; |
Stanislaw Gruszka | ebf0d90 | 2011-08-26 15:43:47 +0200 | [diff] [blame] | 673 | struct stats_general_common *general, *accum_general; |
| 674 | struct stats_general_common *delta_general, *max_general; |
| 675 | struct stats_dbg *dbg, *accum_dbg, *delta_dbg, *max_dbg; |
| 676 | struct stats_div *div, *accum_div, *delta_div, *max_div; |
Wey-Yi Guy | be663ab | 2011-02-21 11:27:26 -0800 | [diff] [blame] | 677 | |
Stanislaw Gruszka | 46bc8d4 | 2011-10-24 16:49:25 +0200 | [diff] [blame] | 678 | if (!il_is_alive(il)) |
Wey-Yi Guy | be663ab | 2011-02-21 11:27:26 -0800 | [diff] [blame] | 679 | return -EAGAIN; |
| 680 | |
| 681 | buf = kzalloc(bufsz, GFP_KERNEL); |
| 682 | if (!buf) { |
Stanislaw Gruszka | 9406f79 | 2011-08-18 22:07:57 +0200 | [diff] [blame] | 683 | IL_ERR("Can not allocate Buffer\n"); |
Wey-Yi Guy | be663ab | 2011-02-21 11:27:26 -0800 | [diff] [blame] | 684 | return -ENOMEM; |
| 685 | } |
| 686 | |
| 687 | /* the statistic information display here is based on |
Stanislaw Gruszka | ebf0d90 | 2011-08-26 15:43:47 +0200 | [diff] [blame] | 688 | * the last stats notification from uCode |
Wey-Yi Guy | be663ab | 2011-02-21 11:27:26 -0800 | [diff] [blame] | 689 | * might not reflect the current uCode activity |
| 690 | */ |
Stanislaw Gruszka | ebf0d90 | 2011-08-26 15:43:47 +0200 | [diff] [blame] | 691 | general = &il->_4965.stats.general.common; |
| 692 | dbg = &il->_4965.stats.general.common.dbg; |
| 693 | div = &il->_4965.stats.general.common.div; |
| 694 | accum_general = &il->_4965.accum_stats.general.common; |
| 695 | accum_dbg = &il->_4965.accum_stats.general.common.dbg; |
| 696 | accum_div = &il->_4965.accum_stats.general.common.div; |
| 697 | delta_general = &il->_4965.delta_stats.general.common; |
Stanislaw Gruszka | 46bc8d4 | 2011-10-24 16:49:25 +0200 | [diff] [blame] | 698 | max_general = &il->_4965.max_delta.general.common; |
Stanislaw Gruszka | ebf0d90 | 2011-08-26 15:43:47 +0200 | [diff] [blame] | 699 | delta_dbg = &il->_4965.delta_stats.general.common.dbg; |
Stanislaw Gruszka | 46bc8d4 | 2011-10-24 16:49:25 +0200 | [diff] [blame] | 700 | max_dbg = &il->_4965.max_delta.general.common.dbg; |
Stanislaw Gruszka | ebf0d90 | 2011-08-26 15:43:47 +0200 | [diff] [blame] | 701 | delta_div = &il->_4965.delta_stats.general.common.div; |
Stanislaw Gruszka | 46bc8d4 | 2011-10-24 16:49:25 +0200 | [diff] [blame] | 702 | max_div = &il->_4965.max_delta.general.common.div; |
Wey-Yi Guy | be663ab | 2011-02-21 11:27:26 -0800 | [diff] [blame] | 703 | |
Stanislaw Gruszka | ebf0d90 | 2011-08-26 15:43:47 +0200 | [diff] [blame] | 704 | pos += il4965_stats_flag(il, buf, bufsz); |
Wey-Yi Guy | be663ab | 2011-02-21 11:27:26 -0800 | [diff] [blame] | 705 | pos += scnprintf(buf + pos, bufsz - pos, |
| 706 | fmt_header, "Statistics_General:"); |
| 707 | pos += scnprintf(buf + pos, bufsz - pos, |
| 708 | fmt_value, "temperature:", |
| 709 | le32_to_cpu(general->temperature)); |
| 710 | pos += scnprintf(buf + pos, bufsz - pos, |
| 711 | fmt_value, "ttl_timestamp:", |
| 712 | le32_to_cpu(general->ttl_timestamp)); |
| 713 | pos += scnprintf(buf + pos, bufsz - pos, |
| 714 | fmt_table, "burst_check:", |
| 715 | le32_to_cpu(dbg->burst_check), |
| 716 | accum_dbg->burst_check, |
| 717 | delta_dbg->burst_check, max_dbg->burst_check); |
| 718 | pos += scnprintf(buf + pos, bufsz - pos, |
| 719 | fmt_table, "burst_count:", |
| 720 | le32_to_cpu(dbg->burst_count), |
| 721 | accum_dbg->burst_count, |
| 722 | delta_dbg->burst_count, max_dbg->burst_count); |
| 723 | pos += scnprintf(buf + pos, bufsz - pos, |
| 724 | fmt_table, "wait_for_silence_timeout_count:", |
| 725 | le32_to_cpu(dbg->wait_for_silence_timeout_cnt), |
| 726 | accum_dbg->wait_for_silence_timeout_cnt, |
| 727 | delta_dbg->wait_for_silence_timeout_cnt, |
| 728 | max_dbg->wait_for_silence_timeout_cnt); |
| 729 | pos += scnprintf(buf + pos, bufsz - pos, |
| 730 | fmt_table, "sleep_time:", |
| 731 | le32_to_cpu(general->sleep_time), |
| 732 | accum_general->sleep_time, |
| 733 | delta_general->sleep_time, max_general->sleep_time); |
| 734 | pos += scnprintf(buf + pos, bufsz - pos, |
| 735 | fmt_table, "slots_out:", |
| 736 | le32_to_cpu(general->slots_out), |
| 737 | accum_general->slots_out, |
| 738 | delta_general->slots_out, max_general->slots_out); |
| 739 | pos += scnprintf(buf + pos, bufsz - pos, |
| 740 | fmt_table, "slots_idle:", |
| 741 | le32_to_cpu(general->slots_idle), |
| 742 | accum_general->slots_idle, |
| 743 | delta_general->slots_idle, max_general->slots_idle); |
| 744 | pos += scnprintf(buf + pos, bufsz - pos, |
| 745 | fmt_table, "tx_on_a:", |
| 746 | le32_to_cpu(div->tx_on_a), accum_div->tx_on_a, |
| 747 | delta_div->tx_on_a, max_div->tx_on_a); |
| 748 | pos += scnprintf(buf + pos, bufsz - pos, |
| 749 | fmt_table, "tx_on_b:", |
| 750 | le32_to_cpu(div->tx_on_b), accum_div->tx_on_b, |
| 751 | delta_div->tx_on_b, max_div->tx_on_b); |
| 752 | pos += scnprintf(buf + pos, bufsz - pos, |
| 753 | fmt_table, "exec_time:", |
| 754 | le32_to_cpu(div->exec_time), accum_div->exec_time, |
| 755 | delta_div->exec_time, max_div->exec_time); |
| 756 | pos += scnprintf(buf + pos, bufsz - pos, |
| 757 | fmt_table, "probe_time:", |
| 758 | le32_to_cpu(div->probe_time), accum_div->probe_time, |
| 759 | delta_div->probe_time, max_div->probe_time); |
| 760 | pos += scnprintf(buf + pos, bufsz - pos, |
| 761 | fmt_table, "rx_enable_counter:", |
| 762 | le32_to_cpu(general->rx_enable_counter), |
| 763 | accum_general->rx_enable_counter, |
| 764 | delta_general->rx_enable_counter, |
| 765 | max_general->rx_enable_counter); |
| 766 | pos += scnprintf(buf + pos, bufsz - pos, |
| 767 | fmt_table, "num_of_sos_states:", |
| 768 | le32_to_cpu(general->num_of_sos_states), |
| 769 | accum_general->num_of_sos_states, |
| 770 | delta_general->num_of_sos_states, |
| 771 | max_general->num_of_sos_states); |
| 772 | ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos); |
| 773 | kfree(buf); |
| 774 | return ret; |
| 775 | } |