spin_unlock_bh(&txq->axq_lock);
 }
 
+static u16 ath_frame_seqno(struct sk_buff *skb)
+{
+       struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
+       return le16_to_cpu(hdr->seq_ctrl) >> IEEE80211_SEQ_SEQ_SHIFT;
+}
+
 static void ath_tx_flush_tid(struct ath_softc *sc, struct ath_atx_tid *tid)
 {
        struct ath_txq *txq = tid->ac->txq;
                list_move_tail(&bf->list, &bf_head);
 
                if (bf_isretried(bf)) {
-                       ath_tx_update_baw(sc, tid, bf->bf_seqno);
+                       ath_tx_update_baw(sc, tid, ath_frame_seqno(bf->bf_mpdu));
                        ath_tx_complete_buf(sc, bf, txq, &bf_head, &ts, 0, 0);
                } else {
                        ath_tx_send_normal(sc, txq, tid, &bf_head);
 }
 
 static void ath_tx_addto_baw(struct ath_softc *sc, struct ath_atx_tid *tid,
-                            struct ath_buf *bf)
+                            u16 seqno)
 {
        int index, cindex;
 
-       if (bf_isretried(bf))
-               return;
-
-       index  = ATH_BA_INDEX(tid->seq_start, bf->bf_seqno);
+       index  = ATH_BA_INDEX(tid->seq_start, seqno);
        cindex = (tid->baw_head + index) & (ATH_TID_MAX_BUFS - 1);
        __set_bit(cindex, tid->tx_buf);
 
        struct ath_buf *bf;
        struct list_head bf_head;
        struct ath_tx_status ts;
+       u16 bf_seqno;
 
        memset(&ts, 0, sizeof(ts));
        INIT_LIST_HEAD(&bf_head);
                bf = list_first_entry(&tid->buf_q, struct ath_buf, list);
                list_move_tail(&bf->list, &bf_head);
 
+               bf_seqno = ath_frame_seqno(bf->bf_mpdu);
                if (bf_isretried(bf))
-                       ath_tx_update_baw(sc, tid, bf->bf_seqno);
+                       ath_tx_update_baw(sc, tid, bf_seqno);
 
                spin_unlock(&txq->axq_lock);
                ath_tx_complete_buf(sc, bf, txq, &bf_head, &ts, 0, 0);
        int isaggr, txfail, txpending, sendbar = 0, needreset = 0, nbad = 0;
        bool rc_update = true;
        struct ieee80211_tx_rate rates[4];
+       u16 bf_seqno;
        int nframes;
 
        skb = bf->bf_mpdu;
 
                skb = bf->bf_mpdu;
                tx_info = IEEE80211_SKB_CB(skb);
+               bf_seqno = ath_frame_seqno(skb);
 
-               if (ATH_BA_ISSET(ba, ATH_BA_INDEX(seq_st, bf->bf_seqno))) {
+               if (ATH_BA_ISSET(ba, ATH_BA_INDEX(seq_st, bf_seqno))) {
                        /* transmit completion, subframe is
                         * acked by block ack */
                        acked_cnt++;
                         * block-ack window
                         */
                        spin_lock_bh(&txq->axq_lock);
-                       ath_tx_update_baw(sc, tid, bf->bf_seqno);
+                       ath_tx_update_baw(sc, tid, bf_seqno);
                        spin_unlock_bh(&txq->axq_lock);
 
                        if (rc_update && (acked_cnt == 1 || txfail_cnt == 1)) {
                                        if (!tbf) {
                                                spin_lock_bh(&txq->axq_lock);
                                                ath_tx_update_baw(sc, tid,
-                                                               bf->bf_seqno);
+                                                               bf_seqno);
                                                spin_unlock_bh(&txq->axq_lock);
 
                                                bf->bf_state.bf_type |=
                al_delta, h_baw = tid->baw_size / 2;
        enum ATH_AGGR_STATUS status = ATH_AGGR_DONE;
        struct ieee80211_tx_info *tx_info;
+       u16 bf_seqno;
 
        bf_first = list_first_entry(&tid->buf_q, struct ath_buf, list);
 
        do {
                bf = list_first_entry(&tid->buf_q, struct ath_buf, list);
+               bf_seqno = ath_frame_seqno(bf->bf_mpdu);
 
                /* do not step over block-ack window */
-               if (!BAW_WITHIN(tid->seq_start, tid->baw_size, bf->bf_seqno)) {
+               if (!BAW_WITHIN(tid->seq_start, tid->baw_size, bf_seqno)) {
                        status = ATH_AGGR_BAW_CLOSED;
                        break;
                }
                ath9k_hw_set_desc_link(sc->sc_ah, bf->bf_desc, 0);
 
                /* link buffers of this frame to the aggregate */
-               ath_tx_addto_baw(sc, tid, bf);
+               if (!bf_isretried(bf))
+                       ath_tx_addto_baw(sc, tid, bf_seqno);
                ath9k_hw_set11n_aggr_middle(sc->sc_ah, bf->bf_desc, ndelim);
                list_move_tail(&bf->list, bf_q);
                if (bf_prev) {
                              struct ath_tx_control *txctl)
 {
        struct ath_buf *bf;
+       u16 bf_seqno;
 
        bf = list_first_entry(bf_head, struct ath_buf, list);
        bf->bf_state.bf_type |= BUF_AMPDU;
        TX_STAT_INC(txctl->txq->axq_qnum, a_queued);
+       bf_seqno = ath_frame_seqno(bf->bf_mpdu);
 
        /*
         * Do not queue to h/w when any of the following conditions is true:
         * - h/w queue depth exceeds low water mark
         */
        if (!list_empty(&tid->buf_q) || tid->paused ||
-           !BAW_WITHIN(tid->seq_start, tid->baw_size, bf->bf_seqno) ||
+           !BAW_WITHIN(tid->seq_start, tid->baw_size, bf_seqno) ||
            txctl->txq->axq_depth >= ATH_AGGR_MIN_QDEPTH) {
                /*
                 * Add this frame to software queue for scheduling later
        }
 
        /* Add sub-frame to BAW */
-       ath_tx_addto_baw(sc, tid, bf);
+       if (!bf_isretried(bf))
+               ath_tx_addto_baw(sc, tid, bf_seqno);
 
        /* Queue to h/w without aggregation */
        bf->bf_nframes = 1;
         */
        tid = ATH_AN_2_TID(an, bf->bf_tidno);
        hdr->seq_ctrl = cpu_to_le16(tid->seq_next << IEEE80211_SEQ_SEQ_SHIFT);
-       bf->bf_seqno = tid->seq_next;
        INCR(tid->seq_next, IEEE80211_SEQ_MAX);
 }
 
        }
 
        while (bf) {
-               ba_index = ATH_BA_INDEX(seq_st, bf->bf_seqno);
+               ba_index = ATH_BA_INDEX(seq_st, ath_frame_seqno(bf->bf_mpdu));
                if (!txok || (isaggr && !ATH_BA_ISSET(ba, ba_index)))
                        nbad++;