aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/iwl-debugfs.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-debugfs.c')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-debugfs.c770
1 files changed, 36 insertions, 734 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-debugfs.c b/drivers/net/wireless/iwlwifi/iwl-debugfs.c
index 607a91f3eb6b..61faf2dd7fbe 100644
--- a/drivers/net/wireless/iwlwifi/iwl-debugfs.c
+++ b/drivers/net/wireless/iwlwifi/iwl-debugfs.c
@@ -106,6 +106,26 @@ static const struct file_operations iwl_dbgfs_##name##_ops = { \
106 .open = iwl_dbgfs_open_file_generic, \ 106 .open = iwl_dbgfs_open_file_generic, \
107}; 107};
108 108
109int iwl_dbgfs_statistics_flag(struct iwl_priv *priv, char *buf, int bufsz)
110{
111 int p = 0;
112
113 p += scnprintf(buf + p, bufsz - p, "Statistics Flag(0x%X):\n",
114 le32_to_cpu(priv->statistics.flag));
115 if (le32_to_cpu(priv->statistics.flag) & UCODE_STATISTICS_CLEAR_MSK)
116 p += scnprintf(buf + p, bufsz - p,
117 "\tStatistics have been cleared\n");
118 p += scnprintf(buf + p, bufsz - p, "\tOperational Frequency: %s\n",
119 (le32_to_cpu(priv->statistics.flag) &
120 UCODE_STATISTICS_FREQUENCY_MSK)
121 ? "2.4 GHz" : "5.2 GHz");
122 p += scnprintf(buf + p, bufsz - p, "\tTGj Narrow Band: %s\n",
123 (le32_to_cpu(priv->statistics.flag) &
124 UCODE_STATISTICS_NARROW_BAND_MSK)
125 ? "enabled" : "disabled");
126 return p;
127}
128EXPORT_SYMBOL(iwl_dbgfs_statistics_flag);
109 129
110static ssize_t iwl_dbgfs_tx_statistics_read(struct file *file, 130static ssize_t iwl_dbgfs_tx_statistics_read(struct file *file,
111 char __user *user_buf, 131 char __user *user_buf,
@@ -1034,474 +1054,15 @@ static ssize_t iwl_dbgfs_rx_queue_read(struct file *file,
1034 return simple_read_from_buffer(user_buf, count, ppos, buf, pos); 1054 return simple_read_from_buffer(user_buf, count, ppos, buf, pos);
1035} 1055}
1036 1056
1037static int iwl_dbgfs_statistics_flag(struct iwl_priv *priv, char *buf,
1038 int bufsz)
1039{
1040 int p = 0;
1041
1042 p += scnprintf(buf + p, bufsz - p,
1043 "Statistics Flag(0x%X):\n",
1044 le32_to_cpu(priv->statistics.flag));
1045 if (le32_to_cpu(priv->statistics.flag) & UCODE_STATISTICS_CLEAR_MSK)
1046 p += scnprintf(buf + p, bufsz - p,
1047 "\tStatistics have been cleared\n");
1048 p += scnprintf(buf + p, bufsz - p,
1049 "\tOperational Frequency: %s\n",
1050 (le32_to_cpu(priv->statistics.flag) &
1051 UCODE_STATISTICS_FREQUENCY_MSK)
1052 ? "2.4 GHz" : "5.2 GHz");
1053 p += scnprintf(buf + p, bufsz - p,
1054 "\tTGj Narrow Band: %s\n",
1055 (le32_to_cpu(priv->statistics.flag) &
1056 UCODE_STATISTICS_NARROW_BAND_MSK)
1057 ? "enabled" : "disabled");
1058 return p;
1059}
1060
1061static const char ucode_stats_header[] =
1062 "%-32s current acumulative delta max\n";
1063static const char ucode_stats_short_format[] =
1064 " %-30s %10u\n";
1065static const char ucode_stats_format[] =
1066 " %-30s %10u %10u %10u %10u\n";
1067
1068static ssize_t iwl_dbgfs_ucode_rx_stats_read(struct file *file, 1057static ssize_t iwl_dbgfs_ucode_rx_stats_read(struct file *file,
1069 char __user *user_buf, 1058 char __user *user_buf,
1070 size_t count, loff_t *ppos) 1059 size_t count, loff_t *ppos)
1071{ 1060{
1072 struct iwl_priv *priv = file->private_data; 1061 struct iwl_priv *priv = file->private_data;
1073 int pos = 0; 1062 if (priv->cfg->ops->lib->debugfs_ops.rx_stats_read)
1074 char *buf; 1063 return priv->cfg->ops->lib->debugfs_ops.rx_stats_read(file,
1075 int bufsz = sizeof(struct statistics_rx_phy) * 40 + 1064 user_buf, count, ppos);
1076 sizeof(struct statistics_rx_non_phy) * 40 + 1065 return 0;
1077 sizeof(struct statistics_rx_ht_phy) * 40 + 400;
1078 ssize_t ret;
1079 struct statistics_rx_phy *ofdm, *accum_ofdm, *delta_ofdm, *max_ofdm;
1080 struct statistics_rx_phy *cck, *accum_cck, *delta_cck, *max_cck;
1081 struct statistics_rx_non_phy *general, *accum_general;
1082 struct statistics_rx_non_phy *delta_general, *max_general;
1083 struct statistics_rx_ht_phy *ht, *accum_ht, *delta_ht, *max_ht;
1084
1085 if (!iwl_is_alive(priv))
1086 return -EAGAIN;
1087
1088 buf = kzalloc(bufsz, GFP_KERNEL);
1089 if (!buf) {
1090 IWL_ERR(priv, "Can not allocate Buffer\n");
1091 return -ENOMEM;
1092 }
1093
1094 /* the statistic information display here is based on
1095 * the last statistics notification from uCode
1096 * might not reflect the current uCode activity
1097 */
1098 ofdm = &priv->statistics.rx.ofdm;
1099 cck = &priv->statistics.rx.cck;
1100 general = &priv->statistics.rx.general;
1101 ht = &priv->statistics.rx.ofdm_ht;
1102 accum_ofdm = &priv->accum_statistics.rx.ofdm;
1103 accum_cck = &priv->accum_statistics.rx.cck;
1104 accum_general = &priv->accum_statistics.rx.general;
1105 accum_ht = &priv->accum_statistics.rx.ofdm_ht;
1106 delta_ofdm = &priv->delta_statistics.rx.ofdm;
1107 delta_cck = &priv->delta_statistics.rx.cck;
1108 delta_general = &priv->delta_statistics.rx.general;
1109 delta_ht = &priv->delta_statistics.rx.ofdm_ht;
1110 max_ofdm = &priv->max_delta.rx.ofdm;
1111 max_cck = &priv->max_delta.rx.cck;
1112 max_general = &priv->max_delta.rx.general;
1113 max_ht = &priv->max_delta.rx.ofdm_ht;
1114
1115 pos += iwl_dbgfs_statistics_flag(priv, buf, bufsz);
1116 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_header,
1117 "Statistics_Rx - OFDM:");
1118 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1119 "ina_cnt:", le32_to_cpu(ofdm->ina_cnt),
1120 accum_ofdm->ina_cnt,
1121 delta_ofdm->ina_cnt, max_ofdm->ina_cnt);
1122 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1123 "fina_cnt:",
1124 le32_to_cpu(ofdm->fina_cnt), accum_ofdm->fina_cnt,
1125 delta_ofdm->fina_cnt, max_ofdm->fina_cnt);
1126 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1127 "plcp_err:",
1128 le32_to_cpu(ofdm->plcp_err), accum_ofdm->plcp_err,
1129 delta_ofdm->plcp_err, max_ofdm->plcp_err);
1130 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1131 "crc32_err:",
1132 le32_to_cpu(ofdm->crc32_err), accum_ofdm->crc32_err,
1133 delta_ofdm->crc32_err, max_ofdm->crc32_err);
1134 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1135 "overrun_err:",
1136 le32_to_cpu(ofdm->overrun_err),
1137 accum_ofdm->overrun_err,
1138 delta_ofdm->overrun_err, max_ofdm->overrun_err);
1139 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1140 "early_overrun_err:",
1141 le32_to_cpu(ofdm->early_overrun_err),
1142 accum_ofdm->early_overrun_err,
1143 delta_ofdm->early_overrun_err,
1144 max_ofdm->early_overrun_err);
1145 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1146 "crc32_good:",
1147 le32_to_cpu(ofdm->crc32_good),
1148 accum_ofdm->crc32_good,
1149 delta_ofdm->crc32_good, max_ofdm->crc32_good);
1150 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1151 "false_alarm_cnt:",
1152 le32_to_cpu(ofdm->false_alarm_cnt),
1153 accum_ofdm->false_alarm_cnt,
1154 delta_ofdm->false_alarm_cnt,
1155 max_ofdm->false_alarm_cnt);
1156 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1157 "fina_sync_err_cnt:",
1158 le32_to_cpu(ofdm->fina_sync_err_cnt),
1159 accum_ofdm->fina_sync_err_cnt,
1160 delta_ofdm->fina_sync_err_cnt,
1161 max_ofdm->fina_sync_err_cnt);
1162 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1163 "sfd_timeout:",
1164 le32_to_cpu(ofdm->sfd_timeout),
1165 accum_ofdm->sfd_timeout,
1166 delta_ofdm->sfd_timeout,
1167 max_ofdm->sfd_timeout);
1168 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1169 "fina_timeout:",
1170 le32_to_cpu(ofdm->fina_timeout),
1171 accum_ofdm->fina_timeout,
1172 delta_ofdm->fina_timeout,
1173 max_ofdm->fina_timeout);
1174 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1175 "unresponded_rts:",
1176 le32_to_cpu(ofdm->unresponded_rts),
1177 accum_ofdm->unresponded_rts,
1178 delta_ofdm->unresponded_rts,
1179 max_ofdm->unresponded_rts);
1180 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1181 "rxe_frame_lmt_ovrun:",
1182 le32_to_cpu(ofdm->rxe_frame_limit_overrun),
1183 accum_ofdm->rxe_frame_limit_overrun,
1184 delta_ofdm->rxe_frame_limit_overrun,
1185 max_ofdm->rxe_frame_limit_overrun);
1186 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1187 "sent_ack_cnt:",
1188 le32_to_cpu(ofdm->sent_ack_cnt),
1189 accum_ofdm->sent_ack_cnt,
1190 delta_ofdm->sent_ack_cnt,
1191 max_ofdm->sent_ack_cnt);
1192 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1193 "sent_cts_cnt:",
1194 le32_to_cpu(ofdm->sent_cts_cnt),
1195 accum_ofdm->sent_cts_cnt,
1196 delta_ofdm->sent_cts_cnt, max_ofdm->sent_cts_cnt);
1197 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1198 "sent_ba_rsp_cnt:",
1199 le32_to_cpu(ofdm->sent_ba_rsp_cnt),
1200 accum_ofdm->sent_ba_rsp_cnt,
1201 delta_ofdm->sent_ba_rsp_cnt,
1202 max_ofdm->sent_ba_rsp_cnt);
1203 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1204 "dsp_self_kill:",
1205 le32_to_cpu(ofdm->dsp_self_kill),
1206 accum_ofdm->dsp_self_kill,
1207 delta_ofdm->dsp_self_kill,
1208 max_ofdm->dsp_self_kill);
1209 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1210 "mh_format_err:",
1211 le32_to_cpu(ofdm->mh_format_err),
1212 accum_ofdm->mh_format_err,
1213 delta_ofdm->mh_format_err,
1214 max_ofdm->mh_format_err);
1215 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1216 "re_acq_main_rssi_sum:",
1217 le32_to_cpu(ofdm->re_acq_main_rssi_sum),
1218 accum_ofdm->re_acq_main_rssi_sum,
1219 delta_ofdm->re_acq_main_rssi_sum,
1220 max_ofdm->re_acq_main_rssi_sum);
1221
1222 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_header,
1223 "Statistics_Rx - CCK:");
1224 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1225 "ina_cnt:",
1226 le32_to_cpu(cck->ina_cnt), accum_cck->ina_cnt,
1227 delta_cck->ina_cnt, max_cck->ina_cnt);
1228 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1229 "fina_cnt:",
1230 le32_to_cpu(cck->fina_cnt), accum_cck->fina_cnt,
1231 delta_cck->fina_cnt, max_cck->fina_cnt);
1232 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1233 "plcp_err:",
1234 le32_to_cpu(cck->plcp_err), accum_cck->plcp_err,
1235 delta_cck->plcp_err, max_cck->plcp_err);
1236 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1237 "crc32_err:",
1238 le32_to_cpu(cck->crc32_err), accum_cck->crc32_err,
1239 delta_cck->crc32_err, max_cck->crc32_err);
1240 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1241 "overrun_err:",
1242 le32_to_cpu(cck->overrun_err),
1243 accum_cck->overrun_err,
1244 delta_cck->overrun_err, max_cck->overrun_err);
1245 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1246 "early_overrun_err:",
1247 le32_to_cpu(cck->early_overrun_err),
1248 accum_cck->early_overrun_err,
1249 delta_cck->early_overrun_err,
1250 max_cck->early_overrun_err);
1251 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1252 "crc32_good:",
1253 le32_to_cpu(cck->crc32_good), accum_cck->crc32_good,
1254 delta_cck->crc32_good,
1255 max_cck->crc32_good);
1256 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1257 "false_alarm_cnt:",
1258 le32_to_cpu(cck->false_alarm_cnt),
1259 accum_cck->false_alarm_cnt,
1260 delta_cck->false_alarm_cnt, max_cck->false_alarm_cnt);
1261 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1262 "fina_sync_err_cnt:",
1263 le32_to_cpu(cck->fina_sync_err_cnt),
1264 accum_cck->fina_sync_err_cnt,
1265 delta_cck->fina_sync_err_cnt,
1266 max_cck->fina_sync_err_cnt);
1267 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1268 "sfd_timeout:",
1269 le32_to_cpu(cck->sfd_timeout),
1270 accum_cck->sfd_timeout,
1271 delta_cck->sfd_timeout, max_cck->sfd_timeout);
1272 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1273 "fina_timeout:",
1274 le32_to_cpu(cck->fina_timeout),
1275 accum_cck->fina_timeout,
1276 delta_cck->fina_timeout, max_cck->fina_timeout);
1277 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1278 "unresponded_rts:",
1279 le32_to_cpu(cck->unresponded_rts),
1280 accum_cck->unresponded_rts,
1281 delta_cck->unresponded_rts,
1282 max_cck->unresponded_rts);
1283 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1284 "rxe_frame_lmt_ovrun:",
1285 le32_to_cpu(cck->rxe_frame_limit_overrun),
1286 accum_cck->rxe_frame_limit_overrun,
1287 delta_cck->rxe_frame_limit_overrun,
1288 max_cck->rxe_frame_limit_overrun);
1289 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1290 "sent_ack_cnt:",
1291 le32_to_cpu(cck->sent_ack_cnt),
1292 accum_cck->sent_ack_cnt,
1293 delta_cck->sent_ack_cnt,
1294 max_cck->sent_ack_cnt);
1295 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1296 "sent_cts_cnt:",
1297 le32_to_cpu(cck->sent_cts_cnt),
1298 accum_cck->sent_cts_cnt,
1299 delta_cck->sent_cts_cnt,
1300 max_cck->sent_cts_cnt);
1301 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1302 "sent_ba_rsp_cnt:",
1303 le32_to_cpu(cck->sent_ba_rsp_cnt),
1304 accum_cck->sent_ba_rsp_cnt,
1305 delta_cck->sent_ba_rsp_cnt,
1306 max_cck->sent_ba_rsp_cnt);
1307 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1308 "dsp_self_kill:",
1309 le32_to_cpu(cck->dsp_self_kill),
1310 accum_cck->dsp_self_kill,
1311 delta_cck->dsp_self_kill,
1312 max_cck->dsp_self_kill);
1313 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1314 "mh_format_err:",
1315 le32_to_cpu(cck->mh_format_err),
1316 accum_cck->mh_format_err,
1317 delta_cck->mh_format_err, max_cck->mh_format_err);
1318 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1319 "re_acq_main_rssi_sum:",
1320 le32_to_cpu(cck->re_acq_main_rssi_sum),
1321 accum_cck->re_acq_main_rssi_sum,
1322 delta_cck->re_acq_main_rssi_sum,
1323 max_cck->re_acq_main_rssi_sum);
1324
1325 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_header,
1326 "Statistics_Rx - GENERAL:");
1327 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1328 "bogus_cts:",
1329 le32_to_cpu(general->bogus_cts),
1330 accum_general->bogus_cts,
1331 delta_general->bogus_cts, max_general->bogus_cts);
1332 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1333 "bogus_ack:",
1334 le32_to_cpu(general->bogus_ack),
1335 accum_general->bogus_ack,
1336 delta_general->bogus_ack, max_general->bogus_ack);
1337 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1338 "non_bssid_frames:",
1339 le32_to_cpu(general->non_bssid_frames),
1340 accum_general->non_bssid_frames,
1341 delta_general->non_bssid_frames,
1342 max_general->non_bssid_frames);
1343 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1344 "filtered_frames:",
1345 le32_to_cpu(general->filtered_frames),
1346 accum_general->filtered_frames,
1347 delta_general->filtered_frames,
1348 max_general->filtered_frames);
1349 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1350 "non_channel_beacons:",
1351 le32_to_cpu(general->non_channel_beacons),
1352 accum_general->non_channel_beacons,
1353 delta_general->non_channel_beacons,
1354 max_general->non_channel_beacons);
1355 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1356 "channel_beacons:",
1357 le32_to_cpu(general->channel_beacons),
1358 accum_general->channel_beacons,
1359 delta_general->channel_beacons,
1360 max_general->channel_beacons);
1361 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1362 "num_missed_bcon:",
1363 le32_to_cpu(general->num_missed_bcon),
1364 accum_general->num_missed_bcon,
1365 delta_general->num_missed_bcon,
1366 max_general->num_missed_bcon);
1367 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1368 "adc_rx_saturation_time:",
1369 le32_to_cpu(general->adc_rx_saturation_time),
1370 accum_general->adc_rx_saturation_time,
1371 delta_general->adc_rx_saturation_time,
1372 max_general->adc_rx_saturation_time);
1373 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1374 "ina_detect_search_tm:",
1375 le32_to_cpu(general->ina_detection_search_time),
1376 accum_general->ina_detection_search_time,
1377 delta_general->ina_detection_search_time,
1378 max_general->ina_detection_search_time);
1379 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1380 "beacon_silence_rssi_a:",
1381 le32_to_cpu(general->beacon_silence_rssi_a),
1382 accum_general->beacon_silence_rssi_a,
1383 delta_general->beacon_silence_rssi_a,
1384 max_general->beacon_silence_rssi_a);
1385 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1386 "beacon_silence_rssi_b:",
1387 le32_to_cpu(general->beacon_silence_rssi_b),
1388 accum_general->beacon_silence_rssi_b,
1389 delta_general->beacon_silence_rssi_b,
1390 max_general->beacon_silence_rssi_b);
1391 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1392 "beacon_silence_rssi_c:",
1393 le32_to_cpu(general->beacon_silence_rssi_c),
1394 accum_general->beacon_silence_rssi_c,
1395 delta_general->beacon_silence_rssi_c,
1396 max_general->beacon_silence_rssi_c);
1397 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1398 "interference_data_flag:",
1399 le32_to_cpu(general->interference_data_flag),
1400 accum_general->interference_data_flag,
1401 delta_general->interference_data_flag,
1402 max_general->interference_data_flag);
1403 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1404 "channel_load:",
1405 le32_to_cpu(general->channel_load),
1406 accum_general->channel_load,
1407 delta_general->channel_load,
1408 max_general->channel_load);
1409 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1410 "dsp_false_alarms:",
1411 le32_to_cpu(general->dsp_false_alarms),
1412 accum_general->dsp_false_alarms,
1413 delta_general->dsp_false_alarms,
1414 max_general->dsp_false_alarms);
1415 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1416 "beacon_rssi_a:",
1417 le32_to_cpu(general->beacon_rssi_a),
1418 accum_general->beacon_rssi_a,
1419 delta_general->beacon_rssi_a,
1420 max_general->beacon_rssi_a);
1421 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1422 "beacon_rssi_b:",
1423 le32_to_cpu(general->beacon_rssi_b),
1424 accum_general->beacon_rssi_b,
1425 delta_general->beacon_rssi_b,
1426 max_general->beacon_rssi_b);
1427 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1428 "beacon_rssi_c:",
1429 le32_to_cpu(general->beacon_rssi_c),
1430 accum_general->beacon_rssi_c,
1431 delta_general->beacon_rssi_c,
1432 max_general->beacon_rssi_c);
1433 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1434 "beacon_energy_a:",
1435 le32_to_cpu(general->beacon_energy_a),
1436 accum_general->beacon_energy_a,
1437 delta_general->beacon_energy_a,
1438 max_general->beacon_energy_a);
1439 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1440 "beacon_energy_b:",
1441 le32_to_cpu(general->beacon_energy_b),
1442 accum_general->beacon_energy_b,
1443 delta_general->beacon_energy_b,
1444 max_general->beacon_energy_b);
1445 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1446 "beacon_energy_c:",
1447 le32_to_cpu(general->beacon_energy_c),
1448 accum_general->beacon_energy_c,
1449 delta_general->beacon_energy_c,
1450 max_general->beacon_energy_c);
1451
1452 pos += scnprintf(buf + pos, bufsz - pos, "Statistics_Rx - OFDM_HT:\n");
1453 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_header,
1454 "Statistics_Rx - OFDM_HT:");
1455 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1456 "plcp_err:",
1457 le32_to_cpu(ht->plcp_err), accum_ht->plcp_err,
1458 delta_ht->plcp_err, max_ht->plcp_err);
1459 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1460 "overrun_err:",
1461 le32_to_cpu(ht->overrun_err), accum_ht->overrun_err,
1462 delta_ht->overrun_err, max_ht->overrun_err);
1463 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1464 "early_overrun_err:",
1465 le32_to_cpu(ht->early_overrun_err),
1466 accum_ht->early_overrun_err,
1467 delta_ht->early_overrun_err,
1468 max_ht->early_overrun_err);
1469 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1470 "crc32_good:",
1471 le32_to_cpu(ht->crc32_good), accum_ht->crc32_good,
1472 delta_ht->crc32_good, max_ht->crc32_good);
1473 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1474 "crc32_err:",
1475 le32_to_cpu(ht->crc32_err), accum_ht->crc32_err,
1476 delta_ht->crc32_err, max_ht->crc32_err);
1477 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1478 "mh_format_err:",
1479 le32_to_cpu(ht->mh_format_err),
1480 accum_ht->mh_format_err,
1481 delta_ht->mh_format_err, max_ht->mh_format_err);
1482 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1483 "agg_crc32_good:",
1484 le32_to_cpu(ht->agg_crc32_good),
1485 accum_ht->agg_crc32_good,
1486 delta_ht->agg_crc32_good, max_ht->agg_crc32_good);
1487 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1488 "agg_mpdu_cnt:",
1489 le32_to_cpu(ht->agg_mpdu_cnt),
1490 accum_ht->agg_mpdu_cnt,
1491 delta_ht->agg_mpdu_cnt, max_ht->agg_mpdu_cnt);
1492 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1493 "agg_cnt:",
1494 le32_to_cpu(ht->agg_cnt), accum_ht->agg_cnt,
1495 delta_ht->agg_cnt, max_ht->agg_cnt);
1496 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1497 "unsupport_mcs:",
1498 le32_to_cpu(ht->unsupport_mcs),
1499 accum_ht->unsupport_mcs,
1500 delta_ht->unsupport_mcs, max_ht->unsupport_mcs);
1501
1502 ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos);
1503 kfree(buf);
1504 return ret;
1505} 1066}
1506 1067
1507static ssize_t iwl_dbgfs_ucode_tx_stats_read(struct file *file, 1068static ssize_t iwl_dbgfs_ucode_tx_stats_read(struct file *file,
@@ -1509,173 +1070,10 @@ static ssize_t iwl_dbgfs_ucode_tx_stats_read(struct file *file,
1509 size_t count, loff_t *ppos) 1070 size_t count, loff_t *ppos)
1510{ 1071{
1511 struct iwl_priv *priv = file->private_data; 1072 struct iwl_priv *priv = file->private_data;
1512 int pos = 0; 1073 if (priv->cfg->ops->lib->debugfs_ops.tx_stats_read)
1513 char *buf; 1074 return priv->cfg->ops->lib->debugfs_ops.tx_stats_read(file,
1514 int bufsz = (sizeof(struct statistics_tx) * 48) + 250; 1075 user_buf, count, ppos);
1515 ssize_t ret; 1076 return 0;
1516 struct statistics_tx *tx, *accum_tx, *delta_tx, *max_tx;
1517
1518 if (!iwl_is_alive(priv))
1519 return -EAGAIN;
1520
1521 buf = kzalloc(bufsz, GFP_KERNEL);
1522 if (!buf) {
1523 IWL_ERR(priv, "Can not allocate Buffer\n");
1524 return -ENOMEM;
1525 }
1526
1527 /* the statistic information display here is based on
1528 * the last statistics notification from uCode
1529 * might not reflect the current uCode activity
1530 */
1531 tx = &priv->statistics.tx;
1532 accum_tx = &priv->accum_statistics.tx;
1533 delta_tx = &priv->delta_statistics.tx;
1534 max_tx = &priv->max_delta.tx;
1535 pos += iwl_dbgfs_statistics_flag(priv, buf, bufsz);
1536 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_header,
1537 "Statistics_Tx:");
1538 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1539 "preamble:",
1540 le32_to_cpu(tx->preamble_cnt),
1541 accum_tx->preamble_cnt,
1542 delta_tx->preamble_cnt, max_tx->preamble_cnt);
1543 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1544 "rx_detected_cnt:",
1545 le32_to_cpu(tx->rx_detected_cnt),
1546 accum_tx->rx_detected_cnt,
1547 delta_tx->rx_detected_cnt, max_tx->rx_detected_cnt);
1548 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1549 "bt_prio_defer_cnt:",
1550 le32_to_cpu(tx->bt_prio_defer_cnt),
1551 accum_tx->bt_prio_defer_cnt,
1552 delta_tx->bt_prio_defer_cnt,
1553 max_tx->bt_prio_defer_cnt);
1554 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1555 "bt_prio_kill_cnt:",
1556 le32_to_cpu(tx->bt_prio_kill_cnt),
1557 accum_tx->bt_prio_kill_cnt,
1558 delta_tx->bt_prio_kill_cnt,
1559 max_tx->bt_prio_kill_cnt);
1560 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1561 "few_bytes_cnt:",
1562 le32_to_cpu(tx->few_bytes_cnt),
1563 accum_tx->few_bytes_cnt,
1564 delta_tx->few_bytes_cnt, max_tx->few_bytes_cnt);
1565 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1566 "cts_timeout:",
1567 le32_to_cpu(tx->cts_timeout), accum_tx->cts_timeout,
1568 delta_tx->cts_timeout, max_tx->cts_timeout);
1569 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1570 "ack_timeout:",
1571 le32_to_cpu(tx->ack_timeout),
1572 accum_tx->ack_timeout,
1573 delta_tx->ack_timeout, max_tx->ack_timeout);
1574 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1575 "expected_ack_cnt:",
1576 le32_to_cpu(tx->expected_ack_cnt),
1577 accum_tx->expected_ack_cnt,
1578 delta_tx->expected_ack_cnt,
1579 max_tx->expected_ack_cnt);
1580 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1581 "actual_ack_cnt:",
1582 le32_to_cpu(tx->actual_ack_cnt),
1583 accum_tx->actual_ack_cnt,
1584 delta_tx->actual_ack_cnt,
1585 max_tx->actual_ack_cnt);
1586 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1587 "dump_msdu_cnt:",
1588 le32_to_cpu(tx->dump_msdu_cnt),
1589 accum_tx->dump_msdu_cnt,
1590 delta_tx->dump_msdu_cnt,
1591 max_tx->dump_msdu_cnt);
1592 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1593 "abort_nxt_frame_mismatch:",
1594 le32_to_cpu(tx->burst_abort_next_frame_mismatch_cnt),
1595 accum_tx->burst_abort_next_frame_mismatch_cnt,
1596 delta_tx->burst_abort_next_frame_mismatch_cnt,
1597 max_tx->burst_abort_next_frame_mismatch_cnt);
1598 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1599 "abort_missing_nxt_frame:",
1600 le32_to_cpu(tx->burst_abort_missing_next_frame_cnt),
1601 accum_tx->burst_abort_missing_next_frame_cnt,
1602 delta_tx->burst_abort_missing_next_frame_cnt,
1603 max_tx->burst_abort_missing_next_frame_cnt);
1604 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1605 "cts_timeout_collision:",
1606 le32_to_cpu(tx->cts_timeout_collision),
1607 accum_tx->cts_timeout_collision,
1608 delta_tx->cts_timeout_collision,
1609 max_tx->cts_timeout_collision);
1610 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1611 "ack_ba_timeout_collision:",
1612 le32_to_cpu(tx->ack_or_ba_timeout_collision),
1613 accum_tx->ack_or_ba_timeout_collision,
1614 delta_tx->ack_or_ba_timeout_collision,
1615 max_tx->ack_or_ba_timeout_collision);
1616 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1617 "agg ba_timeout:",
1618 le32_to_cpu(tx->agg.ba_timeout),
1619 accum_tx->agg.ba_timeout,
1620 delta_tx->agg.ba_timeout,
1621 max_tx->agg.ba_timeout);
1622 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1623 "agg ba_resched_frames:",
1624 le32_to_cpu(tx->agg.ba_reschedule_frames),
1625 accum_tx->agg.ba_reschedule_frames,
1626 delta_tx->agg.ba_reschedule_frames,
1627 max_tx->agg.ba_reschedule_frames);
1628 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1629 "agg scd_query_agg_frame:",
1630 le32_to_cpu(tx->agg.scd_query_agg_frame_cnt),
1631 accum_tx->agg.scd_query_agg_frame_cnt,
1632 delta_tx->agg.scd_query_agg_frame_cnt,
1633 max_tx->agg.scd_query_agg_frame_cnt);
1634 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1635 "agg scd_query_no_agg:",
1636 le32_to_cpu(tx->agg.scd_query_no_agg),
1637 accum_tx->agg.scd_query_no_agg,
1638 delta_tx->agg.scd_query_no_agg,
1639 max_tx->agg.scd_query_no_agg);
1640 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1641 "agg scd_query_agg:",
1642 le32_to_cpu(tx->agg.scd_query_agg),
1643 accum_tx->agg.scd_query_agg,
1644 delta_tx->agg.scd_query_agg,
1645 max_tx->agg.scd_query_agg);
1646 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1647 "agg scd_query_mismatch:",
1648 le32_to_cpu(tx->agg.scd_query_mismatch),
1649 accum_tx->agg.scd_query_mismatch,
1650 delta_tx->agg.scd_query_mismatch,
1651 max_tx->agg.scd_query_mismatch);
1652 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1653 "agg frame_not_ready:",
1654 le32_to_cpu(tx->agg.frame_not_ready),
1655 accum_tx->agg.frame_not_ready,
1656 delta_tx->agg.frame_not_ready,
1657 max_tx->agg.frame_not_ready);
1658 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1659 "agg underrun:",
1660 le32_to_cpu(tx->agg.underrun),
1661 accum_tx->agg.underrun,
1662 delta_tx->agg.underrun, max_tx->agg.underrun);
1663 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1664 "agg bt_prio_kill:",
1665 le32_to_cpu(tx->agg.bt_prio_kill),
1666 accum_tx->agg.bt_prio_kill,
1667 delta_tx->agg.bt_prio_kill,
1668 max_tx->agg.bt_prio_kill);
1669 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1670 "agg rx_ba_rsp_cnt:",
1671 le32_to_cpu(tx->agg.rx_ba_rsp_cnt),
1672 accum_tx->agg.rx_ba_rsp_cnt,
1673 delta_tx->agg.rx_ba_rsp_cnt,
1674 max_tx->agg.rx_ba_rsp_cnt);
1675
1676 ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos);
1677 kfree(buf);
1678 return ret;
1679} 1077}
1680 1078
1681static ssize_t iwl_dbgfs_ucode_general_stats_read(struct file *file, 1079static ssize_t iwl_dbgfs_ucode_general_stats_read(struct file *file,
@@ -1683,107 +1081,10 @@ static ssize_t iwl_dbgfs_ucode_general_stats_read(struct file *file,
1683 size_t count, loff_t *ppos) 1081 size_t count, loff_t *ppos)
1684{ 1082{
1685 struct iwl_priv *priv = file->private_data; 1083 struct iwl_priv *priv = file->private_data;
1686 int pos = 0; 1084 if (priv->cfg->ops->lib->debugfs_ops.general_stats_read)
1687 char *buf; 1085 return priv->cfg->ops->lib->debugfs_ops.general_stats_read(file,
1688 int bufsz = sizeof(struct statistics_general) * 10 + 300; 1086 user_buf, count, ppos);
1689 ssize_t ret; 1087 return 0;
1690 struct statistics_general *general, *accum_general;
1691 struct statistics_general *delta_general, *max_general;
1692 struct statistics_dbg *dbg, *accum_dbg, *delta_dbg, *max_dbg;
1693 struct statistics_div *div, *accum_div, *delta_div, *max_div;
1694
1695 if (!iwl_is_alive(priv))
1696 return -EAGAIN;
1697
1698 buf = kzalloc(bufsz, GFP_KERNEL);
1699 if (!buf) {
1700 IWL_ERR(priv, "Can not allocate Buffer\n");
1701 return -ENOMEM;
1702 }
1703
1704 /* the statistic information display here is based on
1705 * the last statistics notification from uCode
1706 * might not reflect the current uCode activity
1707 */
1708 general = &priv->statistics.general;
1709 dbg = &priv->statistics.general.dbg;
1710 div = &priv->statistics.general.div;
1711 accum_general = &priv->accum_statistics.general;
1712 delta_general = &priv->delta_statistics.general;
1713 max_general = &priv->max_delta.general;
1714 accum_dbg = &priv->accum_statistics.general.dbg;
1715 delta_dbg = &priv->delta_statistics.general.dbg;
1716 max_dbg = &priv->max_delta.general.dbg;
1717 accum_div = &priv->accum_statistics.general.div;
1718 delta_div = &priv->delta_statistics.general.div;
1719 max_div = &priv->max_delta.general.div;
1720 pos += iwl_dbgfs_statistics_flag(priv, buf, bufsz);
1721 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_header,
1722 "Statistics_General:");
1723 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_short_format,
1724 "temperature:",
1725 le32_to_cpu(general->temperature));
1726 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_short_format,
1727 "temperature_m:",
1728 le32_to_cpu(general->temperature_m));
1729 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1730 "burst_check:",
1731 le32_to_cpu(dbg->burst_check),
1732 accum_dbg->burst_check,
1733 delta_dbg->burst_check, max_dbg->burst_check);
1734 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1735 "burst_count:",
1736 le32_to_cpu(dbg->burst_count),
1737 accum_dbg->burst_count,
1738 delta_dbg->burst_count, max_dbg->burst_count);
1739 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1740 "sleep_time:",
1741 le32_to_cpu(general->sleep_time),
1742 accum_general->sleep_time,
1743 delta_general->sleep_time, max_general->sleep_time);
1744 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1745 "slots_out:",
1746 le32_to_cpu(general->slots_out),
1747 accum_general->slots_out,
1748 delta_general->slots_out, max_general->slots_out);
1749 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1750 "slots_idle:",
1751 le32_to_cpu(general->slots_idle),
1752 accum_general->slots_idle,
1753 delta_general->slots_idle, max_general->slots_idle);
1754 pos += scnprintf(buf + pos, bufsz - pos, "ttl_timestamp:\t\t\t%u\n",
1755 le32_to_cpu(general->ttl_timestamp));
1756 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1757 "tx_on_a:",
1758 le32_to_cpu(div->tx_on_a), accum_div->tx_on_a,
1759 delta_div->tx_on_a, max_div->tx_on_a);
1760 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1761 "tx_on_b:",
1762 le32_to_cpu(div->tx_on_b), accum_div->tx_on_b,
1763 delta_div->tx_on_b, max_div->tx_on_b);
1764 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1765 "exec_time:",
1766 le32_to_cpu(div->exec_time), accum_div->exec_time,
1767 delta_div->exec_time, max_div->exec_time);
1768 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1769 "probe_time:",
1770 le32_to_cpu(div->probe_time), accum_div->probe_time,
1771 delta_div->probe_time, max_div->probe_time);
1772 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1773 "rx_enable_counter:",
1774 le32_to_cpu(general->rx_enable_counter),
1775 accum_general->rx_enable_counter,
1776 delta_general->rx_enable_counter,
1777 max_general->rx_enable_counter);
1778 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1779 "num_of_sos_states:",
1780 le32_to_cpu(general->num_of_sos_states),
1781 accum_general->num_of_sos_states,
1782 delta_general->num_of_sos_states,
1783 max_general->num_of_sos_states);
1784 ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos);
1785 kfree(buf);
1786 return ret;
1787} 1088}
1788 1089
1789static ssize_t iwl_dbgfs_sensitivity_read(struct file *file, 1090static ssize_t iwl_dbgfs_sensitivity_read(struct file *file,
@@ -2341,10 +1642,11 @@ int iwl_dbgfs_register(struct iwl_priv *priv, const char *name)
2341 DEBUGFS_ADD_FILE(missed_beacon, dir_debug, S_IWUSR); 1642 DEBUGFS_ADD_FILE(missed_beacon, dir_debug, S_IWUSR);
2342 DEBUGFS_ADD_FILE(plcp_delta, dir_debug, S_IWUSR | S_IRUSR); 1643 DEBUGFS_ADD_FILE(plcp_delta, dir_debug, S_IWUSR | S_IRUSR);
2343 DEBUGFS_ADD_FILE(force_reset, dir_debug, S_IWUSR | S_IRUSR); 1644 DEBUGFS_ADD_FILE(force_reset, dir_debug, S_IWUSR | S_IRUSR);
1645 DEBUGFS_ADD_FILE(ucode_rx_stats, dir_debug, S_IRUSR);
1646 DEBUGFS_ADD_FILE(ucode_tx_stats, dir_debug, S_IRUSR);
1647 DEBUGFS_ADD_FILE(ucode_general_stats, dir_debug, S_IRUSR);
1648
2344 if ((priv->hw_rev & CSR_HW_REV_TYPE_MSK) != CSR_HW_REV_TYPE_3945) { 1649 if ((priv->hw_rev & CSR_HW_REV_TYPE_MSK) != CSR_HW_REV_TYPE_3945) {
2345 DEBUGFS_ADD_FILE(ucode_rx_stats, dir_debug, S_IRUSR);
2346 DEBUGFS_ADD_FILE(ucode_tx_stats, dir_debug, S_IRUSR);
2347 DEBUGFS_ADD_FILE(ucode_general_stats, dir_debug, S_IRUSR);
2348 DEBUGFS_ADD_FILE(sensitivity, dir_debug, S_IRUSR); 1650 DEBUGFS_ADD_FILE(sensitivity, dir_debug, S_IRUSR);
2349 DEBUGFS_ADD_FILE(chain_noise, dir_debug, S_IRUSR); 1651 DEBUGFS_ADD_FILE(chain_noise, dir_debug, S_IRUSR);
2350 DEBUGFS_ADD_FILE(ucode_tracing, dir_debug, S_IWUSR | S_IRUSR); 1652 DEBUGFS_ADD_FILE(ucode_tracing, dir_debug, S_IWUSR | S_IRUSR);