ath9k_htc: Fix fair beacon distribution
authorSujith <Sujith.Manoharan@atheros.com>
Tue, 1 Jun 2010 09:44:19 +0000 (15:14 +0530)
committerJohn W. Linville <linville@tuxdriver.com>
Thu, 3 Jun 2010 18:14:41 +0000 (14:14 -0400)
This patch fixes beacon distribution in IBSS mode
by configuring the hardware beacon queue properly.

Signed-off-by: Sujith <Sujith.Manoharan@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/ath/ath9k/htc.h
drivers/net/wireless/ath/ath9k/htc_drv_beacon.c
drivers/net/wireless/ath/ath9k/htc_drv_main.c

index ba86458a3caeb744e8dff904f8c5a138dc5d0e98..051b8d89b9f25da90c38c459df0b3e1f07ad8494 100644 (file)
@@ -411,6 +411,7 @@ static inline void ath_read_cachesize(struct ath_common *common, int *csz)
        common->bus_ops->read_cachesize(common, csz);
 }
 
+void ath9k_htc_beaconq_config(struct ath9k_htc_priv *priv);
 void ath9k_htc_beacon_config(struct ath9k_htc_priv *priv,
                             struct ieee80211_vif *vif);
 void ath9k_htc_swba(struct ath9k_htc_priv *priv, u8 beacon_pending);
index c10c7d002eb7dcd615e21b0d9967f0b18f4c8ebf..12a3bb0a9159c90f833f08669cca5a8dde50362d 100644 (file)
@@ -222,6 +222,29 @@ void ath9k_htc_swba(struct ath9k_htc_priv *priv, u8 beacon_pending)
        spin_unlock_bh(&priv->beacon_lock);
 }
 
+/* Currently, only for IBSS */
+void ath9k_htc_beaconq_config(struct ath9k_htc_priv *priv)
+{
+       struct ath_hw *ah = priv->ah;
+       struct ath9k_tx_queue_info qi, qi_be;
+       int qnum = priv->hwq_map[ATH9K_WME_AC_BE];
+
+       memset(&qi, 0, sizeof(struct ath9k_tx_queue_info));
+       memset(&qi_be, 0, sizeof(struct ath9k_tx_queue_info));
+
+       ath9k_hw_get_txq_props(ah, qnum, &qi_be);
+
+       qi.tqi_aifs = qi_be.tqi_aifs;
+       qi.tqi_cwmin = 4*qi_be.tqi_cwmin;
+       qi.tqi_cwmax = qi_be.tqi_cwmax;
+
+       if (!ath9k_hw_set_txq_props(ah, priv->beaconq, &qi)) {
+               ath_print(ath9k_hw_common(ah), ATH_DBG_FATAL,
+                         "Unable to update beacon queue %u!\n", qnum);
+       } else {
+               ath9k_hw_resettxqueue(ah, priv->beaconq);
+       }
+}
 
 void ath9k_htc_beacon_config(struct ath9k_htc_priv *priv,
                             struct ieee80211_vif *vif)
index 6bc05fe9be8c876af2207881a7464481b60c528a..e776dee6f074750ee8ea0289f6b6ab5eb3c5963f 100644 (file)
@@ -1574,9 +1574,15 @@ static int ath9k_htc_conf_tx(struct ieee80211_hw *hw, u16 queue,
                  params->cw_max, params->txop);
 
        ret = ath_htc_txq_update(priv, qnum, &qi);
-       if (ret)
+       if (ret) {
                ath_print(common, ATH_DBG_FATAL, "TXQ Update failed\n");
+               goto out;
+       }
 
+       if ((priv->ah->opmode == NL80211_IFTYPE_ADHOC) &&
+           (qnum == priv->hwq_map[ATH9K_WME_AC_BE]))
+                   ath9k_htc_beaconq_config(priv);
+out:
        ath9k_htc_ps_restore(priv);
        mutex_unlock(&priv->mutex);