ath9k: fix rts/cts handling
[openwrt/svn-archive/archive.git] / package / mac80211 / patches / 570-ath9k_fix_rts_cts.patch
1 --- a/drivers/net/wireless/ath/ath9k/xmit.c
2 +++ b/drivers/net/wireless/ath/ath9k/xmit.c
3 @@ -1498,26 +1498,6 @@ static void ath_buf_set_rate(struct ath_
4 if (sc->sc_flags & SC_OP_PREAMBLE_SHORT)
5 ctsrate |= rate->hw_value_short;
6
7 - /*
8 - * ATH9K_TXDESC_RTSENA and ATH9K_TXDESC_CTSENA are mutually exclusive.
9 - * Check the first rate in the series to decide whether RTS/CTS
10 - * or CTS-to-self has to be used.
11 - */
12 - if (rates[0].flags & IEEE80211_TX_RC_USE_CTS_PROTECT)
13 - flags = ATH9K_TXDESC_CTSENA;
14 - else if (rates[0].flags & IEEE80211_TX_RC_USE_RTS_CTS)
15 - flags = ATH9K_TXDESC_RTSENA;
16 -
17 - /* FIXME: Handle aggregation protection */
18 - if (sc->config.ath_aggr_prot &&
19 - (!bf_isaggr(bf) || (bf_isaggr(bf) && bf->bf_al < 8192))) {
20 - flags = ATH9K_TXDESC_RTSENA;
21 - }
22 -
23 - /* For AR5416 - RTS cannot be followed by a frame larger than 8K */
24 - if (bf_isaggr(bf) && (bf->bf_al > sc->sc_ah->caps.rts_aggr_limit))
25 - flags &= ~(ATH9K_TXDESC_RTSENA);
26 -
27 for (i = 0; i < 4; i++) {
28 bool is_40, is_sgi, is_sp;
29 int phy;
30 @@ -1529,8 +1509,15 @@ static void ath_buf_set_rate(struct ath_
31 series[i].Tries = rates[i].count;
32 series[i].ChSel = common->tx_chainmask;
33
34 - if (rates[i].flags & IEEE80211_TX_RC_USE_RTS_CTS)
35 + if ((sc->config.ath_aggr_prot && bf_isaggr(bf)) ||
36 + (rates[i].flags & IEEE80211_TX_RC_USE_RTS_CTS)) {
37 series[i].RateFlags |= ATH9K_RATESERIES_RTS_CTS;
38 + flags |= ATH9K_TXDESC_RTSENA;
39 + } else if (rates[i].flags & IEEE80211_TX_RC_USE_CTS_PROTECT) {
40 + series[i].RateFlags |= ATH9K_RATESERIES_RTS_CTS;
41 + flags |= ATH9K_TXDESC_CTSENA;
42 + }
43 +
44 if (rates[i].flags & IEEE80211_TX_RC_40_MHZ_WIDTH)
45 series[i].RateFlags |= ATH9K_RATESERIES_2040;
46 if (rates[i].flags & IEEE80211_TX_RC_SHORT_GI)
47 @@ -1568,6 +1555,14 @@ static void ath_buf_set_rate(struct ath_
48 phy, rate->bitrate * 100, bf->bf_frmlen, rix, is_sp);
49 }
50
51 + /* For AR5416 - RTS cannot be followed by a frame larger than 8K */
52 + if (bf_isaggr(bf) && (bf->bf_al > sc->sc_ah->caps.rts_aggr_limit))
53 + flags &= ~ATH9K_TXDESC_RTSENA;
54 +
55 + /* ATH9K_TXDESC_RTSENA and ATH9K_TXDESC_CTSENA are mutually exclusive. */
56 + if (flags & ATH9K_TXDESC_RTSENA)
57 + flags &= ~ATH9K_TXDESC_CTSENA;
58 +
59 /* set dur_update_en for l-sig computation except for PS-Poll frames */
60 ath9k_hw_set11n_ratescenario(sc->sc_ah, bf->bf_desc,
61 bf->bf_lastbf->bf_desc,