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.h136
1 files changed, 56 insertions, 80 deletions
diff --git a/net/mac80211/sta_info.h b/net/mac80211/sta_info.h
index 56a3d38a2cd1..8c8ce05ad26f 100644
--- a/net/mac80211/sta_info.h
+++ b/net/mac80211/sta_info.h
@@ -19,7 +19,8 @@
19/** 19/**
20 * enum ieee80211_sta_info_flags - Stations flags 20 * enum ieee80211_sta_info_flags - Stations flags
21 * 21 *
22 * These flags are used with &struct sta_info's @flags member. 22 * These flags are used with &struct sta_info's @flags member, but
23 * only indirectly with set_sta_flag() and friends.
23 * 24 *
24 * @WLAN_STA_AUTH: Station is authenticated. 25 * @WLAN_STA_AUTH: Station is authenticated.
25 * @WLAN_STA_ASSOC: Station is associated. 26 * @WLAN_STA_ASSOC: Station is associated.
@@ -43,24 +44,33 @@
43 * be in the queues 44 * be in the queues
44 * @WLAN_STA_PSPOLL: Station sent PS-poll while driver was keeping 45 * @WLAN_STA_PSPOLL: Station sent PS-poll while driver was keeping
45 * station in power-save mode, reply when the driver unblocks. 46 * station in power-save mode, reply when the driver unblocks.
46 * @WLAN_STA_PS_DRIVER_BUF: Station has frames pending in driver internal 47 * @WLAN_STA_TDLS_PEER: Station is a TDLS peer.
47 * buffers. Automatically cleared on station wake-up. 48 * @WLAN_STA_TDLS_PEER_AUTH: This TDLS peer is authorized to send direct
49 * packets. This means the link is enabled.
50 * @WLAN_STA_UAPSD: Station requested unscheduled SP while driver was
51 * keeping station in power-save mode, reply when the driver
52 * unblocks the station.
53 * @WLAN_STA_SP: Station is in a service period, so don't try to
54 * reply to other uAPSD trigger frames or PS-Poll.
48 */ 55 */
49enum ieee80211_sta_info_flags { 56enum ieee80211_sta_info_flags {
50 WLAN_STA_AUTH = 1<<0, 57 WLAN_STA_AUTH,
51 WLAN_STA_ASSOC = 1<<1, 58 WLAN_STA_ASSOC,
52 WLAN_STA_PS_STA = 1<<2, 59 WLAN_STA_PS_STA,
53 WLAN_STA_AUTHORIZED = 1<<3, 60 WLAN_STA_AUTHORIZED,
54 WLAN_STA_SHORT_PREAMBLE = 1<<4, 61 WLAN_STA_SHORT_PREAMBLE,
55 WLAN_STA_ASSOC_AP = 1<<5, 62 WLAN_STA_ASSOC_AP,
56 WLAN_STA_WME = 1<<6, 63 WLAN_STA_WME,
57 WLAN_STA_WDS = 1<<7, 64 WLAN_STA_WDS,
58 WLAN_STA_CLEAR_PS_FILT = 1<<9, 65 WLAN_STA_CLEAR_PS_FILT,
59 WLAN_STA_MFP = 1<<10, 66 WLAN_STA_MFP,
60 WLAN_STA_BLOCK_BA = 1<<11, 67 WLAN_STA_BLOCK_BA,
61 WLAN_STA_PS_DRIVER = 1<<12, 68 WLAN_STA_PS_DRIVER,
62 WLAN_STA_PSPOLL = 1<<13, 69 WLAN_STA_PSPOLL,
63 WLAN_STA_PS_DRIVER_BUF = 1<<14, 70 WLAN_STA_TDLS_PEER,
71 WLAN_STA_TDLS_PEER_AUTH,
72 WLAN_STA_UAPSD,
73 WLAN_STA_SP,
64}; 74};
65 75
66#define STA_TID_NUM 16 76#define STA_TID_NUM 16
@@ -203,15 +213,16 @@ struct sta_ampdu_mlme {
203 * @last_rx_rate_flag: rx status flag of the last data packet 213 * @last_rx_rate_flag: rx status flag of the last data packet
204 * @lock: used for locking all fields that require locking, see comments 214 * @lock: used for locking all fields that require locking, see comments
205 * in the header file. 215 * in the header file.
206 * @flaglock: spinlock for flags accesses
207 * @drv_unblock_wk: used for driver PS unblocking 216 * @drv_unblock_wk: used for driver PS unblocking
208 * @listen_interval: listen interval of this station, when we're acting as AP 217 * @listen_interval: listen interval of this station, when we're acting as AP
209 * @flags: STA flags, see &enum ieee80211_sta_info_flags 218 * @_flags: STA flags, see &enum ieee80211_sta_info_flags, do not use directly
210 * @ps_tx_buf: buffer of frames to transmit to this station 219 * @ps_tx_buf: buffers (per AC) of frames to transmit to this station
211 * when it leaves power saving state 220 * when it leaves power saving state or polls
212 * @tx_filtered: buffer of frames we already tried to transmit 221 * @tx_filtered: buffers (per AC) of frames we already tried to
213 * but were filtered by hardware due to STA having entered 222 * transmit but were filtered by hardware due to STA having
214 * power saving state 223 * entered power saving state, these are also delivered to
224 * the station when it leaves powersave or polls for frames
225 * @driver_buffered_tids: bitmap of TIDs the driver has data buffered on
215 * @rx_packets: Number of MSDUs received from this STA 226 * @rx_packets: Number of MSDUs received from this STA
216 * @rx_bytes: Number of bytes received from this STA 227 * @rx_bytes: Number of bytes received from this STA
217 * @wep_weak_iv_count: number of weak WEP IVs received from this station 228 * @wep_weak_iv_count: number of weak WEP IVs received from this station
@@ -261,7 +272,6 @@ struct sta_info {
261 struct rate_control_ref *rate_ctrl; 272 struct rate_control_ref *rate_ctrl;
262 void *rate_ctrl_priv; 273 void *rate_ctrl_priv;
263 spinlock_t lock; 274 spinlock_t lock;
264 spinlock_t flaglock;
265 275
266 struct work_struct drv_unblock_wk; 276 struct work_struct drv_unblock_wk;
267 277
@@ -271,18 +281,16 @@ struct sta_info {
271 281
272 bool uploaded; 282 bool uploaded;
273 283
274 /* 284 /* use the accessors defined below */
275 * frequently updated, locked with own spinlock (flaglock), 285 unsigned long _flags;
276 * use the accessors defined below
277 */
278 u32 flags;
279 286
280 /* 287 /*
281 * STA powersave frame queues, no more than the internal 288 * STA powersave frame queues, no more than the internal
282 * locking required. 289 * locking required.
283 */ 290 */
284 struct sk_buff_head ps_tx_buf; 291 struct sk_buff_head ps_tx_buf[IEEE80211_NUM_ACS];
285 struct sk_buff_head tx_filtered; 292 struct sk_buff_head tx_filtered[IEEE80211_NUM_ACS];
293 unsigned long driver_buffered_tids;
286 294
287 /* Updated from RX path only, no locking requirements */ 295 /* Updated from RX path only, no locking requirements */
288 unsigned long rx_packets, rx_bytes; 296 unsigned long rx_packets, rx_bytes;
@@ -358,60 +366,28 @@ static inline enum nl80211_plink_state sta_plink_state(struct sta_info *sta)
358 return NL80211_PLINK_LISTEN; 366 return NL80211_PLINK_LISTEN;
359} 367}
360 368
361static inline void set_sta_flags(struct sta_info *sta, const u32 flags) 369static inline void set_sta_flag(struct sta_info *sta,
370 enum ieee80211_sta_info_flags flag)
362{ 371{
363 unsigned long irqfl; 372 set_bit(flag, &sta->_flags);
364
365 spin_lock_irqsave(&sta->flaglock, irqfl);
366 sta->flags |= flags;
367 spin_unlock_irqrestore(&sta->flaglock, irqfl);
368} 373}
369 374
370static inline void clear_sta_flags(struct sta_info *sta, const u32 flags) 375static inline void clear_sta_flag(struct sta_info *sta,
376 enum ieee80211_sta_info_flags flag)
371{ 377{
372 unsigned long irqfl; 378 clear_bit(flag, &sta->_flags);
373
374 spin_lock_irqsave(&sta->flaglock, irqfl);
375 sta->flags &= ~flags;
376 spin_unlock_irqrestore(&sta->flaglock, irqfl);
377} 379}
378 380
379static inline u32 test_sta_flags(struct sta_info *sta, const u32 flags) 381static inline int test_sta_flag(struct sta_info *sta,
382 enum ieee80211_sta_info_flags flag)
380{ 383{
381 u32 ret; 384 return test_bit(flag, &sta->_flags);
382 unsigned long irqfl;
383
384 spin_lock_irqsave(&sta->flaglock, irqfl);
385 ret = sta->flags & flags;
386 spin_unlock_irqrestore(&sta->flaglock, irqfl);
387
388 return ret;
389} 385}
390 386
391static inline u32 test_and_clear_sta_flags(struct sta_info *sta, 387static inline int test_and_clear_sta_flag(struct sta_info *sta,
392 const u32 flags) 388 enum ieee80211_sta_info_flags flag)
393{ 389{
394 u32 ret; 390 return test_and_clear_bit(flag, &sta->_flags);
395 unsigned long irqfl;
396
397 spin_lock_irqsave(&sta->flaglock, irqfl);
398 ret = sta->flags & flags;
399 sta->flags &= ~flags;
400 spin_unlock_irqrestore(&sta->flaglock, irqfl);
401
402 return ret;
403}
404
405static inline u32 get_sta_flags(struct sta_info *sta)
406{
407 u32 ret;
408 unsigned long irqfl;
409
410 spin_lock_irqsave(&sta->flaglock, irqfl);
411 ret = sta->flags;
412 spin_unlock_irqrestore(&sta->flaglock, irqfl);
413
414 return ret;
415} 391}
416 392
417void ieee80211_assign_tid_tx(struct sta_info *sta, int tid, 393void ieee80211_assign_tid_tx(struct sta_info *sta, int tid,
@@ -429,8 +405,8 @@ rcu_dereference_protected_tid_tx(struct sta_info *sta, int tid)
429#define STA_HASH(sta) (sta[5]) 405#define STA_HASH(sta) (sta[5])
430 406
431 407
432/* Maximum number of frames to buffer per power saving station */ 408/* Maximum number of frames to buffer per power saving station per AC */
433#define STA_MAX_TX_BUFFER 128 409#define STA_MAX_TX_BUFFER 64
434 410
435/* Minimum buffered frame expiry time. If STA uses listen interval that is 411/* Minimum buffered frame expiry time. If STA uses listen interval that is
436 * smaller than this value, the minimum value here is used instead. */ 412 * smaller than this value, the minimum value here is used instead. */
@@ -523,8 +499,7 @@ int sta_info_destroy_addr(struct ieee80211_sub_if_data *sdata,
523int sta_info_destroy_addr_bss(struct ieee80211_sub_if_data *sdata, 499int sta_info_destroy_addr_bss(struct ieee80211_sub_if_data *sdata,
524 const u8 *addr); 500 const u8 *addr);
525 501
526void sta_info_set_tim_bit(struct sta_info *sta); 502void sta_info_recalc_tim(struct sta_info *sta);
527void sta_info_clear_tim_bit(struct sta_info *sta);
528 503
529void sta_info_init(struct ieee80211_local *local); 504void sta_info_init(struct ieee80211_local *local);
530void sta_info_stop(struct ieee80211_local *local); 505void sta_info_stop(struct ieee80211_local *local);
@@ -535,5 +510,6 @@ void ieee80211_sta_expire(struct ieee80211_sub_if_data *sdata,
535 510
536void ieee80211_sta_ps_deliver_wakeup(struct sta_info *sta); 511void ieee80211_sta_ps_deliver_wakeup(struct sta_info *sta);
537void ieee80211_sta_ps_deliver_poll_response(struct sta_info *sta); 512void ieee80211_sta_ps_deliver_poll_response(struct sta_info *sta);
513void ieee80211_sta_ps_deliver_uapsd(struct sta_info *sta);
538 514
539#endif /* STA_INFO_H */ 515#endif /* STA_INFO_H */