~ubuntu-branches/ubuntu/quantal/linux-backports-modules-3.5.0/quantal-updates

« back to all changes in this revision

Viewing changes to updates/cw-3.6/linux-next-cherry-picks/0015-ath9k-Cleanup-TX-status-API.patch

  • Committer: Package Import Robot
  • Author(s): Leann Ogasawara
  • Date: 2012-10-10 22:28:55 UTC
  • Revision ID: package-import@ubuntu.com-20121010222855-qepocc61xktv6gs9
Tags: 3.5.0-17.1
* Open Quantal LBM
* Add compat-wireless 3.6
  -LP: #1066123

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
 
5
 
 
6
Calculate the final rate index inside ath_rc_tx_status().
 
7
 
 
8
Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
 
9
Signed-off-by: John W. Linville <linville@tuxdriver.com>
 
10
---
 
11
 drivers/net/wireless/ath/ath9k/rc.c | 71 +++++++++++++++----------------------
 
12
 1 file changed, 29 insertions(+), 42 deletions(-)
 
13
 
 
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
 
17
        stats->per = per;
 
18
 }
 
19
 
 
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. */
 
22
-
 
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_
 
27
 
 
28
 }
 
29
 
 
30
+static void ath_debug_stat_rc(struct ath_rate_priv *rc, int final_rate)
 
31
+{
 
32
+       struct ath_rc_stats *stats;
 
33
+
 
34
+       stats = &rc->rcstats[final_rate];
 
35
+       stats->success++;
 
36
+}
 
37
 
 
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)
 
43
 {
 
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;
 
50
        u8 flags;
 
51
        u32 i = 0, rix;
 
52
 
 
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)
 
57
+                       break;
 
58
+
 
59
+               final_ts_idx = i;
 
60
+               long_retry = rate->count - 1;
 
61
+       }
 
62
+
 
63
+       if (!(tx_info->flags & IEEE80211_TX_STAT_ACK))
 
64
+               xretries = 1;
 
65
 
 
66
        /*
 
67
         * If the first rate is not the final index, there
 
68
         * are intermediate rate failures to be processed.
 
69
         */
 
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_
 
76
 
 
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,
 
80
-                                               rates[i].count);
 
81
+                                                rix, xretries ? 1 : 2,
 
82
+                                                rates[i].count);
 
83
                        }
 
84
                }
 
85
        } else {
 
86
@@ -1116,15 +1131,16 @@ static void ath_rc_tx_status(struct ath_
 
87
                        xretries = 2;
 
88
        }
 
89
 
 
90
-       flags = rates[i].flags;
 
91
+       flags = rates[final_ts_idx].flags;
 
92
 
 
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))
 
96
                return;
 
97
 
 
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);
 
102
 }
 
103
 
 
104
 static const
 
105
@@ -1248,15 +1264,6 @@ static bool ath_tx_aggr_check(struct ath
 
106
 /* mac80211 Rate Control callbacks */
 
107
 /***********************************/
 
108
 
 
109
-static void ath_debug_stat_rc(struct ath_rate_priv *rc, int final_rate)
 
110
-{
 
111
-       struct ath_rc_stats *stats;
 
112
-
 
113
-       stats = &rc->rcstats[final_rate];
 
114
-       stats->success++;
 
115
-}
 
116
-
 
117
-
 
118
 static void ath_tx_status(void *priv, struct ieee80211_supported_band *sband,
 
119
                          struct ieee80211_sta *sta, void *priv_sta,
 
120
                          struct sk_buff *skb)
 
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;
 
128
-       int i;
 
129
 
 
130
        if (!priv_sta || !ieee80211_is_data(fc))
 
131
                return;
 
132
@@ -1281,20 +1285,7 @@ static void ath_tx_status(void *priv, st
 
133
        if (tx_info->flags & IEEE80211_TX_STAT_TX_FILTERED)
 
134
                return;
 
135
 
 
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)
 
139
-                       break;
 
140
-
 
141
-               final_ts_idx = i;
 
142
-               long_retry = rate->count - 1;
 
143
-       }
 
144
-
 
145
-       if (!(tx_info->flags & IEEE80211_TX_STAT_ACK))
 
146
-               tx_status = 1;
 
147
-
 
148
-       ath_rc_tx_status(sc, ath_rc_priv, tx_info, final_ts_idx, tx_status,
 
149
-                        long_retry);
 
150
+       ath_rc_tx_status(sc, ath_rc_priv, skb);
 
151
 
 
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);
 
156
                }
 
157
        }
 
158
-
 
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]));
 
162
 }
 
163
 
 
164
 static void ath_rate_init(void *priv, struct ieee80211_supported_band *sband,