diff options
Diffstat (limited to 'net/mac80211/sta_info.h')
-rw-r--r-- | net/mac80211/sta_info.h | 119 |
1 files changed, 68 insertions, 51 deletions
diff --git a/net/mac80211/sta_info.h b/net/mac80211/sta_info.h index ccc3adf962c7..822d84522937 100644 --- a/net/mac80211/sta_info.h +++ b/net/mac80211/sta_info.h | |||
@@ -12,6 +12,7 @@ | |||
12 | #include <linux/list.h> | 12 | #include <linux/list.h> |
13 | #include <linux/types.h> | 13 | #include <linux/types.h> |
14 | #include <linux/if_ether.h> | 14 | #include <linux/if_ether.h> |
15 | #include <linux/workqueue.h> | ||
15 | #include "key.h" | 16 | #include "key.h" |
16 | 17 | ||
17 | /** | 18 | /** |
@@ -21,7 +22,7 @@ | |||
21 | * | 22 | * |
22 | * @WLAN_STA_AUTH: Station is authenticated. | 23 | * @WLAN_STA_AUTH: Station is authenticated. |
23 | * @WLAN_STA_ASSOC: Station is associated. | 24 | * @WLAN_STA_ASSOC: Station is associated. |
24 | * @WLAN_STA_PS: Station is in power-save mode | 25 | * @WLAN_STA_PS_STA: Station is in power-save mode |
25 | * @WLAN_STA_AUTHORIZED: Station is authorized to send/receive traffic. | 26 | * @WLAN_STA_AUTHORIZED: Station is authorized to send/receive traffic. |
26 | * This bit is always checked so needs to be enabled for all stations | 27 | * This bit is always checked so needs to be enabled for all stations |
27 | * when virtual port control is not in use. | 28 | * when virtual port control is not in use. |
@@ -36,11 +37,19 @@ | |||
36 | * @WLAN_STA_MFP: Management frame protection is used with this STA. | 37 | * @WLAN_STA_MFP: Management frame protection is used with this STA. |
37 | * @WLAN_STA_SUSPEND: Set/cleared during a suspend/resume cycle. | 38 | * @WLAN_STA_SUSPEND: Set/cleared during a suspend/resume cycle. |
38 | * Used to deny ADDBA requests (both TX and RX). | 39 | * Used to deny ADDBA requests (both TX and RX). |
40 | * @WLAN_STA_PS_DRIVER: driver requires keeping this station in | ||
41 | * power-save mode logically to flush frames that might still | ||
42 | * be in the queues | ||
43 | * @WLAN_STA_PSPOLL: Station sent PS-poll while driver was keeping | ||
44 | * station in power-save mode, reply when the driver unblocks. | ||
45 | * @WLAN_STA_DISASSOC: Disassociation in progress. | ||
46 | * This is used to reject TX BA session requests when disassociation | ||
47 | * is in progress. | ||
39 | */ | 48 | */ |
40 | enum ieee80211_sta_info_flags { | 49 | enum ieee80211_sta_info_flags { |
41 | WLAN_STA_AUTH = 1<<0, | 50 | WLAN_STA_AUTH = 1<<0, |
42 | WLAN_STA_ASSOC = 1<<1, | 51 | WLAN_STA_ASSOC = 1<<1, |
43 | WLAN_STA_PS = 1<<2, | 52 | WLAN_STA_PS_STA = 1<<2, |
44 | WLAN_STA_AUTHORIZED = 1<<3, | 53 | WLAN_STA_AUTHORIZED = 1<<3, |
45 | WLAN_STA_SHORT_PREAMBLE = 1<<4, | 54 | WLAN_STA_SHORT_PREAMBLE = 1<<4, |
46 | WLAN_STA_ASSOC_AP = 1<<5, | 55 | WLAN_STA_ASSOC_AP = 1<<5, |
@@ -48,7 +57,10 @@ enum ieee80211_sta_info_flags { | |||
48 | WLAN_STA_WDS = 1<<7, | 57 | WLAN_STA_WDS = 1<<7, |
49 | WLAN_STA_CLEAR_PS_FILT = 1<<9, | 58 | WLAN_STA_CLEAR_PS_FILT = 1<<9, |
50 | WLAN_STA_MFP = 1<<10, | 59 | WLAN_STA_MFP = 1<<10, |
51 | WLAN_STA_SUSPEND = 1<<11 | 60 | WLAN_STA_SUSPEND = 1<<11, |
61 | WLAN_STA_PS_DRIVER = 1<<12, | ||
62 | WLAN_STA_PSPOLL = 1<<13, | ||
63 | WLAN_STA_DISASSOC = 1<<14, | ||
52 | }; | 64 | }; |
53 | 65 | ||
54 | #define STA_TID_NUM 16 | 66 | #define STA_TID_NUM 16 |
@@ -154,11 +166,6 @@ struct sta_ampdu_mlme { | |||
154 | }; | 166 | }; |
155 | 167 | ||
156 | 168 | ||
157 | /* see __sta_info_unlink */ | ||
158 | #define STA_INFO_PIN_STAT_NORMAL 0 | ||
159 | #define STA_INFO_PIN_STAT_PINNED 1 | ||
160 | #define STA_INFO_PIN_STAT_DESTROY 2 | ||
161 | |||
162 | /** | 169 | /** |
163 | * struct sta_info - STA information | 170 | * struct sta_info - STA information |
164 | * | 171 | * |
@@ -177,8 +184,8 @@ struct sta_ampdu_mlme { | |||
177 | * @lock: used for locking all fields that require locking, see comments | 184 | * @lock: used for locking all fields that require locking, see comments |
178 | * in the header file. | 185 | * in the header file. |
179 | * @flaglock: spinlock for flags accesses | 186 | * @flaglock: spinlock for flags accesses |
187 | * @drv_unblock_wk: used for driver PS unblocking | ||
180 | * @listen_interval: listen interval of this station, when we're acting as AP | 188 | * @listen_interval: listen interval of this station, when we're acting as AP |
181 | * @pin_status: used internally for pinning a STA struct into memory | ||
182 | * @flags: STA flags, see &enum ieee80211_sta_info_flags | 189 | * @flags: STA flags, see &enum ieee80211_sta_info_flags |
183 | * @ps_tx_buf: buffer of frames to transmit to this station | 190 | * @ps_tx_buf: buffer of frames to transmit to this station |
184 | * when it leaves power saving state | 191 | * when it leaves power saving state |
@@ -193,7 +200,6 @@ struct sta_ampdu_mlme { | |||
193 | * @rx_fragments: number of received MPDUs | 200 | * @rx_fragments: number of received MPDUs |
194 | * @rx_dropped: number of dropped MPDUs from this STA | 201 | * @rx_dropped: number of dropped MPDUs from this STA |
195 | * @last_signal: signal of last received frame from this STA | 202 | * @last_signal: signal of last received frame from this STA |
196 | * @last_qual: qual of last received frame from this STA | ||
197 | * @last_noise: noise of last received frame from this STA | 203 | * @last_noise: noise of last received frame from this STA |
198 | * @last_seq_ctrl: last received seq/frag number from this STA (per RX queue) | 204 | * @last_seq_ctrl: last received seq/frag number from this STA (per RX queue) |
199 | * @tx_filtered_count: number of frames the hardware filtered for this STA | 205 | * @tx_filtered_count: number of frames the hardware filtered for this STA |
@@ -217,6 +223,8 @@ struct sta_ampdu_mlme { | |||
217 | * @plink_timer_was_running: used by suspend/resume to restore timers | 223 | * @plink_timer_was_running: used by suspend/resume to restore timers |
218 | * @debugfs: debug filesystem info | 224 | * @debugfs: debug filesystem info |
219 | * @sta: station information we share with the driver | 225 | * @sta: station information we share with the driver |
226 | * @dead: set to true when sta is unlinked | ||
227 | * @uploaded: set to true when sta is uploaded to the driver | ||
220 | */ | 228 | */ |
221 | struct sta_info { | 229 | struct sta_info { |
222 | /* General information, mostly static */ | 230 | /* General information, mostly static */ |
@@ -230,13 +238,13 @@ struct sta_info { | |||
230 | spinlock_t lock; | 238 | spinlock_t lock; |
231 | spinlock_t flaglock; | 239 | spinlock_t flaglock; |
232 | 240 | ||
241 | struct work_struct drv_unblock_wk; | ||
242 | |||
233 | u16 listen_interval; | 243 | u16 listen_interval; |
234 | 244 | ||
235 | /* | 245 | bool dead; |
236 | * for use by the internal lifetime management, | 246 | |
237 | * see __sta_info_unlink | 247 | bool uploaded; |
238 | */ | ||
239 | u8 pin_status; | ||
240 | 248 | ||
241 | /* | 249 | /* |
242 | * frequently updated, locked with own spinlock (flaglock), | 250 | * frequently updated, locked with own spinlock (flaglock), |
@@ -259,7 +267,6 @@ struct sta_info { | |||
259 | unsigned long rx_fragments; | 267 | unsigned long rx_fragments; |
260 | unsigned long rx_dropped; | 268 | unsigned long rx_dropped; |
261 | int last_signal; | 269 | int last_signal; |
262 | int last_qual; | ||
263 | int last_noise; | 270 | int last_noise; |
264 | __le16 last_seq_ctrl[NUM_RX_DATA_QUEUES]; | 271 | __le16 last_seq_ctrl[NUM_RX_DATA_QUEUES]; |
265 | 272 | ||
@@ -301,28 +308,6 @@ struct sta_info { | |||
301 | #ifdef CONFIG_MAC80211_DEBUGFS | 308 | #ifdef CONFIG_MAC80211_DEBUGFS |
302 | struct sta_info_debugfsdentries { | 309 | struct sta_info_debugfsdentries { |
303 | struct dentry *dir; | 310 | struct dentry *dir; |
304 | struct dentry *flags; | ||
305 | struct dentry *num_ps_buf_frames; | ||
306 | struct dentry *inactive_ms; | ||
307 | struct dentry *last_seq_ctrl; | ||
308 | struct dentry *agg_status; | ||
309 | struct dentry *aid; | ||
310 | struct dentry *dev; | ||
311 | struct dentry *rx_packets; | ||
312 | struct dentry *tx_packets; | ||
313 | struct dentry *rx_bytes; | ||
314 | struct dentry *tx_bytes; | ||
315 | struct dentry *rx_duplicates; | ||
316 | struct dentry *rx_fragments; | ||
317 | struct dentry *rx_dropped; | ||
318 | struct dentry *tx_fragments; | ||
319 | struct dentry *tx_filtered; | ||
320 | struct dentry *tx_retry_failed; | ||
321 | struct dentry *tx_retry_count; | ||
322 | struct dentry *last_signal; | ||
323 | struct dentry *last_qual; | ||
324 | struct dentry *last_noise; | ||
325 | struct dentry *wep_weak_iv_count; | ||
326 | bool add_has_run; | 311 | bool add_has_run; |
327 | } debugfs; | 312 | } debugfs; |
328 | #endif | 313 | #endif |
@@ -413,14 +398,42 @@ static inline u32 get_sta_flags(struct sta_info *sta) | |||
413 | #define STA_INFO_CLEANUP_INTERVAL (10 * HZ) | 398 | #define STA_INFO_CLEANUP_INTERVAL (10 * HZ) |
414 | 399 | ||
415 | /* | 400 | /* |
416 | * Get a STA info, must have be under RCU read lock. | 401 | * Get a STA info, must be under RCU read lock. |
417 | */ | 402 | */ |
418 | struct sta_info *sta_info_get(struct ieee80211_local *local, const u8 *addr); | 403 | struct sta_info *sta_info_get(struct ieee80211_sub_if_data *sdata, |
404 | const u8 *addr); | ||
405 | |||
406 | struct sta_info *sta_info_get_bss(struct ieee80211_sub_if_data *sdata, | ||
407 | const u8 *addr); | ||
408 | |||
409 | static inline | ||
410 | void for_each_sta_info_type_check(struct ieee80211_local *local, | ||
411 | const u8 *addr, | ||
412 | struct sta_info *sta, | ||
413 | struct sta_info *nxt) | ||
414 | { | ||
415 | } | ||
416 | |||
417 | #define for_each_sta_info(local, _addr, sta, nxt) \ | ||
418 | for ( /* initialise loop */ \ | ||
419 | sta = rcu_dereference(local->sta_hash[STA_HASH(_addr)]),\ | ||
420 | nxt = sta ? rcu_dereference(sta->hnext) : NULL; \ | ||
421 | /* typecheck */ \ | ||
422 | for_each_sta_info_type_check(local, (_addr), sta, nxt), \ | ||
423 | /* continue condition */ \ | ||
424 | sta; \ | ||
425 | /* advance loop */ \ | ||
426 | sta = nxt, \ | ||
427 | nxt = sta ? rcu_dereference(sta->hnext) : NULL \ | ||
428 | ) \ | ||
429 | /* compare address and run code only if it matches */ \ | ||
430 | if (memcmp(sta->sta.addr, (_addr), ETH_ALEN) == 0) | ||
431 | |||
419 | /* | 432 | /* |
420 | * Get STA info by index, BROKEN! | 433 | * Get STA info by index, BROKEN! |
421 | */ | 434 | */ |
422 | struct sta_info *sta_info_get_by_idx(struct ieee80211_local *local, int idx, | 435 | struct sta_info *sta_info_get_by_idx(struct ieee80211_sub_if_data *sdata, |
423 | struct net_device *dev); | 436 | int idx); |
424 | /* | 437 | /* |
425 | * Create a new STA info, caller owns returned structure | 438 | * Create a new STA info, caller owns returned structure |
426 | * until sta_info_insert(). | 439 | * until sta_info_insert(). |
@@ -431,18 +444,19 @@ struct sta_info *sta_info_alloc(struct ieee80211_sub_if_data *sdata, | |||
431 | * Insert STA info into hash table/list, returns zero or a | 444 | * Insert STA info into hash table/list, returns zero or a |
432 | * -EEXIST if (if the same MAC address is already present). | 445 | * -EEXIST if (if the same MAC address is already present). |
433 | * | 446 | * |
434 | * Calling this without RCU protection makes the caller | 447 | * Calling the non-rcu version makes the caller relinquish, |
435 | * relinquish its reference to @sta. | 448 | * the _rcu version calls read_lock_rcu() and must be called |
449 | * without it held. | ||
436 | */ | 450 | */ |
437 | int sta_info_insert(struct sta_info *sta); | 451 | int sta_info_insert(struct sta_info *sta); |
438 | /* | 452 | int sta_info_insert_rcu(struct sta_info *sta) __acquires(RCU); |
439 | * Unlink a STA info from the hash table/list. | 453 | int sta_info_insert_atomic(struct sta_info *sta); |
440 | * This can NULL the STA pointer if somebody else | 454 | |
441 | * has already unlinked it. | 455 | int sta_info_destroy_addr(struct ieee80211_sub_if_data *sdata, |
442 | */ | 456 | const u8 *addr); |
443 | void sta_info_unlink(struct sta_info **sta); | 457 | int sta_info_destroy_addr_bss(struct ieee80211_sub_if_data *sdata, |
458 | const u8 *addr); | ||
444 | 459 | ||
445 | void sta_info_destroy(struct sta_info *sta); | ||
446 | void sta_info_set_tim_bit(struct sta_info *sta); | 460 | void sta_info_set_tim_bit(struct sta_info *sta); |
447 | void sta_info_clear_tim_bit(struct sta_info *sta); | 461 | void sta_info_clear_tim_bit(struct sta_info *sta); |
448 | 462 | ||
@@ -454,4 +468,7 @@ int sta_info_flush(struct ieee80211_local *local, | |||
454 | void ieee80211_sta_expire(struct ieee80211_sub_if_data *sdata, | 468 | void ieee80211_sta_expire(struct ieee80211_sub_if_data *sdata, |
455 | unsigned long exp_time); | 469 | unsigned long exp_time); |
456 | 470 | ||
471 | void ieee80211_sta_ps_deliver_wakeup(struct sta_info *sta); | ||
472 | void ieee80211_sta_ps_deliver_poll_response(struct sta_info *sta); | ||
473 | |||
457 | #endif /* STA_INFO_H */ | 474 | #endif /* STA_INFO_H */ |