]> git.openfabrics.org - ~shefty/rdma-dev.git/commitdiff
ath5k: Use capabilities information for the number of TX queues
authorBruno Randolf <br1@einfach.org>
Tue, 7 Dec 2010 02:08:12 +0000 (11:08 +0900)
committerJohn W. Linville <linville@tuxdriver.com>
Tue, 7 Dec 2010 22:07:54 +0000 (17:07 -0500)
One thing I missed in my WME series: Older hardware does not have enough
hardware queues to support WME. In this case we just set up one data queue. Use
the capability information to decide how many queues to set up.

Signed-off-by: Bruno Randolf <br1@einfach.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/ath/ath5k/base.c
drivers/net/wireless/ath/ath5k/qcu.c

index 0c419b73f394dc9b0683ac56eced65596a38bd2d..bccea7450c384d34151f7db5a65a22209f5596ae 100644 (file)
@@ -2797,33 +2797,46 @@ ath5k_init(struct ieee80211_hw *hw)
                goto err_bhal;
        }
 
-       /* This order matches mac80211's queue priority, so we can
-        * directly use the mac80211 queue number without any mapping */
-       txq = ath5k_txq_setup(sc, AR5K_TX_QUEUE_DATA, AR5K_WME_AC_VO);
-       if (IS_ERR(txq)) {
-               ATH5K_ERR(sc, "can't setup xmit queue\n");
-               ret = PTR_ERR(txq);
-               goto err_queues;
-       }
-       txq = ath5k_txq_setup(sc, AR5K_TX_QUEUE_DATA, AR5K_WME_AC_VI);
-       if (IS_ERR(txq)) {
-               ATH5K_ERR(sc, "can't setup xmit queue\n");
-               ret = PTR_ERR(txq);
-               goto err_queues;
-       }
-       txq = ath5k_txq_setup(sc, AR5K_TX_QUEUE_DATA, AR5K_WME_AC_BE);
-       if (IS_ERR(txq)) {
-               ATH5K_ERR(sc, "can't setup xmit queue\n");
-               ret = PTR_ERR(txq);
-               goto err_queues;
-       }
-       txq = ath5k_txq_setup(sc, AR5K_TX_QUEUE_DATA, AR5K_WME_AC_BK);
-       if (IS_ERR(txq)) {
-               ATH5K_ERR(sc, "can't setup xmit queue\n");
-               ret = PTR_ERR(txq);
-               goto err_queues;
+       /* 5211 and 5212 usually support 10 queues but we better rely on the
+        * capability information */
+       if (ah->ah_capabilities.cap_queues.q_tx_num >= 6) {
+               /* This order matches mac80211's queue priority, so we can
+               * directly use the mac80211 queue number without any mapping */
+               txq = ath5k_txq_setup(sc, AR5K_TX_QUEUE_DATA, AR5K_WME_AC_VO);
+               if (IS_ERR(txq)) {
+                       ATH5K_ERR(sc, "can't setup xmit queue\n");
+                       ret = PTR_ERR(txq);
+                       goto err_queues;
+               }
+               txq = ath5k_txq_setup(sc, AR5K_TX_QUEUE_DATA, AR5K_WME_AC_VI);
+               if (IS_ERR(txq)) {
+                       ATH5K_ERR(sc, "can't setup xmit queue\n");
+                       ret = PTR_ERR(txq);
+                       goto err_queues;
+               }
+               txq = ath5k_txq_setup(sc, AR5K_TX_QUEUE_DATA, AR5K_WME_AC_BE);
+               if (IS_ERR(txq)) {
+                       ATH5K_ERR(sc, "can't setup xmit queue\n");
+                       ret = PTR_ERR(txq);
+                       goto err_queues;
+               }
+               txq = ath5k_txq_setup(sc, AR5K_TX_QUEUE_DATA, AR5K_WME_AC_BK);
+               if (IS_ERR(txq)) {
+                       ATH5K_ERR(sc, "can't setup xmit queue\n");
+                       ret = PTR_ERR(txq);
+                       goto err_queues;
+               }
+               hw->queues = 4;
+       } else {
+               /* older hardware (5210) can only support one data queue */
+               txq = ath5k_txq_setup(sc, AR5K_TX_QUEUE_DATA, AR5K_WME_AC_BE);
+               if (IS_ERR(txq)) {
+                       ATH5K_ERR(sc, "can't setup xmit queue\n");
+                       ret = PTR_ERR(txq);
+                       goto err_queues;
+               }
+               hw->queues = 1;
        }
-       hw->queues = 4;
 
        tasklet_init(&sc->rxtq, ath5k_tasklet_rx, (unsigned long)sc);
        tasklet_init(&sc->txtq, ath5k_tasklet_tx, (unsigned long)sc);
index 1849eee8235c6aab94c945a4d7b3077aeb70ae5a..2c9c9e793d4ef23b2ac1a66df7355d091d0ce777 100644 (file)
@@ -152,8 +152,8 @@ int ath5k_hw_setup_tx_queue(struct ath5k_hw *ah, enum ath5k_tx_queue queue_type,
        /*
         * Get queue by type
         */
-       /*5210 only has 2 queues*/
-       if (ah->ah_version == AR5K_AR5210) {
+       /* 5210 only has 2 queues */
+       if (ah->ah_capabilities.cap_queues.q_tx_num == 2) {
                switch (queue_type) {
                case AR5K_TX_QUEUE_DATA:
                        queue = AR5K_TX_QUEUE_ID_NOQCU_DATA;