1 --- a/drivers/net/wireless/ath/ath9k/ath9k.h
2 +++ b/drivers/net/wireless/ath/ath9k/ath9k.h
3 @@ -211,12 +211,12 @@ struct ath_frame_info {
4 enum ath9k_key_type keytype;
10 struct ath_buf_state {
14 unsigned long bfs_paprd_timestamp;
17 --- a/drivers/net/wireless/ath/ath9k/xmit.c
18 +++ b/drivers/net/wireless/ath/ath9k/xmit.c
19 @@ -168,7 +168,7 @@ static void ath_tx_flush_tid(struct ath_
21 spin_unlock_bh(&txq->axq_lock);
23 - ath_tx_update_baw(sc, tid, fi->seqno);
24 + ath_tx_update_baw(sc, tid, bf->bf_state.seqno);
25 ath_tx_complete_buf(sc, bf, txq, &bf_head, &ts, 0, 1);
27 ath_tx_send_normal(sc, txq, NULL, &bf_head);
28 @@ -237,7 +237,7 @@ static void ath_tid_drain(struct ath_sof
29 list_add_tail(&bf->list, &bf_head);
32 - ath_tx_update_baw(sc, tid, fi->seqno);
33 + ath_tx_update_baw(sc, tid, bf->bf_state.seqno);
35 spin_unlock(&txq->axq_lock);
36 ath_tx_complete_buf(sc, bf, txq, &bf_head, &ts, 0, 0);
37 @@ -327,7 +327,7 @@ static void ath_tx_count_frames(struct a
40 fi = get_frame_info(bf->bf_mpdu);
41 - ba_index = ATH_BA_INDEX(seq_st, fi->seqno);
42 + ba_index = ATH_BA_INDEX(seq_st, bf->bf_state.seqno);
45 if (!txok || (isaggr && !ATH_BA_ISSET(ba, ba_index)))
46 @@ -428,6 +428,8 @@ static void ath_tx_complete_aggr(struct
48 ath_tx_count_frames(sc, bf, ts, txok, &nframes, &nbad);
50 + u16 seqno = bf->bf_state.seqno;
52 txfail = txpending = sendbar = 0;
53 bf_next = bf->bf_next;
55 @@ -435,7 +437,7 @@ static void ath_tx_complete_aggr(struct
56 tx_info = IEEE80211_SKB_CB(skb);
57 fi = get_frame_info(skb);
59 - if (ATH_BA_ISSET(ba, ATH_BA_INDEX(seq_st, fi->seqno))) {
60 + if (ATH_BA_ISSET(ba, ATH_BA_INDEX(seq_st, seqno))) {
61 /* transmit completion, subframe is
62 * acked by block ack */
64 @@ -479,7 +481,7 @@ static void ath_tx_complete_aggr(struct
67 spin_lock_bh(&txq->axq_lock);
68 - ath_tx_update_baw(sc, tid, fi->seqno);
69 + ath_tx_update_baw(sc, tid, seqno);
70 spin_unlock_bh(&txq->axq_lock);
72 if (rc_update && (acked_cnt == 1 || txfail_cnt == 1)) {
73 @@ -507,7 +509,7 @@ static void ath_tx_complete_aggr(struct
76 spin_lock_bh(&txq->axq_lock);
77 - ath_tx_update_baw(sc, tid, fi->seqno);
78 + ath_tx_update_baw(sc, tid, seqno);
79 spin_unlock_bh(&txq->axq_lock);
81 bf->bf_state.bf_type |=
82 @@ -752,17 +754,19 @@ static enum ATH_AGGR_STATUS ath_tx_form_
83 struct ieee80211_tx_info *tx_info;
84 struct ath_frame_info *fi;
89 skb = skb_peek(&tid->buf_q);
90 fi = get_frame_info(skb);
92 + seqno = bf->bf_state.seqno;
97 /* do not step over block-ack window */
98 - if (!BAW_WITHIN(tid->seq_start, tid->baw_size, fi->seqno)) {
99 + if (!BAW_WITHIN(tid->seq_start, tid->baw_size, seqno)) {
100 status = ATH_AGGR_BAW_CLOSED;
103 @@ -810,7 +814,7 @@ static enum ATH_AGGR_STATUS ath_tx_form_
105 /* link buffers of this frame to the aggregate */
107 - ath_tx_addto_baw(sc, tid, fi->seqno);
108 + ath_tx_addto_baw(sc, tid, seqno);
109 ath9k_hw_set11n_aggr_middle(sc->sc_ah, bf->bf_desc, ndelim);
111 __skb_unlink(skb, &tid->buf_q);
112 @@ -1434,6 +1438,7 @@ static void ath_tx_send_ampdu(struct ath
114 struct ath_frame_info *fi = get_frame_info(bf->bf_mpdu);
115 struct list_head bf_head;
116 + u16 seqno = bf->bf_state.seqno;
118 bf->bf_state.bf_type |= BUF_AMPDU;
120 @@ -1445,7 +1450,7 @@ static void ath_tx_send_ampdu(struct ath
121 * - h/w queue depth exceeds low water mark
123 if (!skb_queue_empty(&tid->buf_q) || tid->paused ||
124 - !BAW_WITHIN(tid->seq_start, tid->baw_size, fi->seqno) ||
125 + !BAW_WITHIN(tid->seq_start, tid->baw_size, seqno) ||
126 txctl->txq->axq_ampdu_depth >= ATH_AGGR_MIN_QDEPTH) {
128 * Add this frame to software queue for scheduling later
129 @@ -1463,7 +1468,7 @@ static void ath_tx_send_ampdu(struct ath
131 /* Add sub-frame to BAW */
133 - ath_tx_addto_baw(sc, tid, fi->seqno);
134 + ath_tx_addto_baw(sc, tid, seqno);
136 /* Queue to h/w without aggregation */
137 TX_STAT_INC(txctl->txq->axq_qnum, a_queued_hw);
138 @@ -1519,39 +1524,19 @@ static enum ath9k_pkt_type get_hw_packet
139 static void setup_frame_info(struct ieee80211_hw *hw, struct sk_buff *skb,
142 - struct ath_softc *sc = hw->priv;
143 struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb);
144 struct ieee80211_sta *sta = tx_info->control.sta;
145 struct ieee80211_key_conf *hw_key = tx_info->control.hw_key;
146 - struct ieee80211_hdr *hdr;
147 + struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
148 struct ath_frame_info *fi = get_frame_info(skb);
149 struct ath_node *an = NULL;
150 - struct ath_atx_tid *tid;
151 enum ath9k_key_type keytype;
155 keytype = ath9k_cmn_get_hw_crypto_keytype(skb);
158 an = (struct ath_node *) sta->drv_priv;
160 - hdr = (struct ieee80211_hdr *)skb->data;
161 - if (an && ieee80211_is_data_qos(hdr->frame_control) &&
162 - conf_is_ht(&hw->conf) && (sc->sc_flags & SC_OP_TXAGGR)) {
164 - tidno = ieee80211_get_qos_ctl(hdr)[0] & IEEE80211_QOS_CTL_TID_MASK;
167 - * Override seqno set by upper layer with the one
168 - * in tx aggregation state.
170 - tid = ATH_AN_2_TID(an, tidno);
171 - seqno = tid->seq_next;
172 - hdr->seq_ctrl = cpu_to_le16(seqno << IEEE80211_SEQ_SEQ_SHIFT);
173 - INCR(tid->seq_next, IEEE80211_SEQ_MAX);
176 memset(fi, 0, sizeof(*fi));
178 fi->keyix = hw_key->hw_key_idx;
179 @@ -1561,7 +1546,6 @@ static void setup_frame_info(struct ieee
180 fi->keyix = ATH9K_TXKEYIX_INVALID;
181 fi->keytype = keytype;
182 fi->framelen = framelen;
186 static int setup_tx_flags(struct sk_buff *skb)
187 @@ -1797,6 +1781,7 @@ static void ath_tx_start_dma(struct ath_
188 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
189 struct list_head bf_head;
190 struct ath_atx_tid *tid = NULL;
194 spin_lock_bh(&txctl->txq->axq_lock);
195 @@ -1806,6 +1791,12 @@ static void ath_tx_start_dma(struct ath_
196 IEEE80211_QOS_CTL_TID_MASK;
197 tid = ATH_AN_2_TID(txctl->an, tidno);
199 + seqno = tid->seq_next;
200 + hdr->seq_ctrl = cpu_to_le16(tid->seq_next << IEEE80211_SEQ_SEQ_SHIFT);
201 + INCR(tid->seq_next, IEEE80211_SEQ_MAX);
203 + bf->bf_state.seqno = seqno;
205 WARN_ON(tid->ac->txq != txctl->txq);