1
From 88dcc2dd717b292d1ef7311a6487c610f709bd10 Mon Sep 17 00:00:00 2001
2
From: Sujith Manoharan <c_manoha@qca.qualcomm.com>
3
Date: Fri, 10 Aug 2012 16:47:09 +0530
4
Subject: [PATCH] ath9k: Cleanup TX status API
6
Calculate the final rate index inside ath_rc_tx_status().
8
Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
9
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11
drivers/net/wireless/ath/ath9k/rc.c | 71 +++++++++++++++----------------------
12
1 file changed, 29 insertions(+), 42 deletions(-)
14
--- a/drivers/net/wireless/ath/ath9k/rc.c
15
+++ b/drivers/net/wireless/ath/ath9k/rc.c
16
@@ -993,9 +993,6 @@ static void ath_debug_stat_retries(struc
20
-/* Update PER, RSSI and whatever else that the code thinks it is doing.
21
- If you can make sense of all this, you really need to go out more. */
23
static void ath_rc_update_ht(struct ath_softc *sc,
24
struct ath_rate_priv *ath_rc_priv,
25
struct ieee80211_tx_info *tx_info,
26
@@ -1069,25 +1066,43 @@ static void ath_rc_update_ht(struct ath_
30
+static void ath_debug_stat_rc(struct ath_rate_priv *rc, int final_rate)
32
+ struct ath_rc_stats *stats;
34
+ stats = &rc->rcstats[final_rate];
38
static void ath_rc_tx_status(struct ath_softc *sc,
39
struct ath_rate_priv *ath_rc_priv,
40
- struct ieee80211_tx_info *tx_info,
41
- int final_ts_idx, int xretries, int long_retry)
42
+ struct sk_buff *skb)
44
- const struct ath_rate_table *rate_table;
45
+ const struct ath_rate_table *rate_table = ath_rc_priv->rate_table;
46
+ struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb);
47
struct ieee80211_tx_rate *rates = tx_info->status.rates;
48
+ struct ieee80211_tx_rate *rate;
49
+ int final_ts_idx = 0, xretries = 0, long_retry = 0;
53
- rate_table = ath_rc_priv->rate_table;
54
+ for (i = 0; i < sc->hw->max_rates; i++) {
55
+ rate = &tx_info->status.rates[i];
56
+ if (rate->idx < 0 || !rate->count)
60
+ long_retry = rate->count - 1;
63
+ if (!(tx_info->flags & IEEE80211_TX_STAT_ACK))
67
* If the first rate is not the final index, there
68
* are intermediate rate failures to be processed.
70
if (final_ts_idx != 0) {
71
- /* Process intermediate rates that failed.*/
72
for (i = 0; i < final_ts_idx ; i++) {
73
if (rates[i].count != 0 && (rates[i].idx >= 0)) {
74
flags = rates[i].flags;
75
@@ -1101,8 +1116,8 @@ static void ath_rc_tx_status(struct ath_
77
rix = ath_rc_get_rateindex(rate_table, &rates[i]);
78
ath_rc_update_ht(sc, ath_rc_priv, tx_info,
79
- rix, xretries ? 1 : 2,
81
+ rix, xretries ? 1 : 2,
86
@@ -1116,15 +1131,16 @@ static void ath_rc_tx_status(struct ath_
90
- flags = rates[i].flags;
91
+ flags = rates[final_ts_idx].flags;
93
/* If HT40 and we have switched mode from 40 to 20 => don't update */
94
if ((flags & IEEE80211_TX_RC_40_MHZ_WIDTH) &&
95
!(ath_rc_priv->ht_cap & WLAN_RC_40_FLAG))
98
- rix = ath_rc_get_rateindex(rate_table, &rates[i]);
99
+ rix = ath_rc_get_rateindex(rate_table, &rates[final_ts_idx]);
100
ath_rc_update_ht(sc, ath_rc_priv, tx_info, rix, xretries, long_retry);
101
+ ath_debug_stat_rc(ath_rc_priv, rix);
105
@@ -1248,15 +1264,6 @@ static bool ath_tx_aggr_check(struct ath
106
/* mac80211 Rate Control callbacks */
107
/***********************************/
109
-static void ath_debug_stat_rc(struct ath_rate_priv *rc, int final_rate)
111
- struct ath_rc_stats *stats;
113
- stats = &rc->rcstats[final_rate];
118
static void ath_tx_status(void *priv, struct ieee80211_supported_band *sband,
119
struct ieee80211_sta *sta, void *priv_sta,
121
@@ -1265,10 +1272,7 @@ static void ath_tx_status(void *priv, st
122
struct ath_rate_priv *ath_rc_priv = priv_sta;
123
struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb);
124
struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
125
- int final_ts_idx = 0, tx_status = 0;
126
- int long_retry = 0;
127
__le16 fc = hdr->frame_control;
130
if (!priv_sta || !ieee80211_is_data(fc))
132
@@ -1281,20 +1285,7 @@ static void ath_tx_status(void *priv, st
133
if (tx_info->flags & IEEE80211_TX_STAT_TX_FILTERED)
136
- for (i = 0; i < sc->hw->max_rates; i++) {
137
- struct ieee80211_tx_rate *rate = &tx_info->status.rates[i];
138
- if (rate->idx < 0 || !rate->count)
142
- long_retry = rate->count - 1;
145
- if (!(tx_info->flags & IEEE80211_TX_STAT_ACK))
148
- ath_rc_tx_status(sc, ath_rc_priv, tx_info, final_ts_idx, tx_status,
150
+ ath_rc_tx_status(sc, ath_rc_priv, skb);
152
/* Check if aggregation has to be enabled for this tid */
153
if (conf_is_ht(&sc->hw->conf) &&
154
@@ -1310,10 +1301,6 @@ static void ath_tx_status(void *priv, st
155
ieee80211_start_tx_ba_session(sta, tid, 0);
159
- ath_debug_stat_rc(ath_rc_priv,
160
- ath_rc_get_rateindex(ath_rc_priv->rate_table,
161
- &tx_info->status.rates[final_ts_idx]));
164
static void ath_rate_init(void *priv, struct ieee80211_supported_band *sband,