ath9k: rework handling of sending BlockAckReq frames, should hopefully lead to fewer...
[openwrt/staging/florian.git] / package / mac80211 / patches / 571-ath9k_send_bar_fix.patch
1 --- a/drivers/net/wireless/ath/ath9k/ath9k.h
2 +++ b/drivers/net/wireless/ath/ath9k/ath9k.h
3 @@ -275,7 +275,6 @@ struct ath_tx_control {
4
5 #define ATH_TX_ERROR 0x01
6 #define ATH_TX_XRETRY 0x02
7 -#define ATH_TX_BAR 0x04
8
9 /**
10 * @txq_map: Index is mac80211 queue number. This is
11 --- a/drivers/net/wireless/ath/ath9k/main.c
12 +++ b/drivers/net/wireless/ath/ath9k/main.c
13 @@ -1801,6 +1801,7 @@ static int ath9k_sta_add(struct ieee8021
14 struct ieee80211_key_conf ps_key = { };
15
16 ath_node_attach(sc, sta);
17 + an->vif = vif;
18
19 if (vif->type != NL80211_IFTYPE_AP &&
20 vif->type != NL80211_IFTYPE_AP_VLAN)
21 --- a/drivers/net/wireless/ath/ath9k/xmit.c
22 +++ b/drivers/net/wireless/ath/ath9k/xmit.c
23 @@ -51,7 +51,7 @@ static void ath_tx_send_normal(struct at
24 struct list_head *bf_head);
25 static void ath_tx_complete_buf(struct ath_softc *sc, struct ath_buf *bf,
26 struct ath_txq *txq, struct list_head *bf_q,
27 - struct ath_tx_status *ts, int txok, int sendbar);
28 + struct ath_tx_status *ts, int txok);
29 static void ath_tx_txqaddbuf(struct ath_softc *sc, struct ath_txq *txq,
30 struct list_head *head, bool internal);
31 static void ath_buf_set_rate(struct ath_softc *sc, struct ath_buf *bf, int len);
32 @@ -166,7 +166,7 @@ static void ath_tx_flush_tid(struct ath_
33 fi = get_frame_info(bf->bf_mpdu);
34 if (fi->retries) {
35 ath_tx_update_baw(sc, tid, fi->seqno);
36 - ath_tx_complete_buf(sc, bf, txq, &bf_head, &ts, 0, 1);
37 + ath_tx_complete_buf(sc, bf, txq, &bf_head, &ts, 0);
38 } else {
39 ath_tx_send_normal(sc, txq, NULL, &bf_head);
40 }
41 @@ -238,7 +238,7 @@ static void ath_tid_drain(struct ath_sof
42 ath_tx_update_baw(sc, tid, fi->seqno);
43
44 spin_unlock(&txq->axq_lock);
45 - ath_tx_complete_buf(sc, bf, txq, &bf_head, &ts, 0, 0);
46 + ath_tx_complete_buf(sc, bf, txq, &bf_head, &ts, 0);
47 spin_lock(&txq->axq_lock);
48 }
49
50 @@ -381,8 +381,7 @@ static void ath_tx_complete_aggr(struct
51 list_move_tail(&bf->list, &bf_head);
52
53 ath_tx_rc_status(sc, bf, ts, 1, 1, 0, false);
54 - ath_tx_complete_buf(sc, bf, txq, &bf_head, ts,
55 - 0, 0);
56 + ath_tx_complete_buf(sc, bf, txq, &bf_head, ts, 0);
57
58 bf = bf_next;
59 }
60 @@ -426,7 +425,7 @@ static void ath_tx_complete_aggr(struct
61
62 ath_tx_count_frames(sc, bf, ts, txok, &nframes, &nbad);
63 while (bf) {
64 - txfail = txpending = sendbar = 0;
65 + txfail = txpending = 0;
66 bf_next = bf->bf_next;
67
68 skb = bf->bf_mpdu;
69 @@ -489,7 +488,7 @@ static void ath_tx_complete_aggr(struct
70 }
71
72 ath_tx_complete_buf(sc, bf, txq, &bf_head, ts,
73 - !txfail, sendbar);
74 + !txfail);
75 } else {
76 /* retry the un-acked ones */
77 ath9k_hw_set_clrdmask(sc->sc_ah, bf->bf_desc, false);
78 @@ -514,7 +513,7 @@ static void ath_tx_complete_aggr(struct
79 nbad, 0, false);
80 ath_tx_complete_buf(sc, bf, txq,
81 &bf_head,
82 - ts, 0, 0);
83 + ts, 0);
84 break;
85 }
86
87 @@ -564,6 +563,9 @@ static void ath_tx_complete_aggr(struct
88 }
89 }
90
91 + if (sendbar || (tid->state & AGGR_CLEANUP))
92 + ieee80211_send_bar(an->vif, sta->addr, tidno, tid->seq_start << 4);
93 +
94 rcu_read_unlock();
95
96 if (needreset)
97 @@ -900,6 +902,7 @@ void ath_tx_aggr_stop(struct ath_softc *
98 spin_unlock_bh(&txq->axq_lock);
99
100 ath_tx_flush_tid(sc, txtid);
101 + ieee80211_send_bar(an->vif, sta->addr, tid, txtid->seq_start << 4);
102 }
103
104 bool ath_tx_aggr_sleep(struct ath_softc *sc, struct ath_node *an)
105 @@ -1178,7 +1181,7 @@ static void ath_drain_txq_list(struct at
106 ath_tx_complete_aggr(sc, txq, bf, &bf_head, &ts, 0,
107 retry_tx);
108 else
109 - ath_tx_complete_buf(sc, bf, txq, &bf_head, &ts, 0, 0);
110 + ath_tx_complete_buf(sc, bf, txq, &bf_head, &ts, 0);
111 spin_lock_bh(&txq->axq_lock);
112 }
113 }
114 @@ -1885,9 +1888,6 @@ static void ath_tx_complete(struct ath_s
115
116 ath_dbg(common, ATH_DBG_XMIT, "TX complete: skb: %p\n", skb);
117
118 - if (tx_flags & ATH_TX_BAR)
119 - tx_info->flags |= IEEE80211_TX_STAT_AMPDU_NO_BACK;
120 -
121 if (!(tx_flags & (ATH_TX_ERROR | ATH_TX_XRETRY))) {
122 /* Frame was ACKed */
123 tx_info->flags |= IEEE80211_TX_STAT_ACK;
124 @@ -1932,15 +1932,12 @@ static void ath_tx_complete(struct ath_s
125
126 static void ath_tx_complete_buf(struct ath_softc *sc, struct ath_buf *bf,
127 struct ath_txq *txq, struct list_head *bf_q,
128 - struct ath_tx_status *ts, int txok, int sendbar)
129 + struct ath_tx_status *ts, int txok)
130 {
131 struct sk_buff *skb = bf->bf_mpdu;
132 unsigned long flags;
133 int tx_flags = 0;
134
135 - if (sendbar)
136 - tx_flags = ATH_TX_BAR;
137 -
138 if (!txok) {
139 tx_flags |= ATH_TX_ERROR;
140
141 @@ -2056,7 +2053,7 @@ static void ath_tx_process_buffer(struct
142 if (ts->ts_status & ATH9K_TXERR_XRETRY)
143 bf->bf_state.bf_type |= BUF_XRETRY;
144 ath_tx_rc_status(sc, bf, ts, 1, txok ? 0 : 1, txok, true);
145 - ath_tx_complete_buf(sc, bf, txq, bf_head, ts, txok, 0);
146 + ath_tx_complete_buf(sc, bf, txq, bf_head, ts, txok);
147 } else
148 ath_tx_complete_aggr(sc, txq, bf, bf_head, ts, txok, true);
149