diff options
author | Sujith Manoharan <c_manoha@qca.qualcomm.com> | 2012-08-10 07:17:09 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2012-08-10 15:27:17 -0400 |
commit | 88dcc2dd717b292d1ef7311a6487c610f709bd10 (patch) | |
tree | 8378392eec9a67fe5a76e0092384d9eace73b292 /drivers/net/wireless/ath | |
parent | c1610117f81ae70b49aaf51ccb9040f2ce5bd358 (diff) |
ath9k: Cleanup TX status API
Calculate the final rate index inside ath_rc_tx_status().
Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/ath')
-rw-r--r-- | drivers/net/wireless/ath/ath9k/rc.c | 71 |
1 files changed, 29 insertions, 42 deletions
diff --git a/drivers/net/wireless/ath/ath9k/rc.c b/drivers/net/wireless/ath/ath9k/rc.c index 0e3d20a864e6..2051fac82582 100644 --- a/drivers/net/wireless/ath/ath9k/rc.c +++ b/drivers/net/wireless/ath/ath9k/rc.c | |||
@@ -993,9 +993,6 @@ static void ath_debug_stat_retries(struct ath_rate_priv *rc, int rix, | |||
993 | stats->per = per; | 993 | stats->per = per; |
994 | } | 994 | } |
995 | 995 | ||
996 | /* Update PER, RSSI and whatever else that the code thinks it is doing. | ||
997 | If you can make sense of all this, you really need to go out more. */ | ||
998 | |||
999 | static void ath_rc_update_ht(struct ath_softc *sc, | 996 | static void ath_rc_update_ht(struct ath_softc *sc, |
1000 | struct ath_rate_priv *ath_rc_priv, | 997 | struct ath_rate_priv *ath_rc_priv, |
1001 | struct ieee80211_tx_info *tx_info, | 998 | struct ieee80211_tx_info *tx_info, |
@@ -1069,25 +1066,43 @@ static void ath_rc_update_ht(struct ath_softc *sc, | |||
1069 | 1066 | ||
1070 | } | 1067 | } |
1071 | 1068 | ||
1069 | static void ath_debug_stat_rc(struct ath_rate_priv *rc, int final_rate) | ||
1070 | { | ||
1071 | struct ath_rc_stats *stats; | ||
1072 | |||
1073 | stats = &rc->rcstats[final_rate]; | ||
1074 | stats->success++; | ||
1075 | } | ||
1072 | 1076 | ||
1073 | static void ath_rc_tx_status(struct ath_softc *sc, | 1077 | static void ath_rc_tx_status(struct ath_softc *sc, |
1074 | struct ath_rate_priv *ath_rc_priv, | 1078 | struct ath_rate_priv *ath_rc_priv, |
1075 | struct ieee80211_tx_info *tx_info, | 1079 | struct sk_buff *skb) |
1076 | int final_ts_idx, int xretries, int long_retry) | ||
1077 | { | 1080 | { |
1078 | const struct ath_rate_table *rate_table; | 1081 | const struct ath_rate_table *rate_table = ath_rc_priv->rate_table; |
1082 | struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb); | ||
1079 | struct ieee80211_tx_rate *rates = tx_info->status.rates; | 1083 | struct ieee80211_tx_rate *rates = tx_info->status.rates; |
1084 | struct ieee80211_tx_rate *rate; | ||
1085 | int final_ts_idx = 0, xretries = 0, long_retry = 0; | ||
1080 | u8 flags; | 1086 | u8 flags; |
1081 | u32 i = 0, rix; | 1087 | u32 i = 0, rix; |
1082 | 1088 | ||
1083 | rate_table = ath_rc_priv->rate_table; | 1089 | for (i = 0; i < sc->hw->max_rates; i++) { |
1090 | rate = &tx_info->status.rates[i]; | ||
1091 | if (rate->idx < 0 || !rate->count) | ||
1092 | break; | ||
1093 | |||
1094 | final_ts_idx = i; | ||
1095 | long_retry = rate->count - 1; | ||
1096 | } | ||
1097 | |||
1098 | if (!(tx_info->flags & IEEE80211_TX_STAT_ACK)) | ||
1099 | xretries = 1; | ||
1084 | 1100 | ||
1085 | /* | 1101 | /* |
1086 | * If the first rate is not the final index, there | 1102 | * If the first rate is not the final index, there |
1087 | * are intermediate rate failures to be processed. | 1103 | * are intermediate rate failures to be processed. |
1088 | */ | 1104 | */ |
1089 | if (final_ts_idx != 0) { | 1105 | if (final_ts_idx != 0) { |
1090 | /* Process intermediate rates that failed.*/ | ||
1091 | for (i = 0; i < final_ts_idx ; i++) { | 1106 | for (i = 0; i < final_ts_idx ; i++) { |
1092 | if (rates[i].count != 0 && (rates[i].idx >= 0)) { | 1107 | if (rates[i].count != 0 && (rates[i].idx >= 0)) { |
1093 | flags = rates[i].flags; | 1108 | flags = rates[i].flags; |
@@ -1101,8 +1116,8 @@ static void ath_rc_tx_status(struct ath_softc *sc, | |||
1101 | 1116 | ||
1102 | rix = ath_rc_get_rateindex(rate_table, &rates[i]); | 1117 | rix = ath_rc_get_rateindex(rate_table, &rates[i]); |
1103 | ath_rc_update_ht(sc, ath_rc_priv, tx_info, | 1118 | ath_rc_update_ht(sc, ath_rc_priv, tx_info, |
1104 | rix, xretries ? 1 : 2, | 1119 | rix, xretries ? 1 : 2, |
1105 | rates[i].count); | 1120 | rates[i].count); |
1106 | } | 1121 | } |
1107 | } | 1122 | } |
1108 | } else { | 1123 | } else { |
@@ -1116,15 +1131,16 @@ static void ath_rc_tx_status(struct ath_softc *sc, | |||
1116 | xretries = 2; | 1131 | xretries = 2; |
1117 | } | 1132 | } |
1118 | 1133 | ||
1119 | flags = rates[i].flags; | 1134 | flags = rates[final_ts_idx].flags; |
1120 | 1135 | ||
1121 | /* If HT40 and we have switched mode from 40 to 20 => don't update */ | 1136 | /* If HT40 and we have switched mode from 40 to 20 => don't update */ |
1122 | if ((flags & IEEE80211_TX_RC_40_MHZ_WIDTH) && | 1137 | if ((flags & IEEE80211_TX_RC_40_MHZ_WIDTH) && |
1123 | !(ath_rc_priv->ht_cap & WLAN_RC_40_FLAG)) | 1138 | !(ath_rc_priv->ht_cap & WLAN_RC_40_FLAG)) |
1124 | return; | 1139 | return; |
1125 | 1140 | ||
1126 | rix = ath_rc_get_rateindex(rate_table, &rates[i]); | 1141 | rix = ath_rc_get_rateindex(rate_table, &rates[final_ts_idx]); |
1127 | ath_rc_update_ht(sc, ath_rc_priv, tx_info, rix, xretries, long_retry); | 1142 | ath_rc_update_ht(sc, ath_rc_priv, tx_info, rix, xretries, long_retry); |
1143 | ath_debug_stat_rc(ath_rc_priv, rix); | ||
1128 | } | 1144 | } |
1129 | 1145 | ||
1130 | static const | 1146 | static const |
@@ -1248,15 +1264,6 @@ static bool ath_tx_aggr_check(struct ath_softc *sc, struct ieee80211_sta *sta, | |||
1248 | /* mac80211 Rate Control callbacks */ | 1264 | /* mac80211 Rate Control callbacks */ |
1249 | /***********************************/ | 1265 | /***********************************/ |
1250 | 1266 | ||
1251 | static void ath_debug_stat_rc(struct ath_rate_priv *rc, int final_rate) | ||
1252 | { | ||
1253 | struct ath_rc_stats *stats; | ||
1254 | |||
1255 | stats = &rc->rcstats[final_rate]; | ||
1256 | stats->success++; | ||
1257 | } | ||
1258 | |||
1259 | |||
1260 | static void ath_tx_status(void *priv, struct ieee80211_supported_band *sband, | 1267 | static void ath_tx_status(void *priv, struct ieee80211_supported_band *sband, |
1261 | struct ieee80211_sta *sta, void *priv_sta, | 1268 | struct ieee80211_sta *sta, void *priv_sta, |
1262 | struct sk_buff *skb) | 1269 | struct sk_buff *skb) |
@@ -1265,10 +1272,7 @@ static void ath_tx_status(void *priv, struct ieee80211_supported_band *sband, | |||
1265 | struct ath_rate_priv *ath_rc_priv = priv_sta; | 1272 | struct ath_rate_priv *ath_rc_priv = priv_sta; |
1266 | struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb); | 1273 | struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb); |
1267 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; | 1274 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; |
1268 | int final_ts_idx = 0, tx_status = 0; | ||
1269 | int long_retry = 0; | ||
1270 | __le16 fc = hdr->frame_control; | 1275 | __le16 fc = hdr->frame_control; |
1271 | int i; | ||
1272 | 1276 | ||
1273 | if (!priv_sta || !ieee80211_is_data(fc)) | 1277 | if (!priv_sta || !ieee80211_is_data(fc)) |
1274 | return; | 1278 | return; |
@@ -1281,20 +1285,7 @@ static void ath_tx_status(void *priv, struct ieee80211_supported_band *sband, | |||
1281 | if (tx_info->flags & IEEE80211_TX_STAT_TX_FILTERED) | 1285 | if (tx_info->flags & IEEE80211_TX_STAT_TX_FILTERED) |
1282 | return; | 1286 | return; |
1283 | 1287 | ||
1284 | for (i = 0; i < sc->hw->max_rates; i++) { | 1288 | ath_rc_tx_status(sc, ath_rc_priv, skb); |
1285 | struct ieee80211_tx_rate *rate = &tx_info->status.rates[i]; | ||
1286 | if (rate->idx < 0 || !rate->count) | ||
1287 | break; | ||
1288 | |||
1289 | final_ts_idx = i; | ||
1290 | long_retry = rate->count - 1; | ||
1291 | } | ||
1292 | |||
1293 | if (!(tx_info->flags & IEEE80211_TX_STAT_ACK)) | ||
1294 | tx_status = 1; | ||
1295 | |||
1296 | ath_rc_tx_status(sc, ath_rc_priv, tx_info, final_ts_idx, tx_status, | ||
1297 | long_retry); | ||
1298 | 1289 | ||
1299 | /* Check if aggregation has to be enabled for this tid */ | 1290 | /* Check if aggregation has to be enabled for this tid */ |
1300 | if (conf_is_ht(&sc->hw->conf) && | 1291 | if (conf_is_ht(&sc->hw->conf) && |
@@ -1310,10 +1301,6 @@ static void ath_tx_status(void *priv, struct ieee80211_supported_band *sband, | |||
1310 | ieee80211_start_tx_ba_session(sta, tid, 0); | 1301 | ieee80211_start_tx_ba_session(sta, tid, 0); |
1311 | } | 1302 | } |
1312 | } | 1303 | } |
1313 | |||
1314 | ath_debug_stat_rc(ath_rc_priv, | ||
1315 | ath_rc_get_rateindex(ath_rc_priv->rate_table, | ||
1316 | &tx_info->status.rates[final_ts_idx])); | ||
1317 | } | 1304 | } |
1318 | 1305 | ||
1319 | static void ath_rate_init(void *priv, struct ieee80211_supported_band *sband, | 1306 | static void ath_rate_init(void *priv, struct ieee80211_supported_band *sband, |