package/devel/binutils: Update to 2.27
[openwrt/staging/chunkeey.git] / package / kernel / mac80211 / patches / 343-mac80211-send-delBA-on-unexpected-BlockAck-data-fram.patch
1 From: Johannes Berg <johannes.berg@intel.com>
2 Date: Mon, 29 Aug 2016 23:25:18 +0300
3 Subject: [PATCH] mac80211: send delBA on unexpected BlockAck data frames
4
5 When we receive data frames with ACK policy BlockAck, send
6 delBA as requested by the 802.11 spec. Since this would be
7 happening for every frame inside an A-MPDU if it's really
8 received outside a session, limit it to a single attempt.
9
10 Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 ---
12
13 --- a/net/mac80211/agg-rx.c
14 +++ b/net/mac80211/agg-rx.c
15 @@ -388,8 +388,10 @@ void __ieee80211_start_rx_ba_session(str
16 }
17
18 end:
19 - if (status == WLAN_STATUS_SUCCESS)
20 + if (status == WLAN_STATUS_SUCCESS) {
21 __set_bit(tid, sta->ampdu_mlme.agg_session_valid);
22 + __clear_bit(tid, sta->ampdu_mlme.unexpected_agg);
23 + }
24 mutex_unlock(&sta->ampdu_mlme.mtx);
25
26 end_no_lock:
27 --- a/net/mac80211/rx.c
28 +++ b/net/mac80211/rx.c
29 @@ -1072,8 +1072,15 @@ static void ieee80211_rx_reorder_ampdu(s
30 tid = *ieee80211_get_qos_ctl(hdr) & IEEE80211_QOS_CTL_TID_MASK;
31
32 tid_agg_rx = rcu_dereference(sta->ampdu_mlme.tid_rx[tid]);
33 - if (!tid_agg_rx)
34 + if (!tid_agg_rx) {
35 + if (ack_policy == IEEE80211_QOS_CTL_ACK_POLICY_BLOCKACK &&
36 + !test_bit(tid, rx->sta->ampdu_mlme.agg_session_valid) &&
37 + !test_and_set_bit(tid, rx->sta->ampdu_mlme.unexpected_agg))
38 + ieee80211_send_delba(rx->sdata, rx->sta->sta.addr, tid,
39 + WLAN_BACK_RECIPIENT,
40 + WLAN_REASON_QSTA_REQUIRE_SETUP);
41 goto dont_reorder;
42 + }
43
44 /* qos null data frames are excluded */
45 if (unlikely(hdr->frame_control & cpu_to_le16(IEEE80211_STYPE_NULLFUNC)))
46 --- a/net/mac80211/sta_info.h
47 +++ b/net/mac80211/sta_info.h
48 @@ -230,6 +230,8 @@ struct tid_ampdu_rx {
49 * @tid_rx_stop_requested: bitmap indicating which BA sessions per TID the
50 * driver requested to close until the work for it runs
51 * @agg_session_valid: bitmap indicating which TID has a rx BA session open on
52 + * @unexpected_agg: bitmap indicating which TID already sent a delBA due to
53 + * unexpected aggregation related frames outside a session
54 * @work: work struct for starting/stopping aggregation
55 * @tid_tx: aggregation info for Tx per TID
56 * @tid_start_tx: sessions where start was requested
57 @@ -244,6 +246,7 @@ struct sta_ampdu_mlme {
58 unsigned long tid_rx_timer_expired[BITS_TO_LONGS(IEEE80211_NUM_TIDS)];
59 unsigned long tid_rx_stop_requested[BITS_TO_LONGS(IEEE80211_NUM_TIDS)];
60 unsigned long agg_session_valid[BITS_TO_LONGS(IEEE80211_NUM_TIDS)];
61 + unsigned long unexpected_agg[BITS_TO_LONGS(IEEE80211_NUM_TIDS)];
62 /* tx */
63 struct work_struct work;
64 struct tid_ampdu_tx __rcu *tid_tx[IEEE80211_NUM_TIDS];