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