diff options
author | Felix Fietkau <nbd@openwrt.org> | 2011-04-09 17:10:19 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2011-04-12 16:59:02 -0400 |
commit | a27049e2c926bcf68360532a5ae66e408296ae85 (patch) | |
tree | 7b039a2912f331ff7ea55326d30995b9bfdab60e | |
parent | 6d7b97b23e114c8fbb825e6721164d228c1af3fc (diff) |
ath5k: fix short preamble rate duration value
Subtract the difference in preamble duration (in usec) from the value
returned by ieee80211_generic_frame_duration.
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r-- | drivers/net/wireless/ath/ath5k/ath5k.h | 2 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath5k/pcu.c | 31 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath5k/qcu.c | 2 |
3 files changed, 14 insertions, 21 deletions
diff --git a/drivers/net/wireless/ath/ath5k/ath5k.h b/drivers/net/wireless/ath/ath5k/ath5k.h index 8a06dbd39629..996d8afafdb7 100644 --- a/drivers/net/wireless/ath/ath5k/ath5k.h +++ b/drivers/net/wireless/ath/ath5k/ath5k.h | |||
@@ -1233,7 +1233,7 @@ int ath5k_eeprom_read_mac(struct ath5k_hw *ah, u8 *mac); | |||
1233 | /* Protocol Control Unit Functions */ | 1233 | /* Protocol Control Unit Functions */ |
1234 | /* Helpers */ | 1234 | /* Helpers */ |
1235 | int ath5k_hw_get_frame_duration(struct ath5k_hw *ah, | 1235 | int ath5k_hw_get_frame_duration(struct ath5k_hw *ah, |
1236 | int len, struct ieee80211_rate *rate); | 1236 | int len, struct ieee80211_rate *rate, bool shortpre); |
1237 | unsigned int ath5k_hw_get_default_slottime(struct ath5k_hw *ah); | 1237 | unsigned int ath5k_hw_get_default_slottime(struct ath5k_hw *ah); |
1238 | unsigned int ath5k_hw_get_default_sifs(struct ath5k_hw *ah); | 1238 | unsigned int ath5k_hw_get_default_sifs(struct ath5k_hw *ah); |
1239 | extern int ath5k_hw_set_opmode(struct ath5k_hw *ah, enum nl80211_iftype opmode); | 1239 | extern int ath5k_hw_set_opmode(struct ath5k_hw *ah, enum nl80211_iftype opmode); |
diff --git a/drivers/net/wireless/ath/ath5k/pcu.c b/drivers/net/wireless/ath/ath5k/pcu.c index a702817daf72..e342e470fb05 100644 --- a/drivers/net/wireless/ath/ath5k/pcu.c +++ b/drivers/net/wireless/ath/ath5k/pcu.c | |||
@@ -75,7 +75,7 @@ static const unsigned int ack_rates_high[] = | |||
75 | * bwmodes. | 75 | * bwmodes. |
76 | */ | 76 | */ |
77 | int ath5k_hw_get_frame_duration(struct ath5k_hw *ah, | 77 | int ath5k_hw_get_frame_duration(struct ath5k_hw *ah, |
78 | int len, struct ieee80211_rate *rate) | 78 | int len, struct ieee80211_rate *rate, bool shortpre) |
79 | { | 79 | { |
80 | struct ath5k_softc *sc = ah->ah_sc; | 80 | struct ath5k_softc *sc = ah->ah_sc; |
81 | int sifs, preamble, plcp_bits, sym_time; | 81 | int sifs, preamble, plcp_bits, sym_time; |
@@ -84,9 +84,15 @@ int ath5k_hw_get_frame_duration(struct ath5k_hw *ah, | |||
84 | 84 | ||
85 | /* Fallback */ | 85 | /* Fallback */ |
86 | if (!ah->ah_bwmode) { | 86 | if (!ah->ah_bwmode) { |
87 | dur = ieee80211_generic_frame_duration(sc->hw, | 87 | __le16 raw_dur = ieee80211_generic_frame_duration(sc->hw, |
88 | NULL, len, rate); | 88 | NULL, len, rate); |
89 | return le16_to_cpu(dur); | 89 | |
90 | /* subtract difference between long and short preamble */ | ||
91 | dur = le16_to_cpu(raw_dur); | ||
92 | if (shortpre) | ||
93 | dur -= 96; | ||
94 | |||
95 | return dur; | ||
90 | } | 96 | } |
91 | 97 | ||
92 | bitrate = rate->bitrate; | 98 | bitrate = rate->bitrate; |
@@ -263,27 +269,14 @@ static inline void ath5k_hw_write_rate_duration(struct ath5k_hw *ah) | |||
263 | * actual rate for this rate. See mac80211 tx.c | 269 | * actual rate for this rate. See mac80211 tx.c |
264 | * ieee80211_duration() for a brief description of | 270 | * ieee80211_duration() for a brief description of |
265 | * what rate we should choose to TX ACKs. */ | 271 | * what rate we should choose to TX ACKs. */ |
266 | tx_time = ath5k_hw_get_frame_duration(ah, 10, rate); | 272 | tx_time = ath5k_hw_get_frame_duration(ah, 10, rate, false); |
267 | 273 | ||
268 | ath5k_hw_reg_write(ah, tx_time, reg); | 274 | ath5k_hw_reg_write(ah, tx_time, reg); |
269 | 275 | ||
270 | if (!(rate->flags & IEEE80211_RATE_SHORT_PREAMBLE)) | 276 | if (!(rate->flags & IEEE80211_RATE_SHORT_PREAMBLE)) |
271 | continue; | 277 | continue; |
272 | 278 | ||
273 | /* | 279 | tx_time = ath5k_hw_get_frame_duration(ah, 10, rate, true); |
274 | * We're not distinguishing short preamble here, | ||
275 | * This is true, all we'll get is a longer value here | ||
276 | * which is not necessarilly bad. We could use | ||
277 | * export ieee80211_frame_duration() but that needs to be | ||
278 | * fixed first to be properly used by mac802111 drivers: | ||
279 | * | ||
280 | * - remove erp stuff and let the routine figure ofdm | ||
281 | * erp rates | ||
282 | * - remove passing argument ieee80211_local as | ||
283 | * drivers don't have access to it | ||
284 | * - move drivers using ieee80211_generic_frame_duration() | ||
285 | * to this | ||
286 | */ | ||
287 | ath5k_hw_reg_write(ah, tx_time, | 280 | ath5k_hw_reg_write(ah, tx_time, |
288 | reg + (AR5K_SET_SHORT_PREAMBLE << 2)); | 281 | reg + (AR5K_SET_SHORT_PREAMBLE << 2)); |
289 | } | 282 | } |
diff --git a/drivers/net/wireless/ath/ath5k/qcu.c b/drivers/net/wireless/ath/ath5k/qcu.c index 3343fb9e4940..93abcfacd990 100644 --- a/drivers/net/wireless/ath/ath5k/qcu.c +++ b/drivers/net/wireless/ath/ath5k/qcu.c | |||
@@ -550,7 +550,7 @@ int ath5k_hw_set_ifs_intervals(struct ath5k_hw *ah, unsigned int slot_time) | |||
550 | else | 550 | else |
551 | rate = &sc->sbands[IEEE80211_BAND_2GHZ].bitrates[0]; | 551 | rate = &sc->sbands[IEEE80211_BAND_2GHZ].bitrates[0]; |
552 | 552 | ||
553 | ack_tx_time = ath5k_hw_get_frame_duration(ah, 10, rate); | 553 | ack_tx_time = ath5k_hw_get_frame_duration(ah, 10, rate, false); |
554 | 554 | ||
555 | /* ack_tx_time includes an SIFS already */ | 555 | /* ack_tx_time includes an SIFS already */ |
556 | eifs = ack_tx_time + sifs + 2 * slot_time; | 556 | eifs = ack_tx_time + sifs + 2 * slot_time; |