Merge carl9170fw
[carl9170fw.git] / carlfw / src / wlan.c
index 4e0feafa12615c96806ee5e52f2b73c79a0b369b..b81b74f687941c330d872dc7f8974f7eccd6fbf2 100644 (file)
@@ -356,9 +356,7 @@ static void _wlan_tx(struct dma_desc *desc)
 static bool wlan_tx_status(struct dma_queue *queue,
                           struct dma_desc *desc)
 {
-       struct ar9170_tx_frame *frame = DESC_PAYLOAD(desc);
        struct carl9170_tx_superframe *super = get_super(desc);
-       struct ieee80211_hdr *hdr = &super->f.data.i3e;
        unsigned int qidx = super->s.queue;
        bool txfail, success;
 
@@ -381,7 +379,7 @@ static bool wlan_tx_status(struct dma_queue *queue,
                         * order.
                         */
 
-                       if (!frame->hdr.mac.ampdu) {
+                       if (!super->f.hdr.mac.ampdu) {
                                /*
                                 * 802.11 - 7.1.3.1.5.
                                 * set "Retry Field" for consecutive attempts
@@ -389,8 +387,8 @@ static bool wlan_tx_status(struct dma_queue *queue,
                                 * Note: For AMPDU see:
                                 * 802.11n 9.9.1.6 "Retransmit Procedures"
                                 */
-
-                               hdr->frame_control |= cpu_to_le16(IEEE80211_FCTL_RETRY);
+                               super->f.data.i3e.frame_control |=
+                                       cpu_to_le16(IEEE80211_FCTL_RETRY);
                        }
 
                        if (txfail) {
@@ -464,7 +462,6 @@ static bool wlan_tx_status(struct dma_queue *queue,
 static void handle_tx_completion(void)
 {
        struct dma_desc *desc;
-       unsigned int map = 0;
        int i;
 
        for (i = AR9170_TXQ_SPECIAL; i >= AR9170_TXQ0; i--) {
@@ -480,10 +477,8 @@ static void handle_tx_completion(void)
 
                wlan_tx_ampdu_end(i);
                if (!queue_empty(&fw.wlan.tx_queue[i]))
-                       map |= BIT(i);
-
+                       wlan_trigger(BIT(i));
        }
-       wlan_trigger(map);
 }
 
 void __hot wlan_tx(struct dma_desc *desc)
@@ -521,8 +516,9 @@ static void wlan_send_buffered_ba(void)
        if (!fw.wlan.ba_desc_available)
                return;
 
-       ctx = &fw.wlan.ba_cache[fw.wlan.ba_head_idx % CONFIG_CARL9170FW_BACK_REQS_NUM];
+       ctx = &fw.wlan.ba_cache[fw.wlan.ba_head_idx];
        fw.wlan.ba_head_idx++;
+       fw.wlan.ba_head_idx %= CONFIG_CARL9170FW_BACK_REQS_NUM;
 
        /* Format BlockAck */
        fw.wlan.ba_desc->status = 0;
@@ -536,8 +532,8 @@ static void wlan_send_buffered_ba(void)
                sizeof(struct ar9170_tx_hwdesc) +
                sizeof(struct ieee80211_ba);
 
-       baf->s.ri[0].tries = 3;
-       baf->s.queue = 0;
+       baf->s.ri[0].tries = 1;
+       baf->s.queue = AR9170_TXQ_VO;
        baf->f.hdr.length = sizeof(struct ieee80211_ba) + FCS_LEN;
 
        /* HW Duration / Backoff */
@@ -575,12 +571,9 @@ static struct carl9170_bar_ctx *wlan_get_bar_cache_buffer(void)
 {
        struct carl9170_bar_ctx *tmp;
 
-       /* expire oldest entry, if we ran out of ba_ctx' */
-       if (fw.wlan.ba_head_idx + CONFIG_CARL9170FW_BACK_REQS_NUM < fw.wlan.ba_tail_idx)
-               fw.wlan.ba_head_idx++;
-
-       tmp = &fw.wlan.ba_cache[fw.wlan.ba_tail_idx % CONFIG_CARL9170FW_BACK_REQS_NUM];
+       tmp = &fw.wlan.ba_cache[fw.wlan.ba_tail_idx];
        fw.wlan.ba_tail_idx++;
+       fw.wlan.ba_tail_idx %= CONFIG_CARL9170FW_BACK_REQS_NUM;
 
        return tmp;
 }