diff options
Diffstat (limited to 'net/mac80211/sta_info.h')
-rw-r--r-- | net/mac80211/sta_info.h | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/net/mac80211/sta_info.h b/net/mac80211/sta_info.h index 1a14fab4bc9a..63f4d316a954 100644 --- a/net/mac80211/sta_info.h +++ b/net/mac80211/sta_info.h | |||
@@ -73,6 +73,14 @@ enum ieee80211_sta_info_flags { | |||
73 | WLAN_STA_4ADDR_EVENT, | 73 | WLAN_STA_4ADDR_EVENT, |
74 | }; | 74 | }; |
75 | 75 | ||
76 | enum 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, | ||
82 | }; | ||
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 0x3 |
@@ -262,6 +270,7 @@ struct sta_ampdu_mlme { | |||
262 | * @dummy: indicate a dummy station created for receiving | 270 | * @dummy: indicate a dummy station created for receiving |
263 | * EAP frames before association | 271 | * EAP frames before association |
264 | * @sta: station information we share with the driver | 272 | * @sta: station information we share with the driver |
273 | * @sta_state: duplicates information about station state (for debug) | ||
265 | */ | 274 | */ |
266 | struct sta_info { | 275 | struct sta_info { |
267 | /* General information, mostly static */ | 276 | /* General information, mostly static */ |
@@ -283,6 +292,8 @@ struct sta_info { | |||
283 | 292 | ||
284 | bool uploaded; | 293 | bool uploaded; |
285 | 294 | ||
295 | enum ieee80211_sta_state sta_state; | ||
296 | |||
286 | /* use the accessors defined below */ | 297 | /* use the accessors defined below */ |
287 | unsigned long _flags; | 298 | unsigned long _flags; |
288 | 299 | ||
@@ -371,12 +382,18 @@ static inline enum nl80211_plink_state sta_plink_state(struct sta_info *sta) | |||
371 | static inline void set_sta_flag(struct sta_info *sta, | 382 | static inline void set_sta_flag(struct sta_info *sta, |
372 | enum ieee80211_sta_info_flags flag) | 383 | enum ieee80211_sta_info_flags flag) |
373 | { | 384 | { |
385 | WARN_ON(flag == WLAN_STA_AUTH || | ||
386 | flag == WLAN_STA_ASSOC || | ||
387 | flag == WLAN_STA_AUTHORIZED); | ||
374 | set_bit(flag, &sta->_flags); | 388 | set_bit(flag, &sta->_flags); |
375 | } | 389 | } |
376 | 390 | ||
377 | static inline void clear_sta_flag(struct sta_info *sta, | 391 | static inline void clear_sta_flag(struct sta_info *sta, |
378 | enum ieee80211_sta_info_flags flag) | 392 | enum ieee80211_sta_info_flags flag) |
379 | { | 393 | { |
394 | WARN_ON(flag == WLAN_STA_AUTH || | ||
395 | flag == WLAN_STA_ASSOC || | ||
396 | flag == WLAN_STA_AUTHORIZED); | ||
380 | clear_bit(flag, &sta->_flags); | 397 | clear_bit(flag, &sta->_flags); |
381 | } | 398 | } |
382 | 399 | ||
@@ -389,15 +406,32 @@ static inline int test_sta_flag(struct sta_info *sta, | |||
389 | static inline int test_and_clear_sta_flag(struct sta_info *sta, | 406 | static inline int test_and_clear_sta_flag(struct sta_info *sta, |
390 | enum ieee80211_sta_info_flags flag) | 407 | enum ieee80211_sta_info_flags flag) |
391 | { | 408 | { |
409 | WARN_ON(flag == WLAN_STA_AUTH || | ||
410 | flag == WLAN_STA_ASSOC || | ||
411 | flag == WLAN_STA_AUTHORIZED); | ||
392 | return test_and_clear_bit(flag, &sta->_flags); | 412 | return test_and_clear_bit(flag, &sta->_flags); |
393 | } | 413 | } |
394 | 414 | ||
395 | static inline int test_and_set_sta_flag(struct sta_info *sta, | 415 | static inline int test_and_set_sta_flag(struct sta_info *sta, |
396 | enum ieee80211_sta_info_flags flag) | 416 | enum ieee80211_sta_info_flags flag) |
397 | { | 417 | { |
418 | WARN_ON(flag == WLAN_STA_AUTH || | ||
419 | flag == WLAN_STA_ASSOC || | ||
420 | flag == WLAN_STA_AUTHORIZED); | ||
398 | return test_and_set_bit(flag, &sta->_flags); | 421 | return test_and_set_bit(flag, &sta->_flags); |
399 | } | 422 | } |
400 | 423 | ||
424 | int sta_info_move_state_checked(struct sta_info *sta, | ||
425 | enum ieee80211_sta_state new_state); | ||
426 | |||
427 | static inline void sta_info_move_state(struct sta_info *sta, | ||
428 | enum ieee80211_sta_state new_state) | ||
429 | { | ||
430 | int ret = sta_info_move_state_checked(sta, new_state); | ||
431 | WARN_ON_ONCE(ret); | ||
432 | } | ||
433 | |||
434 | |||
401 | void ieee80211_assign_tid_tx(struct sta_info *sta, int tid, | 435 | void ieee80211_assign_tid_tx(struct sta_info *sta, int tid, |
402 | struct tid_ampdu_tx *tid_tx); | 436 | struct tid_ampdu_tx *tid_tx); |
403 | 437 | ||
@@ -489,6 +523,9 @@ struct sta_info *sta_info_get_by_idx(struct ieee80211_sub_if_data *sdata, | |||
489 | */ | 523 | */ |
490 | struct sta_info *sta_info_alloc(struct ieee80211_sub_if_data *sdata, | 524 | struct sta_info *sta_info_alloc(struct ieee80211_sub_if_data *sdata, |
491 | u8 *addr, gfp_t gfp); | 525 | u8 *addr, gfp_t gfp); |
526 | |||
527 | void sta_info_free(struct ieee80211_local *local, struct sta_info *sta); | ||
528 | |||
492 | /* | 529 | /* |
493 | * Insert STA info into hash table/list, returns zero or a | 530 | * Insert STA info into hash table/list, returns zero or a |
494 | * -EEXIST if (if the same MAC address is already present). | 531 | * -EEXIST if (if the same MAC address is already present). |