mac80211: b43: Expose PIO mode fallback
[openwrt/svn-archive/archive.git] / package / mac80211 / patches / 461-ath5k_fix_short_preamble_dur.patch
1 --- a/drivers/net/wireless/ath/ath5k/ath5k.h
2 +++ b/drivers/net/wireless/ath/ath5k/ath5k.h
3 @@ -1233,7 +1233,7 @@ int ath5k_eeprom_read_mac(struct ath5k_h
4 /* Protocol Control Unit Functions */
5 /* Helpers */
6 int ath5k_hw_get_frame_duration(struct ath5k_hw *ah,
7 - int len, struct ieee80211_rate *rate);
8 + int len, struct ieee80211_rate *rate, bool shortpre);
9 unsigned int ath5k_hw_get_default_slottime(struct ath5k_hw *ah);
10 unsigned int ath5k_hw_get_default_sifs(struct ath5k_hw *ah);
11 extern int ath5k_hw_set_opmode(struct ath5k_hw *ah, enum nl80211_iftype opmode);
12 --- a/drivers/net/wireless/ath/ath5k/pcu.c
13 +++ b/drivers/net/wireless/ath/ath5k/pcu.c
14 @@ -75,7 +75,7 @@ static const unsigned int ack_rates_high
15 * bwmodes.
16 */
17 int ath5k_hw_get_frame_duration(struct ath5k_hw *ah,
18 - int len, struct ieee80211_rate *rate)
19 + int len, struct ieee80211_rate *rate, bool shortpre)
20 {
21 struct ath5k_softc *sc = ah->ah_sc;
22 int sifs, preamble, plcp_bits, sym_time;
23 @@ -84,9 +84,15 @@ int ath5k_hw_get_frame_duration(struct a
24
25 /* Fallback */
26 if (!ah->ah_bwmode) {
27 - dur = ieee80211_generic_frame_duration(sc->hw,
28 - NULL, len, rate);
29 - return le16_to_cpu(dur);
30 + __le16 raw_dur = ieee80211_generic_frame_duration(sc->hw,
31 + NULL, len, rate);
32 +
33 + /* subtract difference between long and short preamble */
34 + dur = le16_to_cpu(raw_dur);
35 + if (shortpre)
36 + dur -= 96;
37 +
38 + return dur;
39 }
40
41 bitrate = rate->bitrate;
42 @@ -263,27 +269,14 @@ static inline void ath5k_hw_write_rate_d
43 * actual rate for this rate. See mac80211 tx.c
44 * ieee80211_duration() for a brief description of
45 * what rate we should choose to TX ACKs. */
46 - tx_time = ath5k_hw_get_frame_duration(ah, 10, rate);
47 + tx_time = ath5k_hw_get_frame_duration(ah, 10, rate, false);
48
49 ath5k_hw_reg_write(ah, tx_time, reg);
50
51 if (!(rate->flags & IEEE80211_RATE_SHORT_PREAMBLE))
52 continue;
53
54 - /*
55 - * We're not distinguishing short preamble here,
56 - * This is true, all we'll get is a longer value here
57 - * which is not necessarilly bad. We could use
58 - * export ieee80211_frame_duration() but that needs to be
59 - * fixed first to be properly used by mac802111 drivers:
60 - *
61 - * - remove erp stuff and let the routine figure ofdm
62 - * erp rates
63 - * - remove passing argument ieee80211_local as
64 - * drivers don't have access to it
65 - * - move drivers using ieee80211_generic_frame_duration()
66 - * to this
67 - */
68 + tx_time = ath5k_hw_get_frame_duration(ah, 10, rate, true);
69 ath5k_hw_reg_write(ah, tx_time,
70 reg + (AR5K_SET_SHORT_PREAMBLE << 2));
71 }
72 --- a/drivers/net/wireless/ath/ath5k/qcu.c
73 +++ b/drivers/net/wireless/ath/ath5k/qcu.c
74 @@ -550,7 +550,7 @@ int ath5k_hw_set_ifs_intervals(struct at
75 else
76 rate = &sc->sbands[IEEE80211_BAND_2GHZ].bitrates[0];
77
78 - ack_tx_time = ath5k_hw_get_frame_duration(ah, 10, rate);
79 + ack_tx_time = ath5k_hw_get_frame_duration(ah, 10, rate, false);
80
81 /* ack_tx_time includes an SIFS already */
82 eifs = ack_tx_time + sifs + 2 * slot_time;