+@@ -803,24 +790,16 @@ static int ath_compute_num_delims(struct
+ return ndelim;
+ }
+
+-static enum ATH_AGGR_STATUS ath_tx_form_aggr(struct ath_softc *sc,
+- struct ath_txq *txq,
+- struct ath_atx_tid *tid,
+- struct list_head *bf_q,
+- int *aggr_len)
++static struct ath_buf *
++ath_tx_get_tid_subframe(struct ath_softc *sc, struct ath_txq *txq,
++ struct ath_atx_tid *tid)
+ {
+-#define PADBYTES(_len) ((4 - ((_len) % 4)) % 4)
+- struct ath_buf *bf, *bf_first = NULL, *bf_prev = NULL;
+- int rl = 0, nframes = 0, ndelim, prev_al = 0;
+- u16 aggr_limit = 0, al = 0, bpad = 0,
+- al_delta, h_baw = tid->baw_size / 2;
+- enum ATH_AGGR_STATUS status = ATH_AGGR_DONE;
+- struct ieee80211_tx_info *tx_info;
+ struct ath_frame_info *fi;
+ struct sk_buff *skb;
++ struct ath_buf *bf;
+ u16 seqno;
+
+- do {
++ while (1) {
+ skb = skb_peek(&tid->buf_q);
+ fi = get_frame_info(skb);
+ bf = fi->bf;
+@@ -837,10 +816,8 @@ static enum ATH_AGGR_STATUS ath_tx_form_
+ seqno = bf->bf_state.seqno;
+
+ /* do not step over block-ack window */
+- if (!BAW_WITHIN(tid->seq_start, tid->baw_size, seqno)) {
+- status = ATH_AGGR_BAW_CLOSED;
++ if (!BAW_WITHIN(tid->seq_start, tid->baw_size, seqno))
+ break;
+- }
+
+ if (tid->bar_index > ATH_BA_INDEX(tid->seq_start, seqno)) {
+ struct ath_tx_status ts = {};
+@@ -854,10 +831,45 @@ static enum ATH_AGGR_STATUS ath_tx_form_
+ continue;
+ }
+
++ bf->bf_next = NULL;
++ bf->bf_lastbf = bf;
++ return bf;
++ }
++
++ return NULL;
++}
++
++static enum ATH_AGGR_STATUS ath_tx_form_aggr(struct ath_softc *sc,
++ struct ath_txq *txq,
++ struct ath_atx_tid *tid,
++ struct list_head *bf_q,
++ int *aggr_len)
++{
++#define PADBYTES(_len) ((4 - ((_len) % 4)) % 4)
++ struct ath_buf *bf, *bf_first = NULL, *bf_prev = NULL;
++ int rl = 0, nframes = 0, ndelim, prev_al = 0;
++ u16 aggr_limit = 0, al = 0, bpad = 0,
++ al_delta, h_baw = tid->baw_size / 2;
++ enum ATH_AGGR_STATUS status = ATH_AGGR_DONE;
++ struct ieee80211_tx_info *tx_info;
++ struct ath_frame_info *fi;
++ struct sk_buff *skb;
++
++ do {
++ bf = ath_tx_get_tid_subframe(sc, txq, tid);
++ if (!bf) {
++ status = ATH_AGGR_BAW_CLOSED;
++ break;
++ }
++
++ skb = bf->bf_mpdu;
++ fi = get_frame_info(skb);
++
+ if (!bf_first)