diff options
Diffstat (limited to 'drivers/net/wireless/iwlwifi/mvm/rs.c')
-rw-r--r-- | drivers/net/wireless/iwlwifi/mvm/rs.c | 96 |
1 files changed, 76 insertions, 20 deletions
diff --git a/drivers/net/wireless/iwlwifi/mvm/rs.c b/drivers/net/wireless/iwlwifi/mvm/rs.c index 6578498dd5af..dd457df9601e 100644 --- a/drivers/net/wireless/iwlwifi/mvm/rs.c +++ b/drivers/net/wireless/iwlwifi/mvm/rs.c | |||
@@ -1065,6 +1065,37 @@ static inline bool rs_rate_column_match(struct rs_rate *a, | |||
1065 | && ant_match; | 1065 | && ant_match; |
1066 | } | 1066 | } |
1067 | 1067 | ||
1068 | static inline enum rs_column rs_get_column_from_rate(struct rs_rate *rate) | ||
1069 | { | ||
1070 | if (is_legacy(rate)) { | ||
1071 | if (rate->ant == ANT_A) | ||
1072 | return RS_COLUMN_LEGACY_ANT_A; | ||
1073 | |||
1074 | if (rate->ant == ANT_B) | ||
1075 | return RS_COLUMN_LEGACY_ANT_B; | ||
1076 | |||
1077 | goto err; | ||
1078 | } | ||
1079 | |||
1080 | if (is_siso(rate)) { | ||
1081 | if (rate->ant == ANT_A || rate->stbc || rate->bfer) | ||
1082 | return rate->sgi ? RS_COLUMN_SISO_ANT_A_SGI : | ||
1083 | RS_COLUMN_SISO_ANT_A; | ||
1084 | |||
1085 | if (rate->ant == ANT_B) | ||
1086 | return rate->sgi ? RS_COLUMN_SISO_ANT_B_SGI : | ||
1087 | RS_COLUMN_SISO_ANT_B; | ||
1088 | |||
1089 | goto err; | ||
1090 | } | ||
1091 | |||
1092 | if (is_mimo(rate)) | ||
1093 | return rate->sgi ? RS_COLUMN_MIMO2_SGI : RS_COLUMN_MIMO2; | ||
1094 | |||
1095 | err: | ||
1096 | return RS_COLUMN_INVALID; | ||
1097 | } | ||
1098 | |||
1068 | static u8 rs_get_tid(struct ieee80211_hdr *hdr) | 1099 | static u8 rs_get_tid(struct ieee80211_hdr *hdr) |
1069 | { | 1100 | { |
1070 | u8 tid = IWL_MAX_TID_COUNT; | 1101 | u8 tid = IWL_MAX_TID_COUNT; |
@@ -1106,17 +1137,43 @@ void iwl_mvm_rs_tx_status(struct iwl_mvm *mvm, struct ieee80211_sta *sta, | |||
1106 | return; | 1137 | return; |
1107 | } | 1138 | } |
1108 | 1139 | ||
1140 | /* This packet was aggregated but doesn't carry status info */ | ||
1141 | if ((info->flags & IEEE80211_TX_CTL_AMPDU) && | ||
1142 | !(info->flags & IEEE80211_TX_STAT_AMPDU)) | ||
1143 | return; | ||
1144 | |||
1145 | rs_rate_from_ucode_rate(tx_resp_hwrate, info->band, &tx_resp_rate); | ||
1146 | |||
1109 | #ifdef CONFIG_MAC80211_DEBUGFS | 1147 | #ifdef CONFIG_MAC80211_DEBUGFS |
1110 | /* Disable last tx check if we are debugging with fixed rate */ | 1148 | /* Disable last tx check if we are debugging with fixed rate but |
1149 | * update tx stats */ | ||
1111 | if (lq_sta->pers.dbg_fixed_rate) { | 1150 | if (lq_sta->pers.dbg_fixed_rate) { |
1112 | IWL_DEBUG_RATE(mvm, "Fixed rate. avoid rate scaling\n"); | 1151 | int index = tx_resp_rate.index; |
1152 | enum rs_column column; | ||
1153 | int attempts, success; | ||
1154 | |||
1155 | column = rs_get_column_from_rate(&tx_resp_rate); | ||
1156 | if (WARN_ONCE(column == RS_COLUMN_INVALID, | ||
1157 | "Can't map rate 0x%x to column", | ||
1158 | tx_resp_hwrate)) | ||
1159 | return; | ||
1160 | |||
1161 | if (info->flags & IEEE80211_TX_STAT_AMPDU) { | ||
1162 | attempts = info->status.ampdu_len; | ||
1163 | success = info->status.ampdu_ack_len; | ||
1164 | } else { | ||
1165 | attempts = info->status.rates[0].count; | ||
1166 | success = !!(info->flags & IEEE80211_TX_STAT_ACK); | ||
1167 | } | ||
1168 | |||
1169 | lq_sta->pers.tx_stats[column][index].total += attempts; | ||
1170 | lq_sta->pers.tx_stats[column][index].success += success; | ||
1171 | |||
1172 | IWL_DEBUG_RATE(mvm, "Fixed rate 0x%x success %d attempts %d\n", | ||
1173 | tx_resp_hwrate, success, attempts); | ||
1113 | return; | 1174 | return; |
1114 | } | 1175 | } |
1115 | #endif | 1176 | #endif |
1116 | /* This packet was aggregated but doesn't carry status info */ | ||
1117 | if ((info->flags & IEEE80211_TX_CTL_AMPDU) && | ||
1118 | !(info->flags & IEEE80211_TX_STAT_AMPDU)) | ||
1119 | return; | ||
1120 | 1177 | ||
1121 | if (time_after(jiffies, | 1178 | if (time_after(jiffies, |
1122 | (unsigned long)(lq_sta->last_tx + | 1179 | (unsigned long)(lq_sta->last_tx + |
@@ -1142,7 +1199,6 @@ void iwl_mvm_rs_tx_status(struct iwl_mvm *mvm, struct ieee80211_sta *sta, | |||
1142 | table = &lq_sta->lq; | 1199 | table = &lq_sta->lq; |
1143 | lq_hwrate = le32_to_cpu(table->rs_table[0]); | 1200 | lq_hwrate = le32_to_cpu(table->rs_table[0]); |
1144 | rs_rate_from_ucode_rate(lq_hwrate, info->band, &lq_rate); | 1201 | rs_rate_from_ucode_rate(lq_hwrate, info->band, &lq_rate); |
1145 | rs_rate_from_ucode_rate(tx_resp_hwrate, info->band, &tx_resp_rate); | ||
1146 | 1202 | ||
1147 | /* Here we actually compare this rate to the latest LQ command */ | 1203 | /* Here we actually compare this rate to the latest LQ command */ |
1148 | if (!rs_rate_equal(&tx_resp_rate, &lq_rate, allow_ant_mismatch)) { | 1204 | if (!rs_rate_equal(&tx_resp_rate, &lq_rate, allow_ant_mismatch)) { |
@@ -3343,16 +3399,16 @@ static ssize_t rs_sta_dbgfs_scale_table_read(struct file *file, | |||
3343 | (is_legacy(rate)) ? "legacy" : | 3399 | (is_legacy(rate)) ? "legacy" : |
3344 | is_vht(rate) ? "VHT" : "HT"); | 3400 | is_vht(rate) ? "VHT" : "HT"); |
3345 | if (!is_legacy(rate)) { | 3401 | if (!is_legacy(rate)) { |
3346 | desc += sprintf(buff+desc, " %s", | 3402 | desc += sprintf(buff + desc, " %s", |
3347 | (is_siso(rate)) ? "SISO" : "MIMO2"); | 3403 | (is_siso(rate)) ? "SISO" : "MIMO2"); |
3348 | desc += sprintf(buff+desc, " %s", | 3404 | desc += sprintf(buff + desc, " %s", |
3349 | (is_ht20(rate)) ? "20MHz" : | 3405 | (is_ht20(rate)) ? "20MHz" : |
3350 | (is_ht40(rate)) ? "40MHz" : | 3406 | (is_ht40(rate)) ? "40MHz" : |
3351 | (is_ht80(rate)) ? "80Mhz" : "BAD BW"); | 3407 | (is_ht80(rate)) ? "80Mhz" : "BAD BW"); |
3352 | desc += sprintf(buff+desc, " %s %s %s\n", | 3408 | desc += sprintf(buff + desc, " %s %s %s\n", |
3353 | (rate->sgi) ? "SGI" : "NGI", | 3409 | (rate->sgi) ? "SGI" : "NGI", |
3354 | (rate->ldpc) ? "LDPC" : "BCC", | 3410 | (rate->ldpc) ? "LDPC" : "BCC", |
3355 | (lq_sta->is_agg) ? "AGG on" : ""); | 3411 | (lq_sta->is_agg) ? "AGG on" : ""); |
3356 | } | 3412 | } |
3357 | desc += sprintf(buff+desc, "last tx rate=0x%X\n", | 3413 | desc += sprintf(buff+desc, "last tx rate=0x%X\n", |
3358 | lq_sta->last_rate_n_flags); | 3414 | lq_sta->last_rate_n_flags); |
@@ -3373,13 +3429,13 @@ static ssize_t rs_sta_dbgfs_scale_table_read(struct file *file, | |||
3373 | ss_params = le32_to_cpu(lq_sta->lq.ss_params); | 3429 | ss_params = le32_to_cpu(lq_sta->lq.ss_params); |
3374 | desc += sprintf(buff+desc, "single stream params: %s%s%s%s\n", | 3430 | desc += sprintf(buff+desc, "single stream params: %s%s%s%s\n", |
3375 | (ss_params & LQ_SS_PARAMS_VALID) ? | 3431 | (ss_params & LQ_SS_PARAMS_VALID) ? |
3376 | "VALID," : "INVALID", | 3432 | "VALID" : "INVALID", |
3377 | (ss_params & LQ_SS_BFER_ALLOWED) ? | 3433 | (ss_params & LQ_SS_BFER_ALLOWED) ? |
3378 | "BFER," : "", | 3434 | ", BFER" : "", |
3379 | (ss_params & LQ_SS_STBC_1SS_ALLOWED) ? | 3435 | (ss_params & LQ_SS_STBC_1SS_ALLOWED) ? |
3380 | "STBC," : "", | 3436 | ", STBC" : "", |
3381 | (ss_params & LQ_SS_FORCE) ? | 3437 | (ss_params & LQ_SS_FORCE) ? |
3382 | "FORCE" : ""); | 3438 | ", FORCE" : ""); |
3383 | desc += sprintf(buff+desc, | 3439 | desc += sprintf(buff+desc, |
3384 | "Start idx [0]=0x%x [1]=0x%x [2]=0x%x [3]=0x%x\n", | 3440 | "Start idx [0]=0x%x [1]=0x%x [2]=0x%x [3]=0x%x\n", |
3385 | lq_sta->lq.initial_rate_index[0], | 3441 | lq_sta->lq.initial_rate_index[0], |