Commit c6089ccc authored by Sujith's avatar Sujith Committed by John W. Linville

ath9k: Cleanup bss_info_changed callback

* Remove a code chunk dealing with operating mode changes.
  As noted, all such policy changes are to be done in
  add_interface.

* Remove pointless check for empty BSSID.
  Also, remove mode checks - mac80211 does all the needed checks.

* Handle enabling/disabling beacon transmission properly.

* Handle beacon interval changes for AP mode.
  The original code depended on config_interface() to update
  the HW TSF. Since that callback has been removed, handle
  it properly.

* Remove unneeded code dealing with key/privacy.

* Set the chainmasks to 1x1 for IBSS when the BSSID is set.
  This was happening uncondionally before.
Signed-off-by: default avatarSujith <Sujith.Manoharan@atheros.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 827e69bf
...@@ -2956,90 +2956,62 @@ static void ath9k_bss_info_changed(struct ieee80211_hw *hw, ...@@ -2956,90 +2956,62 @@ static void ath9k_bss_info_changed(struct ieee80211_hw *hw,
struct ath_hw *ah = sc->sc_ah; struct ath_hw *ah = sc->sc_ah;
struct ath_common *common = ath9k_hw_common(ah); struct ath_common *common = ath9k_hw_common(ah);
struct ath_vif *avp = (void *)vif->drv_priv; struct ath_vif *avp = (void *)vif->drv_priv;
u32 rfilt = 0; int error;
int error, i;
mutex_lock(&sc->mutex); mutex_lock(&sc->mutex);
/* if (changed & BSS_CHANGED_BSSID) {
* TODO: Need to decide which hw opmode to use for /* Set BSSID */
* multi-interface cases memcpy(common->curbssid, bss_conf->bssid, ETH_ALEN);
* XXX: This belongs into add_interface! memcpy(avp->bssid, bss_conf->bssid, ETH_ALEN);
*/
if (vif->type == NL80211_IFTYPE_AP &&
ah->opmode != NL80211_IFTYPE_AP) {
ah->opmode = NL80211_IFTYPE_STATION;
ath9k_hw_setopmode(ah);
memcpy(common->curbssid, common->macaddr, ETH_ALEN);
common->curaid = 0; common->curaid = 0;
ath9k_hw_write_associd(ah); ath9k_hw_write_associd(ah);
/* Request full reset to get hw opmode changed properly */
sc->sc_flags |= SC_OP_FULL_RESET;
}
if ((changed & BSS_CHANGED_BSSID) && /* Set aggregation protection mode parameters */
!is_zero_ether_addr(bss_conf->bssid)) { sc->config.ath_aggr_prot = 0;
switch (vif->type) {
case NL80211_IFTYPE_STATION:
case NL80211_IFTYPE_ADHOC:
case NL80211_IFTYPE_MESH_POINT:
/* Set BSSID */
memcpy(common->curbssid, bss_conf->bssid, ETH_ALEN);
memcpy(avp->bssid, bss_conf->bssid, ETH_ALEN);
common->curaid = 0;
ath9k_hw_write_associd(ah);
/* Set aggregation protection mode parameters */ /* Only legacy IBSS for now */
sc->config.ath_aggr_prot = 0; if (vif->type == NL80211_IFTYPE_ADHOC)
ath_update_chainmask(sc, 0);
ath_print(common, ATH_DBG_CONFIG, ath_print(common, ATH_DBG_CONFIG,
"RX filter 0x%x bssid %pM aid 0x%x\n", "BSSID: %pM aid: 0x%x\n",
rfilt, common->curbssid, common->curaid); common->curbssid, common->curaid);
/* need to reconfigure the beacon */ /* need to reconfigure the beacon */
sc->sc_flags &= ~SC_OP_BEACONS ; sc->sc_flags &= ~SC_OP_BEACONS ;
}
break; /* Enable transmission of beacons (AP, IBSS, MESH) */
default: if ((changed & BSS_CHANGED_BEACON) ||
break; ((changed & BSS_CHANGED_BEACON_ENABLED) && bss_conf->enable_beacon)) {
} ath9k_hw_stoptxdma(sc->sc_ah, sc->beacon.beaconq);
error = ath_beacon_alloc(aphy, vif);
if (!error)
ath_beacon_config(sc, vif);
} }
if ((vif->type == NL80211_IFTYPE_ADHOC) || /* Disable transmission of beacons */
(vif->type == NL80211_IFTYPE_AP) || if ((changed & BSS_CHANGED_BEACON_ENABLED) && !bss_conf->enable_beacon)
(vif->type == NL80211_IFTYPE_MESH_POINT)) { ath9k_hw_stoptxdma(sc->sc_ah, sc->beacon.beaconq);
if ((changed & BSS_CHANGED_BEACON) ||
(changed & BSS_CHANGED_BEACON_ENABLED &&
bss_conf->enable_beacon)) {
/*
* Allocate and setup the beacon frame.
*
* Stop any previous beacon DMA. This may be
* necessary, for example, when an ibss merge
* causes reconfiguration; we may be called
* with beacon transmission active.
*/
ath9k_hw_stoptxdma(sc->sc_ah, sc->beacon.beaconq);
if (changed & BSS_CHANGED_BEACON_INT) {
sc->beacon_interval = bss_conf->beacon_int;
/*
* In case of AP mode, the HW TSF has to be reset
* when the beacon interval changes.
*/
if (vif->type == NL80211_IFTYPE_AP) {
sc->sc_flags |= SC_OP_TSF_RESET;
ath9k_hw_stoptxdma(sc->sc_ah, sc->beacon.beaconq);
error = ath_beacon_alloc(aphy, vif); error = ath_beacon_alloc(aphy, vif);
if (!error) if (!error)
ath_beacon_config(sc, vif); ath_beacon_config(sc, vif);
} else {
ath_beacon_config(sc, vif);
} }
} }
/* Check for WLAN_CAPABILITY_PRIVACY ? */
if ((avp->av_opmode != NL80211_IFTYPE_STATION)) {
for (i = 0; i < IEEE80211_WEP_NKID; i++)
if (ath9k_hw_keyisvalid(sc->sc_ah, (u16)i))
ath9k_hw_keysetmac(sc->sc_ah,
(u16)i,
common->curbssid);
}
/* Only legacy IBSS for now */
if (vif->type == NL80211_IFTYPE_ADHOC)
ath_update_chainmask(sc, 0);
if (changed & BSS_CHANGED_ERP_PREAMBLE) { if (changed & BSS_CHANGED_ERP_PREAMBLE) {
ath_print(common, ATH_DBG_CONFIG, "BSS Changed PREAMBLE %d\n", ath_print(common, ATH_DBG_CONFIG, "BSS Changed PREAMBLE %d\n",
bss_conf->use_short_preamble); bss_conf->use_short_preamble);
...@@ -3065,18 +3037,6 @@ static void ath9k_bss_info_changed(struct ieee80211_hw *hw, ...@@ -3065,18 +3037,6 @@ static void ath9k_bss_info_changed(struct ieee80211_hw *hw,
ath9k_bss_assoc_info(sc, vif, bss_conf); ath9k_bss_assoc_info(sc, vif, bss_conf);
} }
/*
* The HW TSF has to be reset when the beacon interval changes.
* We set the flag here, and ath_beacon_config_ap() would take this
* into account when it gets called through the subsequent
* config_interface() call - with IFCC_BEACON in the changed field.
*/
if (changed & BSS_CHANGED_BEACON_INT) {
sc->sc_flags |= SC_OP_TSF_RESET;
sc->beacon_interval = bss_conf->beacon_int;
}
mutex_unlock(&sc->mutex); mutex_unlock(&sc->mutex);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment