aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/sta_info.h
diff options
context:
space:
mode:
Diffstat (limited to 'net/mac80211/sta_info.h')
-rw-r--r--net/mac80211/sta_info.h60
1 files changed, 55 insertions, 5 deletions
diff --git a/net/mac80211/sta_info.h b/net/mac80211/sta_info.h
index 8c8ce05ad26f..6f77f12dc3fc 100644
--- a/net/mac80211/sta_info.h
+++ b/net/mac80211/sta_info.h
@@ -30,7 +30,6 @@
30 * when virtual port control is not in use. 30 * when virtual port control is not in use.
31 * @WLAN_STA_SHORT_PREAMBLE: Station is capable of receiving short-preamble 31 * @WLAN_STA_SHORT_PREAMBLE: Station is capable of receiving short-preamble
32 * frames. 32 * frames.
33 * @WLAN_STA_ASSOC_AP: We're associated to that station, it is an AP.
34 * @WLAN_STA_WME: Station is a QoS-STA. 33 * @WLAN_STA_WME: Station is a QoS-STA.
35 * @WLAN_STA_WDS: Station is one of our WDS peers. 34 * @WLAN_STA_WDS: Station is one of our WDS peers.
36 * @WLAN_STA_CLEAR_PS_FILT: Clear PS filter in hardware (using the 35 * @WLAN_STA_CLEAR_PS_FILT: Clear PS filter in hardware (using the
@@ -52,6 +51,7 @@
52 * unblocks the station. 51 * unblocks the station.
53 * @WLAN_STA_SP: Station is in a service period, so don't try to 52 * @WLAN_STA_SP: Station is in a service period, so don't try to
54 * reply to other uAPSD trigger frames or PS-Poll. 53 * reply to other uAPSD trigger frames or PS-Poll.
54 * @WLAN_STA_4ADDR_EVENT: 4-addr event was already sent for this frame.
55 */ 55 */
56enum ieee80211_sta_info_flags { 56enum ieee80211_sta_info_flags {
57 WLAN_STA_AUTH, 57 WLAN_STA_AUTH,
@@ -59,7 +59,6 @@ enum ieee80211_sta_info_flags {
59 WLAN_STA_PS_STA, 59 WLAN_STA_PS_STA,
60 WLAN_STA_AUTHORIZED, 60 WLAN_STA_AUTHORIZED,
61 WLAN_STA_SHORT_PREAMBLE, 61 WLAN_STA_SHORT_PREAMBLE,
62 WLAN_STA_ASSOC_AP,
63 WLAN_STA_WME, 62 WLAN_STA_WME,
64 WLAN_STA_WDS, 63 WLAN_STA_WDS,
65 WLAN_STA_CLEAR_PS_FILT, 64 WLAN_STA_CLEAR_PS_FILT,
@@ -71,11 +70,22 @@ enum ieee80211_sta_info_flags {
71 WLAN_STA_TDLS_PEER_AUTH, 70 WLAN_STA_TDLS_PEER_AUTH,
72 WLAN_STA_UAPSD, 71 WLAN_STA_UAPSD,
73 WLAN_STA_SP, 72 WLAN_STA_SP,
73 WLAN_STA_4ADDR_EVENT,
74};
75
76enum ieee80211_sta_state {
77 /* NOTE: These need to be ordered correctly! */
78 IEEE80211_STA_NONE,
79 IEEE80211_STA_AUTH,
80 IEEE80211_STA_ASSOC,
81 IEEE80211_STA_AUTHORIZED,
74}; 82};
75 83
76#define STA_TID_NUM 16 84#define STA_TID_NUM 16
77#define ADDBA_RESP_INTERVAL HZ 85#define ADDBA_RESP_INTERVAL HZ
78#define HT_AGG_MAX_RETRIES 0x3 86#define HT_AGG_MAX_RETRIES 15
87#define HT_AGG_BURST_RETRIES 3
88#define HT_AGG_RETRIES_PERIOD (15 * HZ)
79 89
80#define HT_AGG_STATE_DRV_READY 0 90#define HT_AGG_STATE_DRV_READY 0
81#define HT_AGG_STATE_RESPONSE_RECEIVED 1 91#define HT_AGG_STATE_RESPONSE_RECEIVED 1
@@ -88,6 +98,7 @@ enum ieee80211_sta_info_flags {
88 * struct tid_ampdu_tx - TID aggregation information (Tx). 98 * struct tid_ampdu_tx - TID aggregation information (Tx).
89 * 99 *
90 * @rcu_head: rcu head for freeing structure 100 * @rcu_head: rcu head for freeing structure
101 * @session_timer: check if we keep Tx-ing on the TID (by timeout value)
91 * @addba_resp_timer: timer for peer's response to addba request 102 * @addba_resp_timer: timer for peer's response to addba request
92 * @pending: pending frames queue -- use sta's spinlock to protect 103 * @pending: pending frames queue -- use sta's spinlock to protect
93 * @dialog_token: dialog token for aggregation session 104 * @dialog_token: dialog token for aggregation session
@@ -110,6 +121,7 @@ enum ieee80211_sta_info_flags {
110 */ 121 */
111struct tid_ampdu_tx { 122struct tid_ampdu_tx {
112 struct rcu_head rcu_head; 123 struct rcu_head rcu_head;
124 struct timer_list session_timer;
113 struct timer_list addba_resp_timer; 125 struct timer_list addba_resp_timer;
114 struct sk_buff_head pending; 126 struct sk_buff_head pending;
115 unsigned long state; 127 unsigned long state;
@@ -169,6 +181,7 @@ struct tid_ampdu_rx {
169 * @tid_tx: aggregation info for Tx per TID 181 * @tid_tx: aggregation info for Tx per TID
170 * @tid_start_tx: sessions where start was requested 182 * @tid_start_tx: sessions where start was requested
171 * @addba_req_num: number of times addBA request has been sent. 183 * @addba_req_num: number of times addBA request has been sent.
184 * @last_addba_req_time: timestamp of the last addBA request.
172 * @dialog_token_allocator: dialog token enumerator for each new session; 185 * @dialog_token_allocator: dialog token enumerator for each new session;
173 * @work: work struct for starting/stopping aggregation 186 * @work: work struct for starting/stopping aggregation
174 * @tid_rx_timer_expired: bitmap indicating on which TIDs the 187 * @tid_rx_timer_expired: bitmap indicating on which TIDs the
@@ -188,6 +201,7 @@ struct sta_ampdu_mlme {
188 struct work_struct work; 201 struct work_struct work;
189 struct tid_ampdu_tx __rcu *tid_tx[STA_TID_NUM]; 202 struct tid_ampdu_tx __rcu *tid_tx[STA_TID_NUM];
190 struct tid_ampdu_tx *tid_start_tx[STA_TID_NUM]; 203 struct tid_ampdu_tx *tid_start_tx[STA_TID_NUM];
204 unsigned long last_addba_req_time[STA_TID_NUM];
191 u8 addba_req_num[STA_TID_NUM]; 205 u8 addba_req_num[STA_TID_NUM];
192 u8 dialog_token_allocator; 206 u8 dialog_token_allocator;
193}; 207};
@@ -260,6 +274,8 @@ struct sta_ampdu_mlme {
260 * @dummy: indicate a dummy station created for receiving 274 * @dummy: indicate a dummy station created for receiving
261 * EAP frames before association 275 * EAP frames before association
262 * @sta: station information we share with the driver 276 * @sta: station information we share with the driver
277 * @sta_state: duplicates information about station state (for debug)
278 * @beacon_loss_count: number of times beacon loss has triggered
263 */ 279 */
264struct sta_info { 280struct sta_info {
265 /* General information, mostly static */ 281 /* General information, mostly static */
@@ -281,6 +297,8 @@ struct sta_info {
281 297
282 bool uploaded; 298 bool uploaded;
283 299
300 enum ieee80211_sta_state sta_state;
301
284 /* use the accessors defined below */ 302 /* use the accessors defined below */
285 unsigned long _flags; 303 unsigned long _flags;
286 304
@@ -350,6 +368,7 @@ struct sta_info {
350#endif 368#endif
351 369
352 unsigned int lost_packets; 370 unsigned int lost_packets;
371 unsigned int beacon_loss_count;
353 372
354 /* should be right in front of sta to be in the same cache line */ 373 /* should be right in front of sta to be in the same cache line */
355 bool dummy; 374 bool dummy;
@@ -369,12 +388,18 @@ static inline enum nl80211_plink_state sta_plink_state(struct sta_info *sta)
369static inline void set_sta_flag(struct sta_info *sta, 388static inline void set_sta_flag(struct sta_info *sta,
370 enum ieee80211_sta_info_flags flag) 389 enum ieee80211_sta_info_flags flag)
371{ 390{
391 WARN_ON(flag == WLAN_STA_AUTH ||
392 flag == WLAN_STA_ASSOC ||
393 flag == WLAN_STA_AUTHORIZED);
372 set_bit(flag, &sta->_flags); 394 set_bit(flag, &sta->_flags);
373} 395}
374 396
375static inline void clear_sta_flag(struct sta_info *sta, 397static inline void clear_sta_flag(struct sta_info *sta,
376 enum ieee80211_sta_info_flags flag) 398 enum ieee80211_sta_info_flags flag)
377{ 399{
400 WARN_ON(flag == WLAN_STA_AUTH ||
401 flag == WLAN_STA_ASSOC ||
402 flag == WLAN_STA_AUTHORIZED);
378 clear_bit(flag, &sta->_flags); 403 clear_bit(flag, &sta->_flags);
379} 404}
380 405
@@ -387,9 +412,32 @@ static inline int test_sta_flag(struct sta_info *sta,
387static inline int test_and_clear_sta_flag(struct sta_info *sta, 412static inline int test_and_clear_sta_flag(struct sta_info *sta,
388 enum ieee80211_sta_info_flags flag) 413 enum ieee80211_sta_info_flags flag)
389{ 414{
415 WARN_ON(flag == WLAN_STA_AUTH ||
416 flag == WLAN_STA_ASSOC ||
417 flag == WLAN_STA_AUTHORIZED);
390 return test_and_clear_bit(flag, &sta->_flags); 418 return test_and_clear_bit(flag, &sta->_flags);
391} 419}
392 420
421static inline int test_and_set_sta_flag(struct sta_info *sta,
422 enum ieee80211_sta_info_flags flag)
423{
424 WARN_ON(flag == WLAN_STA_AUTH ||
425 flag == WLAN_STA_ASSOC ||
426 flag == WLAN_STA_AUTHORIZED);
427 return test_and_set_bit(flag, &sta->_flags);
428}
429
430int sta_info_move_state_checked(struct sta_info *sta,
431 enum ieee80211_sta_state new_state);
432
433static inline void sta_info_move_state(struct sta_info *sta,
434 enum ieee80211_sta_state new_state)
435{
436 int ret = sta_info_move_state_checked(sta, new_state);
437 WARN_ON_ONCE(ret);
438}
439
440
393void ieee80211_assign_tid_tx(struct sta_info *sta, int tid, 441void ieee80211_assign_tid_tx(struct sta_info *sta, int tid,
394 struct tid_ampdu_tx *tid_tx); 442 struct tid_ampdu_tx *tid_tx);
395 443
@@ -480,7 +528,10 @@ struct sta_info *sta_info_get_by_idx(struct ieee80211_sub_if_data *sdata,
480 * until sta_info_insert(). 528 * until sta_info_insert().
481 */ 529 */
482struct sta_info *sta_info_alloc(struct ieee80211_sub_if_data *sdata, 530struct sta_info *sta_info_alloc(struct ieee80211_sub_if_data *sdata,
483 u8 *addr, gfp_t gfp); 531 const u8 *addr, gfp_t gfp);
532
533void sta_info_free(struct ieee80211_local *local, struct sta_info *sta);
534
484/* 535/*
485 * Insert STA info into hash table/list, returns zero or a 536 * Insert STA info into hash table/list, returns zero or a
486 * -EEXIST if (if the same MAC address is already present). 537 * -EEXIST if (if the same MAC address is already present).
@@ -491,7 +542,6 @@ struct sta_info *sta_info_alloc(struct ieee80211_sub_if_data *sdata,
491 */ 542 */
492int sta_info_insert(struct sta_info *sta); 543int sta_info_insert(struct sta_info *sta);
493int sta_info_insert_rcu(struct sta_info *sta) __acquires(RCU); 544int sta_info_insert_rcu(struct sta_info *sta) __acquires(RCU);
494int sta_info_insert_atomic(struct sta_info *sta);
495int sta_info_reinsert(struct sta_info *sta); 545int sta_info_reinsert(struct sta_info *sta);
496 546
497int sta_info_destroy_addr(struct ieee80211_sub_if_data *sdata, 547int sta_info_destroy_addr(struct ieee80211_sub_if_data *sdata,