From 01333d7d7a1ce6be94e5dad4112f573fda476efe Mon Sep 17 00:00:00 2001 From: Christian Lamparter Date: Sat, 5 Mar 2011 00:18:04 +0100 Subject: [PATCH] carl9170 firmware: reverse QoS queue mapping This seems to work much better than the mapping from Atheros original source. Signed-off-by: Christian Lamparter --- carlfw/src/wlan.c | 10 +++++----- include/shared/wlan.h | 19 ++++++++----------- tools/carlu/src/tx.c | 2 +- 3 files changed, 14 insertions(+), 17 deletions(-) diff --git a/carlfw/src/wlan.c b/carlfw/src/wlan.c index 08836db..03536e0 100644 --- a/carlfw/src/wlan.c +++ b/carlfw/src/wlan.c @@ -466,7 +466,7 @@ static void handle_tx_completion(void) unsigned int map = 0; int i; - for (i = 0; i < __AR9170_NUM_TX_QUEUES; i++) { + for (i = AR9170_TXQ_SPECIAL; i >= AR9170_TXQ0; i--) { __while_desc_bits(desc, &fw.wlan.tx_queue[i], AR9170_OWN_BITS_SW) { if (!wlan_tx_status(&fw.wlan.tx_queue[i], desc)) { /* termination requested. */ @@ -1098,9 +1098,9 @@ void handle_wlan(void) static void wlan_check_hang(void) { struct dma_desc *desc; - unsigned int i; + int i; - for (i = 0; i < __AR9170_NUM_TX_QUEUES; i++) { + for (i = AR9170_TXQ_SPECIAL; i >= AR9170_TXQ0; i--) { if (queue_empty(&fw.wlan.tx_queue[i])) { /* Nothing to do here... move along */ continue; @@ -1175,7 +1175,7 @@ static void wlan_mac_reset(void) uint32_t ack_power; uint32_t rts_cts_tpc; uint32_t rts_cts_rate; - unsigned int i; + int i; #ifdef CONFIG_CARL9170FW_RADIO_FUNCTIONS uint32_t rx_BB; @@ -1251,7 +1251,7 @@ static void wlan_mac_reset(void) val = AR9170_DMA_TRIGGER_RXQ; /* Reinitialize all WLAN TX DMA queues. */ - for (i = 0; i < __AR9170_NUM_TX_QUEUES; i++) { + for (i = AR9170_TXQ_SPECIAL; i >= AR9170_TXQ0; i--) { struct dma_desc *iter; __for_each_desc_bits(iter, &fw.wlan.tx_queue[i], AR9170_OWN_BITS_SW); diff --git a/include/shared/wlan.h b/include/shared/wlan.h index 16b0364..ea17995 100644 --- a/include/shared/wlan.h +++ b/include/shared/wlan.h @@ -404,16 +404,6 @@ static inline u8 ar9170_get_decrypt_type(struct ar9170_rx_macstatus *t) (t->DAidx & 0xc0) >> 6; } -enum ar9170_txq { - AR9170_TXQ_BE, - - AR9170_TXQ_VI, - AR9170_TXQ_VO, - AR9170_TXQ_BK, - - __AR9170_NUM_TXQ, -}; - /* * This is an workaround for several undocumented bugs. * Don't mess with the QoS/AC <-> HW Queue map, if you don't @@ -431,7 +421,14 @@ enum ar9170_txq { * result, this makes the device pretty much useless * for any serious 802.11n setup. */ -static const u8 ar9170_qmap[__AR9170_NUM_TXQ] = { 2, 1, 0, 3 }; +enum ar9170_txq { + AR9170_TXQ_BK = 0, /* TXQ0 */ + AR9170_TXQ_BE, /* TXQ1 */ + AR9170_TXQ_VI, /* TXQ2 */ + AR9170_TXQ_VO, /* TXQ3 */ + + __AR9170_NUM_TXQ, +}; #define AR9170_TXQ_DEPTH 32 diff --git a/tools/carlu/src/tx.c b/tools/carlu/src/tx.c index d4774de..ec97502 100644 --- a/tools/carlu/src/tx.c +++ b/tools/carlu/src/tx.c @@ -188,7 +188,7 @@ int carlu_tx(struct carlu *ar, struct frame *frame) txp->s.len = cpu_to_le16(frame->len); - queue = ar9170_qmap[frame->queue % ARRAY_SIZE(ar9170_qmap)]; + queue = (frame->queue % __AR9170_NUM_TXQ); SET_VAL(CARL9170_TX_SUPER_MISC_QUEUE, txp->s.misc, queue); -- 2.31.1