Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 103170
b: refs/heads/master
c: 5a9f7b0
h: refs/heads/master
v: v3
  • Loading branch information
Johannes Berg authored and John W. Linville committed Jun 26, 2008
1 parent 721644b commit 60e729f
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 14 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 135a2110c55c71d7ccaf5ac66968b993347fe8e2
refs/heads/master: 5a9f7b047e81a73a1ce3e42ef87c28a61fd4df24
1 change: 1 addition & 0 deletions trunk/net/mac80211/sta_info.c
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,7 @@ struct sta_info *sta_info_alloc(struct ieee80211_sub_if_data *sdata,
return NULL;

spin_lock_init(&sta->lock);
spin_lock_init(&sta->flaglock);

memcpy(sta->addr, addr, ETH_ALEN);
sta->local = local;
Expand Down
40 changes: 27 additions & 13 deletions trunk/net/mac80211/sta_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ struct sta_ampdu_mlme {
* @aid: STA's unique AID (1..2007, 0 = not assigned yet),
* only used in AP (and IBSS?) mode
* @flags: STA flags, see &enum ieee80211_sta_info_flags
* @flaglock: spinlock for flags accesses
* @ps_tx_buf: buffer of frames to transmit to this station
* when it leaves power saving state
* @tx_filtered: buffer of frames we already tried to transmit
Expand All @@ -186,6 +187,7 @@ struct sta_info {
struct rate_control_ref *rate_ctrl;
void *rate_ctrl_priv;
spinlock_t lock;
spinlock_t flaglock;
struct ieee80211_ht_info ht_info;
u64 supp_rates[IEEE80211_NUM_BANDS];
u8 addr[ETH_ALEN];
Expand All @@ -198,7 +200,10 @@ struct sta_info {
*/
u8 pin_status;

/* frequently updated information, locked with lock spinlock */
/*
* frequently updated, locked with own spinlock (flaglock),
* use the accessors defined below
*/
u32 flags;

/*
Expand Down Expand Up @@ -293,34 +298,41 @@ static inline enum plink_state sta_plink_state(struct sta_info *sta)

static inline void set_sta_flags(struct sta_info *sta, const u32 flags)
{
spin_lock_bh(&sta->lock);
unsigned long irqfl;

spin_lock_irqsave(&sta->flaglock, irqfl);
sta->flags |= flags;
spin_unlock_bh(&sta->lock);
spin_unlock_irqrestore(&sta->flaglock, irqfl);
}

static inline void clear_sta_flags(struct sta_info *sta, const u32 flags)
{
spin_lock_bh(&sta->lock);
unsigned long irqfl;

spin_lock_irqsave(&sta->flaglock, irqfl);
sta->flags &= ~flags;
spin_unlock_bh(&sta->lock);
spin_unlock_irqrestore(&sta->flaglock, irqfl);
}

static inline void set_and_clear_sta_flags(struct sta_info *sta,
const u32 set, const u32 clear)
{
spin_lock_bh(&sta->lock);
unsigned long irqfl;

spin_lock_irqsave(&sta->flaglock, irqfl);
sta->flags |= set;
sta->flags &= ~clear;
spin_unlock_bh(&sta->lock);
spin_unlock_irqrestore(&sta->flaglock, irqfl);
}

static inline u32 test_sta_flags(struct sta_info *sta, const u32 flags)
{
u32 ret;
unsigned long irqfl;

spin_lock_bh(&sta->lock);
spin_lock_irqsave(&sta->flaglock, irqfl);
ret = sta->flags & flags;
spin_unlock_bh(&sta->lock);
spin_unlock_irqrestore(&sta->flaglock, irqfl);

return ret;
}
Expand All @@ -329,22 +341,24 @@ static inline u32 test_and_clear_sta_flags(struct sta_info *sta,
const u32 flags)
{
u32 ret;
unsigned long irqfl;

spin_lock_bh(&sta->lock);
spin_lock_irqsave(&sta->flaglock, irqfl);
ret = sta->flags & flags;
sta->flags &= ~flags;
spin_unlock_bh(&sta->lock);
spin_unlock_irqrestore(&sta->flaglock, irqfl);

return ret;
}

static inline u32 get_sta_flags(struct sta_info *sta)
{
u32 ret;
unsigned long irqfl;

spin_lock_bh(&sta->lock);
spin_lock_irqsave(&sta->flaglock, irqfl);
ret = sta->flags;
spin_unlock_bh(&sta->lock);
spin_unlock_irqrestore(&sta->flaglock, irqfl);

return ret;
}
Expand Down

0 comments on commit 60e729f

Please sign in to comment.