diff options
author | Johannes Berg <johannes.berg@intel.com> | 2012-01-12 03:31:10 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2012-01-30 15:41:25 -0500 |
commit | 83d5cc012441531ab0bf6f99881958e964e9cf11 (patch) | |
tree | b36a127cd4d735f5b4a0b7fbfbdd3714bceca44f /net/mac80211/sta_info.h | |
parent | c037b8367c7e2b775a99d74037f5df014d2fbf06 (diff) |
mac80211: station state transition error handling
In the future, when we start notifying drivers,
state transitions could potentially fail. To make
it easier to distinguish between programming bugs
and driver failures:
* rename sta_info_move_state() to
sta_info_pre_move_state() which can only be
called before the station is inserted (and
check this with a new station flag).
* rename sta_info_move_state_checked() to just
plain sta_info_move_state(), as it will be
the regular function that can fail for more
than just one reason (bad transition or an
error from the driver)
This makes the programming model easier -- one of
the functions can only be called before insertion
and can't fail, the other can fail.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/mac80211/sta_info.h')
-rw-r--r-- | net/mac80211/sta_info.h | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/net/mac80211/sta_info.h b/net/mac80211/sta_info.h index 6f77f12dc3fc..381de37d2478 100644 --- a/net/mac80211/sta_info.h +++ b/net/mac80211/sta_info.h | |||
@@ -52,6 +52,7 @@ | |||
52 | * @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 |
53 | * 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. | 54 | * @WLAN_STA_4ADDR_EVENT: 4-addr event was already sent for this frame. |
55 | * @WLAN_STA_INSERTED: This station is inserted into the hash table. | ||
55 | */ | 56 | */ |
56 | enum ieee80211_sta_info_flags { | 57 | enum ieee80211_sta_info_flags { |
57 | WLAN_STA_AUTH, | 58 | WLAN_STA_AUTH, |
@@ -71,6 +72,7 @@ enum ieee80211_sta_info_flags { | |||
71 | WLAN_STA_UAPSD, | 72 | WLAN_STA_UAPSD, |
72 | WLAN_STA_SP, | 73 | WLAN_STA_SP, |
73 | WLAN_STA_4ADDR_EVENT, | 74 | WLAN_STA_4ADDR_EVENT, |
75 | WLAN_STA_INSERTED, | ||
74 | }; | 76 | }; |
75 | 77 | ||
76 | enum ieee80211_sta_state { | 78 | enum ieee80211_sta_state { |
@@ -427,13 +429,17 @@ static inline int test_and_set_sta_flag(struct sta_info *sta, | |||
427 | return test_and_set_bit(flag, &sta->_flags); | 429 | return test_and_set_bit(flag, &sta->_flags); |
428 | } | 430 | } |
429 | 431 | ||
430 | int sta_info_move_state_checked(struct sta_info *sta, | 432 | int sta_info_move_state(struct sta_info *sta, |
431 | enum ieee80211_sta_state new_state); | 433 | enum ieee80211_sta_state new_state); |
432 | 434 | ||
433 | static inline void sta_info_move_state(struct sta_info *sta, | 435 | static inline void sta_info_pre_move_state(struct sta_info *sta, |
434 | enum ieee80211_sta_state new_state) | 436 | enum ieee80211_sta_state new_state) |
435 | { | 437 | { |
436 | int ret = sta_info_move_state_checked(sta, new_state); | 438 | int ret; |
439 | |||
440 | WARN_ON_ONCE(test_sta_flag(sta, WLAN_STA_INSERTED)); | ||
441 | |||
442 | ret = sta_info_move_state(sta, new_state); | ||
437 | WARN_ON_ONCE(ret); | 443 | WARN_ON_ONCE(ret); |
438 | } | 444 | } |
439 | 445 | ||
@@ -544,6 +550,7 @@ int sta_info_insert(struct sta_info *sta); | |||
544 | int sta_info_insert_rcu(struct sta_info *sta) __acquires(RCU); | 550 | int sta_info_insert_rcu(struct sta_info *sta) __acquires(RCU); |
545 | int sta_info_reinsert(struct sta_info *sta); | 551 | int sta_info_reinsert(struct sta_info *sta); |
546 | 552 | ||
553 | int __must_check __sta_info_destroy(struct sta_info *sta); | ||
547 | int sta_info_destroy_addr(struct ieee80211_sub_if_data *sdata, | 554 | int sta_info_destroy_addr(struct ieee80211_sub_if_data *sdata, |
548 | const u8 *addr); | 555 | const u8 *addr); |
549 | int sta_info_destroy_addr_bss(struct ieee80211_sub_if_data *sdata, | 556 | int sta_info_destroy_addr_bss(struct ieee80211_sub_if_data *sdata, |