aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-debugfs.c850
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-dev.h2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-rx.c19
3 files changed, 545 insertions, 326 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-debugfs.c b/drivers/net/wireless/iwlwifi/iwl-debugfs.c
index 4a2ac9311ba8..2264cbd95a00 100644
--- a/drivers/net/wireless/iwlwifi/iwl-debugfs.c
+++ b/drivers/net/wireless/iwlwifi/iwl-debugfs.c
@@ -1081,6 +1081,12 @@ static int iwl_dbgfs_statistics_flag(struct iwl_priv *priv, char *buf,
1081 return p; 1081 return p;
1082} 1082}
1083 1083
1084static const char ucode_stats_header[] =
1085 "%-32s current acumulative delta max\n";
1086static const char ucode_stats_short_format[] =
1087 " %-30s %10u\n";
1088static const char ucode_stats_format[] =
1089 " %-30s %10u %10u %10u %10u\n";
1084 1090
1085static ssize_t iwl_dbgfs_ucode_rx_stats_read(struct file *file, 1091static ssize_t iwl_dbgfs_ucode_rx_stats_read(struct file *file,
1086 char __user *user_buf, 1092 char __user *user_buf,
@@ -1089,14 +1095,15 @@ static ssize_t iwl_dbgfs_ucode_rx_stats_read(struct file *file,
1089 struct iwl_priv *priv = file->private_data; 1095 struct iwl_priv *priv = file->private_data;
1090 int pos = 0; 1096 int pos = 0;
1091 char *buf; 1097 char *buf;
1092 int bufsz = sizeof(struct statistics_rx_phy) * 20 + 1098 int bufsz = sizeof(struct statistics_rx_phy) * 40 +
1093 sizeof(struct statistics_rx_non_phy) * 20 + 1099 sizeof(struct statistics_rx_non_phy) * 40 +
1094 sizeof(struct statistics_rx_ht_phy) * 20 + 400; 1100 sizeof(struct statistics_rx_ht_phy) * 40 + 400;
1095 ssize_t ret; 1101 ssize_t ret;
1096 struct statistics_rx_phy *ofdm, *accum_ofdm; 1102 struct statistics_rx_phy *ofdm, *accum_ofdm, *delta_ofdm, *max_ofdm;
1097 struct statistics_rx_phy *cck, *accum_cck; 1103 struct statistics_rx_phy *cck, *accum_cck, *delta_cck, *max_cck;
1098 struct statistics_rx_non_phy *general, *accum_general; 1104 struct statistics_rx_non_phy *general, *accum_general;
1099 struct statistics_rx_ht_phy *ht, *accum_ht; 1105 struct statistics_rx_non_phy *delta_general, *max_general;
1106 struct statistics_rx_ht_phy *ht, *accum_ht, *delta_ht, *max_ht;
1100 1107
1101 if (!iwl_is_alive(priv)) 1108 if (!iwl_is_alive(priv))
1102 return -EAGAIN; 1109 return -EAGAIN;
@@ -1129,267 +1136,401 @@ static ssize_t iwl_dbgfs_ucode_rx_stats_read(struct file *file,
1129 accum_cck = &priv->accum_statistics.rx.cck; 1136 accum_cck = &priv->accum_statistics.rx.cck;
1130 accum_general = &priv->accum_statistics.rx.general; 1137 accum_general = &priv->accum_statistics.rx.general;
1131 accum_ht = &priv->accum_statistics.rx.ofdm_ht; 1138 accum_ht = &priv->accum_statistics.rx.ofdm_ht;
1139 delta_ofdm = &priv->delta_statistics.rx.ofdm;
1140 delta_cck = &priv->delta_statistics.rx.cck;
1141 delta_general = &priv->delta_statistics.rx.general;
1142 delta_ht = &priv->delta_statistics.rx.ofdm_ht;
1143 max_ofdm = &priv->max_delta.rx.ofdm;
1144 max_cck = &priv->max_delta.rx.cck;
1145 max_general = &priv->max_delta.rx.general;
1146 max_ht = &priv->max_delta.rx.ofdm_ht;
1147
1132 pos += iwl_dbgfs_statistics_flag(priv, buf, bufsz); 1148 pos += iwl_dbgfs_statistics_flag(priv, buf, bufsz);
1133 pos += scnprintf(buf + pos, bufsz - pos, "Statistics_Rx - OFDM:\n"); 1149 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_header,
1134 pos += scnprintf(buf + pos, bufsz - pos, 1150 "Statistics_Rx - OFDM:");
1135 "\t\t\tcurrent\t\t\taccumulative\n"); 1151 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1136 pos += scnprintf(buf + pos, bufsz - pos, "ina_cnt:\t\t%u\t\t\t%u\n", 1152 "ina_cnt:", le32_to_cpu(ofdm->ina_cnt),
1137 le32_to_cpu(ofdm->ina_cnt), accum_ofdm->ina_cnt); 1153 accum_ofdm->ina_cnt,
1138 pos += scnprintf(buf + pos, bufsz - pos, "fina_cnt:\t\t%u\t\t\t%u\n", 1154 delta_ofdm->ina_cnt, max_ofdm->ina_cnt);
1139 le32_to_cpu(ofdm->fina_cnt), accum_ofdm->fina_cnt); 1155 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1140 pos += scnprintf(buf + pos, bufsz - pos, "plcp_err:\t\t%u\t\t\t%u\n", 1156 "fina_cnt:",
1141 le32_to_cpu(ofdm->plcp_err), accum_ofdm->plcp_err); 1157 le32_to_cpu(ofdm->fina_cnt), accum_ofdm->fina_cnt,
1142 pos += scnprintf(buf + pos, bufsz - pos, "crc32_err:\t\t%u\t\t\t%u\n", 1158 delta_ofdm->fina_cnt, max_ofdm->fina_cnt);
1143 le32_to_cpu(ofdm->crc32_err), accum_ofdm->crc32_err); 1159 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1144 pos += scnprintf(buf + pos, bufsz - pos, 1160 "plcp_err:",
1145 "overrun_err:\t\t%u\t\t\t%u\n", 1161 le32_to_cpu(ofdm->plcp_err), accum_ofdm->plcp_err,
1162 delta_ofdm->plcp_err, max_ofdm->plcp_err);
1163 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1164 "crc32_err:",
1165 le32_to_cpu(ofdm->crc32_err), accum_ofdm->crc32_err,
1166 delta_ofdm->crc32_err, max_ofdm->crc32_err);
1167 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1168 "overrun_err:",
1146 le32_to_cpu(ofdm->overrun_err), 1169 le32_to_cpu(ofdm->overrun_err),
1147 accum_ofdm->overrun_err); 1170 accum_ofdm->overrun_err,
1148 pos += scnprintf(buf + pos, bufsz - pos, 1171 delta_ofdm->overrun_err, max_ofdm->overrun_err);
1149 "early_overrun_err:\t%u\t\t\t%u\n", 1172 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1173 "early_overrun_err:",
1150 le32_to_cpu(ofdm->early_overrun_err), 1174 le32_to_cpu(ofdm->early_overrun_err),
1151 accum_ofdm->early_overrun_err); 1175 accum_ofdm->early_overrun_err,
1152 pos += scnprintf(buf + pos, bufsz - pos, "crc32_good:\t\t%u\t\t\t%u\n", 1176 delta_ofdm->early_overrun_err,
1177 max_ofdm->early_overrun_err);
1178 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1179 "crc32_good:",
1153 le32_to_cpu(ofdm->crc32_good), 1180 le32_to_cpu(ofdm->crc32_good),
1154 accum_ofdm->crc32_good); 1181 accum_ofdm->crc32_good,
1155 pos += scnprintf(buf + pos, bufsz - pos, 1182 delta_ofdm->crc32_good, max_ofdm->crc32_good);
1156 "false_alarm_cnt:\t%u\t\t\t%u\n", 1183 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1184 "false_alarm_cnt:",
1157 le32_to_cpu(ofdm->false_alarm_cnt), 1185 le32_to_cpu(ofdm->false_alarm_cnt),
1158 accum_ofdm->false_alarm_cnt); 1186 accum_ofdm->false_alarm_cnt,
1159 pos += scnprintf(buf + pos, bufsz - pos, 1187 delta_ofdm->false_alarm_cnt,
1160 "fina_sync_err_cnt:\t%u\t\t\t%u\n", 1188 max_ofdm->false_alarm_cnt);
1189 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1190 "fina_sync_err_cnt:",
1161 le32_to_cpu(ofdm->fina_sync_err_cnt), 1191 le32_to_cpu(ofdm->fina_sync_err_cnt),
1162 accum_ofdm->fina_sync_err_cnt); 1192 accum_ofdm->fina_sync_err_cnt,
1163 pos += scnprintf(buf + pos, bufsz - pos, 1193 delta_ofdm->fina_sync_err_cnt,
1164 "sfd_timeout:\t\t%u\t\t\t%u\n", 1194 max_ofdm->fina_sync_err_cnt);
1195 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1196 "sfd_timeout:",
1165 le32_to_cpu(ofdm->sfd_timeout), 1197 le32_to_cpu(ofdm->sfd_timeout),
1166 accum_ofdm->sfd_timeout); 1198 accum_ofdm->sfd_timeout,
1167 pos += scnprintf(buf + pos, bufsz - pos, 1199 delta_ofdm->sfd_timeout,
1168 "fina_timeout:\t\t%u\t\t\t%u\n", 1200 max_ofdm->sfd_timeout);
1201 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1202 "fina_timeout:",
1169 le32_to_cpu(ofdm->fina_timeout), 1203 le32_to_cpu(ofdm->fina_timeout),
1170 accum_ofdm->fina_timeout); 1204 accum_ofdm->fina_timeout,
1171 pos += scnprintf(buf + pos, bufsz - pos, 1205 delta_ofdm->fina_timeout,
1172 "unresponded_rts:\t%u\t\t\t%u\n", 1206 max_ofdm->fina_timeout);
1207 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1208 "unresponded_rts:",
1173 le32_to_cpu(ofdm->unresponded_rts), 1209 le32_to_cpu(ofdm->unresponded_rts),
1174 accum_ofdm->unresponded_rts); 1210 accum_ofdm->unresponded_rts,
1175 pos += scnprintf(buf + pos, bufsz - pos, 1211 delta_ofdm->unresponded_rts,
1176 "rxe_frame_lmt_ovrun:\t%u\t\t\t%u\n", 1212 max_ofdm->unresponded_rts);
1213 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1214 "rxe_frame_lmt_ovrun:",
1177 le32_to_cpu(ofdm->rxe_frame_limit_overrun), 1215 le32_to_cpu(ofdm->rxe_frame_limit_overrun),
1178 accum_ofdm->rxe_frame_limit_overrun); 1216 accum_ofdm->rxe_frame_limit_overrun,
1179 pos += scnprintf(buf + pos, bufsz - pos, 1217 delta_ofdm->rxe_frame_limit_overrun,
1180 "sent_ack_cnt:\t\t%u\t\t\t%u\n", 1218 max_ofdm->rxe_frame_limit_overrun);
1219 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1220 "sent_ack_cnt:",
1181 le32_to_cpu(ofdm->sent_ack_cnt), 1221 le32_to_cpu(ofdm->sent_ack_cnt),
1182 accum_ofdm->sent_ack_cnt); 1222 accum_ofdm->sent_ack_cnt,
1183 pos += scnprintf(buf + pos, bufsz - pos, 1223 delta_ofdm->sent_ack_cnt,
1184 "sent_cts_cnt:\t\t%u\t\t\t%u\n", 1224 max_ofdm->sent_ack_cnt);
1225 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1226 "sent_cts_cnt:",
1185 le32_to_cpu(ofdm->sent_cts_cnt), 1227 le32_to_cpu(ofdm->sent_cts_cnt),
1186 accum_ofdm->sent_cts_cnt); 1228 accum_ofdm->sent_cts_cnt,
1187 pos += scnprintf(buf + pos, bufsz - pos, 1229 delta_ofdm->sent_cts_cnt, max_ofdm->sent_cts_cnt);
1188 "sent_ba_rsp_cnt:\t%u\t\t\t%u\n", 1230 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1231 "sent_ba_rsp_cnt:",
1189 le32_to_cpu(ofdm->sent_ba_rsp_cnt), 1232 le32_to_cpu(ofdm->sent_ba_rsp_cnt),
1190 accum_ofdm->sent_ba_rsp_cnt); 1233 accum_ofdm->sent_ba_rsp_cnt,
1191 pos += scnprintf(buf + pos, bufsz - pos, 1234 delta_ofdm->sent_ba_rsp_cnt,
1192 "dsp_self_kill:\t\t%u\t\t\t%u\n", 1235 max_ofdm->sent_ba_rsp_cnt);
1236 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1237 "dsp_self_kill:",
1193 le32_to_cpu(ofdm->dsp_self_kill), 1238 le32_to_cpu(ofdm->dsp_self_kill),
1194 accum_ofdm->dsp_self_kill); 1239 accum_ofdm->dsp_self_kill,
1195 pos += scnprintf(buf + pos, bufsz - pos, 1240 delta_ofdm->dsp_self_kill,
1196 "mh_format_err:\t\t%u\t\t\t%u\n", 1241 max_ofdm->dsp_self_kill);
1242 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1243 "mh_format_err:",
1197 le32_to_cpu(ofdm->mh_format_err), 1244 le32_to_cpu(ofdm->mh_format_err),
1198 accum_ofdm->mh_format_err); 1245 accum_ofdm->mh_format_err,
1199 pos += scnprintf(buf + pos, bufsz - pos, 1246 delta_ofdm->mh_format_err,
1200 "re_acq_main_rssi_sum:\t%u\t\t\t%u\n", 1247 max_ofdm->mh_format_err);
1248 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1249 "re_acq_main_rssi_sum:",
1201 le32_to_cpu(ofdm->re_acq_main_rssi_sum), 1250 le32_to_cpu(ofdm->re_acq_main_rssi_sum),
1202 accum_ofdm->re_acq_main_rssi_sum); 1251 accum_ofdm->re_acq_main_rssi_sum,
1203 1252 delta_ofdm->re_acq_main_rssi_sum,
1204 pos += scnprintf(buf + pos, bufsz - pos, "Statistics_Rx - CCK:\n"); 1253 max_ofdm->re_acq_main_rssi_sum);
1205 pos += scnprintf(buf + pos, bufsz - pos, 1254
1206 "\t\t\tcurrent\t\t\taccumulative\n"); 1255 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_header,
1207 pos += scnprintf(buf + pos, bufsz - pos, "ina_cnt:\t\t%u\t\t\t%u\n", 1256 "Statistics_Rx - CCK:");
1208 le32_to_cpu(cck->ina_cnt), accum_cck->ina_cnt); 1257 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1209 pos += scnprintf(buf + pos, bufsz - pos, "fina_cnt:\t\t%u\t\t\t%u\n", 1258 "ina_cnt:",
1210 le32_to_cpu(cck->fina_cnt), accum_cck->fina_cnt); 1259 le32_to_cpu(cck->ina_cnt), accum_cck->ina_cnt,
1211 pos += scnprintf(buf + pos, bufsz - pos, "plcp_err:\t\t%u\t\t\t%u\n", 1260 delta_cck->ina_cnt, max_cck->ina_cnt);
1212 le32_to_cpu(cck->plcp_err), accum_cck->plcp_err); 1261 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1213 pos += scnprintf(buf + pos, bufsz - pos, "crc32_err:\t\t%u\t\t\t%u\n", 1262 "fina_cnt:",
1214 le32_to_cpu(cck->crc32_err), accum_cck->crc32_err); 1263 le32_to_cpu(cck->fina_cnt), accum_cck->fina_cnt,
1215 pos += scnprintf(buf + pos, bufsz - pos, 1264 delta_cck->fina_cnt, max_cck->fina_cnt);
1216 "overrun_err:\t\t%u\t\t\t%u\n", 1265 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1266 "plcp_err:",
1267 le32_to_cpu(cck->plcp_err), accum_cck->plcp_err,
1268 delta_cck->plcp_err, max_cck->plcp_err);
1269 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1270 "crc32_err:",
1271 le32_to_cpu(cck->crc32_err), accum_cck->crc32_err,
1272 delta_cck->crc32_err, max_cck->crc32_err);
1273 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1274 "overrun_err:",
1217 le32_to_cpu(cck->overrun_err), 1275 le32_to_cpu(cck->overrun_err),
1218 accum_cck->overrun_err); 1276 accum_cck->overrun_err,
1219 pos += scnprintf(buf + pos, bufsz - pos, 1277 delta_cck->overrun_err, max_cck->overrun_err);
1220 "early_overrun_err:\t%u\t\t\t%u\n", 1278 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1279 "early_overrun_err:",
1221 le32_to_cpu(cck->early_overrun_err), 1280 le32_to_cpu(cck->early_overrun_err),
1222 accum_cck->early_overrun_err); 1281 accum_cck->early_overrun_err,
1223 pos += scnprintf(buf + pos, bufsz - pos, "crc32_good:\t\t%u\t\t\t%u\n", 1282 delta_cck->early_overrun_err,
1224 le32_to_cpu(cck->crc32_good), accum_cck->crc32_good); 1283 max_cck->early_overrun_err);
1225 pos += scnprintf(buf + pos, bufsz - pos, 1284 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1226 "false_alarm_cnt:\t%u\t\t\t%u\n", 1285 "crc32_good:",
1286 le32_to_cpu(cck->crc32_good), accum_cck->crc32_good,
1287 delta_cck->crc32_good,
1288 max_cck->crc32_good);
1289 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1290 "false_alarm_cnt:",
1227 le32_to_cpu(cck->false_alarm_cnt), 1291 le32_to_cpu(cck->false_alarm_cnt),
1228 accum_cck->false_alarm_cnt); 1292 accum_cck->false_alarm_cnt,
1229 pos += scnprintf(buf + pos, bufsz - pos, 1293 delta_cck->false_alarm_cnt, max_cck->false_alarm_cnt);
1230 "fina_sync_err_cnt:\t%u\t\t\t%u\n", 1294 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1295 "fina_sync_err_cnt:",
1231 le32_to_cpu(cck->fina_sync_err_cnt), 1296 le32_to_cpu(cck->fina_sync_err_cnt),
1232 accum_cck->fina_sync_err_cnt); 1297 accum_cck->fina_sync_err_cnt,
1233 pos += scnprintf(buf + pos, bufsz - pos, 1298 delta_cck->fina_sync_err_cnt,
1234 "sfd_timeout:\t\t%u\t\t\t%u\n", 1299 max_cck->fina_sync_err_cnt);
1300 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1301 "sfd_timeout:",
1235 le32_to_cpu(cck->sfd_timeout), 1302 le32_to_cpu(cck->sfd_timeout),
1236 accum_cck->sfd_timeout); 1303 accum_cck->sfd_timeout,
1237 pos += scnprintf(buf + pos, bufsz - pos, 1304 delta_cck->sfd_timeout, max_cck->sfd_timeout);
1238 "fina_timeout:\t\t%u\t\t\t%u\n", 1305 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1306 "fina_timeout:",
1239 le32_to_cpu(cck->fina_timeout), 1307 le32_to_cpu(cck->fina_timeout),
1240 accum_cck->fina_timeout); 1308 accum_cck->fina_timeout,
1241 pos += scnprintf(buf + pos, bufsz - pos, 1309 delta_cck->fina_timeout, max_cck->fina_timeout);
1242 "unresponded_rts:\t%u\t\t\t%u\n", 1310 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1311 "unresponded_rts:",
1243 le32_to_cpu(cck->unresponded_rts), 1312 le32_to_cpu(cck->unresponded_rts),
1244 accum_cck->unresponded_rts); 1313 accum_cck->unresponded_rts,
1245 pos += scnprintf(buf + pos, bufsz - pos, 1314 delta_cck->unresponded_rts,
1246 "rxe_frame_lmt_ovrun:\t%u\t\t\t%u\n", 1315 max_cck->unresponded_rts);
1316 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1317 "rxe_frame_lmt_ovrun:",
1247 le32_to_cpu(cck->rxe_frame_limit_overrun), 1318 le32_to_cpu(cck->rxe_frame_limit_overrun),
1248 accum_cck->rxe_frame_limit_overrun); 1319 accum_cck->rxe_frame_limit_overrun,
1249 pos += scnprintf(buf + pos, bufsz - pos, 1320 delta_cck->rxe_frame_limit_overrun,
1250 "sent_ack_cnt:\t\t%u\t\t\t%u\n", 1321 max_cck->rxe_frame_limit_overrun);
1322 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1323 "sent_ack_cnt:",
1251 le32_to_cpu(cck->sent_ack_cnt), 1324 le32_to_cpu(cck->sent_ack_cnt),
1252 accum_cck->sent_ack_cnt); 1325 accum_cck->sent_ack_cnt,
1253 pos += scnprintf(buf + pos, bufsz - pos, 1326 delta_cck->sent_ack_cnt,
1254 "sent_cts_cnt:\t\t%u\t\t\t%u\n", 1327 max_cck->sent_ack_cnt);
1328 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1329 "sent_cts_cnt:",
1255 le32_to_cpu(cck->sent_cts_cnt), 1330 le32_to_cpu(cck->sent_cts_cnt),
1256 accum_cck->sent_cts_cnt); 1331 accum_cck->sent_cts_cnt,
1257 pos += scnprintf(buf + pos, bufsz - pos, 1332 delta_cck->sent_cts_cnt,
1258 "sent_ba_rsp_cnt:\t%u\t\t\t%u\n", 1333 max_cck->sent_cts_cnt);
1334 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1335 "sent_ba_rsp_cnt:",
1259 le32_to_cpu(cck->sent_ba_rsp_cnt), 1336 le32_to_cpu(cck->sent_ba_rsp_cnt),
1260 accum_cck->sent_ba_rsp_cnt); 1337 accum_cck->sent_ba_rsp_cnt,
1261 pos += scnprintf(buf + pos, bufsz - pos, 1338 delta_cck->sent_ba_rsp_cnt,
1262 "dsp_self_kill:\t\t%u\t\t\t%u\n", 1339 max_cck->sent_ba_rsp_cnt);
1340 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1341 "dsp_self_kill:",
1263 le32_to_cpu(cck->dsp_self_kill), 1342 le32_to_cpu(cck->dsp_self_kill),
1264 accum_cck->dsp_self_kill); 1343 accum_cck->dsp_self_kill,
1265 pos += scnprintf(buf + pos, bufsz - pos, 1344 delta_cck->dsp_self_kill,
1266 "mh_format_err:\t\t%u\t\t\t%u\n", 1345 max_cck->dsp_self_kill);
1346 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1347 "mh_format_err:",
1267 le32_to_cpu(cck->mh_format_err), 1348 le32_to_cpu(cck->mh_format_err),
1268 accum_cck->mh_format_err); 1349 accum_cck->mh_format_err,
1269 pos += scnprintf(buf + pos, bufsz - pos, 1350 delta_cck->mh_format_err, max_cck->mh_format_err);
1270 "re_acq_main_rssi_sum:\t%u\t\t\t%u\n", 1351 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1352 "re_acq_main_rssi_sum:",
1271 le32_to_cpu(cck->re_acq_main_rssi_sum), 1353 le32_to_cpu(cck->re_acq_main_rssi_sum),
1272 accum_cck->re_acq_main_rssi_sum); 1354 accum_cck->re_acq_main_rssi_sum,
1273 1355 delta_cck->re_acq_main_rssi_sum,
1274 pos += scnprintf(buf + pos, bufsz - pos, "Statistics_Rx - GENERAL:\n"); 1356 max_cck->re_acq_main_rssi_sum);
1275 pos += scnprintf(buf + pos, bufsz - pos, 1357
1276 "\t\t\tcurrent\t\t\taccumulative\n"); 1358 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_header,
1277 pos += scnprintf(buf + pos, bufsz - pos, "bogus_cts:\t\t%u\t\t\t%u\n", 1359 "Statistics_Rx - GENERAL:");
1360 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1361 "bogus_cts:",
1278 le32_to_cpu(general->bogus_cts), 1362 le32_to_cpu(general->bogus_cts),
1279 accum_general->bogus_cts); 1363 accum_general->bogus_cts,
1280 pos += scnprintf(buf + pos, bufsz - pos, "bogus_ack:\t\t%u\t\t\t%u\n", 1364 delta_general->bogus_cts, max_general->bogus_cts);
1365 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1366 "bogus_ack:",
1281 le32_to_cpu(general->bogus_ack), 1367 le32_to_cpu(general->bogus_ack),
1282 accum_general->bogus_ack); 1368 accum_general->bogus_ack,
1283 pos += scnprintf(buf + pos, bufsz - pos, 1369 delta_general->bogus_ack, max_general->bogus_ack);
1284 "non_bssid_frames:\t%u\t\t\t%u\n", 1370 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1371 "non_bssid_frames:",
1285 le32_to_cpu(general->non_bssid_frames), 1372 le32_to_cpu(general->non_bssid_frames),
1286 accum_general->non_bssid_frames); 1373 accum_general->non_bssid_frames,
1287 pos += scnprintf(buf + pos, bufsz - pos, 1374 delta_general->non_bssid_frames,
1288 "filtered_frames:\t%u\t\t\t%u\n", 1375 max_general->non_bssid_frames);
1376 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1377 "filtered_frames:",
1289 le32_to_cpu(general->filtered_frames), 1378 le32_to_cpu(general->filtered_frames),
1290 accum_general->filtered_frames); 1379 accum_general->filtered_frames,
1291 pos += scnprintf(buf + pos, bufsz - pos, 1380 delta_general->filtered_frames,
1292 "non_channel_beacons:\t%u\t\t\t%u\n", 1381 max_general->filtered_frames);
1382 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1383 "non_channel_beacons:",
1293 le32_to_cpu(general->non_channel_beacons), 1384 le32_to_cpu(general->non_channel_beacons),
1294 accum_general->non_channel_beacons); 1385 accum_general->non_channel_beacons,
1295 pos += scnprintf(buf + pos, bufsz - pos, 1386 delta_general->non_channel_beacons,
1296 "channel_beacons:\t%u\t\t\t%u\n", 1387 max_general->non_channel_beacons);
1388 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1389 "channel_beacons:",
1297 le32_to_cpu(general->channel_beacons), 1390 le32_to_cpu(general->channel_beacons),
1298 accum_general->channel_beacons); 1391 accum_general->channel_beacons,
1299 pos += scnprintf(buf + pos, bufsz - pos, 1392 delta_general->channel_beacons,
1300 "num_missed_bcon:\t%u\t\t\t%u\n", 1393 max_general->channel_beacons);
1394 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1395 "num_missed_bcon:",
1301 le32_to_cpu(general->num_missed_bcon), 1396 le32_to_cpu(general->num_missed_bcon),
1302 accum_general->num_missed_bcon); 1397 accum_general->num_missed_bcon,
1303 pos += scnprintf(buf + pos, bufsz - pos, 1398 delta_general->num_missed_bcon,
1304 "adc_rx_saturation_time:\t%u\t\t\t%u\n", 1399 max_general->num_missed_bcon);
1400 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1401 "adc_rx_saturation_time:",
1305 le32_to_cpu(general->adc_rx_saturation_time), 1402 le32_to_cpu(general->adc_rx_saturation_time),
1306 accum_general->adc_rx_saturation_time); 1403 accum_general->adc_rx_saturation_time,
1307 pos += scnprintf(buf + pos, bufsz - pos, 1404 delta_general->adc_rx_saturation_time,
1308 "ina_detect_search_tm:\t%u\t\t\t%u\n", 1405 max_general->adc_rx_saturation_time);
1406 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1407 "ina_detect_search_tm:",
1309 le32_to_cpu(general->ina_detection_search_time), 1408 le32_to_cpu(general->ina_detection_search_time),
1310 accum_general->ina_detection_search_time); 1409 accum_general->ina_detection_search_time,
1311 pos += scnprintf(buf + pos, bufsz - pos, 1410 delta_general->ina_detection_search_time,
1312 "beacon_silence_rssi_a:\t%u\t\t\t%u\n", 1411 max_general->ina_detection_search_time);
1412 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1413 "beacon_silence_rssi_a:",
1313 le32_to_cpu(general->beacon_silence_rssi_a), 1414 le32_to_cpu(general->beacon_silence_rssi_a),
1314 accum_general->beacon_silence_rssi_a); 1415 accum_general->beacon_silence_rssi_a,
1315 pos += scnprintf(buf + pos, bufsz - pos, 1416 delta_general->beacon_silence_rssi_a,
1316 "beacon_silence_rssi_b:\t%u\t\t\t%u\n", 1417 max_general->beacon_silence_rssi_a);
1418 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1419 "beacon_silence_rssi_b:",
1317 le32_to_cpu(general->beacon_silence_rssi_b), 1420 le32_to_cpu(general->beacon_silence_rssi_b),
1318 accum_general->beacon_silence_rssi_b); 1421 accum_general->beacon_silence_rssi_b,
1319 pos += scnprintf(buf + pos, bufsz - pos, 1422 delta_general->beacon_silence_rssi_b,
1320 "beacon_silence_rssi_c:\t%u\t\t\t%u\n", 1423 max_general->beacon_silence_rssi_b);
1424 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1425 "beacon_silence_rssi_c:",
1321 le32_to_cpu(general->beacon_silence_rssi_c), 1426 le32_to_cpu(general->beacon_silence_rssi_c),
1322 accum_general->beacon_silence_rssi_c); 1427 accum_general->beacon_silence_rssi_c,
1323 pos += scnprintf(buf + pos, bufsz - pos, 1428 delta_general->beacon_silence_rssi_c,
1324 "interference_data_flag:\t%u\t\t\t%u\n", 1429 max_general->beacon_silence_rssi_c);
1430 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1431 "interference_data_flag:",
1325 le32_to_cpu(general->interference_data_flag), 1432 le32_to_cpu(general->interference_data_flag),
1326 accum_general->interference_data_flag); 1433 accum_general->interference_data_flag,
1327 pos += scnprintf(buf + pos, bufsz - pos, 1434 delta_general->interference_data_flag,
1328 "channel_load:\t\t%u\t\t\t%u\n", 1435 max_general->interference_data_flag);
1436 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1437 "channel_load:",
1329 le32_to_cpu(general->channel_load), 1438 le32_to_cpu(general->channel_load),
1330 accum_general->channel_load); 1439 accum_general->channel_load,
1331 pos += scnprintf(buf + pos, bufsz - pos, 1440 delta_general->channel_load,
1332 "dsp_false_alarms:\t%u\t\t\t%u\n", 1441 max_general->channel_load);
1442 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1443 "dsp_false_alarms:",
1333 le32_to_cpu(general->dsp_false_alarms), 1444 le32_to_cpu(general->dsp_false_alarms),
1334 accum_general->dsp_false_alarms); 1445 accum_general->dsp_false_alarms,
1335 pos += scnprintf(buf + pos, bufsz - pos, 1446 delta_general->dsp_false_alarms,
1336 "beacon_rssi_a:\t\t%u\t\t\t%u\n", 1447 max_general->dsp_false_alarms);
1448 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1449 "beacon_rssi_a:",
1337 le32_to_cpu(general->beacon_rssi_a), 1450 le32_to_cpu(general->beacon_rssi_a),
1338 accum_general->beacon_rssi_a); 1451 accum_general->beacon_rssi_a,
1339 pos += scnprintf(buf + pos, bufsz - pos, 1452 delta_general->beacon_rssi_a,
1340 "beacon_rssi_b:\t\t%u\t\t\t%u\n", 1453 max_general->beacon_rssi_a);
1454 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1455 "beacon_rssi_b:",
1341 le32_to_cpu(general->beacon_rssi_b), 1456 le32_to_cpu(general->beacon_rssi_b),
1342 accum_general->beacon_rssi_b); 1457 accum_general->beacon_rssi_b,
1343 pos += scnprintf(buf + pos, bufsz - pos, 1458 delta_general->beacon_rssi_b,
1344 "beacon_rssi_c:\t\t%u\t\t\t%u\n", 1459 max_general->beacon_rssi_b);
1460 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1461 "beacon_rssi_c:",
1345 le32_to_cpu(general->beacon_rssi_c), 1462 le32_to_cpu(general->beacon_rssi_c),
1346 accum_general->beacon_rssi_c); 1463 accum_general->beacon_rssi_c,
1347 pos += scnprintf(buf + pos, bufsz - pos, 1464 delta_general->beacon_rssi_c,
1348 "beacon_energy_a:\t%u\t\t\t%u\n", 1465 max_general->beacon_rssi_c);
1466 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1467 "beacon_energy_a:",
1349 le32_to_cpu(general->beacon_energy_a), 1468 le32_to_cpu(general->beacon_energy_a),
1350 accum_general->beacon_energy_a); 1469 accum_general->beacon_energy_a,
1351 pos += scnprintf(buf + pos, bufsz - pos, 1470 delta_general->beacon_energy_a,
1352 "beacon_energy_b:\t%u\t\t\t%u\n", 1471 max_general->beacon_energy_a);
1472 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1473 "beacon_energy_b:",
1353 le32_to_cpu(general->beacon_energy_b), 1474 le32_to_cpu(general->beacon_energy_b),
1354 accum_general->beacon_energy_b); 1475 accum_general->beacon_energy_b,
1355 pos += scnprintf(buf + pos, bufsz - pos, 1476 delta_general->beacon_energy_b,
1356 "beacon_energy_c:\t%u\t\t\t%u\n", 1477 max_general->beacon_energy_b);
1478 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1479 "beacon_energy_c:",
1357 le32_to_cpu(general->beacon_energy_c), 1480 le32_to_cpu(general->beacon_energy_c),
1358 accum_general->beacon_energy_c); 1481 accum_general->beacon_energy_c,
1482 delta_general->beacon_energy_c,
1483 max_general->beacon_energy_c);
1359 1484
1360 pos += scnprintf(buf + pos, bufsz - pos, "Statistics_Rx - OFDM_HT:\n"); 1485 pos += scnprintf(buf + pos, bufsz - pos, "Statistics_Rx - OFDM_HT:\n");
1361 pos += scnprintf(buf + pos, bufsz - pos, 1486 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_header,
1362 "\t\t\tcurrent\t\t\taccumulative\n"); 1487 "Statistics_Rx - OFDM_HT:");
1363 pos += scnprintf(buf + pos, bufsz - pos, "plcp_err:\t\t%u\t\t\t%u\n", 1488 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1364 le32_to_cpu(ht->plcp_err), accum_ht->plcp_err); 1489 "plcp_err:",
1365 pos += scnprintf(buf + pos, bufsz - pos, 1490 le32_to_cpu(ht->plcp_err), accum_ht->plcp_err,
1366 "overrun_err:\t\t%u\t\t\t%u\n", 1491 delta_ht->plcp_err, max_ht->plcp_err);
1367 le32_to_cpu(ht->overrun_err), accum_ht->overrun_err); 1492 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1368 pos += scnprintf(buf + pos, bufsz - pos, 1493 "overrun_err:",
1369 "early_overrun_err:\t%u\t\t\t%u\n", 1494 le32_to_cpu(ht->overrun_err), accum_ht->overrun_err,
1495 delta_ht->overrun_err, max_ht->overrun_err);
1496 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1497 "early_overrun_err:",
1370 le32_to_cpu(ht->early_overrun_err), 1498 le32_to_cpu(ht->early_overrun_err),
1371 accum_ht->early_overrun_err); 1499 accum_ht->early_overrun_err,
1372 pos += scnprintf(buf + pos, bufsz - pos, "crc32_good:\t\t%u\t\t\t%u\n", 1500 delta_ht->early_overrun_err,
1373 le32_to_cpu(ht->crc32_good), accum_ht->crc32_good); 1501 max_ht->early_overrun_err);
1374 pos += scnprintf(buf + pos, bufsz - pos, "crc32_err:\t\t%u\t\t\t%u\n", 1502 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1375 le32_to_cpu(ht->crc32_err), accum_ht->crc32_err); 1503 "crc32_good:",
1376 pos += scnprintf(buf + pos, bufsz - pos, 1504 le32_to_cpu(ht->crc32_good), accum_ht->crc32_good,
1377 "mh_format_err:\t\t%u\t\t\t%u\n", 1505 delta_ht->crc32_good, max_ht->crc32_good);
1506 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1507 "crc32_err:",
1508 le32_to_cpu(ht->crc32_err), accum_ht->crc32_err,
1509 delta_ht->crc32_err, max_ht->crc32_err);
1510 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1511 "mh_format_err:",
1378 le32_to_cpu(ht->mh_format_err), 1512 le32_to_cpu(ht->mh_format_err),
1379 accum_ht->mh_format_err); 1513 accum_ht->mh_format_err,
1380 pos += scnprintf(buf + pos, bufsz - pos, 1514 delta_ht->mh_format_err, max_ht->mh_format_err);
1381 "agg_crc32_good:\t\t%u\t\t\t%u\n", 1515 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1516 "agg_crc32_good:",
1382 le32_to_cpu(ht->agg_crc32_good), 1517 le32_to_cpu(ht->agg_crc32_good),
1383 accum_ht->agg_crc32_good); 1518 accum_ht->agg_crc32_good,
1384 pos += scnprintf(buf + pos, bufsz - pos, 1519 delta_ht->agg_crc32_good, max_ht->agg_crc32_good);
1385 "agg_mpdu_cnt:\t\t%u\t\t\t%u\n", 1520 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1521 "agg_mpdu_cnt:",
1386 le32_to_cpu(ht->agg_mpdu_cnt), 1522 le32_to_cpu(ht->agg_mpdu_cnt),
1387 accum_ht->agg_mpdu_cnt); 1523 accum_ht->agg_mpdu_cnt,
1388 pos += scnprintf(buf + pos, bufsz - pos, "agg_cnt:\t\t%u\t\t\t%u\n", 1524 delta_ht->agg_mpdu_cnt, max_ht->agg_mpdu_cnt);
1389 le32_to_cpu(ht->agg_cnt), accum_ht->agg_cnt); 1525 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1390 pos += scnprintf(buf + pos, bufsz - pos, "unsupport_mcs:\t\t%u\t\t\t%u\n", 1526 "agg_cnt:",
1527 le32_to_cpu(ht->agg_cnt), accum_ht->agg_cnt,
1528 delta_ht->agg_cnt, max_ht->agg_cnt);
1529 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1530 "unsupport_mcs:",
1391 le32_to_cpu(ht->unsupport_mcs), 1531 le32_to_cpu(ht->unsupport_mcs),
1392 accum_ht->unsupport_mcs); 1532 accum_ht->unsupport_mcs,
1533 delta_ht->unsupport_mcs, max_ht->unsupport_mcs);
1393 1534
1394 ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos); 1535 ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos);
1395 kfree(buf); 1536 kfree(buf);
@@ -1403,9 +1544,9 @@ static ssize_t iwl_dbgfs_ucode_tx_stats_read(struct file *file,
1403 struct iwl_priv *priv = file->private_data; 1544 struct iwl_priv *priv = file->private_data;
1404 int pos = 0; 1545 int pos = 0;
1405 char *buf; 1546 char *buf;
1406 int bufsz = (sizeof(struct statistics_tx) * 24) + 250; 1547 int bufsz = (sizeof(struct statistics_tx) * 48) + 250;
1407 ssize_t ret; 1548 ssize_t ret;
1408 struct statistics_tx *tx, *accum_tx; 1549 struct statistics_tx *tx, *accum_tx, *delta_tx, *max_tx;
1409 1550
1410 if (!iwl_is_alive(priv)) 1551 if (!iwl_is_alive(priv))
1411 return -EAGAIN; 1552 return -EAGAIN;
@@ -1432,106 +1573,148 @@ static ssize_t iwl_dbgfs_ucode_tx_stats_read(struct file *file,
1432 */ 1573 */
1433 tx = &priv->statistics.tx; 1574 tx = &priv->statistics.tx;
1434 accum_tx = &priv->accum_statistics.tx; 1575 accum_tx = &priv->accum_statistics.tx;
1576 delta_tx = &priv->delta_statistics.tx;
1577 max_tx = &priv->max_delta.tx;
1435 pos += iwl_dbgfs_statistics_flag(priv, buf, bufsz); 1578 pos += iwl_dbgfs_statistics_flag(priv, buf, bufsz);
1436 pos += scnprintf(buf + pos, bufsz - pos, "Statistics_Tx:\n"); 1579 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_header,
1437 pos += scnprintf(buf + pos, bufsz - pos, 1580 "Statistics_Tx:");
1438 "\t\t\tcurrent\t\t\taccumulative\n"); 1581 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1439 pos += scnprintf(buf + pos, bufsz - pos, "preamble:\t\t\t%u\t\t\t%u\n", 1582 "preamble:",
1440 le32_to_cpu(tx->preamble_cnt), 1583 le32_to_cpu(tx->preamble_cnt),
1441 accum_tx->preamble_cnt); 1584 accum_tx->preamble_cnt,
1442 pos += scnprintf(buf + pos, bufsz - pos, 1585 delta_tx->preamble_cnt, max_tx->preamble_cnt);
1443 "rx_detected_cnt:\t\t%u\t\t\t%u\n", 1586 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1587 "rx_detected_cnt:",
1444 le32_to_cpu(tx->rx_detected_cnt), 1588 le32_to_cpu(tx->rx_detected_cnt),
1445 accum_tx->rx_detected_cnt); 1589 accum_tx->rx_detected_cnt,
1446 pos += scnprintf(buf + pos, bufsz - pos, 1590 delta_tx->rx_detected_cnt, max_tx->rx_detected_cnt);
1447 "bt_prio_defer_cnt:\t\t%u\t\t\t%u\n", 1591 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1592 "bt_prio_defer_cnt:",
1448 le32_to_cpu(tx->bt_prio_defer_cnt), 1593 le32_to_cpu(tx->bt_prio_defer_cnt),
1449 accum_tx->bt_prio_defer_cnt); 1594 accum_tx->bt_prio_defer_cnt,
1450 pos += scnprintf(buf + pos, bufsz - pos, 1595 delta_tx->bt_prio_defer_cnt,
1451 "bt_prio_kill_cnt:\t\t%u\t\t\t%u\n", 1596 max_tx->bt_prio_defer_cnt);
1597 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1598 "bt_prio_kill_cnt:",
1452 le32_to_cpu(tx->bt_prio_kill_cnt), 1599 le32_to_cpu(tx->bt_prio_kill_cnt),
1453 accum_tx->bt_prio_kill_cnt); 1600 accum_tx->bt_prio_kill_cnt,
1454 pos += scnprintf(buf + pos, bufsz - pos, 1601 delta_tx->bt_prio_kill_cnt,
1455 "few_bytes_cnt:\t\t\t%u\t\t\t%u\n", 1602 max_tx->bt_prio_kill_cnt);
1603 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1604 "few_bytes_cnt:",
1456 le32_to_cpu(tx->few_bytes_cnt), 1605 le32_to_cpu(tx->few_bytes_cnt),
1457 accum_tx->few_bytes_cnt); 1606 accum_tx->few_bytes_cnt,
1458 pos += scnprintf(buf + pos, bufsz - pos, 1607 delta_tx->few_bytes_cnt, max_tx->few_bytes_cnt);
1459 "cts_timeout:\t\t\t%u\t\t\t%u\n", 1608 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1460 le32_to_cpu(tx->cts_timeout), accum_tx->cts_timeout); 1609 "cts_timeout:",
1461 pos += scnprintf(buf + pos, bufsz - pos, 1610 le32_to_cpu(tx->cts_timeout), accum_tx->cts_timeout,
1462 "ack_timeout:\t\t\t%u\t\t\t%u\n", 1611 delta_tx->cts_timeout, max_tx->cts_timeout);
1612 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1613 "ack_timeout:",
1463 le32_to_cpu(tx->ack_timeout), 1614 le32_to_cpu(tx->ack_timeout),
1464 accum_tx->ack_timeout); 1615 accum_tx->ack_timeout,
1465 pos += scnprintf(buf + pos, bufsz - pos, 1616 delta_tx->ack_timeout, max_tx->ack_timeout);
1466 "expected_ack_cnt:\t\t%u\t\t\t%u\n", 1617 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1618 "expected_ack_cnt:",
1467 le32_to_cpu(tx->expected_ack_cnt), 1619 le32_to_cpu(tx->expected_ack_cnt),
1468 accum_tx->expected_ack_cnt); 1620 accum_tx->expected_ack_cnt,
1469 pos += scnprintf(buf + pos, bufsz - pos, 1621 delta_tx->expected_ack_cnt,
1470 "actual_ack_cnt:\t\t\t%u\t\t\t%u\n", 1622 max_tx->expected_ack_cnt);
1623 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1624 "actual_ack_cnt:",
1471 le32_to_cpu(tx->actual_ack_cnt), 1625 le32_to_cpu(tx->actual_ack_cnt),
1472 accum_tx->actual_ack_cnt); 1626 accum_tx->actual_ack_cnt,
1473 pos += scnprintf(buf + pos, bufsz - pos, 1627 delta_tx->actual_ack_cnt,
1474 "dump_msdu_cnt:\t\t\t%u\t\t\t%u\n", 1628 max_tx->actual_ack_cnt);
1629 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1630 "dump_msdu_cnt:",
1475 le32_to_cpu(tx->dump_msdu_cnt), 1631 le32_to_cpu(tx->dump_msdu_cnt),
1476 accum_tx->dump_msdu_cnt); 1632 accum_tx->dump_msdu_cnt,
1477 pos += scnprintf(buf + pos, bufsz - pos, 1633 delta_tx->dump_msdu_cnt,
1478 "abort_nxt_frame_mismatch:" 1634 max_tx->dump_msdu_cnt);
1479 "\t%u\t\t\t%u\n", 1635 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1636 "abort_nxt_frame_mismatch:",
1480 le32_to_cpu(tx->burst_abort_next_frame_mismatch_cnt), 1637 le32_to_cpu(tx->burst_abort_next_frame_mismatch_cnt),
1481 accum_tx->burst_abort_next_frame_mismatch_cnt); 1638 accum_tx->burst_abort_next_frame_mismatch_cnt,
1482 pos += scnprintf(buf + pos, bufsz - pos, 1639 delta_tx->burst_abort_next_frame_mismatch_cnt,
1483 "abort_missing_nxt_frame:" 1640 max_tx->burst_abort_next_frame_mismatch_cnt);
1484 "\t%u\t\t\t%u\n", 1641 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1642 "abort_missing_nxt_frame:",
1485 le32_to_cpu(tx->burst_abort_missing_next_frame_cnt), 1643 le32_to_cpu(tx->burst_abort_missing_next_frame_cnt),
1486 accum_tx->burst_abort_missing_next_frame_cnt); 1644 accum_tx->burst_abort_missing_next_frame_cnt,
1487 pos += scnprintf(buf + pos, bufsz - pos, 1645 delta_tx->burst_abort_missing_next_frame_cnt,
1488 "cts_timeout_collision:\t\t%u\t\t\t%u\n", 1646 max_tx->burst_abort_missing_next_frame_cnt);
1647 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1648 "cts_timeout_collision:",
1489 le32_to_cpu(tx->cts_timeout_collision), 1649 le32_to_cpu(tx->cts_timeout_collision),
1490 accum_tx->cts_timeout_collision); 1650 accum_tx->cts_timeout_collision,
1491 pos += scnprintf(buf + pos, bufsz - pos, 1651 delta_tx->cts_timeout_collision,
1492 "ack_ba_timeout_collision:\t%u\t\t\t%u\n", 1652 max_tx->cts_timeout_collision);
1653 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1654 "ack_ba_timeout_collision:",
1493 le32_to_cpu(tx->ack_or_ba_timeout_collision), 1655 le32_to_cpu(tx->ack_or_ba_timeout_collision),
1494 accum_tx->ack_or_ba_timeout_collision); 1656 accum_tx->ack_or_ba_timeout_collision,
1495 pos += scnprintf(buf + pos, bufsz - pos, 1657 delta_tx->ack_or_ba_timeout_collision,
1496 "agg ba_timeout:\t\t\t%u\t\t\t%u\n", 1658 max_tx->ack_or_ba_timeout_collision);
1659 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1660 "agg ba_timeout:",
1497 le32_to_cpu(tx->agg.ba_timeout), 1661 le32_to_cpu(tx->agg.ba_timeout),
1498 accum_tx->agg.ba_timeout); 1662 accum_tx->agg.ba_timeout,
1499 pos += scnprintf(buf + pos, bufsz - pos, 1663 delta_tx->agg.ba_timeout,
1500 "agg ba_resched_frames:\t\t%u\t\t\t%u\n", 1664 max_tx->agg.ba_timeout);
1665 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1666 "agg ba_resched_frames:",
1501 le32_to_cpu(tx->agg.ba_reschedule_frames), 1667 le32_to_cpu(tx->agg.ba_reschedule_frames),
1502 accum_tx->agg.ba_reschedule_frames); 1668 accum_tx->agg.ba_reschedule_frames,
1503 pos += scnprintf(buf + pos, bufsz - pos, 1669 delta_tx->agg.ba_reschedule_frames,
1504 "agg scd_query_agg_frame:\t%u\t\t\t%u\n", 1670 max_tx->agg.ba_reschedule_frames);
1671 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1672 "agg scd_query_agg_frame:",
1505 le32_to_cpu(tx->agg.scd_query_agg_frame_cnt), 1673 le32_to_cpu(tx->agg.scd_query_agg_frame_cnt),
1506 accum_tx->agg.scd_query_agg_frame_cnt); 1674 accum_tx->agg.scd_query_agg_frame_cnt,
1507 pos += scnprintf(buf + pos, bufsz - pos, 1675 delta_tx->agg.scd_query_agg_frame_cnt,
1508 "agg scd_query_no_agg:\t\t%u\t\t\t%u\n", 1676 max_tx->agg.scd_query_agg_frame_cnt);
1677 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1678 "agg scd_query_no_agg:",
1509 le32_to_cpu(tx->agg.scd_query_no_agg), 1679 le32_to_cpu(tx->agg.scd_query_no_agg),
1510 accum_tx->agg.scd_query_no_agg); 1680 accum_tx->agg.scd_query_no_agg,
1511 pos += scnprintf(buf + pos, bufsz - pos, 1681 delta_tx->agg.scd_query_no_agg,
1512 "agg scd_query_agg:\t\t%u\t\t\t%u\n", 1682 max_tx->agg.scd_query_no_agg);
1683 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1684 "agg scd_query_agg:",
1513 le32_to_cpu(tx->agg.scd_query_agg), 1685 le32_to_cpu(tx->agg.scd_query_agg),
1514 accum_tx->agg.scd_query_agg); 1686 accum_tx->agg.scd_query_agg,
1515 pos += scnprintf(buf + pos, bufsz - pos, 1687 delta_tx->agg.scd_query_agg,
1516 "agg scd_query_mismatch:\t\t%u\t\t\t%u\n", 1688 max_tx->agg.scd_query_agg);
1689 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1690 "agg scd_query_mismatch:",
1517 le32_to_cpu(tx->agg.scd_query_mismatch), 1691 le32_to_cpu(tx->agg.scd_query_mismatch),
1518 accum_tx->agg.scd_query_mismatch); 1692 accum_tx->agg.scd_query_mismatch,
1519 pos += scnprintf(buf + pos, bufsz - pos, 1693 delta_tx->agg.scd_query_mismatch,
1520 "agg frame_not_ready:\t\t%u\t\t\t%u\n", 1694 max_tx->agg.scd_query_mismatch);
1695 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1696 "agg frame_not_ready:",
1521 le32_to_cpu(tx->agg.frame_not_ready), 1697 le32_to_cpu(tx->agg.frame_not_ready),
1522 accum_tx->agg.frame_not_ready); 1698 accum_tx->agg.frame_not_ready,
1523 pos += scnprintf(buf + pos, bufsz - pos, 1699 delta_tx->agg.frame_not_ready,
1524 "agg underrun:\t\t\t%u\t\t\t%u\n", 1700 max_tx->agg.frame_not_ready);
1701 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1702 "agg underrun:",
1525 le32_to_cpu(tx->agg.underrun), 1703 le32_to_cpu(tx->agg.underrun),
1526 accum_tx->agg.underrun); 1704 accum_tx->agg.underrun,
1527 pos += scnprintf(buf + pos, bufsz - pos, 1705 delta_tx->agg.underrun, max_tx->agg.underrun);
1528 "agg bt_prio_kill:\t\t%u\t\t\t%u\n", 1706 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1707 "agg bt_prio_kill:",
1529 le32_to_cpu(tx->agg.bt_prio_kill), 1708 le32_to_cpu(tx->agg.bt_prio_kill),
1530 accum_tx->agg.bt_prio_kill); 1709 accum_tx->agg.bt_prio_kill,
1531 pos += scnprintf(buf + pos, bufsz - pos, 1710 delta_tx->agg.bt_prio_kill,
1532 "agg rx_ba_rsp_cnt:\t\t%u\t\t\t%u\n", 1711 max_tx->agg.bt_prio_kill);
1712 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1713 "agg rx_ba_rsp_cnt:",
1533 le32_to_cpu(tx->agg.rx_ba_rsp_cnt), 1714 le32_to_cpu(tx->agg.rx_ba_rsp_cnt),
1534 accum_tx->agg.rx_ba_rsp_cnt); 1715 accum_tx->agg.rx_ba_rsp_cnt,
1716 delta_tx->agg.rx_ba_rsp_cnt,
1717 max_tx->agg.rx_ba_rsp_cnt);
1535 1718
1536 ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos); 1719 ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos);
1537 kfree(buf); 1720 kfree(buf);
@@ -1545,11 +1728,12 @@ static ssize_t iwl_dbgfs_ucode_general_stats_read(struct file *file,
1545 struct iwl_priv *priv = file->private_data; 1728 struct iwl_priv *priv = file->private_data;
1546 int pos = 0; 1729 int pos = 0;
1547 char *buf; 1730 char *buf;
1548 int bufsz = sizeof(struct statistics_general) * 4 + 250; 1731 int bufsz = sizeof(struct statistics_general) * 8 + 250;
1549 ssize_t ret; 1732 ssize_t ret;
1550 struct statistics_general *general, *accum_general; 1733 struct statistics_general *general, *accum_general;
1551 struct statistics_dbg *dbg, *accum_dbg; 1734 struct statistics_general *delta_general, *max_general;
1552 struct statistics_div *div, *accum_div; 1735 struct statistics_dbg *dbg, *accum_dbg, *delta_dbg, *max_dbg;
1736 struct statistics_div *div, *accum_div, *delta_div, *max_div;
1553 1737
1554 if (!iwl_is_alive(priv)) 1738 if (!iwl_is_alive(priv))
1555 return -EAGAIN; 1739 return -EAGAIN;
@@ -1578,52 +1762,72 @@ static ssize_t iwl_dbgfs_ucode_general_stats_read(struct file *file,
1578 dbg = &priv->statistics.general.dbg; 1762 dbg = &priv->statistics.general.dbg;
1579 div = &priv->statistics.general.div; 1763 div = &priv->statistics.general.div;
1580 accum_general = &priv->accum_statistics.general; 1764 accum_general = &priv->accum_statistics.general;
1765 delta_general = &priv->delta_statistics.general;
1766 max_general = &priv->max_delta.general;
1581 accum_dbg = &priv->accum_statistics.general.dbg; 1767 accum_dbg = &priv->accum_statistics.general.dbg;
1768 delta_dbg = &priv->delta_statistics.general.dbg;
1769 max_dbg = &priv->max_delta.general.dbg;
1582 accum_div = &priv->accum_statistics.general.div; 1770 accum_div = &priv->accum_statistics.general.div;
1771 delta_div = &priv->delta_statistics.general.div;
1772 max_div = &priv->max_delta.general.div;
1583 pos += iwl_dbgfs_statistics_flag(priv, buf, bufsz); 1773 pos += iwl_dbgfs_statistics_flag(priv, buf, bufsz);
1584 pos += scnprintf(buf + pos, bufsz - pos, "Statistics_General:\n"); 1774 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_header,
1585 pos += scnprintf(buf + pos, bufsz - pos, 1775 "Statistics_General:");
1586 "\t\t\tcurrent\t\t\taccumulative\n"); 1776 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_short_format,
1587 pos += scnprintf(buf + pos, bufsz - pos, "temperature:\t\t\t%u\n", 1777 "temperature:",
1588 le32_to_cpu(general->temperature)); 1778 le32_to_cpu(general->temperature));
1589 pos += scnprintf(buf + pos, bufsz - pos, "temperature_m:\t\t\t%u\n", 1779 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_short_format,
1780 "temperature_m:",
1590 le32_to_cpu(general->temperature_m)); 1781 le32_to_cpu(general->temperature_m));
1591 pos += scnprintf(buf + pos, bufsz - pos, 1782 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1592 "burst_check:\t\t\t%u\t\t\t%u\n", 1783 "burst_check:",
1593 le32_to_cpu(dbg->burst_check), 1784 le32_to_cpu(dbg->burst_check),
1594 accum_dbg->burst_check); 1785 accum_dbg->burst_check,
1595 pos += scnprintf(buf + pos, bufsz - pos, 1786 delta_dbg->burst_check, max_dbg->burst_check);
1596 "burst_count:\t\t\t%u\t\t\t%u\n", 1787 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1788 "burst_count:",
1597 le32_to_cpu(dbg->burst_count), 1789 le32_to_cpu(dbg->burst_count),
1598 accum_dbg->burst_count); 1790 accum_dbg->burst_count,
1599 pos += scnprintf(buf + pos, bufsz - pos, 1791 delta_dbg->burst_count, max_dbg->burst_count);
1600 "sleep_time:\t\t\t%u\t\t\t%u\n", 1792 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1793 "sleep_time:",
1601 le32_to_cpu(general->sleep_time), 1794 le32_to_cpu(general->sleep_time),
1602 accum_general->sleep_time); 1795 accum_general->sleep_time,
1603 pos += scnprintf(buf + pos, bufsz - pos, 1796 delta_general->sleep_time, max_general->sleep_time);
1604 "slots_out:\t\t\t%u\t\t\t%u\n", 1797 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1798 "slots_out:",
1605 le32_to_cpu(general->slots_out), 1799 le32_to_cpu(general->slots_out),
1606 accum_general->slots_out); 1800 accum_general->slots_out,
1607 pos += scnprintf(buf + pos, bufsz - pos, 1801 delta_general->slots_out, max_general->slots_out);
1608 "slots_idle:\t\t\t%u\t\t\t%u\n", 1802 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1803 "slots_idle:",
1609 le32_to_cpu(general->slots_idle), 1804 le32_to_cpu(general->slots_idle),
1610 accum_general->slots_idle); 1805 accum_general->slots_idle,
1806 delta_general->slots_idle, max_general->slots_idle);
1611 pos += scnprintf(buf + pos, bufsz - pos, "ttl_timestamp:\t\t\t%u\n", 1807 pos += scnprintf(buf + pos, bufsz - pos, "ttl_timestamp:\t\t\t%u\n",
1612 le32_to_cpu(general->ttl_timestamp)); 1808 le32_to_cpu(general->ttl_timestamp));
1613 pos += scnprintf(buf + pos, bufsz - pos, "tx_on_a:\t\t\t%u\t\t\t%u\n", 1809 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1614 le32_to_cpu(div->tx_on_a), accum_div->tx_on_a); 1810 "tx_on_a:",
1615 pos += scnprintf(buf + pos, bufsz - pos, "tx_on_b:\t\t\t%u\t\t\t%u\n", 1811 le32_to_cpu(div->tx_on_a), accum_div->tx_on_a,
1616 le32_to_cpu(div->tx_on_b), accum_div->tx_on_b); 1812 delta_div->tx_on_a, max_div->tx_on_a);
1617 pos += scnprintf(buf + pos, bufsz - pos, 1813 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1618 "exec_time:\t\t\t%u\t\t\t%u\n", 1814 "tx_on_b:",
1619 le32_to_cpu(div->exec_time), accum_div->exec_time); 1815 le32_to_cpu(div->tx_on_b), accum_div->tx_on_b,
1620 pos += scnprintf(buf + pos, bufsz - pos, 1816 delta_div->tx_on_b, max_div->tx_on_b);
1621 "probe_time:\t\t\t%u\t\t\t%u\n", 1817 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1622 le32_to_cpu(div->probe_time), accum_div->probe_time); 1818 "exec_time:",
1623 pos += scnprintf(buf + pos, bufsz - pos, 1819 le32_to_cpu(div->exec_time), accum_div->exec_time,
1624 "rx_enable_counter:\t\t%u\t\t\t%u\n", 1820 delta_div->exec_time, max_div->exec_time);
1821 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1822 "probe_time:",
1823 le32_to_cpu(div->probe_time), accum_div->probe_time,
1824 delta_div->probe_time, max_div->probe_time);
1825 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1826 "rx_enable_counter:",
1625 le32_to_cpu(general->rx_enable_counter), 1827 le32_to_cpu(general->rx_enable_counter),
1626 accum_general->rx_enable_counter); 1828 accum_general->rx_enable_counter,
1829 delta_general->rx_enable_counter,
1830 max_general->rx_enable_counter);
1627 ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos); 1831 ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos);
1628 kfree(buf); 1832 kfree(buf);
1629 return ret; 1833 return ret;
diff --git a/drivers/net/wireless/iwlwifi/iwl-dev.h b/drivers/net/wireless/iwlwifi/iwl-dev.h
index 70f0e79c8e4a..63e45cd3f634 100644
--- a/drivers/net/wireless/iwlwifi/iwl-dev.h
+++ b/drivers/net/wireless/iwlwifi/iwl-dev.h
@@ -1162,6 +1162,8 @@ struct iwl_priv {
1162 struct iwl_notif_statistics statistics; 1162 struct iwl_notif_statistics statistics;
1163#ifdef CONFIG_IWLWIFI_DEBUG 1163#ifdef CONFIG_IWLWIFI_DEBUG
1164 struct iwl_notif_statistics accum_statistics; 1164 struct iwl_notif_statistics accum_statistics;
1165 struct iwl_notif_statistics delta_statistics;
1166 struct iwl_notif_statistics max_delta;
1165#endif 1167#endif
1166 1168
1167 /* context information */ 1169 /* context information */
diff --git a/drivers/net/wireless/iwlwifi/iwl-rx.c b/drivers/net/wireless/iwlwifi/iwl-rx.c
index 10db97327452..5bbe5f1f749c 100644
--- a/drivers/net/wireless/iwlwifi/iwl-rx.c
+++ b/drivers/net/wireless/iwlwifi/iwl-rx.c
@@ -564,15 +564,24 @@ static void iwl_accumulative_statistics(struct iwl_priv *priv,
564 int i; 564 int i;
565 __le32 *prev_stats; 565 __le32 *prev_stats;
566 u32 *accum_stats; 566 u32 *accum_stats;
567 u32 *delta, *max_delta;
567 568
568 prev_stats = (__le32 *)&priv->statistics; 569 prev_stats = (__le32 *)&priv->statistics;
569 accum_stats = (u32 *)&priv->accum_statistics; 570 accum_stats = (u32 *)&priv->accum_statistics;
571 delta = (u32 *)&priv->delta_statistics;
572 max_delta = (u32 *)&priv->max_delta;
570 573
571 for (i = sizeof(__le32); i < sizeof(struct iwl_notif_statistics); 574 for (i = sizeof(__le32); i < sizeof(struct iwl_notif_statistics);
572 i += sizeof(__le32), stats++, prev_stats++, accum_stats++) 575 i += sizeof(__le32), stats++, prev_stats++, delta++,
573 if (le32_to_cpu(*stats) > le32_to_cpu(*prev_stats)) 576 max_delta++, accum_stats++) {
574 *accum_stats += (le32_to_cpu(*stats) - 577 if (le32_to_cpu(*stats) > le32_to_cpu(*prev_stats)) {
578 *delta = (le32_to_cpu(*stats) -
575 le32_to_cpu(*prev_stats)); 579 le32_to_cpu(*prev_stats));
580 *accum_stats += *delta;
581 if (*delta > *max_delta)
582 *max_delta = *delta;
583 }
584 }
576 585
577 /* reset accumulative statistics for "no-counter" type statistics */ 586 /* reset accumulative statistics for "no-counter" type statistics */
578 priv->accum_statistics.general.temperature = 587 priv->accum_statistics.general.temperature =
@@ -641,6 +650,10 @@ void iwl_reply_statistics(struct iwl_priv *priv,
641#ifdef CONFIG_IWLWIFI_DEBUG 650#ifdef CONFIG_IWLWIFI_DEBUG
642 memset(&priv->accum_statistics, 0, 651 memset(&priv->accum_statistics, 0,
643 sizeof(struct iwl_notif_statistics)); 652 sizeof(struct iwl_notif_statistics));
653 memset(&priv->delta_statistics, 0,
654 sizeof(struct iwl_notif_statistics));
655 memset(&priv->max_delta, 0,
656 sizeof(struct iwl_notif_statistics));
644#endif 657#endif
645 IWL_DEBUG_RX(priv, "Statistics have been cleared\n"); 658 IWL_DEBUG_RX(priv, "Statistics have been cleared\n");
646 } 659 }