diff options
-rw-r--r-- | net/mac80211/Makefile | 2 | ||||
-rw-r--r-- | net/mac80211/agg-rx.c | 287 | ||||
-rw-r--r-- | net/mac80211/agg-tx.c | 593 | ||||
-rw-r--r-- | net/mac80211/ht.c | 867 | ||||
-rw-r--r-- | net/mac80211/ieee80211_i.h | 3 |
5 files changed, 895 insertions, 857 deletions
diff --git a/net/mac80211/Makefile b/net/mac80211/Makefile index 58c94bb38e87..3503a3d21318 100644 --- a/net/mac80211/Makefile +++ b/net/mac80211/Makefile | |||
@@ -8,7 +8,7 @@ mac80211-y := \ | |||
8 | wep.o \ | 8 | wep.o \ |
9 | wpa.o \ | 9 | wpa.o \ |
10 | scan.o \ | 10 | scan.o \ |
11 | ht.o \ | 11 | ht.o agg-tx.o agg-rx.o \ |
12 | mlme.o \ | 12 | mlme.o \ |
13 | iface.o \ | 13 | iface.o \ |
14 | rate.o \ | 14 | rate.o \ |
diff --git a/net/mac80211/agg-rx.c b/net/mac80211/agg-rx.c new file mode 100644 index 000000000000..62b9feb3c804 --- /dev/null +++ b/net/mac80211/agg-rx.c | |||
@@ -0,0 +1,287 @@ | |||
1 | /* | ||
2 | * HT handling | ||
3 | * | ||
4 | * Copyright 2003, Jouni Malinen <jkmaline@cc.hut.fi> | ||
5 | * Copyright 2002-2005, Instant802 Networks, Inc. | ||
6 | * Copyright 2005-2006, Devicescape Software, Inc. | ||
7 | * Copyright 2006-2007 Jiri Benc <jbenc@suse.cz> | ||
8 | * Copyright 2007, Michael Wu <flamingice@sourmilk.net> | ||
9 | * Copyright 2007-2008, Intel Corporation | ||
10 | * | ||
11 | * This program is free software; you can redistribute it and/or modify | ||
12 | * it under the terms of the GNU General Public License version 2 as | ||
13 | * published by the Free Software Foundation. | ||
14 | */ | ||
15 | |||
16 | #include <linux/ieee80211.h> | ||
17 | #include <net/mac80211.h> | ||
18 | #include "ieee80211_i.h" | ||
19 | |||
20 | void ieee80211_sta_stop_rx_ba_session(struct ieee80211_sub_if_data *sdata, u8 *ra, u16 tid, | ||
21 | u16 initiator, u16 reason) | ||
22 | { | ||
23 | struct ieee80211_local *local = sdata->local; | ||
24 | struct ieee80211_hw *hw = &local->hw; | ||
25 | struct sta_info *sta; | ||
26 | int ret, i; | ||
27 | |||
28 | rcu_read_lock(); | ||
29 | |||
30 | sta = sta_info_get(local, ra); | ||
31 | if (!sta) { | ||
32 | rcu_read_unlock(); | ||
33 | return; | ||
34 | } | ||
35 | |||
36 | /* check if TID is in operational state */ | ||
37 | spin_lock_bh(&sta->lock); | ||
38 | if (sta->ampdu_mlme.tid_state_rx[tid] | ||
39 | != HT_AGG_STATE_OPERATIONAL) { | ||
40 | spin_unlock_bh(&sta->lock); | ||
41 | rcu_read_unlock(); | ||
42 | return; | ||
43 | } | ||
44 | sta->ampdu_mlme.tid_state_rx[tid] = | ||
45 | HT_AGG_STATE_REQ_STOP_BA_MSK | | ||
46 | (initiator << HT_AGG_STATE_INITIATOR_SHIFT); | ||
47 | spin_unlock_bh(&sta->lock); | ||
48 | |||
49 | /* stop HW Rx aggregation. ampdu_action existence | ||
50 | * already verified in session init so we add the BUG_ON */ | ||
51 | BUG_ON(!local->ops->ampdu_action); | ||
52 | |||
53 | #ifdef CONFIG_MAC80211_HT_DEBUG | ||
54 | printk(KERN_DEBUG "Rx BA session stop requested for %pM tid %u\n", | ||
55 | ra, tid); | ||
56 | #endif /* CONFIG_MAC80211_HT_DEBUG */ | ||
57 | |||
58 | ret = local->ops->ampdu_action(hw, IEEE80211_AMPDU_RX_STOP, | ||
59 | &sta->sta, tid, NULL); | ||
60 | if (ret) | ||
61 | printk(KERN_DEBUG "HW problem - can not stop rx " | ||
62 | "aggregation for tid %d\n", tid); | ||
63 | |||
64 | /* shutdown timer has not expired */ | ||
65 | if (initiator != WLAN_BACK_TIMER) | ||
66 | del_timer_sync(&sta->ampdu_mlme.tid_rx[tid]->session_timer); | ||
67 | |||
68 | /* check if this is a self generated aggregation halt */ | ||
69 | if (initiator == WLAN_BACK_RECIPIENT || initiator == WLAN_BACK_TIMER) | ||
70 | ieee80211_send_delba(sdata, ra, tid, 0, reason); | ||
71 | |||
72 | /* free the reordering buffer */ | ||
73 | for (i = 0; i < sta->ampdu_mlme.tid_rx[tid]->buf_size; i++) { | ||
74 | if (sta->ampdu_mlme.tid_rx[tid]->reorder_buf[i]) { | ||
75 | /* release the reordered frames */ | ||
76 | dev_kfree_skb(sta->ampdu_mlme.tid_rx[tid]->reorder_buf[i]); | ||
77 | sta->ampdu_mlme.tid_rx[tid]->stored_mpdu_num--; | ||
78 | sta->ampdu_mlme.tid_rx[tid]->reorder_buf[i] = NULL; | ||
79 | } | ||
80 | } | ||
81 | /* free resources */ | ||
82 | kfree(sta->ampdu_mlme.tid_rx[tid]->reorder_buf); | ||
83 | kfree(sta->ampdu_mlme.tid_rx[tid]); | ||
84 | sta->ampdu_mlme.tid_rx[tid] = NULL; | ||
85 | sta->ampdu_mlme.tid_state_rx[tid] = HT_AGG_STATE_IDLE; | ||
86 | |||
87 | rcu_read_unlock(); | ||
88 | } | ||
89 | |||
90 | /* | ||
91 | * After accepting the AddBA Request we activated a timer, | ||
92 | * resetting it after each frame that arrives from the originator. | ||
93 | * if this timer expires ieee80211_sta_stop_rx_ba_session will be executed. | ||
94 | */ | ||
95 | static void sta_rx_agg_session_timer_expired(unsigned long data) | ||
96 | { | ||
97 | /* not an elegant detour, but there is no choice as the timer passes | ||
98 | * only one argument, and various sta_info are needed here, so init | ||
99 | * flow in sta_info_create gives the TID as data, while the timer_to_id | ||
100 | * array gives the sta through container_of */ | ||
101 | u8 *ptid = (u8 *)data; | ||
102 | u8 *timer_to_id = ptid - *ptid; | ||
103 | struct sta_info *sta = container_of(timer_to_id, struct sta_info, | ||
104 | timer_to_tid[0]); | ||
105 | |||
106 | #ifdef CONFIG_MAC80211_HT_DEBUG | ||
107 | printk(KERN_DEBUG "rx session timer expired on tid %d\n", (u16)*ptid); | ||
108 | #endif | ||
109 | ieee80211_sta_stop_rx_ba_session(sta->sdata, sta->sta.addr, | ||
110 | (u16)*ptid, WLAN_BACK_TIMER, | ||
111 | WLAN_REASON_QSTA_TIMEOUT); | ||
112 | } | ||
113 | |||
114 | static void ieee80211_send_addba_resp(struct ieee80211_sub_if_data *sdata, u8 *da, u16 tid, | ||
115 | u8 dialog_token, u16 status, u16 policy, | ||
116 | u16 buf_size, u16 timeout) | ||
117 | { | ||
118 | struct ieee80211_if_sta *ifsta = &sdata->u.sta; | ||
119 | struct ieee80211_local *local = sdata->local; | ||
120 | struct sk_buff *skb; | ||
121 | struct ieee80211_mgmt *mgmt; | ||
122 | u16 capab; | ||
123 | |||
124 | skb = dev_alloc_skb(sizeof(*mgmt) + local->hw.extra_tx_headroom); | ||
125 | |||
126 | if (!skb) { | ||
127 | printk(KERN_DEBUG "%s: failed to allocate buffer " | ||
128 | "for addba resp frame\n", sdata->dev->name); | ||
129 | return; | ||
130 | } | ||
131 | |||
132 | skb_reserve(skb, local->hw.extra_tx_headroom); | ||
133 | mgmt = (struct ieee80211_mgmt *) skb_put(skb, 24); | ||
134 | memset(mgmt, 0, 24); | ||
135 | memcpy(mgmt->da, da, ETH_ALEN); | ||
136 | memcpy(mgmt->sa, sdata->dev->dev_addr, ETH_ALEN); | ||
137 | if (sdata->vif.type == NL80211_IFTYPE_AP) | ||
138 | memcpy(mgmt->bssid, sdata->dev->dev_addr, ETH_ALEN); | ||
139 | else | ||
140 | memcpy(mgmt->bssid, ifsta->bssid, ETH_ALEN); | ||
141 | mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | | ||
142 | IEEE80211_STYPE_ACTION); | ||
143 | |||
144 | skb_put(skb, 1 + sizeof(mgmt->u.action.u.addba_resp)); | ||
145 | mgmt->u.action.category = WLAN_CATEGORY_BACK; | ||
146 | mgmt->u.action.u.addba_resp.action_code = WLAN_ACTION_ADDBA_RESP; | ||
147 | mgmt->u.action.u.addba_resp.dialog_token = dialog_token; | ||
148 | |||
149 | capab = (u16)(policy << 1); /* bit 1 aggregation policy */ | ||
150 | capab |= (u16)(tid << 2); /* bit 5:2 TID number */ | ||
151 | capab |= (u16)(buf_size << 6); /* bit 15:6 max size of aggregation */ | ||
152 | |||
153 | mgmt->u.action.u.addba_resp.capab = cpu_to_le16(capab); | ||
154 | mgmt->u.action.u.addba_resp.timeout = cpu_to_le16(timeout); | ||
155 | mgmt->u.action.u.addba_resp.status = cpu_to_le16(status); | ||
156 | |||
157 | ieee80211_tx_skb(sdata, skb, 1); | ||
158 | } | ||
159 | |||
160 | void ieee80211_process_addba_request(struct ieee80211_local *local, | ||
161 | struct sta_info *sta, | ||
162 | struct ieee80211_mgmt *mgmt, | ||
163 | size_t len) | ||
164 | { | ||
165 | struct ieee80211_hw *hw = &local->hw; | ||
166 | struct ieee80211_conf *conf = &hw->conf; | ||
167 | struct tid_ampdu_rx *tid_agg_rx; | ||
168 | u16 capab, tid, timeout, ba_policy, buf_size, start_seq_num, status; | ||
169 | u8 dialog_token; | ||
170 | int ret = -EOPNOTSUPP; | ||
171 | |||
172 | /* extract session parameters from addba request frame */ | ||
173 | dialog_token = mgmt->u.action.u.addba_req.dialog_token; | ||
174 | timeout = le16_to_cpu(mgmt->u.action.u.addba_req.timeout); | ||
175 | start_seq_num = | ||
176 | le16_to_cpu(mgmt->u.action.u.addba_req.start_seq_num) >> 4; | ||
177 | |||
178 | capab = le16_to_cpu(mgmt->u.action.u.addba_req.capab); | ||
179 | ba_policy = (capab & IEEE80211_ADDBA_PARAM_POLICY_MASK) >> 1; | ||
180 | tid = (capab & IEEE80211_ADDBA_PARAM_TID_MASK) >> 2; | ||
181 | buf_size = (capab & IEEE80211_ADDBA_PARAM_BUF_SIZE_MASK) >> 6; | ||
182 | |||
183 | status = WLAN_STATUS_REQUEST_DECLINED; | ||
184 | |||
185 | /* sanity check for incoming parameters: | ||
186 | * check if configuration can support the BA policy | ||
187 | * and if buffer size does not exceeds max value */ | ||
188 | /* XXX: check own ht delayed BA capability?? */ | ||
189 | if (((ba_policy != 1) | ||
190 | && (!(sta->sta.ht_cap.cap & IEEE80211_HT_CAP_DELAY_BA))) | ||
191 | || (buf_size > IEEE80211_MAX_AMPDU_BUF)) { | ||
192 | status = WLAN_STATUS_INVALID_QOS_PARAM; | ||
193 | #ifdef CONFIG_MAC80211_HT_DEBUG | ||
194 | if (net_ratelimit()) | ||
195 | printk(KERN_DEBUG "AddBA Req with bad params from " | ||
196 | "%pM on tid %u. policy %d, buffer size %d\n", | ||
197 | mgmt->sa, tid, ba_policy, | ||
198 | buf_size); | ||
199 | #endif /* CONFIG_MAC80211_HT_DEBUG */ | ||
200 | goto end_no_lock; | ||
201 | } | ||
202 | /* determine default buffer size */ | ||
203 | if (buf_size == 0) { | ||
204 | struct ieee80211_supported_band *sband; | ||
205 | |||
206 | sband = local->hw.wiphy->bands[conf->channel->band]; | ||
207 | buf_size = IEEE80211_MIN_AMPDU_BUF; | ||
208 | buf_size = buf_size << sband->ht_cap.ampdu_factor; | ||
209 | } | ||
210 | |||
211 | |||
212 | /* examine state machine */ | ||
213 | spin_lock_bh(&sta->lock); | ||
214 | |||
215 | if (sta->ampdu_mlme.tid_state_rx[tid] != HT_AGG_STATE_IDLE) { | ||
216 | #ifdef CONFIG_MAC80211_HT_DEBUG | ||
217 | if (net_ratelimit()) | ||
218 | printk(KERN_DEBUG "unexpected AddBA Req from " | ||
219 | "%pM on tid %u\n", | ||
220 | mgmt->sa, tid); | ||
221 | #endif /* CONFIG_MAC80211_HT_DEBUG */ | ||
222 | goto end; | ||
223 | } | ||
224 | |||
225 | /* prepare A-MPDU MLME for Rx aggregation */ | ||
226 | sta->ampdu_mlme.tid_rx[tid] = | ||
227 | kmalloc(sizeof(struct tid_ampdu_rx), GFP_ATOMIC); | ||
228 | if (!sta->ampdu_mlme.tid_rx[tid]) { | ||
229 | #ifdef CONFIG_MAC80211_HT_DEBUG | ||
230 | if (net_ratelimit()) | ||
231 | printk(KERN_ERR "allocate rx mlme to tid %d failed\n", | ||
232 | tid); | ||
233 | #endif | ||
234 | goto end; | ||
235 | } | ||
236 | /* rx timer */ | ||
237 | sta->ampdu_mlme.tid_rx[tid]->session_timer.function = | ||
238 | sta_rx_agg_session_timer_expired; | ||
239 | sta->ampdu_mlme.tid_rx[tid]->session_timer.data = | ||
240 | (unsigned long)&sta->timer_to_tid[tid]; | ||
241 | init_timer(&sta->ampdu_mlme.tid_rx[tid]->session_timer); | ||
242 | |||
243 | tid_agg_rx = sta->ampdu_mlme.tid_rx[tid]; | ||
244 | |||
245 | /* prepare reordering buffer */ | ||
246 | tid_agg_rx->reorder_buf = | ||
247 | kcalloc(buf_size, sizeof(struct sk_buff *), GFP_ATOMIC); | ||
248 | if (!tid_agg_rx->reorder_buf) { | ||
249 | #ifdef CONFIG_MAC80211_HT_DEBUG | ||
250 | if (net_ratelimit()) | ||
251 | printk(KERN_ERR "can not allocate reordering buffer " | ||
252 | "to tid %d\n", tid); | ||
253 | #endif | ||
254 | kfree(sta->ampdu_mlme.tid_rx[tid]); | ||
255 | goto end; | ||
256 | } | ||
257 | |||
258 | if (local->ops->ampdu_action) | ||
259 | ret = local->ops->ampdu_action(hw, IEEE80211_AMPDU_RX_START, | ||
260 | &sta->sta, tid, &start_seq_num); | ||
261 | #ifdef CONFIG_MAC80211_HT_DEBUG | ||
262 | printk(KERN_DEBUG "Rx A-MPDU request on tid %d result %d\n", tid, ret); | ||
263 | #endif /* CONFIG_MAC80211_HT_DEBUG */ | ||
264 | |||
265 | if (ret) { | ||
266 | kfree(tid_agg_rx->reorder_buf); | ||
267 | kfree(tid_agg_rx); | ||
268 | sta->ampdu_mlme.tid_rx[tid] = NULL; | ||
269 | goto end; | ||
270 | } | ||
271 | |||
272 | /* change state and send addba resp */ | ||
273 | sta->ampdu_mlme.tid_state_rx[tid] = HT_AGG_STATE_OPERATIONAL; | ||
274 | tid_agg_rx->dialog_token = dialog_token; | ||
275 | tid_agg_rx->ssn = start_seq_num; | ||
276 | tid_agg_rx->head_seq_num = start_seq_num; | ||
277 | tid_agg_rx->buf_size = buf_size; | ||
278 | tid_agg_rx->timeout = timeout; | ||
279 | tid_agg_rx->stored_mpdu_num = 0; | ||
280 | status = WLAN_STATUS_SUCCESS; | ||
281 | end: | ||
282 | spin_unlock_bh(&sta->lock); | ||
283 | |||
284 | end_no_lock: | ||
285 | ieee80211_send_addba_resp(sta->sdata, sta->sta.addr, tid, | ||
286 | dialog_token, status, 1, buf_size, timeout); | ||
287 | } | ||
diff --git a/net/mac80211/agg-tx.c b/net/mac80211/agg-tx.c new file mode 100644 index 000000000000..6ab731fecc20 --- /dev/null +++ b/net/mac80211/agg-tx.c | |||
@@ -0,0 +1,593 @@ | |||
1 | /* | ||
2 | * HT handling | ||
3 | * | ||
4 | * Copyright 2003, Jouni Malinen <jkmaline@cc.hut.fi> | ||
5 | * Copyright 2002-2005, Instant802 Networks, Inc. | ||
6 | * Copyright 2005-2006, Devicescape Software, Inc. | ||
7 | * Copyright 2006-2007 Jiri Benc <jbenc@suse.cz> | ||
8 | * Copyright 2007, Michael Wu <flamingice@sourmilk.net> | ||
9 | * Copyright 2007-2009, Intel Corporation | ||
10 | * | ||
11 | * This program is free software; you can redistribute it and/or modify | ||
12 | * it under the terms of the GNU General Public License version 2 as | ||
13 | * published by the Free Software Foundation. | ||
14 | */ | ||
15 | |||
16 | #include <linux/ieee80211.h> | ||
17 | #include <net/mac80211.h> | ||
18 | #include "ieee80211_i.h" | ||
19 | #include "wme.h" | ||
20 | |||
21 | static void ieee80211_send_addba_request(struct ieee80211_sub_if_data *sdata, | ||
22 | const u8 *da, u16 tid, | ||
23 | u8 dialog_token, u16 start_seq_num, | ||
24 | u16 agg_size, u16 timeout) | ||
25 | { | ||
26 | struct ieee80211_local *local = sdata->local; | ||
27 | struct ieee80211_if_sta *ifsta = &sdata->u.sta; | ||
28 | struct sk_buff *skb; | ||
29 | struct ieee80211_mgmt *mgmt; | ||
30 | u16 capab; | ||
31 | |||
32 | skb = dev_alloc_skb(sizeof(*mgmt) + local->hw.extra_tx_headroom); | ||
33 | |||
34 | if (!skb) { | ||
35 | printk(KERN_ERR "%s: failed to allocate buffer " | ||
36 | "for addba request frame\n", sdata->dev->name); | ||
37 | return; | ||
38 | } | ||
39 | skb_reserve(skb, local->hw.extra_tx_headroom); | ||
40 | mgmt = (struct ieee80211_mgmt *) skb_put(skb, 24); | ||
41 | memset(mgmt, 0, 24); | ||
42 | memcpy(mgmt->da, da, ETH_ALEN); | ||
43 | memcpy(mgmt->sa, sdata->dev->dev_addr, ETH_ALEN); | ||
44 | if (sdata->vif.type == NL80211_IFTYPE_AP) | ||
45 | memcpy(mgmt->bssid, sdata->dev->dev_addr, ETH_ALEN); | ||
46 | else | ||
47 | memcpy(mgmt->bssid, ifsta->bssid, ETH_ALEN); | ||
48 | |||
49 | mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | | ||
50 | IEEE80211_STYPE_ACTION); | ||
51 | |||
52 | skb_put(skb, 1 + sizeof(mgmt->u.action.u.addba_req)); | ||
53 | |||
54 | mgmt->u.action.category = WLAN_CATEGORY_BACK; | ||
55 | mgmt->u.action.u.addba_req.action_code = WLAN_ACTION_ADDBA_REQ; | ||
56 | |||
57 | mgmt->u.action.u.addba_req.dialog_token = dialog_token; | ||
58 | capab = (u16)(1 << 1); /* bit 1 aggregation policy */ | ||
59 | capab |= (u16)(tid << 2); /* bit 5:2 TID number */ | ||
60 | capab |= (u16)(agg_size << 6); /* bit 15:6 max size of aggergation */ | ||
61 | |||
62 | mgmt->u.action.u.addba_req.capab = cpu_to_le16(capab); | ||
63 | |||
64 | mgmt->u.action.u.addba_req.timeout = cpu_to_le16(timeout); | ||
65 | mgmt->u.action.u.addba_req.start_seq_num = | ||
66 | cpu_to_le16(start_seq_num << 4); | ||
67 | |||
68 | ieee80211_tx_skb(sdata, skb, 1); | ||
69 | } | ||
70 | |||
71 | void ieee80211_send_bar(struct ieee80211_sub_if_data *sdata, u8 *ra, u16 tid, u16 ssn) | ||
72 | { | ||
73 | struct ieee80211_local *local = sdata->local; | ||
74 | struct sk_buff *skb; | ||
75 | struct ieee80211_bar *bar; | ||
76 | u16 bar_control = 0; | ||
77 | |||
78 | skb = dev_alloc_skb(sizeof(*bar) + local->hw.extra_tx_headroom); | ||
79 | if (!skb) { | ||
80 | printk(KERN_ERR "%s: failed to allocate buffer for " | ||
81 | "bar frame\n", sdata->dev->name); | ||
82 | return; | ||
83 | } | ||
84 | skb_reserve(skb, local->hw.extra_tx_headroom); | ||
85 | bar = (struct ieee80211_bar *)skb_put(skb, sizeof(*bar)); | ||
86 | memset(bar, 0, sizeof(*bar)); | ||
87 | bar->frame_control = cpu_to_le16(IEEE80211_FTYPE_CTL | | ||
88 | IEEE80211_STYPE_BACK_REQ); | ||
89 | memcpy(bar->ra, ra, ETH_ALEN); | ||
90 | memcpy(bar->ta, sdata->dev->dev_addr, ETH_ALEN); | ||
91 | bar_control |= (u16)IEEE80211_BAR_CTRL_ACK_POLICY_NORMAL; | ||
92 | bar_control |= (u16)IEEE80211_BAR_CTRL_CBMTID_COMPRESSED_BA; | ||
93 | bar_control |= (u16)(tid << 12); | ||
94 | bar->control = cpu_to_le16(bar_control); | ||
95 | bar->start_seq_num = cpu_to_le16(ssn); | ||
96 | |||
97 | ieee80211_tx_skb(sdata, skb, 0); | ||
98 | } | ||
99 | |||
100 | /* | ||
101 | * After sending add Block Ack request we activated a timer until | ||
102 | * add Block Ack response will arrive from the recipient. | ||
103 | * If this timer expires sta_addba_resp_timer_expired will be executed. | ||
104 | */ | ||
105 | static void sta_addba_resp_timer_expired(unsigned long data) | ||
106 | { | ||
107 | /* not an elegant detour, but there is no choice as the timer passes | ||
108 | * only one argument, and both sta_info and TID are needed, so init | ||
109 | * flow in sta_info_create gives the TID as data, while the timer_to_id | ||
110 | * array gives the sta through container_of */ | ||
111 | u16 tid = *(u8 *)data; | ||
112 | struct sta_info *temp_sta = container_of((void *)data, | ||
113 | struct sta_info, timer_to_tid[tid]); | ||
114 | |||
115 | struct ieee80211_local *local = temp_sta->local; | ||
116 | struct ieee80211_hw *hw = &local->hw; | ||
117 | struct sta_info *sta; | ||
118 | u8 *state; | ||
119 | |||
120 | rcu_read_lock(); | ||
121 | |||
122 | sta = sta_info_get(local, temp_sta->sta.addr); | ||
123 | if (!sta) { | ||
124 | rcu_read_unlock(); | ||
125 | return; | ||
126 | } | ||
127 | |||
128 | state = &sta->ampdu_mlme.tid_state_tx[tid]; | ||
129 | /* check if the TID waits for addBA response */ | ||
130 | spin_lock_bh(&sta->lock); | ||
131 | if (!(*state & HT_ADDBA_REQUESTED_MSK)) { | ||
132 | spin_unlock_bh(&sta->lock); | ||
133 | *state = HT_AGG_STATE_IDLE; | ||
134 | #ifdef CONFIG_MAC80211_HT_DEBUG | ||
135 | printk(KERN_DEBUG "timer expired on tid %d but we are not " | ||
136 | "expecting addBA response there", tid); | ||
137 | #endif | ||
138 | goto timer_expired_exit; | ||
139 | } | ||
140 | |||
141 | #ifdef CONFIG_MAC80211_HT_DEBUG | ||
142 | printk(KERN_DEBUG "addBA response timer expired on tid %d\n", tid); | ||
143 | #endif | ||
144 | |||
145 | /* go through the state check in stop_BA_session */ | ||
146 | *state = HT_AGG_STATE_OPERATIONAL; | ||
147 | spin_unlock_bh(&sta->lock); | ||
148 | ieee80211_stop_tx_ba_session(hw, temp_sta->sta.addr, tid, | ||
149 | WLAN_BACK_INITIATOR); | ||
150 | |||
151 | timer_expired_exit: | ||
152 | rcu_read_unlock(); | ||
153 | } | ||
154 | |||
155 | int ieee80211_start_tx_ba_session(struct ieee80211_hw *hw, u8 *ra, u16 tid) | ||
156 | { | ||
157 | struct ieee80211_local *local = hw_to_local(hw); | ||
158 | struct sta_info *sta; | ||
159 | struct ieee80211_sub_if_data *sdata; | ||
160 | u16 start_seq_num; | ||
161 | u8 *state; | ||
162 | int ret = 0; | ||
163 | |||
164 | if ((tid >= STA_TID_NUM) || !(hw->flags & IEEE80211_HW_AMPDU_AGGREGATION)) | ||
165 | return -EINVAL; | ||
166 | |||
167 | #ifdef CONFIG_MAC80211_HT_DEBUG | ||
168 | printk(KERN_DEBUG "Open BA session requested for %pM tid %u\n", | ||
169 | ra, tid); | ||
170 | #endif /* CONFIG_MAC80211_HT_DEBUG */ | ||
171 | |||
172 | rcu_read_lock(); | ||
173 | |||
174 | sta = sta_info_get(local, ra); | ||
175 | if (!sta) { | ||
176 | #ifdef CONFIG_MAC80211_HT_DEBUG | ||
177 | printk(KERN_DEBUG "Could not find the station\n"); | ||
178 | #endif | ||
179 | ret = -ENOENT; | ||
180 | goto exit; | ||
181 | } | ||
182 | |||
183 | spin_lock_bh(&sta->lock); | ||
184 | |||
185 | /* we have tried too many times, receiver does not want A-MPDU */ | ||
186 | if (sta->ampdu_mlme.addba_req_num[tid] > HT_AGG_MAX_RETRIES) { | ||
187 | ret = -EBUSY; | ||
188 | goto err_unlock_sta; | ||
189 | } | ||
190 | |||
191 | state = &sta->ampdu_mlme.tid_state_tx[tid]; | ||
192 | /* check if the TID is not in aggregation flow already */ | ||
193 | if (*state != HT_AGG_STATE_IDLE) { | ||
194 | #ifdef CONFIG_MAC80211_HT_DEBUG | ||
195 | printk(KERN_DEBUG "BA request denied - session is not " | ||
196 | "idle on tid %u\n", tid); | ||
197 | #endif /* CONFIG_MAC80211_HT_DEBUG */ | ||
198 | ret = -EAGAIN; | ||
199 | goto err_unlock_sta; | ||
200 | } | ||
201 | |||
202 | /* prepare A-MPDU MLME for Tx aggregation */ | ||
203 | sta->ampdu_mlme.tid_tx[tid] = | ||
204 | kmalloc(sizeof(struct tid_ampdu_tx), GFP_ATOMIC); | ||
205 | if (!sta->ampdu_mlme.tid_tx[tid]) { | ||
206 | #ifdef CONFIG_MAC80211_HT_DEBUG | ||
207 | if (net_ratelimit()) | ||
208 | printk(KERN_ERR "allocate tx mlme to tid %d failed\n", | ||
209 | tid); | ||
210 | #endif | ||
211 | ret = -ENOMEM; | ||
212 | goto err_unlock_sta; | ||
213 | } | ||
214 | /* Tx timer */ | ||
215 | sta->ampdu_mlme.tid_tx[tid]->addba_resp_timer.function = | ||
216 | sta_addba_resp_timer_expired; | ||
217 | sta->ampdu_mlme.tid_tx[tid]->addba_resp_timer.data = | ||
218 | (unsigned long)&sta->timer_to_tid[tid]; | ||
219 | init_timer(&sta->ampdu_mlme.tid_tx[tid]->addba_resp_timer); | ||
220 | |||
221 | if (hw->ampdu_queues) { | ||
222 | /* create a new queue for this aggregation */ | ||
223 | ret = ieee80211_ht_agg_queue_add(local, sta, tid); | ||
224 | |||
225 | /* case no queue is available to aggregation | ||
226 | * don't switch to aggregation */ | ||
227 | if (ret) { | ||
228 | #ifdef CONFIG_MAC80211_HT_DEBUG | ||
229 | printk(KERN_DEBUG "BA request denied - " | ||
230 | "queue unavailable for tid %d\n", tid); | ||
231 | #endif /* CONFIG_MAC80211_HT_DEBUG */ | ||
232 | goto err_unlock_queue; | ||
233 | } | ||
234 | } | ||
235 | sdata = sta->sdata; | ||
236 | |||
237 | /* Ok, the Addba frame hasn't been sent yet, but if the driver calls the | ||
238 | * call back right away, it must see that the flow has begun */ | ||
239 | *state |= HT_ADDBA_REQUESTED_MSK; | ||
240 | |||
241 | /* This is slightly racy because the queue isn't stopped */ | ||
242 | start_seq_num = sta->tid_seq[tid]; | ||
243 | |||
244 | if (local->ops->ampdu_action) | ||
245 | ret = local->ops->ampdu_action(hw, IEEE80211_AMPDU_TX_START, | ||
246 | &sta->sta, tid, &start_seq_num); | ||
247 | |||
248 | if (ret) { | ||
249 | /* No need to requeue the packets in the agg queue, since we | ||
250 | * held the tx lock: no packet could be enqueued to the newly | ||
251 | * allocated queue */ | ||
252 | if (hw->ampdu_queues) | ||
253 | ieee80211_ht_agg_queue_remove(local, sta, tid, 0); | ||
254 | #ifdef CONFIG_MAC80211_HT_DEBUG | ||
255 | printk(KERN_DEBUG "BA request denied - HW unavailable for" | ||
256 | " tid %d\n", tid); | ||
257 | #endif /* CONFIG_MAC80211_HT_DEBUG */ | ||
258 | *state = HT_AGG_STATE_IDLE; | ||
259 | goto err_unlock_queue; | ||
260 | } | ||
261 | |||
262 | /* Will put all the packets in the new SW queue */ | ||
263 | if (hw->ampdu_queues) | ||
264 | ieee80211_requeue(local, ieee802_1d_to_ac[tid]); | ||
265 | spin_unlock_bh(&sta->lock); | ||
266 | |||
267 | /* send an addBA request */ | ||
268 | sta->ampdu_mlme.dialog_token_allocator++; | ||
269 | sta->ampdu_mlme.tid_tx[tid]->dialog_token = | ||
270 | sta->ampdu_mlme.dialog_token_allocator; | ||
271 | sta->ampdu_mlme.tid_tx[tid]->ssn = start_seq_num; | ||
272 | |||
273 | |||
274 | ieee80211_send_addba_request(sta->sdata, ra, tid, | ||
275 | sta->ampdu_mlme.tid_tx[tid]->dialog_token, | ||
276 | sta->ampdu_mlme.tid_tx[tid]->ssn, | ||
277 | 0x40, 5000); | ||
278 | /* activate the timer for the recipient's addBA response */ | ||
279 | sta->ampdu_mlme.tid_tx[tid]->addba_resp_timer.expires = | ||
280 | jiffies + ADDBA_RESP_INTERVAL; | ||
281 | add_timer(&sta->ampdu_mlme.tid_tx[tid]->addba_resp_timer); | ||
282 | #ifdef CONFIG_MAC80211_HT_DEBUG | ||
283 | printk(KERN_DEBUG "activated addBA response timer on tid %d\n", tid); | ||
284 | #endif | ||
285 | goto exit; | ||
286 | |||
287 | err_unlock_queue: | ||
288 | kfree(sta->ampdu_mlme.tid_tx[tid]); | ||
289 | sta->ampdu_mlme.tid_tx[tid] = NULL; | ||
290 | ret = -EBUSY; | ||
291 | err_unlock_sta: | ||
292 | spin_unlock_bh(&sta->lock); | ||
293 | exit: | ||
294 | rcu_read_unlock(); | ||
295 | return ret; | ||
296 | } | ||
297 | EXPORT_SYMBOL(ieee80211_start_tx_ba_session); | ||
298 | |||
299 | void ieee80211_start_tx_ba_cb(struct ieee80211_hw *hw, u8 *ra, u16 tid) | ||
300 | { | ||
301 | struct ieee80211_local *local = hw_to_local(hw); | ||
302 | struct sta_info *sta; | ||
303 | u8 *state; | ||
304 | |||
305 | if (tid >= STA_TID_NUM) { | ||
306 | #ifdef CONFIG_MAC80211_HT_DEBUG | ||
307 | printk(KERN_DEBUG "Bad TID value: tid = %d (>= %d)\n", | ||
308 | tid, STA_TID_NUM); | ||
309 | #endif | ||
310 | return; | ||
311 | } | ||
312 | |||
313 | rcu_read_lock(); | ||
314 | sta = sta_info_get(local, ra); | ||
315 | if (!sta) { | ||
316 | rcu_read_unlock(); | ||
317 | #ifdef CONFIG_MAC80211_HT_DEBUG | ||
318 | printk(KERN_DEBUG "Could not find station: %pM\n", ra); | ||
319 | #endif | ||
320 | return; | ||
321 | } | ||
322 | |||
323 | state = &sta->ampdu_mlme.tid_state_tx[tid]; | ||
324 | spin_lock_bh(&sta->lock); | ||
325 | |||
326 | if (!(*state & HT_ADDBA_REQUESTED_MSK)) { | ||
327 | #ifdef CONFIG_MAC80211_HT_DEBUG | ||
328 | printk(KERN_DEBUG "addBA was not requested yet, state is %d\n", | ||
329 | *state); | ||
330 | #endif | ||
331 | spin_unlock_bh(&sta->lock); | ||
332 | rcu_read_unlock(); | ||
333 | return; | ||
334 | } | ||
335 | |||
336 | WARN_ON_ONCE(*state & HT_ADDBA_DRV_READY_MSK); | ||
337 | |||
338 | *state |= HT_ADDBA_DRV_READY_MSK; | ||
339 | |||
340 | if (*state == HT_AGG_STATE_OPERATIONAL) { | ||
341 | #ifdef CONFIG_MAC80211_HT_DEBUG | ||
342 | printk(KERN_DEBUG "Aggregation is on for tid %d \n", tid); | ||
343 | #endif | ||
344 | if (hw->ampdu_queues) | ||
345 | ieee80211_wake_queue(hw, sta->tid_to_tx_q[tid]); | ||
346 | } | ||
347 | spin_unlock_bh(&sta->lock); | ||
348 | rcu_read_unlock(); | ||
349 | } | ||
350 | EXPORT_SYMBOL(ieee80211_start_tx_ba_cb); | ||
351 | |||
352 | |||
353 | int ieee80211_stop_tx_ba_session(struct ieee80211_hw *hw, | ||
354 | u8 *ra, u16 tid, | ||
355 | enum ieee80211_back_parties initiator) | ||
356 | { | ||
357 | struct ieee80211_local *local = hw_to_local(hw); | ||
358 | struct sta_info *sta; | ||
359 | u8 *state; | ||
360 | int ret = 0; | ||
361 | |||
362 | if (tid >= STA_TID_NUM) | ||
363 | return -EINVAL; | ||
364 | |||
365 | rcu_read_lock(); | ||
366 | sta = sta_info_get(local, ra); | ||
367 | if (!sta) { | ||
368 | rcu_read_unlock(); | ||
369 | return -ENOENT; | ||
370 | } | ||
371 | |||
372 | /* check if the TID is in aggregation */ | ||
373 | state = &sta->ampdu_mlme.tid_state_tx[tid]; | ||
374 | spin_lock_bh(&sta->lock); | ||
375 | |||
376 | if (*state != HT_AGG_STATE_OPERATIONAL) { | ||
377 | ret = -ENOENT; | ||
378 | goto stop_BA_exit; | ||
379 | } | ||
380 | |||
381 | #ifdef CONFIG_MAC80211_HT_DEBUG | ||
382 | printk(KERN_DEBUG "Tx BA session stop requested for %pM tid %u\n", | ||
383 | ra, tid); | ||
384 | #endif /* CONFIG_MAC80211_HT_DEBUG */ | ||
385 | |||
386 | if (hw->ampdu_queues) | ||
387 | ieee80211_stop_queue(hw, sta->tid_to_tx_q[tid]); | ||
388 | |||
389 | *state = HT_AGG_STATE_REQ_STOP_BA_MSK | | ||
390 | (initiator << HT_AGG_STATE_INITIATOR_SHIFT); | ||
391 | |||
392 | if (local->ops->ampdu_action) | ||
393 | ret = local->ops->ampdu_action(hw, IEEE80211_AMPDU_TX_STOP, | ||
394 | &sta->sta, tid, NULL); | ||
395 | |||
396 | /* case HW denied going back to legacy */ | ||
397 | if (ret) { | ||
398 | WARN_ON(ret != -EBUSY); | ||
399 | *state = HT_AGG_STATE_OPERATIONAL; | ||
400 | if (hw->ampdu_queues) | ||
401 | ieee80211_wake_queue(hw, sta->tid_to_tx_q[tid]); | ||
402 | goto stop_BA_exit; | ||
403 | } | ||
404 | |||
405 | stop_BA_exit: | ||
406 | spin_unlock_bh(&sta->lock); | ||
407 | rcu_read_unlock(); | ||
408 | return ret; | ||
409 | } | ||
410 | EXPORT_SYMBOL(ieee80211_stop_tx_ba_session); | ||
411 | |||
412 | void ieee80211_stop_tx_ba_cb(struct ieee80211_hw *hw, u8 *ra, u8 tid) | ||
413 | { | ||
414 | struct ieee80211_local *local = hw_to_local(hw); | ||
415 | struct sta_info *sta; | ||
416 | u8 *state; | ||
417 | int agg_queue; | ||
418 | |||
419 | if (tid >= STA_TID_NUM) { | ||
420 | #ifdef CONFIG_MAC80211_HT_DEBUG | ||
421 | printk(KERN_DEBUG "Bad TID value: tid = %d (>= %d)\n", | ||
422 | tid, STA_TID_NUM); | ||
423 | #endif | ||
424 | return; | ||
425 | } | ||
426 | |||
427 | #ifdef CONFIG_MAC80211_HT_DEBUG | ||
428 | printk(KERN_DEBUG "Stopping Tx BA session for %pM tid %d\n", | ||
429 | ra, tid); | ||
430 | #endif /* CONFIG_MAC80211_HT_DEBUG */ | ||
431 | |||
432 | rcu_read_lock(); | ||
433 | sta = sta_info_get(local, ra); | ||
434 | if (!sta) { | ||
435 | #ifdef CONFIG_MAC80211_HT_DEBUG | ||
436 | printk(KERN_DEBUG "Could not find station: %pM\n", ra); | ||
437 | #endif | ||
438 | rcu_read_unlock(); | ||
439 | return; | ||
440 | } | ||
441 | state = &sta->ampdu_mlme.tid_state_tx[tid]; | ||
442 | |||
443 | /* NOTE: no need to use sta->lock in this state check, as | ||
444 | * ieee80211_stop_tx_ba_session will let only one stop call to | ||
445 | * pass through per sta/tid | ||
446 | */ | ||
447 | if ((*state & HT_AGG_STATE_REQ_STOP_BA_MSK) == 0) { | ||
448 | #ifdef CONFIG_MAC80211_HT_DEBUG | ||
449 | printk(KERN_DEBUG "unexpected callback to A-MPDU stop\n"); | ||
450 | #endif | ||
451 | rcu_read_unlock(); | ||
452 | return; | ||
453 | } | ||
454 | |||
455 | if (*state & HT_AGG_STATE_INITIATOR_MSK) | ||
456 | ieee80211_send_delba(sta->sdata, ra, tid, | ||
457 | WLAN_BACK_INITIATOR, WLAN_REASON_QSTA_NOT_USE); | ||
458 | |||
459 | if (hw->ampdu_queues) { | ||
460 | agg_queue = sta->tid_to_tx_q[tid]; | ||
461 | ieee80211_ht_agg_queue_remove(local, sta, tid, 1); | ||
462 | |||
463 | /* We just requeued the all the frames that were in the | ||
464 | * removed queue, and since we might miss a softirq we do | ||
465 | * netif_schedule_queue. ieee80211_wake_queue is not used | ||
466 | * here as this queue is not necessarily stopped | ||
467 | */ | ||
468 | netif_schedule_queue(netdev_get_tx_queue(local->mdev, | ||
469 | agg_queue)); | ||
470 | } | ||
471 | spin_lock_bh(&sta->lock); | ||
472 | *state = HT_AGG_STATE_IDLE; | ||
473 | sta->ampdu_mlme.addba_req_num[tid] = 0; | ||
474 | kfree(sta->ampdu_mlme.tid_tx[tid]); | ||
475 | sta->ampdu_mlme.tid_tx[tid] = NULL; | ||
476 | spin_unlock_bh(&sta->lock); | ||
477 | |||
478 | rcu_read_unlock(); | ||
479 | } | ||
480 | EXPORT_SYMBOL(ieee80211_stop_tx_ba_cb); | ||
481 | |||
482 | void ieee80211_start_tx_ba_cb_irqsafe(struct ieee80211_hw *hw, | ||
483 | const u8 *ra, u16 tid) | ||
484 | { | ||
485 | struct ieee80211_local *local = hw_to_local(hw); | ||
486 | struct ieee80211_ra_tid *ra_tid; | ||
487 | struct sk_buff *skb = dev_alloc_skb(0); | ||
488 | |||
489 | if (unlikely(!skb)) { | ||
490 | #ifdef CONFIG_MAC80211_HT_DEBUG | ||
491 | if (net_ratelimit()) | ||
492 | printk(KERN_WARNING "%s: Not enough memory, " | ||
493 | "dropping start BA session", skb->dev->name); | ||
494 | #endif | ||
495 | return; | ||
496 | } | ||
497 | ra_tid = (struct ieee80211_ra_tid *) &skb->cb; | ||
498 | memcpy(&ra_tid->ra, ra, ETH_ALEN); | ||
499 | ra_tid->tid = tid; | ||
500 | |||
501 | skb->pkt_type = IEEE80211_ADDBA_MSG; | ||
502 | skb_queue_tail(&local->skb_queue, skb); | ||
503 | tasklet_schedule(&local->tasklet); | ||
504 | } | ||
505 | EXPORT_SYMBOL(ieee80211_start_tx_ba_cb_irqsafe); | ||
506 | |||
507 | void ieee80211_stop_tx_ba_cb_irqsafe(struct ieee80211_hw *hw, | ||
508 | const u8 *ra, u16 tid) | ||
509 | { | ||
510 | struct ieee80211_local *local = hw_to_local(hw); | ||
511 | struct ieee80211_ra_tid *ra_tid; | ||
512 | struct sk_buff *skb = dev_alloc_skb(0); | ||
513 | |||
514 | if (unlikely(!skb)) { | ||
515 | #ifdef CONFIG_MAC80211_HT_DEBUG | ||
516 | if (net_ratelimit()) | ||
517 | printk(KERN_WARNING "%s: Not enough memory, " | ||
518 | "dropping stop BA session", skb->dev->name); | ||
519 | #endif | ||
520 | return; | ||
521 | } | ||
522 | ra_tid = (struct ieee80211_ra_tid *) &skb->cb; | ||
523 | memcpy(&ra_tid->ra, ra, ETH_ALEN); | ||
524 | ra_tid->tid = tid; | ||
525 | |||
526 | skb->pkt_type = IEEE80211_DELBA_MSG; | ||
527 | skb_queue_tail(&local->skb_queue, skb); | ||
528 | tasklet_schedule(&local->tasklet); | ||
529 | } | ||
530 | EXPORT_SYMBOL(ieee80211_stop_tx_ba_cb_irqsafe); | ||
531 | |||
532 | void ieee80211_process_addba_resp(struct ieee80211_local *local, | ||
533 | struct sta_info *sta, | ||
534 | struct ieee80211_mgmt *mgmt, | ||
535 | size_t len) | ||
536 | { | ||
537 | struct ieee80211_hw *hw = &local->hw; | ||
538 | u16 capab; | ||
539 | u16 tid, start_seq_num; | ||
540 | u8 *state; | ||
541 | |||
542 | capab = le16_to_cpu(mgmt->u.action.u.addba_resp.capab); | ||
543 | tid = (capab & IEEE80211_ADDBA_PARAM_TID_MASK) >> 2; | ||
544 | |||
545 | state = &sta->ampdu_mlme.tid_state_tx[tid]; | ||
546 | |||
547 | spin_lock_bh(&sta->lock); | ||
548 | |||
549 | if (!(*state & HT_ADDBA_REQUESTED_MSK)) { | ||
550 | spin_unlock_bh(&sta->lock); | ||
551 | return; | ||
552 | } | ||
553 | |||
554 | if (mgmt->u.action.u.addba_resp.dialog_token != | ||
555 | sta->ampdu_mlme.tid_tx[tid]->dialog_token) { | ||
556 | spin_unlock_bh(&sta->lock); | ||
557 | #ifdef CONFIG_MAC80211_HT_DEBUG | ||
558 | printk(KERN_DEBUG "wrong addBA response token, tid %d\n", tid); | ||
559 | #endif /* CONFIG_MAC80211_HT_DEBUG */ | ||
560 | return; | ||
561 | } | ||
562 | |||
563 | del_timer_sync(&sta->ampdu_mlme.tid_tx[tid]->addba_resp_timer); | ||
564 | #ifdef CONFIG_MAC80211_HT_DEBUG | ||
565 | printk(KERN_DEBUG "switched off addBA timer for tid %d \n", tid); | ||
566 | #endif /* CONFIG_MAC80211_HT_DEBUG */ | ||
567 | if (le16_to_cpu(mgmt->u.action.u.addba_resp.status) | ||
568 | == WLAN_STATUS_SUCCESS) { | ||
569 | *state |= HT_ADDBA_RECEIVED_MSK; | ||
570 | sta->ampdu_mlme.addba_req_num[tid] = 0; | ||
571 | |||
572 | if (*state == HT_AGG_STATE_OPERATIONAL && | ||
573 | local->hw.ampdu_queues) | ||
574 | ieee80211_wake_queue(hw, sta->tid_to_tx_q[tid]); | ||
575 | |||
576 | if (local->ops->ampdu_action) { | ||
577 | (void)local->ops->ampdu_action(hw, | ||
578 | IEEE80211_AMPDU_TX_RESUME, | ||
579 | &sta->sta, tid, &start_seq_num); | ||
580 | } | ||
581 | #ifdef CONFIG_MAC80211_HT_DEBUG | ||
582 | printk(KERN_DEBUG "Resuming TX aggregation for tid %d\n", tid); | ||
583 | #endif /* CONFIG_MAC80211_HT_DEBUG */ | ||
584 | spin_unlock_bh(&sta->lock); | ||
585 | } else { | ||
586 | sta->ampdu_mlme.addba_req_num[tid]++; | ||
587 | /* this will allow the state check in stop_BA_session */ | ||
588 | *state = HT_AGG_STATE_OPERATIONAL; | ||
589 | spin_unlock_bh(&sta->lock); | ||
590 | ieee80211_stop_tx_ba_session(hw, sta->sta.addr, tid, | ||
591 | WLAN_BACK_INITIATOR); | ||
592 | } | ||
593 | } | ||
diff --git a/net/mac80211/ht.c b/net/mac80211/ht.c index 7a38d2e76ca9..869ea5fd3f51 100644 --- a/net/mac80211/ht.c +++ b/net/mac80211/ht.c | |||
@@ -17,8 +17,6 @@ | |||
17 | #include <net/wireless.h> | 17 | #include <net/wireless.h> |
18 | #include <net/mac80211.h> | 18 | #include <net/mac80211.h> |
19 | #include "ieee80211_i.h" | 19 | #include "ieee80211_i.h" |
20 | #include "sta_info.h" | ||
21 | #include "wme.h" | ||
22 | 20 | ||
23 | void ieee80211_ht_cap_ie_to_sta_ht_cap(struct ieee80211_supported_band *sband, | 21 | void ieee80211_ht_cap_ie_to_sta_ht_cap(struct ieee80211_supported_band *sband, |
24 | struct ieee80211_ht_cap *ht_cap_ie, | 22 | struct ieee80211_ht_cap *ht_cap_ie, |
@@ -155,105 +153,23 @@ u32 ieee80211_enable_ht(struct ieee80211_sub_if_data *sdata, | |||
155 | return changed; | 153 | return changed; |
156 | } | 154 | } |
157 | 155 | ||
158 | static void ieee80211_send_addba_request(struct ieee80211_sub_if_data *sdata, | 156 | void ieee80211_sta_tear_down_BA_sessions(struct ieee80211_sub_if_data *sdata, u8 *addr) |
159 | const u8 *da, u16 tid, | ||
160 | u8 dialog_token, u16 start_seq_num, | ||
161 | u16 agg_size, u16 timeout) | ||
162 | { | ||
163 | struct ieee80211_local *local = sdata->local; | ||
164 | struct ieee80211_if_sta *ifsta = &sdata->u.sta; | ||
165 | struct sk_buff *skb; | ||
166 | struct ieee80211_mgmt *mgmt; | ||
167 | u16 capab; | ||
168 | |||
169 | skb = dev_alloc_skb(sizeof(*mgmt) + local->hw.extra_tx_headroom); | ||
170 | |||
171 | if (!skb) { | ||
172 | printk(KERN_ERR "%s: failed to allocate buffer " | ||
173 | "for addba request frame\n", sdata->dev->name); | ||
174 | return; | ||
175 | } | ||
176 | skb_reserve(skb, local->hw.extra_tx_headroom); | ||
177 | mgmt = (struct ieee80211_mgmt *) skb_put(skb, 24); | ||
178 | memset(mgmt, 0, 24); | ||
179 | memcpy(mgmt->da, da, ETH_ALEN); | ||
180 | memcpy(mgmt->sa, sdata->dev->dev_addr, ETH_ALEN); | ||
181 | if (sdata->vif.type == NL80211_IFTYPE_AP) | ||
182 | memcpy(mgmt->bssid, sdata->dev->dev_addr, ETH_ALEN); | ||
183 | else | ||
184 | memcpy(mgmt->bssid, ifsta->bssid, ETH_ALEN); | ||
185 | |||
186 | mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | | ||
187 | IEEE80211_STYPE_ACTION); | ||
188 | |||
189 | skb_put(skb, 1 + sizeof(mgmt->u.action.u.addba_req)); | ||
190 | |||
191 | mgmt->u.action.category = WLAN_CATEGORY_BACK; | ||
192 | mgmt->u.action.u.addba_req.action_code = WLAN_ACTION_ADDBA_REQ; | ||
193 | |||
194 | mgmt->u.action.u.addba_req.dialog_token = dialog_token; | ||
195 | capab = (u16)(1 << 1); /* bit 1 aggregation policy */ | ||
196 | capab |= (u16)(tid << 2); /* bit 5:2 TID number */ | ||
197 | capab |= (u16)(agg_size << 6); /* bit 15:6 max size of aggergation */ | ||
198 | |||
199 | mgmt->u.action.u.addba_req.capab = cpu_to_le16(capab); | ||
200 | |||
201 | mgmt->u.action.u.addba_req.timeout = cpu_to_le16(timeout); | ||
202 | mgmt->u.action.u.addba_req.start_seq_num = | ||
203 | cpu_to_le16(start_seq_num << 4); | ||
204 | |||
205 | ieee80211_tx_skb(sdata, skb, 1); | ||
206 | } | ||
207 | |||
208 | static void ieee80211_send_addba_resp(struct ieee80211_sub_if_data *sdata, u8 *da, u16 tid, | ||
209 | u8 dialog_token, u16 status, u16 policy, | ||
210 | u16 buf_size, u16 timeout) | ||
211 | { | 157 | { |
212 | struct ieee80211_if_sta *ifsta = &sdata->u.sta; | ||
213 | struct ieee80211_local *local = sdata->local; | 158 | struct ieee80211_local *local = sdata->local; |
214 | struct sk_buff *skb; | 159 | int i; |
215 | struct ieee80211_mgmt *mgmt; | ||
216 | u16 capab; | ||
217 | |||
218 | skb = dev_alloc_skb(sizeof(*mgmt) + local->hw.extra_tx_headroom); | ||
219 | 160 | ||
220 | if (!skb) { | 161 | for (i = 0; i < STA_TID_NUM; i++) { |
221 | printk(KERN_DEBUG "%s: failed to allocate buffer " | 162 | ieee80211_stop_tx_ba_session(&local->hw, addr, i, |
222 | "for addba resp frame\n", sdata->dev->name); | 163 | WLAN_BACK_INITIATOR); |
223 | return; | 164 | ieee80211_sta_stop_rx_ba_session(sdata, addr, i, |
165 | WLAN_BACK_RECIPIENT, | ||
166 | WLAN_REASON_QSTA_LEAVE_QBSS); | ||
224 | } | 167 | } |
225 | |||
226 | skb_reserve(skb, local->hw.extra_tx_headroom); | ||
227 | mgmt = (struct ieee80211_mgmt *) skb_put(skb, 24); | ||
228 | memset(mgmt, 0, 24); | ||
229 | memcpy(mgmt->da, da, ETH_ALEN); | ||
230 | memcpy(mgmt->sa, sdata->dev->dev_addr, ETH_ALEN); | ||
231 | if (sdata->vif.type == NL80211_IFTYPE_AP) | ||
232 | memcpy(mgmt->bssid, sdata->dev->dev_addr, ETH_ALEN); | ||
233 | else | ||
234 | memcpy(mgmt->bssid, ifsta->bssid, ETH_ALEN); | ||
235 | mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | | ||
236 | IEEE80211_STYPE_ACTION); | ||
237 | |||
238 | skb_put(skb, 1 + sizeof(mgmt->u.action.u.addba_resp)); | ||
239 | mgmt->u.action.category = WLAN_CATEGORY_BACK; | ||
240 | mgmt->u.action.u.addba_resp.action_code = WLAN_ACTION_ADDBA_RESP; | ||
241 | mgmt->u.action.u.addba_resp.dialog_token = dialog_token; | ||
242 | |||
243 | capab = (u16)(policy << 1); /* bit 1 aggregation policy */ | ||
244 | capab |= (u16)(tid << 2); /* bit 5:2 TID number */ | ||
245 | capab |= (u16)(buf_size << 6); /* bit 15:6 max size of aggregation */ | ||
246 | |||
247 | mgmt->u.action.u.addba_resp.capab = cpu_to_le16(capab); | ||
248 | mgmt->u.action.u.addba_resp.timeout = cpu_to_le16(timeout); | ||
249 | mgmt->u.action.u.addba_resp.status = cpu_to_le16(status); | ||
250 | |||
251 | ieee80211_tx_skb(sdata, skb, 1); | ||
252 | } | 168 | } |
253 | 169 | ||
254 | static void ieee80211_send_delba(struct ieee80211_sub_if_data *sdata, | 170 | void ieee80211_send_delba(struct ieee80211_sub_if_data *sdata, |
255 | const u8 *da, u16 tid, | 171 | const u8 *da, u16 tid, |
256 | u16 initiator, u16 reason_code) | 172 | u16 initiator, u16 reason_code) |
257 | { | 173 | { |
258 | struct ieee80211_local *local = sdata->local; | 174 | struct ieee80211_local *local = sdata->local; |
259 | struct ieee80211_if_sta *ifsta = &sdata->u.sta; | 175 | struct ieee80211_if_sta *ifsta = &sdata->u.sta; |
@@ -294,767 +210,6 @@ static void ieee80211_send_delba(struct ieee80211_sub_if_data *sdata, | |||
294 | ieee80211_tx_skb(sdata, skb, 1); | 210 | ieee80211_tx_skb(sdata, skb, 1); |
295 | } | 211 | } |
296 | 212 | ||
297 | void ieee80211_send_bar(struct ieee80211_sub_if_data *sdata, u8 *ra, u16 tid, u16 ssn) | ||
298 | { | ||
299 | struct ieee80211_local *local = sdata->local; | ||
300 | struct sk_buff *skb; | ||
301 | struct ieee80211_bar *bar; | ||
302 | u16 bar_control = 0; | ||
303 | |||
304 | skb = dev_alloc_skb(sizeof(*bar) + local->hw.extra_tx_headroom); | ||
305 | if (!skb) { | ||
306 | printk(KERN_ERR "%s: failed to allocate buffer for " | ||
307 | "bar frame\n", sdata->dev->name); | ||
308 | return; | ||
309 | } | ||
310 | skb_reserve(skb, local->hw.extra_tx_headroom); | ||
311 | bar = (struct ieee80211_bar *)skb_put(skb, sizeof(*bar)); | ||
312 | memset(bar, 0, sizeof(*bar)); | ||
313 | bar->frame_control = cpu_to_le16(IEEE80211_FTYPE_CTL | | ||
314 | IEEE80211_STYPE_BACK_REQ); | ||
315 | memcpy(bar->ra, ra, ETH_ALEN); | ||
316 | memcpy(bar->ta, sdata->dev->dev_addr, ETH_ALEN); | ||
317 | bar_control |= (u16)IEEE80211_BAR_CTRL_ACK_POLICY_NORMAL; | ||
318 | bar_control |= (u16)IEEE80211_BAR_CTRL_CBMTID_COMPRESSED_BA; | ||
319 | bar_control |= (u16)(tid << 12); | ||
320 | bar->control = cpu_to_le16(bar_control); | ||
321 | bar->start_seq_num = cpu_to_le16(ssn); | ||
322 | |||
323 | ieee80211_tx_skb(sdata, skb, 0); | ||
324 | } | ||
325 | |||
326 | void ieee80211_sta_stop_rx_ba_session(struct ieee80211_sub_if_data *sdata, u8 *ra, u16 tid, | ||
327 | u16 initiator, u16 reason) | ||
328 | { | ||
329 | struct ieee80211_local *local = sdata->local; | ||
330 | struct ieee80211_hw *hw = &local->hw; | ||
331 | struct sta_info *sta; | ||
332 | int ret, i; | ||
333 | |||
334 | rcu_read_lock(); | ||
335 | |||
336 | sta = sta_info_get(local, ra); | ||
337 | if (!sta) { | ||
338 | rcu_read_unlock(); | ||
339 | return; | ||
340 | } | ||
341 | |||
342 | /* check if TID is in operational state */ | ||
343 | spin_lock_bh(&sta->lock); | ||
344 | if (sta->ampdu_mlme.tid_state_rx[tid] | ||
345 | != HT_AGG_STATE_OPERATIONAL) { | ||
346 | spin_unlock_bh(&sta->lock); | ||
347 | rcu_read_unlock(); | ||
348 | return; | ||
349 | } | ||
350 | sta->ampdu_mlme.tid_state_rx[tid] = | ||
351 | HT_AGG_STATE_REQ_STOP_BA_MSK | | ||
352 | (initiator << HT_AGG_STATE_INITIATOR_SHIFT); | ||
353 | spin_unlock_bh(&sta->lock); | ||
354 | |||
355 | /* stop HW Rx aggregation. ampdu_action existence | ||
356 | * already verified in session init so we add the BUG_ON */ | ||
357 | BUG_ON(!local->ops->ampdu_action); | ||
358 | |||
359 | #ifdef CONFIG_MAC80211_HT_DEBUG | ||
360 | printk(KERN_DEBUG "Rx BA session stop requested for %pM tid %u\n", | ||
361 | ra, tid); | ||
362 | #endif /* CONFIG_MAC80211_HT_DEBUG */ | ||
363 | |||
364 | ret = local->ops->ampdu_action(hw, IEEE80211_AMPDU_RX_STOP, | ||
365 | &sta->sta, tid, NULL); | ||
366 | if (ret) | ||
367 | printk(KERN_DEBUG "HW problem - can not stop rx " | ||
368 | "aggregation for tid %d\n", tid); | ||
369 | |||
370 | /* shutdown timer has not expired */ | ||
371 | if (initiator != WLAN_BACK_TIMER) | ||
372 | del_timer_sync(&sta->ampdu_mlme.tid_rx[tid]->session_timer); | ||
373 | |||
374 | /* check if this is a self generated aggregation halt */ | ||
375 | if (initiator == WLAN_BACK_RECIPIENT || initiator == WLAN_BACK_TIMER) | ||
376 | ieee80211_send_delba(sdata, ra, tid, 0, reason); | ||
377 | |||
378 | /* free the reordering buffer */ | ||
379 | for (i = 0; i < sta->ampdu_mlme.tid_rx[tid]->buf_size; i++) { | ||
380 | if (sta->ampdu_mlme.tid_rx[tid]->reorder_buf[i]) { | ||
381 | /* release the reordered frames */ | ||
382 | dev_kfree_skb(sta->ampdu_mlme.tid_rx[tid]->reorder_buf[i]); | ||
383 | sta->ampdu_mlme.tid_rx[tid]->stored_mpdu_num--; | ||
384 | sta->ampdu_mlme.tid_rx[tid]->reorder_buf[i] = NULL; | ||
385 | } | ||
386 | } | ||
387 | /* free resources */ | ||
388 | kfree(sta->ampdu_mlme.tid_rx[tid]->reorder_buf); | ||
389 | kfree(sta->ampdu_mlme.tid_rx[tid]); | ||
390 | sta->ampdu_mlme.tid_rx[tid] = NULL; | ||
391 | sta->ampdu_mlme.tid_state_rx[tid] = HT_AGG_STATE_IDLE; | ||
392 | |||
393 | rcu_read_unlock(); | ||
394 | } | ||
395 | |||
396 | |||
397 | /* | ||
398 | * After sending add Block Ack request we activated a timer until | ||
399 | * add Block Ack response will arrive from the recipient. | ||
400 | * If this timer expires sta_addba_resp_timer_expired will be executed. | ||
401 | */ | ||
402 | static void sta_addba_resp_timer_expired(unsigned long data) | ||
403 | { | ||
404 | /* not an elegant detour, but there is no choice as the timer passes | ||
405 | * only one argument, and both sta_info and TID are needed, so init | ||
406 | * flow in sta_info_create gives the TID as data, while the timer_to_id | ||
407 | * array gives the sta through container_of */ | ||
408 | u16 tid = *(u8 *)data; | ||
409 | struct sta_info *temp_sta = container_of((void *)data, | ||
410 | struct sta_info, timer_to_tid[tid]); | ||
411 | |||
412 | struct ieee80211_local *local = temp_sta->local; | ||
413 | struct ieee80211_hw *hw = &local->hw; | ||
414 | struct sta_info *sta; | ||
415 | u8 *state; | ||
416 | |||
417 | rcu_read_lock(); | ||
418 | |||
419 | sta = sta_info_get(local, temp_sta->sta.addr); | ||
420 | if (!sta) { | ||
421 | rcu_read_unlock(); | ||
422 | return; | ||
423 | } | ||
424 | |||
425 | state = &sta->ampdu_mlme.tid_state_tx[tid]; | ||
426 | /* check if the TID waits for addBA response */ | ||
427 | spin_lock_bh(&sta->lock); | ||
428 | if (!(*state & HT_ADDBA_REQUESTED_MSK)) { | ||
429 | spin_unlock_bh(&sta->lock); | ||
430 | *state = HT_AGG_STATE_IDLE; | ||
431 | #ifdef CONFIG_MAC80211_HT_DEBUG | ||
432 | printk(KERN_DEBUG "timer expired on tid %d but we are not " | ||
433 | "expecting addBA response there", tid); | ||
434 | #endif | ||
435 | goto timer_expired_exit; | ||
436 | } | ||
437 | |||
438 | #ifdef CONFIG_MAC80211_HT_DEBUG | ||
439 | printk(KERN_DEBUG "addBA response timer expired on tid %d\n", tid); | ||
440 | #endif | ||
441 | |||
442 | /* go through the state check in stop_BA_session */ | ||
443 | *state = HT_AGG_STATE_OPERATIONAL; | ||
444 | spin_unlock_bh(&sta->lock); | ||
445 | ieee80211_stop_tx_ba_session(hw, temp_sta->sta.addr, tid, | ||
446 | WLAN_BACK_INITIATOR); | ||
447 | |||
448 | timer_expired_exit: | ||
449 | rcu_read_unlock(); | ||
450 | } | ||
451 | |||
452 | void ieee80211_sta_tear_down_BA_sessions(struct ieee80211_sub_if_data *sdata, u8 *addr) | ||
453 | { | ||
454 | struct ieee80211_local *local = sdata->local; | ||
455 | int i; | ||
456 | |||
457 | for (i = 0; i < STA_TID_NUM; i++) { | ||
458 | ieee80211_stop_tx_ba_session(&local->hw, addr, i, | ||
459 | WLAN_BACK_INITIATOR); | ||
460 | ieee80211_sta_stop_rx_ba_session(sdata, addr, i, | ||
461 | WLAN_BACK_RECIPIENT, | ||
462 | WLAN_REASON_QSTA_LEAVE_QBSS); | ||
463 | } | ||
464 | } | ||
465 | |||
466 | int ieee80211_start_tx_ba_session(struct ieee80211_hw *hw, u8 *ra, u16 tid) | ||
467 | { | ||
468 | struct ieee80211_local *local = hw_to_local(hw); | ||
469 | struct sta_info *sta; | ||
470 | struct ieee80211_sub_if_data *sdata; | ||
471 | u16 start_seq_num; | ||
472 | u8 *state; | ||
473 | int ret = 0; | ||
474 | |||
475 | if ((tid >= STA_TID_NUM) || !(hw->flags & IEEE80211_HW_AMPDU_AGGREGATION)) | ||
476 | return -EINVAL; | ||
477 | |||
478 | #ifdef CONFIG_MAC80211_HT_DEBUG | ||
479 | printk(KERN_DEBUG "Open BA session requested for %pM tid %u\n", | ||
480 | ra, tid); | ||
481 | #endif /* CONFIG_MAC80211_HT_DEBUG */ | ||
482 | |||
483 | rcu_read_lock(); | ||
484 | |||
485 | sta = sta_info_get(local, ra); | ||
486 | if (!sta) { | ||
487 | #ifdef CONFIG_MAC80211_HT_DEBUG | ||
488 | printk(KERN_DEBUG "Could not find the station\n"); | ||
489 | #endif | ||
490 | ret = -ENOENT; | ||
491 | goto exit; | ||
492 | } | ||
493 | |||
494 | spin_lock_bh(&sta->lock); | ||
495 | |||
496 | /* we have tried too many times, receiver does not want A-MPDU */ | ||
497 | if (sta->ampdu_mlme.addba_req_num[tid] > HT_AGG_MAX_RETRIES) { | ||
498 | ret = -EBUSY; | ||
499 | goto err_unlock_sta; | ||
500 | } | ||
501 | |||
502 | state = &sta->ampdu_mlme.tid_state_tx[tid]; | ||
503 | /* check if the TID is not in aggregation flow already */ | ||
504 | if (*state != HT_AGG_STATE_IDLE) { | ||
505 | #ifdef CONFIG_MAC80211_HT_DEBUG | ||
506 | printk(KERN_DEBUG "BA request denied - session is not " | ||
507 | "idle on tid %u\n", tid); | ||
508 | #endif /* CONFIG_MAC80211_HT_DEBUG */ | ||
509 | ret = -EAGAIN; | ||
510 | goto err_unlock_sta; | ||
511 | } | ||
512 | |||
513 | /* prepare A-MPDU MLME for Tx aggregation */ | ||
514 | sta->ampdu_mlme.tid_tx[tid] = | ||
515 | kmalloc(sizeof(struct tid_ampdu_tx), GFP_ATOMIC); | ||
516 | if (!sta->ampdu_mlme.tid_tx[tid]) { | ||
517 | #ifdef CONFIG_MAC80211_HT_DEBUG | ||
518 | if (net_ratelimit()) | ||
519 | printk(KERN_ERR "allocate tx mlme to tid %d failed\n", | ||
520 | tid); | ||
521 | #endif | ||
522 | ret = -ENOMEM; | ||
523 | goto err_unlock_sta; | ||
524 | } | ||
525 | /* Tx timer */ | ||
526 | sta->ampdu_mlme.tid_tx[tid]->addba_resp_timer.function = | ||
527 | sta_addba_resp_timer_expired; | ||
528 | sta->ampdu_mlme.tid_tx[tid]->addba_resp_timer.data = | ||
529 | (unsigned long)&sta->timer_to_tid[tid]; | ||
530 | init_timer(&sta->ampdu_mlme.tid_tx[tid]->addba_resp_timer); | ||
531 | |||
532 | if (hw->ampdu_queues) { | ||
533 | /* create a new queue for this aggregation */ | ||
534 | ret = ieee80211_ht_agg_queue_add(local, sta, tid); | ||
535 | |||
536 | /* case no queue is available to aggregation | ||
537 | * don't switch to aggregation */ | ||
538 | if (ret) { | ||
539 | #ifdef CONFIG_MAC80211_HT_DEBUG | ||
540 | printk(KERN_DEBUG "BA request denied - " | ||
541 | "queue unavailable for tid %d\n", tid); | ||
542 | #endif /* CONFIG_MAC80211_HT_DEBUG */ | ||
543 | goto err_unlock_queue; | ||
544 | } | ||
545 | } | ||
546 | sdata = sta->sdata; | ||
547 | |||
548 | /* Ok, the Addba frame hasn't been sent yet, but if the driver calls the | ||
549 | * call back right away, it must see that the flow has begun */ | ||
550 | *state |= HT_ADDBA_REQUESTED_MSK; | ||
551 | |||
552 | /* This is slightly racy because the queue isn't stopped */ | ||
553 | start_seq_num = sta->tid_seq[tid]; | ||
554 | |||
555 | if (local->ops->ampdu_action) | ||
556 | ret = local->ops->ampdu_action(hw, IEEE80211_AMPDU_TX_START, | ||
557 | &sta->sta, tid, &start_seq_num); | ||
558 | |||
559 | if (ret) { | ||
560 | /* No need to requeue the packets in the agg queue, since we | ||
561 | * held the tx lock: no packet could be enqueued to the newly | ||
562 | * allocated queue */ | ||
563 | if (hw->ampdu_queues) | ||
564 | ieee80211_ht_agg_queue_remove(local, sta, tid, 0); | ||
565 | #ifdef CONFIG_MAC80211_HT_DEBUG | ||
566 | printk(KERN_DEBUG "BA request denied - HW unavailable for" | ||
567 | " tid %d\n", tid); | ||
568 | #endif /* CONFIG_MAC80211_HT_DEBUG */ | ||
569 | *state = HT_AGG_STATE_IDLE; | ||
570 | goto err_unlock_queue; | ||
571 | } | ||
572 | |||
573 | /* Will put all the packets in the new SW queue */ | ||
574 | if (hw->ampdu_queues) | ||
575 | ieee80211_requeue(local, ieee802_1d_to_ac[tid]); | ||
576 | spin_unlock_bh(&sta->lock); | ||
577 | |||
578 | /* send an addBA request */ | ||
579 | sta->ampdu_mlme.dialog_token_allocator++; | ||
580 | sta->ampdu_mlme.tid_tx[tid]->dialog_token = | ||
581 | sta->ampdu_mlme.dialog_token_allocator; | ||
582 | sta->ampdu_mlme.tid_tx[tid]->ssn = start_seq_num; | ||
583 | |||
584 | |||
585 | ieee80211_send_addba_request(sta->sdata, ra, tid, | ||
586 | sta->ampdu_mlme.tid_tx[tid]->dialog_token, | ||
587 | sta->ampdu_mlme.tid_tx[tid]->ssn, | ||
588 | 0x40, 5000); | ||
589 | /* activate the timer for the recipient's addBA response */ | ||
590 | sta->ampdu_mlme.tid_tx[tid]->addba_resp_timer.expires = | ||
591 | jiffies + ADDBA_RESP_INTERVAL; | ||
592 | add_timer(&sta->ampdu_mlme.tid_tx[tid]->addba_resp_timer); | ||
593 | #ifdef CONFIG_MAC80211_HT_DEBUG | ||
594 | printk(KERN_DEBUG "activated addBA response timer on tid %d\n", tid); | ||
595 | #endif | ||
596 | goto exit; | ||
597 | |||
598 | err_unlock_queue: | ||
599 | kfree(sta->ampdu_mlme.tid_tx[tid]); | ||
600 | sta->ampdu_mlme.tid_tx[tid] = NULL; | ||
601 | ret = -EBUSY; | ||
602 | err_unlock_sta: | ||
603 | spin_unlock_bh(&sta->lock); | ||
604 | exit: | ||
605 | rcu_read_unlock(); | ||
606 | return ret; | ||
607 | } | ||
608 | EXPORT_SYMBOL(ieee80211_start_tx_ba_session); | ||
609 | |||
610 | int ieee80211_stop_tx_ba_session(struct ieee80211_hw *hw, | ||
611 | u8 *ra, u16 tid, | ||
612 | enum ieee80211_back_parties initiator) | ||
613 | { | ||
614 | struct ieee80211_local *local = hw_to_local(hw); | ||
615 | struct sta_info *sta; | ||
616 | u8 *state; | ||
617 | int ret = 0; | ||
618 | |||
619 | if (tid >= STA_TID_NUM) | ||
620 | return -EINVAL; | ||
621 | |||
622 | rcu_read_lock(); | ||
623 | sta = sta_info_get(local, ra); | ||
624 | if (!sta) { | ||
625 | rcu_read_unlock(); | ||
626 | return -ENOENT; | ||
627 | } | ||
628 | |||
629 | /* check if the TID is in aggregation */ | ||
630 | state = &sta->ampdu_mlme.tid_state_tx[tid]; | ||
631 | spin_lock_bh(&sta->lock); | ||
632 | |||
633 | if (*state != HT_AGG_STATE_OPERATIONAL) { | ||
634 | ret = -ENOENT; | ||
635 | goto stop_BA_exit; | ||
636 | } | ||
637 | |||
638 | #ifdef CONFIG_MAC80211_HT_DEBUG | ||
639 | printk(KERN_DEBUG "Tx BA session stop requested for %pM tid %u\n", | ||
640 | ra, tid); | ||
641 | #endif /* CONFIG_MAC80211_HT_DEBUG */ | ||
642 | |||
643 | if (hw->ampdu_queues) | ||
644 | ieee80211_stop_queue(hw, sta->tid_to_tx_q[tid]); | ||
645 | |||
646 | *state = HT_AGG_STATE_REQ_STOP_BA_MSK | | ||
647 | (initiator << HT_AGG_STATE_INITIATOR_SHIFT); | ||
648 | |||
649 | if (local->ops->ampdu_action) | ||
650 | ret = local->ops->ampdu_action(hw, IEEE80211_AMPDU_TX_STOP, | ||
651 | &sta->sta, tid, NULL); | ||
652 | |||
653 | /* case HW denied going back to legacy */ | ||
654 | if (ret) { | ||
655 | WARN_ON(ret != -EBUSY); | ||
656 | *state = HT_AGG_STATE_OPERATIONAL; | ||
657 | if (hw->ampdu_queues) | ||
658 | ieee80211_wake_queue(hw, sta->tid_to_tx_q[tid]); | ||
659 | goto stop_BA_exit; | ||
660 | } | ||
661 | |||
662 | stop_BA_exit: | ||
663 | spin_unlock_bh(&sta->lock); | ||
664 | rcu_read_unlock(); | ||
665 | return ret; | ||
666 | } | ||
667 | EXPORT_SYMBOL(ieee80211_stop_tx_ba_session); | ||
668 | |||
669 | void ieee80211_start_tx_ba_cb(struct ieee80211_hw *hw, u8 *ra, u16 tid) | ||
670 | { | ||
671 | struct ieee80211_local *local = hw_to_local(hw); | ||
672 | struct sta_info *sta; | ||
673 | u8 *state; | ||
674 | |||
675 | if (tid >= STA_TID_NUM) { | ||
676 | #ifdef CONFIG_MAC80211_HT_DEBUG | ||
677 | printk(KERN_DEBUG "Bad TID value: tid = %d (>= %d)\n", | ||
678 | tid, STA_TID_NUM); | ||
679 | #endif | ||
680 | return; | ||
681 | } | ||
682 | |||
683 | rcu_read_lock(); | ||
684 | sta = sta_info_get(local, ra); | ||
685 | if (!sta) { | ||
686 | rcu_read_unlock(); | ||
687 | #ifdef CONFIG_MAC80211_HT_DEBUG | ||
688 | printk(KERN_DEBUG "Could not find station: %pM\n", ra); | ||
689 | #endif | ||
690 | return; | ||
691 | } | ||
692 | |||
693 | state = &sta->ampdu_mlme.tid_state_tx[tid]; | ||
694 | spin_lock_bh(&sta->lock); | ||
695 | |||
696 | if (!(*state & HT_ADDBA_REQUESTED_MSK)) { | ||
697 | #ifdef CONFIG_MAC80211_HT_DEBUG | ||
698 | printk(KERN_DEBUG "addBA was not requested yet, state is %d\n", | ||
699 | *state); | ||
700 | #endif | ||
701 | spin_unlock_bh(&sta->lock); | ||
702 | rcu_read_unlock(); | ||
703 | return; | ||
704 | } | ||
705 | |||
706 | WARN_ON_ONCE(*state & HT_ADDBA_DRV_READY_MSK); | ||
707 | |||
708 | *state |= HT_ADDBA_DRV_READY_MSK; | ||
709 | |||
710 | if (*state == HT_AGG_STATE_OPERATIONAL) { | ||
711 | #ifdef CONFIG_MAC80211_HT_DEBUG | ||
712 | printk(KERN_DEBUG "Aggregation is on for tid %d \n", tid); | ||
713 | #endif | ||
714 | if (hw->ampdu_queues) | ||
715 | ieee80211_wake_queue(hw, sta->tid_to_tx_q[tid]); | ||
716 | } | ||
717 | spin_unlock_bh(&sta->lock); | ||
718 | rcu_read_unlock(); | ||
719 | } | ||
720 | EXPORT_SYMBOL(ieee80211_start_tx_ba_cb); | ||
721 | |||
722 | void ieee80211_stop_tx_ba_cb(struct ieee80211_hw *hw, u8 *ra, u8 tid) | ||
723 | { | ||
724 | struct ieee80211_local *local = hw_to_local(hw); | ||
725 | struct sta_info *sta; | ||
726 | u8 *state; | ||
727 | int agg_queue; | ||
728 | |||
729 | if (tid >= STA_TID_NUM) { | ||
730 | #ifdef CONFIG_MAC80211_HT_DEBUG | ||
731 | printk(KERN_DEBUG "Bad TID value: tid = %d (>= %d)\n", | ||
732 | tid, STA_TID_NUM); | ||
733 | #endif | ||
734 | return; | ||
735 | } | ||
736 | |||
737 | #ifdef CONFIG_MAC80211_HT_DEBUG | ||
738 | printk(KERN_DEBUG "Stopping Tx BA session for %pM tid %d\n", | ||
739 | ra, tid); | ||
740 | #endif /* CONFIG_MAC80211_HT_DEBUG */ | ||
741 | |||
742 | rcu_read_lock(); | ||
743 | sta = sta_info_get(local, ra); | ||
744 | if (!sta) { | ||
745 | #ifdef CONFIG_MAC80211_HT_DEBUG | ||
746 | printk(KERN_DEBUG "Could not find station: %pM\n", ra); | ||
747 | #endif | ||
748 | rcu_read_unlock(); | ||
749 | return; | ||
750 | } | ||
751 | state = &sta->ampdu_mlme.tid_state_tx[tid]; | ||
752 | |||
753 | /* NOTE: no need to use sta->lock in this state check, as | ||
754 | * ieee80211_stop_tx_ba_session will let only one stop call to | ||
755 | * pass through per sta/tid | ||
756 | */ | ||
757 | if ((*state & HT_AGG_STATE_REQ_STOP_BA_MSK) == 0) { | ||
758 | #ifdef CONFIG_MAC80211_HT_DEBUG | ||
759 | printk(KERN_DEBUG "unexpected callback to A-MPDU stop\n"); | ||
760 | #endif | ||
761 | rcu_read_unlock(); | ||
762 | return; | ||
763 | } | ||
764 | |||
765 | if (*state & HT_AGG_STATE_INITIATOR_MSK) | ||
766 | ieee80211_send_delba(sta->sdata, ra, tid, | ||
767 | WLAN_BACK_INITIATOR, WLAN_REASON_QSTA_NOT_USE); | ||
768 | |||
769 | if (hw->ampdu_queues) { | ||
770 | agg_queue = sta->tid_to_tx_q[tid]; | ||
771 | ieee80211_ht_agg_queue_remove(local, sta, tid, 1); | ||
772 | |||
773 | /* We just requeued the all the frames that were in the | ||
774 | * removed queue, and since we might miss a softirq we do | ||
775 | * netif_schedule_queue. ieee80211_wake_queue is not used | ||
776 | * here as this queue is not necessarily stopped | ||
777 | */ | ||
778 | netif_schedule_queue(netdev_get_tx_queue(local->mdev, | ||
779 | agg_queue)); | ||
780 | } | ||
781 | spin_lock_bh(&sta->lock); | ||
782 | *state = HT_AGG_STATE_IDLE; | ||
783 | sta->ampdu_mlme.addba_req_num[tid] = 0; | ||
784 | kfree(sta->ampdu_mlme.tid_tx[tid]); | ||
785 | sta->ampdu_mlme.tid_tx[tid] = NULL; | ||
786 | spin_unlock_bh(&sta->lock); | ||
787 | |||
788 | rcu_read_unlock(); | ||
789 | } | ||
790 | EXPORT_SYMBOL(ieee80211_stop_tx_ba_cb); | ||
791 | |||
792 | void ieee80211_start_tx_ba_cb_irqsafe(struct ieee80211_hw *hw, | ||
793 | const u8 *ra, u16 tid) | ||
794 | { | ||
795 | struct ieee80211_local *local = hw_to_local(hw); | ||
796 | struct ieee80211_ra_tid *ra_tid; | ||
797 | struct sk_buff *skb = dev_alloc_skb(0); | ||
798 | |||
799 | if (unlikely(!skb)) { | ||
800 | #ifdef CONFIG_MAC80211_HT_DEBUG | ||
801 | if (net_ratelimit()) | ||
802 | printk(KERN_WARNING "%s: Not enough memory, " | ||
803 | "dropping start BA session", skb->dev->name); | ||
804 | #endif | ||
805 | return; | ||
806 | } | ||
807 | ra_tid = (struct ieee80211_ra_tid *) &skb->cb; | ||
808 | memcpy(&ra_tid->ra, ra, ETH_ALEN); | ||
809 | ra_tid->tid = tid; | ||
810 | |||
811 | skb->pkt_type = IEEE80211_ADDBA_MSG; | ||
812 | skb_queue_tail(&local->skb_queue, skb); | ||
813 | tasklet_schedule(&local->tasklet); | ||
814 | } | ||
815 | EXPORT_SYMBOL(ieee80211_start_tx_ba_cb_irqsafe); | ||
816 | |||
817 | void ieee80211_stop_tx_ba_cb_irqsafe(struct ieee80211_hw *hw, | ||
818 | const u8 *ra, u16 tid) | ||
819 | { | ||
820 | struct ieee80211_local *local = hw_to_local(hw); | ||
821 | struct ieee80211_ra_tid *ra_tid; | ||
822 | struct sk_buff *skb = dev_alloc_skb(0); | ||
823 | |||
824 | if (unlikely(!skb)) { | ||
825 | #ifdef CONFIG_MAC80211_HT_DEBUG | ||
826 | if (net_ratelimit()) | ||
827 | printk(KERN_WARNING "%s: Not enough memory, " | ||
828 | "dropping stop BA session", skb->dev->name); | ||
829 | #endif | ||
830 | return; | ||
831 | } | ||
832 | ra_tid = (struct ieee80211_ra_tid *) &skb->cb; | ||
833 | memcpy(&ra_tid->ra, ra, ETH_ALEN); | ||
834 | ra_tid->tid = tid; | ||
835 | |||
836 | skb->pkt_type = IEEE80211_DELBA_MSG; | ||
837 | skb_queue_tail(&local->skb_queue, skb); | ||
838 | tasklet_schedule(&local->tasklet); | ||
839 | } | ||
840 | EXPORT_SYMBOL(ieee80211_stop_tx_ba_cb_irqsafe); | ||
841 | |||
842 | /* | ||
843 | * After accepting the AddBA Request we activated a timer, | ||
844 | * resetting it after each frame that arrives from the originator. | ||
845 | * if this timer expires ieee80211_sta_stop_rx_ba_session will be executed. | ||
846 | */ | ||
847 | static void sta_rx_agg_session_timer_expired(unsigned long data) | ||
848 | { | ||
849 | /* not an elegant detour, but there is no choice as the timer passes | ||
850 | * only one argument, and various sta_info are needed here, so init | ||
851 | * flow in sta_info_create gives the TID as data, while the timer_to_id | ||
852 | * array gives the sta through container_of */ | ||
853 | u8 *ptid = (u8 *)data; | ||
854 | u8 *timer_to_id = ptid - *ptid; | ||
855 | struct sta_info *sta = container_of(timer_to_id, struct sta_info, | ||
856 | timer_to_tid[0]); | ||
857 | |||
858 | #ifdef CONFIG_MAC80211_HT_DEBUG | ||
859 | printk(KERN_DEBUG "rx session timer expired on tid %d\n", (u16)*ptid); | ||
860 | #endif | ||
861 | ieee80211_sta_stop_rx_ba_session(sta->sdata, sta->sta.addr, | ||
862 | (u16)*ptid, WLAN_BACK_TIMER, | ||
863 | WLAN_REASON_QSTA_TIMEOUT); | ||
864 | } | ||
865 | |||
866 | void ieee80211_process_addba_request(struct ieee80211_local *local, | ||
867 | struct sta_info *sta, | ||
868 | struct ieee80211_mgmt *mgmt, | ||
869 | size_t len) | ||
870 | { | ||
871 | struct ieee80211_hw *hw = &local->hw; | ||
872 | struct ieee80211_conf *conf = &hw->conf; | ||
873 | struct tid_ampdu_rx *tid_agg_rx; | ||
874 | u16 capab, tid, timeout, ba_policy, buf_size, start_seq_num, status; | ||
875 | u8 dialog_token; | ||
876 | int ret = -EOPNOTSUPP; | ||
877 | |||
878 | /* extract session parameters from addba request frame */ | ||
879 | dialog_token = mgmt->u.action.u.addba_req.dialog_token; | ||
880 | timeout = le16_to_cpu(mgmt->u.action.u.addba_req.timeout); | ||
881 | start_seq_num = | ||
882 | le16_to_cpu(mgmt->u.action.u.addba_req.start_seq_num) >> 4; | ||
883 | |||
884 | capab = le16_to_cpu(mgmt->u.action.u.addba_req.capab); | ||
885 | ba_policy = (capab & IEEE80211_ADDBA_PARAM_POLICY_MASK) >> 1; | ||
886 | tid = (capab & IEEE80211_ADDBA_PARAM_TID_MASK) >> 2; | ||
887 | buf_size = (capab & IEEE80211_ADDBA_PARAM_BUF_SIZE_MASK) >> 6; | ||
888 | |||
889 | status = WLAN_STATUS_REQUEST_DECLINED; | ||
890 | |||
891 | /* sanity check for incoming parameters: | ||
892 | * check if configuration can support the BA policy | ||
893 | * and if buffer size does not exceeds max value */ | ||
894 | /* XXX: check own ht delayed BA capability?? */ | ||
895 | if (((ba_policy != 1) | ||
896 | && (!(sta->sta.ht_cap.cap & IEEE80211_HT_CAP_DELAY_BA))) | ||
897 | || (buf_size > IEEE80211_MAX_AMPDU_BUF)) { | ||
898 | status = WLAN_STATUS_INVALID_QOS_PARAM; | ||
899 | #ifdef CONFIG_MAC80211_HT_DEBUG | ||
900 | if (net_ratelimit()) | ||
901 | printk(KERN_DEBUG "AddBA Req with bad params from " | ||
902 | "%pM on tid %u. policy %d, buffer size %d\n", | ||
903 | mgmt->sa, tid, ba_policy, | ||
904 | buf_size); | ||
905 | #endif /* CONFIG_MAC80211_HT_DEBUG */ | ||
906 | goto end_no_lock; | ||
907 | } | ||
908 | /* determine default buffer size */ | ||
909 | if (buf_size == 0) { | ||
910 | struct ieee80211_supported_band *sband; | ||
911 | |||
912 | sband = local->hw.wiphy->bands[conf->channel->band]; | ||
913 | buf_size = IEEE80211_MIN_AMPDU_BUF; | ||
914 | buf_size = buf_size << sband->ht_cap.ampdu_factor; | ||
915 | } | ||
916 | |||
917 | |||
918 | /* examine state machine */ | ||
919 | spin_lock_bh(&sta->lock); | ||
920 | |||
921 | if (sta->ampdu_mlme.tid_state_rx[tid] != HT_AGG_STATE_IDLE) { | ||
922 | #ifdef CONFIG_MAC80211_HT_DEBUG | ||
923 | if (net_ratelimit()) | ||
924 | printk(KERN_DEBUG "unexpected AddBA Req from " | ||
925 | "%pM on tid %u\n", | ||
926 | mgmt->sa, tid); | ||
927 | #endif /* CONFIG_MAC80211_HT_DEBUG */ | ||
928 | goto end; | ||
929 | } | ||
930 | |||
931 | /* prepare A-MPDU MLME for Rx aggregation */ | ||
932 | sta->ampdu_mlme.tid_rx[tid] = | ||
933 | kmalloc(sizeof(struct tid_ampdu_rx), GFP_ATOMIC); | ||
934 | if (!sta->ampdu_mlme.tid_rx[tid]) { | ||
935 | #ifdef CONFIG_MAC80211_HT_DEBUG | ||
936 | if (net_ratelimit()) | ||
937 | printk(KERN_ERR "allocate rx mlme to tid %d failed\n", | ||
938 | tid); | ||
939 | #endif | ||
940 | goto end; | ||
941 | } | ||
942 | /* rx timer */ | ||
943 | sta->ampdu_mlme.tid_rx[tid]->session_timer.function = | ||
944 | sta_rx_agg_session_timer_expired; | ||
945 | sta->ampdu_mlme.tid_rx[tid]->session_timer.data = | ||
946 | (unsigned long)&sta->timer_to_tid[tid]; | ||
947 | init_timer(&sta->ampdu_mlme.tid_rx[tid]->session_timer); | ||
948 | |||
949 | tid_agg_rx = sta->ampdu_mlme.tid_rx[tid]; | ||
950 | |||
951 | /* prepare reordering buffer */ | ||
952 | tid_agg_rx->reorder_buf = | ||
953 | kcalloc(buf_size, sizeof(struct sk_buff *), GFP_ATOMIC); | ||
954 | if (!tid_agg_rx->reorder_buf) { | ||
955 | #ifdef CONFIG_MAC80211_HT_DEBUG | ||
956 | if (net_ratelimit()) | ||
957 | printk(KERN_ERR "can not allocate reordering buffer " | ||
958 | "to tid %d\n", tid); | ||
959 | #endif | ||
960 | kfree(sta->ampdu_mlme.tid_rx[tid]); | ||
961 | goto end; | ||
962 | } | ||
963 | |||
964 | if (local->ops->ampdu_action) | ||
965 | ret = local->ops->ampdu_action(hw, IEEE80211_AMPDU_RX_START, | ||
966 | &sta->sta, tid, &start_seq_num); | ||
967 | #ifdef CONFIG_MAC80211_HT_DEBUG | ||
968 | printk(KERN_DEBUG "Rx A-MPDU request on tid %d result %d\n", tid, ret); | ||
969 | #endif /* CONFIG_MAC80211_HT_DEBUG */ | ||
970 | |||
971 | if (ret) { | ||
972 | kfree(tid_agg_rx->reorder_buf); | ||
973 | kfree(tid_agg_rx); | ||
974 | sta->ampdu_mlme.tid_rx[tid] = NULL; | ||
975 | goto end; | ||
976 | } | ||
977 | |||
978 | /* change state and send addba resp */ | ||
979 | sta->ampdu_mlme.tid_state_rx[tid] = HT_AGG_STATE_OPERATIONAL; | ||
980 | tid_agg_rx->dialog_token = dialog_token; | ||
981 | tid_agg_rx->ssn = start_seq_num; | ||
982 | tid_agg_rx->head_seq_num = start_seq_num; | ||
983 | tid_agg_rx->buf_size = buf_size; | ||
984 | tid_agg_rx->timeout = timeout; | ||
985 | tid_agg_rx->stored_mpdu_num = 0; | ||
986 | status = WLAN_STATUS_SUCCESS; | ||
987 | end: | ||
988 | spin_unlock_bh(&sta->lock); | ||
989 | |||
990 | end_no_lock: | ||
991 | ieee80211_send_addba_resp(sta->sdata, sta->sta.addr, tid, | ||
992 | dialog_token, status, 1, buf_size, timeout); | ||
993 | } | ||
994 | |||
995 | void ieee80211_process_addba_resp(struct ieee80211_local *local, | ||
996 | struct sta_info *sta, | ||
997 | struct ieee80211_mgmt *mgmt, | ||
998 | size_t len) | ||
999 | { | ||
1000 | struct ieee80211_hw *hw = &local->hw; | ||
1001 | u16 capab; | ||
1002 | u16 tid, start_seq_num; | ||
1003 | u8 *state; | ||
1004 | |||
1005 | capab = le16_to_cpu(mgmt->u.action.u.addba_resp.capab); | ||
1006 | tid = (capab & IEEE80211_ADDBA_PARAM_TID_MASK) >> 2; | ||
1007 | |||
1008 | state = &sta->ampdu_mlme.tid_state_tx[tid]; | ||
1009 | |||
1010 | spin_lock_bh(&sta->lock); | ||
1011 | |||
1012 | if (!(*state & HT_ADDBA_REQUESTED_MSK)) { | ||
1013 | spin_unlock_bh(&sta->lock); | ||
1014 | return; | ||
1015 | } | ||
1016 | |||
1017 | if (mgmt->u.action.u.addba_resp.dialog_token != | ||
1018 | sta->ampdu_mlme.tid_tx[tid]->dialog_token) { | ||
1019 | spin_unlock_bh(&sta->lock); | ||
1020 | #ifdef CONFIG_MAC80211_HT_DEBUG | ||
1021 | printk(KERN_DEBUG "wrong addBA response token, tid %d\n", tid); | ||
1022 | #endif /* CONFIG_MAC80211_HT_DEBUG */ | ||
1023 | return; | ||
1024 | } | ||
1025 | |||
1026 | del_timer_sync(&sta->ampdu_mlme.tid_tx[tid]->addba_resp_timer); | ||
1027 | #ifdef CONFIG_MAC80211_HT_DEBUG | ||
1028 | printk(KERN_DEBUG "switched off addBA timer for tid %d \n", tid); | ||
1029 | #endif /* CONFIG_MAC80211_HT_DEBUG */ | ||
1030 | if (le16_to_cpu(mgmt->u.action.u.addba_resp.status) | ||
1031 | == WLAN_STATUS_SUCCESS) { | ||
1032 | *state |= HT_ADDBA_RECEIVED_MSK; | ||
1033 | sta->ampdu_mlme.addba_req_num[tid] = 0; | ||
1034 | |||
1035 | if (*state == HT_AGG_STATE_OPERATIONAL && | ||
1036 | local->hw.ampdu_queues) | ||
1037 | ieee80211_wake_queue(hw, sta->tid_to_tx_q[tid]); | ||
1038 | |||
1039 | if (local->ops->ampdu_action) { | ||
1040 | (void)local->ops->ampdu_action(hw, | ||
1041 | IEEE80211_AMPDU_TX_RESUME, | ||
1042 | &sta->sta, tid, &start_seq_num); | ||
1043 | } | ||
1044 | #ifdef CONFIG_MAC80211_HT_DEBUG | ||
1045 | printk(KERN_DEBUG "Resuming TX aggregation for tid %d\n", tid); | ||
1046 | #endif /* CONFIG_MAC80211_HT_DEBUG */ | ||
1047 | spin_unlock_bh(&sta->lock); | ||
1048 | } else { | ||
1049 | sta->ampdu_mlme.addba_req_num[tid]++; | ||
1050 | /* this will allow the state check in stop_BA_session */ | ||
1051 | *state = HT_AGG_STATE_OPERATIONAL; | ||
1052 | spin_unlock_bh(&sta->lock); | ||
1053 | ieee80211_stop_tx_ba_session(hw, sta->sta.addr, tid, | ||
1054 | WLAN_BACK_INITIATOR); | ||
1055 | } | ||
1056 | } | ||
1057 | |||
1058 | void ieee80211_process_delba(struct ieee80211_sub_if_data *sdata, | 213 | void ieee80211_process_delba(struct ieee80211_sub_if_data *sdata, |
1059 | struct sta_info *sta, | 214 | struct sta_info *sta, |
1060 | struct ieee80211_mgmt *mgmt, size_t len) | 215 | struct ieee80211_mgmt *mgmt, size_t len) |
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h index 5b230015f938..6987dfa41c7f 100644 --- a/net/mac80211/ieee80211_i.h +++ b/net/mac80211/ieee80211_i.h | |||
@@ -987,6 +987,9 @@ u32 ieee80211_enable_ht(struct ieee80211_sub_if_data *sdata, | |||
987 | struct ieee80211_ht_info *hti, | 987 | struct ieee80211_ht_info *hti, |
988 | u16 ap_ht_cap_flags); | 988 | u16 ap_ht_cap_flags); |
989 | void ieee80211_send_bar(struct ieee80211_sub_if_data *sdata, u8 *ra, u16 tid, u16 ssn); | 989 | void ieee80211_send_bar(struct ieee80211_sub_if_data *sdata, u8 *ra, u16 tid, u16 ssn); |
990 | void ieee80211_send_delba(struct ieee80211_sub_if_data *sdata, | ||
991 | const u8 *da, u16 tid, | ||
992 | u16 initiator, u16 reason_code); | ||
990 | 993 | ||
991 | void ieee80211_sta_stop_rx_ba_session(struct ieee80211_sub_if_data *sdata, u8 *da, | 994 | void ieee80211_sta_stop_rx_ba_session(struct ieee80211_sub_if_data *sdata, u8 *da, |
992 | u16 tid, u16 initiator, u16 reason); | 995 | u16 tid, u16 initiator, u16 reason); |