ath9k: prepare for multi-interface CSA support
authorMichal Kazior <michal.kazior@tieto.com>
Mon, 20 Jan 2014 14:27:12 +0000 (15:27 +0100)
committerJohn W. Linville <linville@tuxdriver.com>
Wed, 12 Feb 2014 20:31:48 +0000 (15:31 -0500)
Soon mac80211 will support multi-interface CSA so
using sc->csa_vif is not an option.

Instead just depend on vif->csa_active. Calling
ieee80211_csa_finish() multiple number of times
should not be an issue.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/ath/ath9k/ath9k.h
drivers/net/wireless/ath/ath9k/beacon.c
drivers/net/wireless/ath/ath9k/main.c
drivers/net/wireless/ath/ath9k/xmit.c

index b5ac32c..7fde8ec 100644 (file)
@@ -442,7 +442,8 @@ void ath9k_beacon_config(struct ath_softc *sc, struct ieee80211_vif *vif,
 void ath9k_beacon_assign_slot(struct ath_softc *sc, struct ieee80211_vif *vif);
 void ath9k_beacon_remove_slot(struct ath_softc *sc, struct ieee80211_vif *vif);
 void ath9k_set_beacon(struct ath_softc *sc);
-bool ath9k_csa_is_finished(struct ath_softc *sc);
+bool ath9k_csa_is_finished(struct ath_softc *sc, struct ieee80211_vif *vif);
+void ath9k_csa_update(struct ath_softc *sc);
 
 /*******************/
 /* Link Monitoring */
@@ -774,7 +775,6 @@ struct ath_softc {
 #endif
 
        struct ath_descdma txsdma;
-       struct ieee80211_vif *csa_vif;
 
        struct ath_ant_comb ant_comb;
        u8 ant_tx, ant_rx;
index 2e8bba0..32d00e8 100644 (file)
@@ -292,11 +292,8 @@ static void ath9k_set_tsfadjust(struct ath_softc *sc, struct ieee80211_vif *vif)
                (unsigned long long)tsfadjust, avp->av_bslot);
 }
 
-bool ath9k_csa_is_finished(struct ath_softc *sc)
+bool ath9k_csa_is_finished(struct ath_softc *sc, struct ieee80211_vif *vif)
 {
-       struct ieee80211_vif *vif;
-
-       vif = sc->csa_vif;
        if (!vif || !vif->csa_active)
                return false;
 
@@ -304,11 +301,23 @@ bool ath9k_csa_is_finished(struct ath_softc *sc)
                return false;
 
        ieee80211_csa_finish(vif);
-
-       sc->csa_vif = NULL;
        return true;
 }
 
+static void ath9k_csa_update_vif(void *data, u8 *mac, struct ieee80211_vif *vif)
+{
+       struct ath_softc *sc = data;
+       ath9k_csa_is_finished(sc, vif);
+}
+
+void ath9k_csa_update(struct ath_softc *sc)
+{
+       ieee80211_iterate_active_interfaces(sc->hw,
+                                           IEEE80211_IFACE_ITER_NORMAL,
+                                           ath9k_csa_update_vif,
+                                           sc);
+}
+
 void ath9k_beacon_tasklet(unsigned long data)
 {
        struct ath_softc *sc = (struct ath_softc *)data;
@@ -362,13 +371,13 @@ void ath9k_beacon_tasklet(unsigned long data)
                return;
        }
 
-       /* EDMA devices check that in the tx completion function. */
-       if (!edma && ath9k_csa_is_finished(sc))
-               return;
-
        slot = ath9k_beacon_choose_slot(sc);
        vif = sc->beacon.bslot[slot];
 
+       /* EDMA devices check that in the tx completion function. */
+       if (!edma && ath9k_csa_is_finished(sc, vif))
+               return;
+
        if (!vif || !vif->bss_conf.enable_beacon)
                return;
 
index 5924f72..317fcb9 100644 (file)
@@ -1178,9 +1178,6 @@ static void ath9k_remove_interface(struct ieee80211_hw *hw,
        if (ath9k_uses_beacons(vif->type))
                ath9k_beacon_remove_slot(sc, vif);
 
-       if (sc->csa_vif == vif)
-               sc->csa_vif = NULL;
-
        ath9k_ps_wakeup(sc);
        ath9k_calculate_summary_state(hw, NULL);
        ath9k_ps_restore(sc);
@@ -2086,13 +2083,8 @@ static void ath9k_channel_switch_beacon(struct ieee80211_hw *hw,
                                        struct ieee80211_vif *vif,
                                        struct cfg80211_chan_def *chandef)
 {
-       struct ath_softc *sc = hw->priv;
-
-       /* mac80211 does not support CSA in multi-if cases (yet) */
-       if (WARN_ON(sc->csa_vif))
-               return;
-
-       sc->csa_vif = vif;
+       /* depend on vif->csa_active only */
+       return;
 }
 
 struct ieee80211_ops ath9k_ops = {
index 0a75e2f..a650704 100644 (file)
@@ -2566,7 +2566,7 @@ void ath_tx_edma_tasklet(struct ath_softc *sc)
                        sc->beacon.tx_processed = true;
                        sc->beacon.tx_last = !(ts.ts_status & ATH9K_TXERR_MASK);
 
-                       ath9k_csa_is_finished(sc);
+                       ath9k_csa_update(sc);
                        continue;
                }