diff options
author | Wey-Yi Guy <wey-yi.w.guy@intel.com> | 2009-08-07 18:41:42 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-08-14 09:13:47 -0400 |
commit | e8fe59aecb9020b06305be4f8c67d73cbf49cbd2 (patch) | |
tree | b5b1121cb625775294244458ee64274e9f4f2f9e /drivers/net/wireless/iwlwifi/iwl-debugfs.c | |
parent | 141b03e07a54af68fc099459bf780a182b240b45 (diff) |
iwlwifi: uCode statistics notification counter
Display statistics notification information
The information break down into
uCode_tx_stats
uCode_rx_stats
uCode_general_stats
and can be found in /sys/kernel/debug/ieee80211/phy0/iwlagn/debug
directory
The statistic information display in debugFs is based on the last
statistics notification from uCode; it might not reflect the current
uCode activity. Using "watch" command to monitor the uCode
activity should give up-to-date statistics provided by uCode.
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
Signed-off-by: Reinette Chatre <reinette.chatre@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-debugfs.c')
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-debugfs.c | 412 |
1 files changed, 412 insertions, 0 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-debugfs.c b/drivers/net/wireless/iwlwifi/iwl-debugfs.c index d4109cbb4f31..20e4edb36ec4 100644 --- a/drivers/net/wireless/iwlwifi/iwl-debugfs.c +++ b/drivers/net/wireless/iwlwifi/iwl-debugfs.c | |||
@@ -950,11 +950,410 @@ static ssize_t iwl_dbgfs_rx_queue_read(struct file *file, | |||
950 | return simple_read_from_buffer(user_buf, count, ppos, buf, pos); | 950 | return simple_read_from_buffer(user_buf, count, ppos, buf, pos); |
951 | } | 951 | } |
952 | 952 | ||
953 | #define UCODE_STATISTICS_CLEAR_MSK (0x1 << 0) | ||
954 | #define UCODE_STATISTICS_FREQUENCY_MSK (0x1 << 1) | ||
955 | #define UCODE_STATISTICS_NARROW_BAND_MSK (0x1 << 2) | ||
956 | |||
957 | static int iwl_dbgfs_statistics_flag(struct iwl_priv *priv, char *buf, | ||
958 | int bufsz) | ||
959 | { | ||
960 | int p = 0; | ||
961 | |||
962 | p += scnprintf(buf + p, bufsz - p, | ||
963 | "Statistics Flag(0x%X):\n", | ||
964 | le32_to_cpu(priv->statistics.flag)); | ||
965 | if (le32_to_cpu(priv->statistics.flag) & UCODE_STATISTICS_CLEAR_MSK) | ||
966 | p += scnprintf(buf + p, bufsz - p, | ||
967 | "\tStatistics have been cleared\n"); | ||
968 | p += scnprintf(buf + p, bufsz - p, | ||
969 | "\tOperational Frequency: %s\n", | ||
970 | (le32_to_cpu(priv->statistics.flag) & | ||
971 | UCODE_STATISTICS_FREQUENCY_MSK) | ||
972 | ? "2.4 GHz" : "5.2 GHz"); | ||
973 | p += scnprintf(buf + p, bufsz - p, | ||
974 | "\tTGj Narrow Band: %s\n", | ||
975 | (le32_to_cpu(priv->statistics.flag) & | ||
976 | UCODE_STATISTICS_NARROW_BAND_MSK) | ||
977 | ? "enabled" : "disabled"); | ||
978 | return p; | ||
979 | } | ||
980 | |||
981 | |||
982 | static ssize_t iwl_dbgfs_ucode_rx_stats_read(struct file *file, | ||
983 | char __user *user_buf, | ||
984 | size_t count, loff_t *ppos) | ||
985 | { | ||
986 | struct iwl_priv *priv = (struct iwl_priv *)file->private_data; | ||
987 | int pos = 0; | ||
988 | char *buf; | ||
989 | int bufsz = sizeof(struct statistics_rx_phy) * 20 + | ||
990 | sizeof(struct statistics_rx_non_phy) * 20 + | ||
991 | sizeof(struct statistics_rx_ht_phy) * 20 + 400; | ||
992 | ssize_t ret; | ||
993 | struct statistics_rx_phy *ofdm; | ||
994 | struct statistics_rx_phy *cck; | ||
995 | struct statistics_rx_non_phy *general; | ||
996 | struct statistics_rx_ht_phy *ht; | ||
997 | |||
998 | if (!iwl_is_alive(priv)) | ||
999 | return -EAGAIN; | ||
1000 | |||
1001 | /* make request to uCode to retrieve statistics information */ | ||
1002 | mutex_lock(&priv->mutex); | ||
1003 | ret = iwl_send_statistics_request(priv, 0); | ||
1004 | mutex_unlock(&priv->mutex); | ||
1005 | |||
1006 | if (ret) { | ||
1007 | IWL_ERR(priv, | ||
1008 | "Error sending statistics request: %zd\n", ret); | ||
1009 | return -EAGAIN; | ||
1010 | } | ||
1011 | buf = kzalloc(bufsz, GFP_KERNEL); | ||
1012 | if (!buf) { | ||
1013 | IWL_ERR(priv, "Can not allocate Buffer\n"); | ||
1014 | return -ENOMEM; | ||
1015 | } | ||
1016 | |||
1017 | /* the statistic information display here is based on | ||
1018 | * the last statistics notification from uCode | ||
1019 | * might not reflect the current uCode activity | ||
1020 | */ | ||
1021 | ofdm = &priv->statistics.rx.ofdm; | ||
1022 | cck = &priv->statistics.rx.cck; | ||
1023 | general = &priv->statistics.rx.general; | ||
1024 | ht = &priv->statistics.rx.ofdm_ht; | ||
1025 | pos += iwl_dbgfs_statistics_flag(priv, buf, bufsz); | ||
1026 | pos += scnprintf(buf + pos, bufsz - pos, "Statistics_Rx - OFDM:\n"); | ||
1027 | pos += scnprintf(buf + pos, bufsz - pos, "ina_cnt: %u\n", | ||
1028 | le32_to_cpu(ofdm->ina_cnt)); | ||
1029 | pos += scnprintf(buf + pos, bufsz - pos, "fina_cnt: %u\n", | ||
1030 | le32_to_cpu(ofdm->fina_cnt)); | ||
1031 | pos += scnprintf(buf + pos, bufsz - pos, "plcp_err: %u\n", | ||
1032 | le32_to_cpu(ofdm->plcp_err)); | ||
1033 | pos += scnprintf(buf + pos, bufsz - pos, "crc32_err: %u\n", | ||
1034 | le32_to_cpu(ofdm->crc32_err)); | ||
1035 | pos += scnprintf(buf + pos, bufsz - pos, "overrun_err: %u\n", | ||
1036 | le32_to_cpu(ofdm->overrun_err)); | ||
1037 | pos += scnprintf(buf + pos, bufsz - pos, "early_overrun_err: %u\n", | ||
1038 | le32_to_cpu(ofdm->early_overrun_err)); | ||
1039 | pos += scnprintf(buf + pos, bufsz - pos, "crc32_good: %u\n", | ||
1040 | le32_to_cpu(ofdm->crc32_good)); | ||
1041 | pos += scnprintf(buf + pos, bufsz - pos, "false_alarm_cnt: %u\n", | ||
1042 | le32_to_cpu(ofdm->false_alarm_cnt)); | ||
1043 | pos += scnprintf(buf + pos, bufsz - pos, "fina_sync_err_cnt: %u\n", | ||
1044 | le32_to_cpu(ofdm->fina_sync_err_cnt)); | ||
1045 | pos += scnprintf(buf + pos, bufsz - pos, "sfd_timeout: %u\n", | ||
1046 | le32_to_cpu(ofdm->sfd_timeout)); | ||
1047 | pos += scnprintf(buf + pos, bufsz - pos, "fina_timeout: %u\n", | ||
1048 | le32_to_cpu(ofdm->fina_timeout)); | ||
1049 | pos += scnprintf(buf + pos, bufsz - pos, "unresponded_rts: %u\n", | ||
1050 | le32_to_cpu(ofdm->unresponded_rts)); | ||
1051 | pos += scnprintf(buf + pos, bufsz - pos, | ||
1052 | "rxe_frame_limit_overrun: %u\n", | ||
1053 | le32_to_cpu(ofdm->rxe_frame_limit_overrun)); | ||
1054 | pos += scnprintf(buf + pos, bufsz - pos, "sent_ack_cnt: %u\n", | ||
1055 | le32_to_cpu(ofdm->sent_ack_cnt)); | ||
1056 | pos += scnprintf(buf + pos, bufsz - pos, "sent_cts_cnt: %u\n", | ||
1057 | le32_to_cpu(ofdm->sent_cts_cnt)); | ||
1058 | pos += scnprintf(buf + pos, bufsz - pos, "sent_ba_rsp_cnt: %u\n", | ||
1059 | le32_to_cpu(ofdm->sent_ba_rsp_cnt)); | ||
1060 | pos += scnprintf(buf + pos, bufsz - pos, "dsp_self_kill: %u\n", | ||
1061 | le32_to_cpu(ofdm->dsp_self_kill)); | ||
1062 | pos += scnprintf(buf + pos, bufsz - pos, "mh_format_err: %u\n", | ||
1063 | le32_to_cpu(ofdm->mh_format_err)); | ||
1064 | pos += scnprintf(buf + pos, bufsz - pos, "re_acq_main_rssi_sum: %u\n", | ||
1065 | le32_to_cpu(ofdm->re_acq_main_rssi_sum)); | ||
1066 | |||
1067 | pos += scnprintf(buf + pos, bufsz - pos, "Statistics_Rx - CCK:\n"); | ||
1068 | pos += scnprintf(buf + pos, bufsz - pos, "ina_cnt: %u\n", | ||
1069 | le32_to_cpu(cck->ina_cnt)); | ||
1070 | pos += scnprintf(buf + pos, bufsz - pos, "fina_cnt: %u\n", | ||
1071 | le32_to_cpu(cck->fina_cnt)); | ||
1072 | pos += scnprintf(buf + pos, bufsz - pos, "plcp_err: %u\n", | ||
1073 | le32_to_cpu(cck->plcp_err)); | ||
1074 | pos += scnprintf(buf + pos, bufsz - pos, "crc32_err: %u\n", | ||
1075 | le32_to_cpu(cck->crc32_err)); | ||
1076 | pos += scnprintf(buf + pos, bufsz - pos, "overrun_err: %u\n", | ||
1077 | le32_to_cpu(cck->overrun_err)); | ||
1078 | pos += scnprintf(buf + pos, bufsz - pos, "early_overrun_err: %u\n", | ||
1079 | le32_to_cpu(cck->early_overrun_err)); | ||
1080 | pos += scnprintf(buf + pos, bufsz - pos, "crc32_good: %u\n", | ||
1081 | le32_to_cpu(cck->crc32_good)); | ||
1082 | pos += scnprintf(buf + pos, bufsz - pos, "false_alarm_cnt: %u\n", | ||
1083 | le32_to_cpu(cck->false_alarm_cnt)); | ||
1084 | pos += scnprintf(buf + pos, bufsz - pos, "fina_sync_err_cnt: %u\n", | ||
1085 | le32_to_cpu(cck->fina_sync_err_cnt)); | ||
1086 | pos += scnprintf(buf + pos, bufsz - pos, "sfd_timeout: %u\n", | ||
1087 | le32_to_cpu(cck->sfd_timeout)); | ||
1088 | pos += scnprintf(buf + pos, bufsz - pos, "fina_timeout: %u\n", | ||
1089 | le32_to_cpu(cck->fina_timeout)); | ||
1090 | pos += scnprintf(buf + pos, bufsz - pos, "unresponded_rts: %u\n", | ||
1091 | le32_to_cpu(cck->unresponded_rts)); | ||
1092 | pos += scnprintf(buf + pos, bufsz - pos, | ||
1093 | "rxe_frame_limit_overrun: %u\n", | ||
1094 | le32_to_cpu(cck->rxe_frame_limit_overrun)); | ||
1095 | pos += scnprintf(buf + pos, bufsz - pos, "sent_ack_cnt: %u\n", | ||
1096 | le32_to_cpu(cck->sent_ack_cnt)); | ||
1097 | pos += scnprintf(buf + pos, bufsz - pos, "sent_cts_cnt: %u\n", | ||
1098 | le32_to_cpu(cck->sent_cts_cnt)); | ||
1099 | pos += scnprintf(buf + pos, bufsz - pos, "sent_ba_rsp_cnt: %u\n", | ||
1100 | le32_to_cpu(cck->sent_ba_rsp_cnt)); | ||
1101 | pos += scnprintf(buf + pos, bufsz - pos, "dsp_self_kill: %u\n", | ||
1102 | le32_to_cpu(cck->dsp_self_kill)); | ||
1103 | pos += scnprintf(buf + pos, bufsz - pos, "mh_format_err: %u\n", | ||
1104 | le32_to_cpu(cck->mh_format_err)); | ||
1105 | pos += scnprintf(buf + pos, bufsz - pos, "re_acq_main_rssi_sum: %u\n", | ||
1106 | le32_to_cpu(cck->re_acq_main_rssi_sum)); | ||
1107 | |||
1108 | pos += scnprintf(buf + pos, bufsz - pos, "Statistics_Rx - GENERAL:\n"); | ||
1109 | pos += scnprintf(buf + pos, bufsz - pos, "bogus_cts: %u\n", | ||
1110 | le32_to_cpu(general->bogus_cts)); | ||
1111 | pos += scnprintf(buf + pos, bufsz - pos, "bogus_ack: %u\n", | ||
1112 | le32_to_cpu(general->bogus_ack)); | ||
1113 | pos += scnprintf(buf + pos, bufsz - pos, "non_bssid_frames: %u\n", | ||
1114 | le32_to_cpu(general->non_bssid_frames)); | ||
1115 | pos += scnprintf(buf + pos, bufsz - pos, "filtered_frames: %u\n", | ||
1116 | le32_to_cpu(general->filtered_frames)); | ||
1117 | pos += scnprintf(buf + pos, bufsz - pos, "non_channel_beacons: %u\n", | ||
1118 | le32_to_cpu(general->non_channel_beacons)); | ||
1119 | pos += scnprintf(buf + pos, bufsz - pos, "channel_beacons: %u\n", | ||
1120 | le32_to_cpu(general->channel_beacons)); | ||
1121 | pos += scnprintf(buf + pos, bufsz - pos, "num_missed_bcon: %u\n", | ||
1122 | le32_to_cpu(general->num_missed_bcon)); | ||
1123 | pos += scnprintf(buf + pos, bufsz - pos, | ||
1124 | "adc_rx_saturation_time: %u\n", | ||
1125 | le32_to_cpu(general->adc_rx_saturation_time)); | ||
1126 | pos += scnprintf(buf + pos, bufsz - pos, | ||
1127 | "ina_detection_search_time: %u\n", | ||
1128 | le32_to_cpu(general->ina_detection_search_time)); | ||
1129 | pos += scnprintf(buf + pos, bufsz - pos, "beacon_silence_rssi_a: %u\n", | ||
1130 | le32_to_cpu(general->beacon_silence_rssi_a)); | ||
1131 | pos += scnprintf(buf + pos, bufsz - pos, "beacon_silence_rssi_b: %u\n", | ||
1132 | le32_to_cpu(general->beacon_silence_rssi_b)); | ||
1133 | pos += scnprintf(buf + pos, bufsz - pos, "beacon_silence_rssi_c: %u\n", | ||
1134 | le32_to_cpu(general->beacon_silence_rssi_c)); | ||
1135 | pos += scnprintf(buf + pos, bufsz - pos, | ||
1136 | "interference_data_flag: %u\n", | ||
1137 | le32_to_cpu(general->interference_data_flag)); | ||
1138 | pos += scnprintf(buf + pos, bufsz - pos, "channel_load: %u\n", | ||
1139 | le32_to_cpu(general->channel_load)); | ||
1140 | pos += scnprintf(buf + pos, bufsz - pos, "dsp_false_alarms: %u\n", | ||
1141 | le32_to_cpu(general->dsp_false_alarms)); | ||
1142 | pos += scnprintf(buf + pos, bufsz - pos, "beacon_rssi_a: %u\n", | ||
1143 | le32_to_cpu(general->beacon_rssi_a)); | ||
1144 | pos += scnprintf(buf + pos, bufsz - pos, "beacon_rssi_b: %u\n", | ||
1145 | le32_to_cpu(general->beacon_rssi_b)); | ||
1146 | pos += scnprintf(buf + pos, bufsz - pos, "beacon_rssi_c: %u\n", | ||
1147 | le32_to_cpu(general->beacon_rssi_c)); | ||
1148 | pos += scnprintf(buf + pos, bufsz - pos, "beacon_energy_a: %u\n", | ||
1149 | le32_to_cpu(general->beacon_energy_a)); | ||
1150 | pos += scnprintf(buf + pos, bufsz - pos, "beacon_energy_b: %u\n", | ||
1151 | le32_to_cpu(general->beacon_energy_b)); | ||
1152 | pos += scnprintf(buf + pos, bufsz - pos, "beacon_energy_c: %u\n", | ||
1153 | le32_to_cpu(general->beacon_energy_c)); | ||
1154 | |||
1155 | pos += scnprintf(buf + pos, bufsz - pos, "Statistics_Rx - OFDM_HT:\n"); | ||
1156 | pos += scnprintf(buf + pos, bufsz - pos, "plcp_err: %u\n", | ||
1157 | le32_to_cpu(ht->plcp_err)); | ||
1158 | pos += scnprintf(buf + pos, bufsz - pos, "overrun_err: %u\n", | ||
1159 | le32_to_cpu(ht->overrun_err)); | ||
1160 | pos += scnprintf(buf + pos, bufsz - pos, "early_overrun_err: %u\n", | ||
1161 | le32_to_cpu(ht->early_overrun_err)); | ||
1162 | pos += scnprintf(buf + pos, bufsz - pos, "crc32_good: %u\n", | ||
1163 | le32_to_cpu(ht->crc32_good)); | ||
1164 | pos += scnprintf(buf + pos, bufsz - pos, "crc32_err: %u\n", | ||
1165 | le32_to_cpu(ht->crc32_err)); | ||
1166 | pos += scnprintf(buf + pos, bufsz - pos, "mh_format_err: %u\n", | ||
1167 | le32_to_cpu(ht->mh_format_err)); | ||
1168 | pos += scnprintf(buf + pos, bufsz - pos, "agg_crc32_good: %u\n", | ||
1169 | le32_to_cpu(ht->agg_crc32_good)); | ||
1170 | pos += scnprintf(buf + pos, bufsz - pos, "agg_mpdu_cnt: %u\n", | ||
1171 | le32_to_cpu(ht->agg_mpdu_cnt)); | ||
1172 | pos += scnprintf(buf + pos, bufsz - pos, "agg_cnt: %u\n", | ||
1173 | le32_to_cpu(ht->agg_cnt)); | ||
1174 | |||
1175 | ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos); | ||
1176 | kfree(buf); | ||
1177 | return ret; | ||
1178 | } | ||
1179 | |||
1180 | static ssize_t iwl_dbgfs_ucode_tx_stats_read(struct file *file, | ||
1181 | char __user *user_buf, | ||
1182 | size_t count, loff_t *ppos) | ||
1183 | { | ||
1184 | struct iwl_priv *priv = (struct iwl_priv *)file->private_data; | ||
1185 | int pos = 0; | ||
1186 | char *buf; | ||
1187 | int bufsz = (sizeof(struct statistics_tx) * 24) + 250; | ||
1188 | ssize_t ret; | ||
1189 | struct statistics_tx *tx; | ||
1190 | |||
1191 | if (!iwl_is_alive(priv)) | ||
1192 | return -EAGAIN; | ||
1193 | |||
1194 | /* make request to uCode to retrieve statistics information */ | ||
1195 | mutex_lock(&priv->mutex); | ||
1196 | ret = iwl_send_statistics_request(priv, 0); | ||
1197 | mutex_unlock(&priv->mutex); | ||
1198 | |||
1199 | if (ret) { | ||
1200 | IWL_ERR(priv, | ||
1201 | "Error sending statistics request: %zd\n", ret); | ||
1202 | return -EAGAIN; | ||
1203 | } | ||
1204 | buf = kzalloc(bufsz, GFP_KERNEL); | ||
1205 | if (!buf) { | ||
1206 | IWL_ERR(priv, "Can not allocate Buffer\n"); | ||
1207 | return -ENOMEM; | ||
1208 | } | ||
1209 | |||
1210 | /* the statistic information display here is based on | ||
1211 | * the last statistics notification from uCode | ||
1212 | * might not reflect the current uCode activity | ||
1213 | */ | ||
1214 | tx = &priv->statistics.tx; | ||
1215 | pos += iwl_dbgfs_statistics_flag(priv, buf, bufsz); | ||
1216 | pos += scnprintf(buf + pos, bufsz - pos, "Statistics_Tx:\n"); | ||
1217 | pos += scnprintf(buf + pos, bufsz - pos, "preamble: %u\n", | ||
1218 | le32_to_cpu(tx->preamble_cnt)); | ||
1219 | pos += scnprintf(buf + pos, bufsz - pos, "rx_detected_cnt: %u\n", | ||
1220 | le32_to_cpu(tx->rx_detected_cnt)); | ||
1221 | pos += scnprintf(buf + pos, bufsz - pos, "bt_prio_defer_cnt: %u\n", | ||
1222 | le32_to_cpu(tx->bt_prio_defer_cnt)); | ||
1223 | pos += scnprintf(buf + pos, bufsz - pos, "bt_prio_kill_cnt: %u\n", | ||
1224 | le32_to_cpu(tx->bt_prio_kill_cnt)); | ||
1225 | pos += scnprintf(buf + pos, bufsz - pos, "few_bytes_cnt: %u\n", | ||
1226 | le32_to_cpu(tx->few_bytes_cnt)); | ||
1227 | pos += scnprintf(buf + pos, bufsz - pos, "cts_timeout: %u\n", | ||
1228 | le32_to_cpu(tx->cts_timeout)); | ||
1229 | pos += scnprintf(buf + pos, bufsz - pos, "ack_timeout: %u\n", | ||
1230 | le32_to_cpu(tx->ack_timeout)); | ||
1231 | pos += scnprintf(buf + pos, bufsz - pos, "expected_ack_cnt: %u\n", | ||
1232 | le32_to_cpu(tx->expected_ack_cnt)); | ||
1233 | pos += scnprintf(buf + pos, bufsz - pos, "actual_ack_cnt: %u\n", | ||
1234 | le32_to_cpu(tx->actual_ack_cnt)); | ||
1235 | pos += scnprintf(buf + pos, bufsz - pos, "dump_msdu_cnt: %u\n", | ||
1236 | le32_to_cpu(tx->dump_msdu_cnt)); | ||
1237 | pos += scnprintf(buf + pos, bufsz - pos, | ||
1238 | "burst_abort_next_frame_mismatch_cnt: %u\n", | ||
1239 | le32_to_cpu(tx->burst_abort_next_frame_mismatch_cnt)); | ||
1240 | pos += scnprintf(buf + pos, bufsz - pos, | ||
1241 | "burst_abort_missing_next_frame_cnt: %u\n", | ||
1242 | le32_to_cpu(tx->burst_abort_missing_next_frame_cnt)); | ||
1243 | pos += scnprintf(buf + pos, bufsz - pos, "cts_timeout_collision: %u\n", | ||
1244 | le32_to_cpu(tx->cts_timeout_collision)); | ||
1245 | pos += scnprintf(buf + pos, bufsz - pos, | ||
1246 | "ack_or_ba_timeout_collision: %u\n", | ||
1247 | le32_to_cpu(tx->ack_or_ba_timeout_collision)); | ||
1248 | pos += scnprintf(buf + pos, bufsz - pos, "agg ba_timeout: %u\n", | ||
1249 | le32_to_cpu(tx->agg.ba_timeout)); | ||
1250 | pos += scnprintf(buf + pos, bufsz - pos, | ||
1251 | "agg ba_reschedule_frames: %u\n", | ||
1252 | le32_to_cpu(tx->agg.ba_reschedule_frames)); | ||
1253 | pos += scnprintf(buf + pos, bufsz - pos, | ||
1254 | "agg scd_query_agg_frame_cnt: %u\n", | ||
1255 | le32_to_cpu(tx->agg.scd_query_agg_frame_cnt)); | ||
1256 | pos += scnprintf(buf + pos, bufsz - pos, "agg scd_query_no_agg: %u\n", | ||
1257 | le32_to_cpu(tx->agg.scd_query_no_agg)); | ||
1258 | pos += scnprintf(buf + pos, bufsz - pos, "agg scd_query_agg: %u\n", | ||
1259 | le32_to_cpu(tx->agg.scd_query_agg)); | ||
1260 | pos += scnprintf(buf + pos, bufsz - pos, | ||
1261 | "agg scd_query_mismatch: %u\n", | ||
1262 | le32_to_cpu(tx->agg.scd_query_mismatch)); | ||
1263 | pos += scnprintf(buf + pos, bufsz - pos, "agg frame_not_ready: %u\n", | ||
1264 | le32_to_cpu(tx->agg.frame_not_ready)); | ||
1265 | pos += scnprintf(buf + pos, bufsz - pos, "agg underrun: %u\n", | ||
1266 | le32_to_cpu(tx->agg.underrun)); | ||
1267 | pos += scnprintf(buf + pos, bufsz - pos, "agg bt_prio_kill: %u\n", | ||
1268 | le32_to_cpu(tx->agg.bt_prio_kill)); | ||
1269 | pos += scnprintf(buf + pos, bufsz - pos, "agg rx_ba_rsp_cnt: %u\n", | ||
1270 | le32_to_cpu(tx->agg.rx_ba_rsp_cnt)); | ||
1271 | |||
1272 | ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos); | ||
1273 | kfree(buf); | ||
1274 | return ret; | ||
1275 | } | ||
1276 | |||
1277 | static ssize_t iwl_dbgfs_ucode_general_stats_read(struct file *file, | ||
1278 | char __user *user_buf, | ||
1279 | size_t count, loff_t *ppos) | ||
1280 | { | ||
1281 | struct iwl_priv *priv = (struct iwl_priv *)file->private_data; | ||
1282 | int pos = 0; | ||
1283 | char *buf; | ||
1284 | int bufsz = sizeof(struct statistics_general) * 4 + 250; | ||
1285 | ssize_t ret; | ||
1286 | struct statistics_general *general; | ||
1287 | struct statistics_dbg *dbg; | ||
1288 | struct statistics_div *div; | ||
1289 | |||
1290 | if (!iwl_is_alive(priv)) | ||
1291 | return -EAGAIN; | ||
1292 | |||
1293 | /* make request to uCode to retrieve statistics information */ | ||
1294 | mutex_lock(&priv->mutex); | ||
1295 | ret = iwl_send_statistics_request(priv, 0); | ||
1296 | mutex_unlock(&priv->mutex); | ||
1297 | |||
1298 | if (ret) { | ||
1299 | IWL_ERR(priv, | ||
1300 | "Error sending statistics request: %zd\n", ret); | ||
1301 | return -EAGAIN; | ||
1302 | } | ||
1303 | buf = kzalloc(bufsz, GFP_KERNEL); | ||
1304 | if (!buf) { | ||
1305 | IWL_ERR(priv, "Can not allocate Buffer\n"); | ||
1306 | return -ENOMEM; | ||
1307 | } | ||
1308 | |||
1309 | /* the statistic information display here is based on | ||
1310 | * the last statistics notification from uCode | ||
1311 | * might not reflect the current uCode activity | ||
1312 | */ | ||
1313 | general = &priv->statistics.general; | ||
1314 | dbg = &priv->statistics.general.dbg; | ||
1315 | div = &priv->statistics.general.div; | ||
1316 | pos += iwl_dbgfs_statistics_flag(priv, buf, bufsz); | ||
1317 | pos += scnprintf(buf + pos, bufsz - pos, "Statistics_General:\n"); | ||
1318 | pos += scnprintf(buf + pos, bufsz - pos, "temperature: %u\n", | ||
1319 | le32_to_cpu(general->temperature)); | ||
1320 | pos += scnprintf(buf + pos, bufsz - pos, "temperature_m: %u\n", | ||
1321 | le32_to_cpu(general->temperature_m)); | ||
1322 | pos += scnprintf(buf + pos, bufsz - pos, "burst_check: %u\n", | ||
1323 | le32_to_cpu(dbg->burst_check)); | ||
1324 | pos += scnprintf(buf + pos, bufsz - pos, "burst_count: %u\n", | ||
1325 | le32_to_cpu(dbg->burst_count)); | ||
1326 | pos += scnprintf(buf + pos, bufsz - pos, "sleep_time: %u\n", | ||
1327 | le32_to_cpu(general->sleep_time)); | ||
1328 | pos += scnprintf(buf + pos, bufsz - pos, "slots_out: %u\n", | ||
1329 | le32_to_cpu(general->slots_out)); | ||
1330 | pos += scnprintf(buf + pos, bufsz - pos, "slots_idle: %u\n", | ||
1331 | le32_to_cpu(general->slots_idle)); | ||
1332 | pos += scnprintf(buf + pos, bufsz - pos, "ttl_timestamp: %u\n", | ||
1333 | le32_to_cpu(general->ttl_timestamp)); | ||
1334 | pos += scnprintf(buf + pos, bufsz - pos, "tx_on_a: %u\n", | ||
1335 | le32_to_cpu(div->tx_on_a)); | ||
1336 | pos += scnprintf(buf + pos, bufsz - pos, "tx_on_b: %u\n", | ||
1337 | le32_to_cpu(div->tx_on_b)); | ||
1338 | pos += scnprintf(buf + pos, bufsz - pos, "exec_time: %u\n", | ||
1339 | le32_to_cpu(div->exec_time)); | ||
1340 | pos += scnprintf(buf + pos, bufsz - pos, "probe_time: %u\n", | ||
1341 | le32_to_cpu(div->probe_time)); | ||
1342 | pos += scnprintf(buf + pos, bufsz - pos, "rx_enable_counter: %u\n", | ||
1343 | le32_to_cpu(general->rx_enable_counter)); | ||
1344 | ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos); | ||
1345 | kfree(buf); | ||
1346 | return ret; | ||
1347 | } | ||
1348 | |||
953 | DEBUGFS_READ_WRITE_FILE_OPS(rx_statistics); | 1349 | DEBUGFS_READ_WRITE_FILE_OPS(rx_statistics); |
954 | DEBUGFS_READ_WRITE_FILE_OPS(tx_statistics); | 1350 | DEBUGFS_READ_WRITE_FILE_OPS(tx_statistics); |
955 | DEBUGFS_READ_WRITE_FILE_OPS(traffic_log); | 1351 | DEBUGFS_READ_WRITE_FILE_OPS(traffic_log); |
956 | DEBUGFS_READ_FILE_OPS(rx_queue); | 1352 | DEBUGFS_READ_FILE_OPS(rx_queue); |
957 | DEBUGFS_READ_FILE_OPS(tx_queue); | 1353 | DEBUGFS_READ_FILE_OPS(tx_queue); |
1354 | DEBUGFS_READ_FILE_OPS(ucode_rx_stats); | ||
1355 | DEBUGFS_READ_FILE_OPS(ucode_tx_stats); | ||
1356 | DEBUGFS_READ_FILE_OPS(ucode_general_stats); | ||
958 | 1357 | ||
959 | /* | 1358 | /* |
960 | * Create the debugfs files and directories | 1359 | * Create the debugfs files and directories |
@@ -1001,6 +1400,11 @@ int iwl_dbgfs_register(struct iwl_priv *priv, const char *name) | |||
1001 | DEBUGFS_ADD_FILE(traffic_log, debug); | 1400 | DEBUGFS_ADD_FILE(traffic_log, debug); |
1002 | DEBUGFS_ADD_FILE(rx_queue, debug); | 1401 | DEBUGFS_ADD_FILE(rx_queue, debug); |
1003 | DEBUGFS_ADD_FILE(tx_queue, debug); | 1402 | DEBUGFS_ADD_FILE(tx_queue, debug); |
1403 | if ((priv->hw_rev & CSR_HW_REV_TYPE_MSK) != CSR_HW_REV_TYPE_3945) { | ||
1404 | DEBUGFS_ADD_FILE(ucode_rx_stats, debug); | ||
1405 | DEBUGFS_ADD_FILE(ucode_tx_stats, debug); | ||
1406 | DEBUGFS_ADD_FILE(ucode_general_stats, debug); | ||
1407 | } | ||
1004 | DEBUGFS_ADD_BOOL(disable_sensitivity, rf, &priv->disable_sens_cal); | 1408 | DEBUGFS_ADD_BOOL(disable_sensitivity, rf, &priv->disable_sens_cal); |
1005 | DEBUGFS_ADD_BOOL(disable_chain_noise, rf, | 1409 | DEBUGFS_ADD_BOOL(disable_chain_noise, rf, |
1006 | &priv->disable_chain_noise_cal); | 1410 | &priv->disable_chain_noise_cal); |
@@ -1045,6 +1449,14 @@ void iwl_dbgfs_unregister(struct iwl_priv *priv) | |||
1045 | DEBUGFS_REMOVE(priv->dbgfs->dbgfs_debug_files.file_traffic_log); | 1449 | DEBUGFS_REMOVE(priv->dbgfs->dbgfs_debug_files.file_traffic_log); |
1046 | DEBUGFS_REMOVE(priv->dbgfs->dbgfs_debug_files.file_rx_queue); | 1450 | DEBUGFS_REMOVE(priv->dbgfs->dbgfs_debug_files.file_rx_queue); |
1047 | DEBUGFS_REMOVE(priv->dbgfs->dbgfs_debug_files.file_tx_queue); | 1451 | DEBUGFS_REMOVE(priv->dbgfs->dbgfs_debug_files.file_tx_queue); |
1452 | if ((priv->hw_rev & CSR_HW_REV_TYPE_MSK) != CSR_HW_REV_TYPE_3945) { | ||
1453 | DEBUGFS_REMOVE(priv->dbgfs->dbgfs_debug_files. | ||
1454 | file_ucode_rx_stats); | ||
1455 | DEBUGFS_REMOVE(priv->dbgfs->dbgfs_debug_files. | ||
1456 | file_ucode_tx_stats); | ||
1457 | DEBUGFS_REMOVE(priv->dbgfs->dbgfs_debug_files. | ||
1458 | file_ucode_general_stats); | ||
1459 | } | ||
1048 | DEBUGFS_REMOVE(priv->dbgfs->dir_debug); | 1460 | DEBUGFS_REMOVE(priv->dbgfs->dir_debug); |
1049 | DEBUGFS_REMOVE(priv->dbgfs->dbgfs_rf_files.file_disable_sensitivity); | 1461 | DEBUGFS_REMOVE(priv->dbgfs->dbgfs_rf_files.file_disable_sensitivity); |
1050 | DEBUGFS_REMOVE(priv->dbgfs->dbgfs_rf_files.file_disable_chain_noise); | 1462 | DEBUGFS_REMOVE(priv->dbgfs->dbgfs_rf_files.file_disable_chain_noise); |