ath9k: fix short slot vs long slot handling, implement support for setting the covera...
[openwrt/svn-archive/archive.git] / package / mac80211 / patches / 560-ath9k_coverage_class.patch
1 --- a/drivers/net/wireless/ath/ath9k/hw.c
2 +++ b/drivers/net/wireless/ath/ath9k/hw.c
3 @@ -1211,6 +1211,7 @@ void ath9k_hw_init_global_settings(struc
4 {
5 struct ieee80211_conf *conf = &ath9k_hw_common(ah)->hw->conf;
6 int acktimeout;
7 + int slottime;
8 int sifstime;
9
10 ath_print(ath9k_hw_common(ah), ATH_DBG_RESET, "ah->misc_mode 0x%x\n",
11 @@ -1225,8 +1226,10 @@ void ath9k_hw_init_global_settings(struc
12 else
13 sifstime = 10;
14
15 - acktimeout = ah->slottime + sifstime;
16 - ath9k_hw_setslottime(ah, ah->slottime);
17 + /* As defined by IEEE 802.11-2007 17.3.8.6 */
18 + slottime = ah->slottime + 3 * ah->coverage_class;
19 + acktimeout = slottime + sifstime;
20 + ath9k_hw_setslottime(ah, slottime);
21 ath9k_hw_set_ack_timeout(ah, acktimeout);
22 ath9k_hw_set_cts_timeout(ah, acktimeout);
23 if (ah->globaltxtimeout != (u32) -1)
24 --- a/drivers/net/wireless/ath/ath9k/hw.h
25 +++ b/drivers/net/wireless/ath/ath9k/hw.h
26 @@ -551,6 +551,7 @@ struct ath_hw {
27 u32 *bank6Temp;
28
29 int16_t txpower_indexoffset;
30 + int coverage_class;
31 u32 beacon_interval;
32 u32 slottime;
33 u32 globaltxtimeout;
34 --- a/drivers/net/wireless/ath/ath9k/main.c
35 +++ b/drivers/net/wireless/ath/ath9k/main.c
36 @@ -2015,6 +2015,18 @@ static void ath9k_sw_scan_complete(struc
37 mutex_unlock(&sc->mutex);
38 }
39
40 +static void ath9k_set_coverage_class(struct ieee80211_hw *hw, u8 coverage_class)
41 +{
42 + struct ath_wiphy *aphy = hw->priv;
43 + struct ath_softc *sc = aphy->sc;
44 + struct ath_hw *ah = sc->sc_ah;
45 +
46 + mutex_lock(&sc->mutex);
47 + ah->coverage_class = coverage_class;
48 + ath9k_hw_init_global_settings(ah);
49 + mutex_unlock(&sc->mutex);
50 +}
51 +
52 struct ieee80211_ops ath9k_ops = {
53 .tx = ath9k_tx,
54 .start = ath9k_start,
55 @@ -2034,4 +2046,5 @@ struct ieee80211_ops ath9k_ops = {
56 .sw_scan_start = ath9k_sw_scan_start,
57 .sw_scan_complete = ath9k_sw_scan_complete,
58 .rfkill_poll = ath9k_rfkill_poll_state,
59 + .set_coverage_class = ath9k_set_coverage_class,
60 };