mac80211: force use_short_slot=true for 5GHz
Subsystems (2)
PATCH 1/3 mac80211: force use_short_slot=true for 5GHz
Normally 5GHz does not have a concept of long vs short slot time, however the slot time that it ends up using is the same as for 2.4 GHZ and use_short_slot == true
Because of that, it makes more sense to force use_short_slot = true whenever 5 GHz is being used, so that this particular check does not have to be in every single driver that uses this flag.
---
net/mac80211/mlme.c +2 -0
@@ -670,6 +670,8 @@ static u32 ieee80211_handle_bss_capabili } use_short_slot = !!(capab &WLAN_CAPABILITY_SHORT_SLOT_TIME ); +if (sdata->local->hw.conf.channel->band ==IEEE80211_BAND_5GHZ ) + use_short_slot = true;if (use_protection != bss_conf->use_cts_prot) { bss_conf->use_cts_prot = use_protection;
PATCH 2/3 ath9k: cleanup slot time and ack/cts timeout handling
Previously ath9k left the initialization of slot timing and ACK/CTS timeout to the mode specific initvals. This does not handle short vs long slot in 2.4 GHz and uses a rather strange value for the 2.4 GHz ACK timeout (64 usec).
This patch uses the proper ath9k_hw functions for setting slot time and timeouts and also implements the switch between short and long slot time in 2.4 GHz
---
drivers/net/wireless/ath/ath9k/main.c +20 -0
@@ -1790,6 +1790,7 @@ static void ath9k_bss_info_changed(strucstruct ath_hw *ah = sc->sc_ah;struct ath_common *common =ath9k_hw_common (ah);struct ath_vif *avp = (void *)vif->drv_priv; +int slottime;int error;mutex_lock (&sc->mutex);
@@ -1825,6 +1826,25 @@ static void ath9k_bss_info_changed(strucath_beacon_config (sc, vif); } +if (changed &BSS_CHANGED_ERP_SLOT ) { +if (bss_conf->use_short_slot) + slottime =9 ; +else + slottime =20 ; +if (vif->type ==NL80211_IFTYPE_AP ) { +/* +* Defer update, so that connected stations can adjust +* their settings at the same time. +* See beacon.c for more details +*/ + sc->beacon.slottime = slottime; + sc->beacon.updateslot =UPDATE ; + }else { + ah->slottime = slottime; +ath9k_hw_init_global_settings (ah); + } + } +/* Disable transmission of beacons */ if ((changed &BSS_CHANGED_BEACON_ENABLED ) && !bss_conf->enable_beacon)ath9k_hw_stoptxdma (sc->sc_ah, sc->beacon.beaconq);
drivers/net/wireless/ath/ath9k/hw.c +32 -71
153 lines not on this page · raw message
drivers/net/wireless/ath/ath9k/hw.h +1 -3
@@ -553,8 +553,6 @@ struct ath_hw {int16_t txpower_indexoffset;u32 beacon_interval;u32 slottime; -u32 acktimeout; -u32 ctstimeout;u32 globaltxtimeout;/* ANI */
@@ -668,7 +666,7 @@ void ath9k_hw_settsf64(struct ath_hw *ahvoid ath9k_hw_reset_tsf (struct ath_hw *ah);void ath9k_hw_set_tsfadjust (struct ath_hw *ah,u32 setting);u64 ath9k_hw_extend_tsf (struct ath_hw *ah,u32 rstamp); -bool ath9k_hw_setslottime (struct ath_hw *ah,u32 us); +void ath9k_hw_init_global_settings (struct ath_hw *ah);void ath9k_hw_set11nmac2040 (struct ath_hw *ah);void ath9k_hw_beaconinit (struct ath_hw *ah,u32 next_beacon,u32 beacon_period); void ath9k_hw_set_sta_beacon_timers(struct ath_hw *ah,
drivers/net/wireless/ath/ath9k/beacon.c +2 -1
@@ -480,7 +480,8 @@ void ath_beacon_tasklet(unsigned long da sc->beacon.updateslot =COMMIT ;/* commit next beacon */ sc->beacon.slotupdate = slot; }else if (sc->beacon.updateslot ==COMMIT && sc->beacon.slotupdate == slot) { -ath9k_hw_setslottime (sc->sc_ah, sc->beacon.slottime); + ah->slottime = sc->beacon.slottime; +ath9k_hw_init_global_settings (ah); sc->beacon.updateslot =OK ; }if (bfaddr !=0 ) {
PATCH 3/3 ath9k: implement coverage class support
---
drivers/net/wireless/ath/ath9k/hw.c +5 -2
@@ -1211,6 +1211,7 @@ void ath9k_hw_init_global_settings(struc {struct ieee80211_conf *conf = &ath9k_hw_common (ah)->hw->conf;int acktimeout; +int slottime;int sifstime; ath_print(ath9k_hw_common(ah), ATH_DBG_RESET, "ah->misc_mode 0x%x\n",
@@ -1225,8 +1226,10 @@ void ath9k_hw_init_global_settings(strucelse sifstime =10 ; - acktimeout = ah->slottime + sifstime; -ath9k_hw_setslottime (ah, ah->slottime); +/* As defined by IEEE 802.11-2007 17.3.8.6 */ + slottime = ah->slottime +3 * ah->coverage_class; + acktimeout = slottime + sifstime; +ath9k_hw_setslottime (ah, slottime);ath9k_hw_set_ack_timeout (ah, acktimeout);ath9k_hw_set_cts_timeout (ah, acktimeout);if (ah->globaltxtimeout != (u32) -1 )
drivers/net/wireless/ath/ath9k/hw.h +1 -0
@@ -551,6 +551,7 @@ struct ath_hw {u32 *bank6Temp;int16_t txpower_indexoffset; +int coverage_class;u32 beacon_interval;u32 slottime;u32 globaltxtimeout;
drivers/net/wireless/ath/ath9k/main.c +1 -0
@@ -2015,6 +2015,18 @@ static void ath9k_sw_scan_complete(strucmutex_unlock (&sc->mutex); } +static void ath9k_set_coverage_class(struct ieee80211_hw *hw, u8
coverage_class)
+{
+ struct ath_wiphy *aphy = hw->priv;
+ struct ath_softc *sc = aphy->sc;
+ struct ath_hw *ah = sc->sc_ah;
+
+ mutex_lock(&sc->mutex);
+ ah->coverage_class = coverage_class;
+ ath9k_hw_init_global_settings(ah);
+ mutex_unlock(&sc->mutex);
+}
+
struct ieee80211_ops ath9k_ops = {
.tx = ath9k_tx,
.start = ath9k_start,
@@ -2034,4 +2046,5 @@ struct ieee80211_ops ath9k_ops = {
.sw_scan_start = ath9k_sw_scan_start, .sw_scan_complete = ath9k_sw_scan_complete, .rfkill_poll = ath9k_rfkill_poll_state,
+ .set_coverage_class = ath9k_set_coverage_class,
};
PATCH v2 1/3 mac80211: force use_short_slot=true for 5GHz
In reply to Felix FietkauNormally 5GHz does not have a concept of long vs short slot time, however the slot time that it ends up using is the same as for 2.4 GHZ and use_short_slot == true
Because of that, it makes more sense to force use_short_slot = true whenever 5 GHz is being used, so that this particular check does not have to be in every single driver that uses this flag.
---
v2: sorry, forgot one chunk of the patch
net/mac80211/mlme.c +2 -0
@@ -670,6 +670,8 @@ static u32 ieee80211_handle_bss_capabili } use_short_slot = !!(capab &WLAN_CAPABILITY_SHORT_SLOT_TIME ); +if (sdata->local->hw.conf.channel->band ==IEEE80211_BAND_5GHZ ) + use_short_slot = true;if (use_protection != bss_conf->use_cts_prot) { bss_conf->use_cts_prot = use_protection;
net/mac80211/cfg.c +7 -0
@@ -1087,6 +1087,13 @@ static int ieee80211_change_bss(struct w params->use_short_preamble; changed |=BSS_CHANGED_ERP_PREAMBLE ; } + +if (!sdata->vif.bss_conf.use_short_slot && + sdata->local->hw.conf.channel->band ==IEEE80211_BAND_5GHZ ) { + sdata->vif.bss_conf.use_short_slot = true; + changed |=BSS_CHANGED_ERP_SLOT ; + } +if (params->use_short_slot_time >=0 ) { sdata->vif.bss_conf.use_short_slot = params->use_short_slot_time;