1 --- a/net/mac80211/sta_info.h
2 +++ b/net/mac80211/sta_info.h
3 @@ -84,6 +84,8 @@ enum ieee80211_sta_info_flags {
4 * @stop_initiator: initiator of a session stop
5 * @tx_stop: TX DelBA frame when stopping
6 * @buf_size: reorder buffer size at receiver
7 + * @failed_bar_ssn: ssn of the last failed BAR tx attempt
8 + * @bar_pending: BAR needs to be re-sent
10 * This structure's lifetime is managed by RCU, assignments to
11 * the array holding it must hold the aggregation mutex.
12 @@ -104,6 +106,9 @@ struct tid_ampdu_tx {
22 --- a/net/mac80211/status.c
23 +++ b/net/mac80211/status.c
24 @@ -127,12 +127,32 @@ static void ieee80211_handle_filtered_fr
28 +static void ieee80211_check_pending_bar(struct sta_info *sta, u8 *addr, u8 tid)
30 + struct tid_ampdu_tx *tid_tx;
32 + tid_tx = rcu_dereference(sta->ampdu_mlme.tid_tx[tid]);
33 + if (!tid_tx || !tid_tx->bar_pending)
36 + tid_tx->bar_pending = false;
37 + ieee80211_send_bar(sta->sdata, addr, tid, tid_tx->failed_bar_ssn);
40 static void ieee80211_frame_acked(struct sta_info *sta, struct sk_buff *skb)
42 struct ieee80211_mgmt *mgmt = (void *) skb->data;
43 struct ieee80211_local *local = sta->local;
44 struct ieee80211_sub_if_data *sdata = sta->sdata;
46 + if (ieee80211_is_data_qos(mgmt->frame_control)) {
47 + struct ieee80211_hdr *hdr = (void *) skb->data;
48 + u8 *qc = ieee80211_get_qos_ctl(hdr);
49 + u16 tid = qc[0] & 0xf;
51 + ieee80211_check_pending_bar(sta, hdr->addr1, tid);
54 if (ieee80211_is_action(mgmt->frame_control) &&
55 sdata->vif.type == NL80211_IFTYPE_STATION &&
56 mgmt->u.action.category == WLAN_CATEGORY_HT &&
57 @@ -161,6 +181,18 @@ static void ieee80211_frame_acked(struct
61 +static void ieee80211_set_bar_pending(struct sta_info *sta, u8 tid, u16 ssn)
63 + struct tid_ampdu_tx *tid_tx;
65 + tid_tx = rcu_dereference(sta->ampdu_mlme.tid_tx[tid]);
69 + tid_tx->failed_bar_ssn = ssn;
70 + tid_tx->bar_pending = true;
74 * Use a static threshold for now, best value to be determined
76 @@ -246,6 +278,8 @@ void ieee80211_tx_status(struct ieee8021
79 if (!acked && ieee80211_is_back_req(fc)) {
83 * BAR failed, let's tear down the BA session as a
84 * last resort as some STAs (Intel 5100 on Windows)
85 @@ -253,11 +287,15 @@ void ieee80211_tx_status(struct ieee8021
88 bar = (struct ieee80211_bar *) skb->data;
89 - if (!(bar->control & IEEE80211_BAR_CTRL_MULTI_TID)) {
90 - tid = (bar->control &
91 + control = le16_to_cpu(bar->control);
92 + if (!(control & IEEE80211_BAR_CTRL_MULTI_TID)) {
93 + u16 ssn = le16_to_cpu(bar->start_seq_num);
96 IEEE80211_BAR_CTRL_TID_INFO_MASK) >>
97 IEEE80211_BAR_CTRL_TID_INFO_SHIFT;
98 - ieee80211_stop_tx_ba_session(&sta->sta, tid);
100 + ieee80211_set_bar_pending(sta, tid, ssn);