diff options
author | Johannes Berg <johannes@sipsolutions.net> | 2008-02-20 05:21:35 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2008-02-29 15:37:26 -0500 |
commit | 004c872e78d433f84f0a5cd4db7a6c780c0946e1 (patch) | |
tree | bd9e7cd0b69e720738d49e170e4f4f64e9111e1a /net/mac80211/ieee80211_i.h | |
parent | 836341a70471ba77657b0b420dd7eea3c30a038b (diff) |
mac80211: consolidate TIM handling code
This consolidates all TIM handling code to avoid re-introducing
errors with the bitmap/set_tim order and to reduce code. While
reading the code I noticed a possible problem so I also added
a comment about that.
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/mac80211/ieee80211_i.h')
-rw-r--r-- | net/mac80211/ieee80211_i.h | 36 |
1 files changed, 1 insertions, 35 deletions
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h index 1b4a4497030d..b07b3cbfd039 100644 --- a/net/mac80211/ieee80211_i.h +++ b/net/mac80211/ieee80211_i.h | |||
@@ -207,7 +207,7 @@ struct ieee80211_if_ap { | |||
207 | 207 | ||
208 | /* yes, this looks ugly, but guarantees that we can later use | 208 | /* yes, this looks ugly, but guarantees that we can later use |
209 | * bitmap_empty :) | 209 | * bitmap_empty :) |
210 | * NB: don't ever use set_bit, use bss_tim_set/bss_tim_clear! */ | 210 | * NB: don't touch this bitmap, use sta_info_{set,clear}_tim_bit */ |
211 | u8 tim[sizeof(unsigned long) * BITS_TO_LONGS(IEEE80211_MAX_AID + 1)]; | 211 | u8 tim[sizeof(unsigned long) * BITS_TO_LONGS(IEEE80211_MAX_AID + 1)]; |
212 | atomic_t num_sta_ps; /* number of stations in PS mode */ | 212 | atomic_t num_sta_ps; /* number of stations in PS mode */ |
213 | struct sk_buff_head ps_bc_buf; | 213 | struct sk_buff_head ps_bc_buf; |
@@ -640,40 +640,6 @@ struct sta_attribute { | |||
640 | ssize_t (*store)(struct sta_info *, const char *buf, size_t count); | 640 | ssize_t (*store)(struct sta_info *, const char *buf, size_t count); |
641 | }; | 641 | }; |
642 | 642 | ||
643 | static inline void __bss_tim_set(struct ieee80211_if_ap *bss, u16 aid) | ||
644 | { | ||
645 | /* | ||
646 | * This format has been mandated by the IEEE specifications, | ||
647 | * so this line may not be changed to use the __set_bit() format. | ||
648 | */ | ||
649 | bss->tim[aid / 8] |= (1 << (aid % 8)); | ||
650 | } | ||
651 | |||
652 | static inline void bss_tim_set(struct ieee80211_local *local, | ||
653 | struct ieee80211_if_ap *bss, u16 aid) | ||
654 | { | ||
655 | read_lock_bh(&local->sta_lock); | ||
656 | __bss_tim_set(bss, aid); | ||
657 | read_unlock_bh(&local->sta_lock); | ||
658 | } | ||
659 | |||
660 | static inline void __bss_tim_clear(struct ieee80211_if_ap *bss, u16 aid) | ||
661 | { | ||
662 | /* | ||
663 | * This format has been mandated by the IEEE specifications, | ||
664 | * so this line may not be changed to use the __clear_bit() format. | ||
665 | */ | ||
666 | bss->tim[aid / 8] &= ~(1 << (aid % 8)); | ||
667 | } | ||
668 | |||
669 | static inline void bss_tim_clear(struct ieee80211_local *local, | ||
670 | struct ieee80211_if_ap *bss, u16 aid) | ||
671 | { | ||
672 | read_lock_bh(&local->sta_lock); | ||
673 | __bss_tim_clear(bss, aid); | ||
674 | read_unlock_bh(&local->sta_lock); | ||
675 | } | ||
676 | |||
677 | static inline int ieee80211_bssid_match(const u8 *raddr, const u8 *addr) | 643 | static inline int ieee80211_bssid_match(const u8 *raddr, const u8 *addr) |
678 | { | 644 | { |
679 | return compare_ether_addr(raddr, addr) == 0 || | 645 | return compare_ether_addr(raddr, addr) == 0 || |