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 */
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
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)
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
27 - dur = ieee80211_generic_frame_duration(sc->hw,
29 - return le16_to_cpu(dur);
30 + __le16 raw_dur = ieee80211_generic_frame_duration(sc->hw,
33 + /* subtract difference between long and short preamble */
34 + dur = le16_to_cpu(raw_dur);
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);
49 ath5k_hw_reg_write(ah, tx_time, reg);
51 if (!(rate->flags & IEEE80211_RATE_SHORT_PREAMBLE))
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:
61 - * - remove erp stuff and let the routine figure ofdm
63 - * - remove passing argument ieee80211_local as
64 - * drivers don't have access to it
65 - * - move drivers using ieee80211_generic_frame_duration()
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));
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
76 rate = &sc->sbands[IEEE80211_BAND_2GHZ].bitrates[0];
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);
81 /* ack_tx_time includes an SIFS already */
82 eifs = ack_tx_time + sifs + 2 * slot_time;