ath9k: Add CTWindow support

Since CTWindow can be used for improving discoverability,
fill this field in the NoA Attribute properly.

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
This commit is contained in:
Sujith Manoharan 2014-09-05 08:03:14 +05:30 committed by John W. Linville
parent bb628eb9f0
commit fdcf1bd44f
3 changed files with 31 additions and 2 deletions

View File

@ -572,6 +572,8 @@ void ath9k_release_buffered_frames(struct ieee80211_hw *hw,
/* VIFs */
/********/
#define P2P_DEFAULT_CTWIN 10
struct ath_vif {
struct list_head list;

View File

@ -1166,6 +1166,30 @@ static void ath9k_update_p2p_ps(struct ath_softc *sc, struct ieee80211_vif *vif)
ath9k_update_p2p_ps_timer(sc, avp);
}
static u8 ath9k_get_ctwin(struct ath_softc *sc, struct ath_vif *avp)
{
struct ath_beacon_config *cur_conf = &sc->cur_chan->beacon;
u8 switch_time, ctwin;
/*
* Channel switch in multi-channel mode is deferred
* by a quarter beacon interval when handling
* ATH_CHANCTX_EVENT_BEACON_PREPARE, so the P2P-GO
* interface is guaranteed to be discoverable
* for that duration after a TBTT.
*/
switch_time = cur_conf->beacon_interval / 4;
ctwin = avp->vif->bss_conf.p2p_noa_attr.oppps_ctwindow;
if (ctwin && (ctwin < switch_time))
return ctwin;
if (switch_time < P2P_DEFAULT_CTWIN)
return 0;
return P2P_DEFAULT_CTWIN;
}
void ath9k_beacon_add_noa(struct ath_softc *sc, struct ath_vif *avp,
struct sk_buff *skb)
{
@ -1198,6 +1222,8 @@ void ath9k_beacon_add_noa(struct ath_softc *sc, struct ath_vif *avp,
memset(noa, 0, noa_len);
noa->index = avp->noa_index;
noa->oppps_ctwindow = ath9k_get_ctwin(sc, avp);
if (avp->periodic_noa_duration) {
u32 interval = TU_TO_USEC(sc->cur_chan->beacon.beacon_interval);

View File

@ -763,8 +763,9 @@ static void ath9k_set_hw_capab(struct ath_softc *sc, struct ieee80211_hw *hw)
if (AR_SREV_9160_10_OR_LATER(sc->sc_ah) || ath9k_modparam_nohwcrypt)
hw->flags |= IEEE80211_HW_MFP_CAPABLE;
hw->wiphy->features |= (NL80211_FEATURE_ACTIVE_MONITOR |
NL80211_FEATURE_AP_MODE_CHAN_WIDTH_CHANGE);
hw->wiphy->features |= NL80211_FEATURE_ACTIVE_MONITOR |
NL80211_FEATURE_AP_MODE_CHAN_WIDTH_CHANGE |
NL80211_FEATURE_P2P_GO_CTWIN;
if (!config_enabled(CONFIG_ATH9K_TX99)) {
hw->wiphy->interface_modes =