diff options
Diffstat (limited to 'net/mac80211/sta_info.h')
-rw-r--r-- | net/mac80211/sta_info.h | 168 |
1 files changed, 136 insertions, 32 deletions
diff --git a/net/mac80211/sta_info.h b/net/mac80211/sta_info.h index f8c95bc9659c..109db787ccb7 100644 --- a/net/mac80211/sta_info.h +++ b/net/mac80211/sta_info.h | |||
@@ -32,7 +32,7 @@ | |||
32 | * @WLAN_STA_WDS: Station is one of our WDS peers. | 32 | * @WLAN_STA_WDS: Station is one of our WDS peers. |
33 | * @WLAN_STA_PSPOLL: Station has just PS-polled us. | 33 | * @WLAN_STA_PSPOLL: Station has just PS-polled us. |
34 | * @WLAN_STA_CLEAR_PS_FILT: Clear PS filter in hardware (using the | 34 | * @WLAN_STA_CLEAR_PS_FILT: Clear PS filter in hardware (using the |
35 | * IEEE80211_TXCTL_CLEAR_PS_FILT control flag) when the next | 35 | * IEEE80211_TX_CTL_CLEAR_PS_FILT control flag) when the next |
36 | * frame to this station is transmitted. | 36 | * frame to this station is transmitted. |
37 | */ | 37 | */ |
38 | enum ieee80211_sta_info_flags { | 38 | enum ieee80211_sta_info_flags { |
@@ -129,23 +129,19 @@ enum plink_state { | |||
129 | * | 129 | * |
130 | * @tid_state_rx: TID's state in Rx session state machine. | 130 | * @tid_state_rx: TID's state in Rx session state machine. |
131 | * @tid_rx: aggregation info for Rx per TID | 131 | * @tid_rx: aggregation info for Rx per TID |
132 | * @ampdu_rx: for locking sections in aggregation Rx flow | ||
133 | * @tid_state_tx: TID's state in Tx session state machine. | 132 | * @tid_state_tx: TID's state in Tx session state machine. |
134 | * @tid_tx: aggregation info for Tx per TID | 133 | * @tid_tx: aggregation info for Tx per TID |
135 | * @addba_req_num: number of times addBA request has been sent. | 134 | * @addba_req_num: number of times addBA request has been sent. |
136 | * @ampdu_tx: for locking sectionsi in aggregation Tx flow | ||
137 | * @dialog_token_allocator: dialog token enumerator for each new session; | 135 | * @dialog_token_allocator: dialog token enumerator for each new session; |
138 | */ | 136 | */ |
139 | struct sta_ampdu_mlme { | 137 | struct sta_ampdu_mlme { |
140 | /* rx */ | 138 | /* rx */ |
141 | u8 tid_state_rx[STA_TID_NUM]; | 139 | u8 tid_state_rx[STA_TID_NUM]; |
142 | struct tid_ampdu_rx *tid_rx[STA_TID_NUM]; | 140 | struct tid_ampdu_rx *tid_rx[STA_TID_NUM]; |
143 | spinlock_t ampdu_rx; | ||
144 | /* tx */ | 141 | /* tx */ |
145 | u8 tid_state_tx[STA_TID_NUM]; | 142 | u8 tid_state_tx[STA_TID_NUM]; |
146 | struct tid_ampdu_tx *tid_tx[STA_TID_NUM]; | 143 | struct tid_ampdu_tx *tid_tx[STA_TID_NUM]; |
147 | u8 addba_req_num[STA_TID_NUM]; | 144 | u8 addba_req_num[STA_TID_NUM]; |
148 | spinlock_t ampdu_tx; | ||
149 | u8 dialog_token_allocator; | 145 | u8 dialog_token_allocator; |
150 | }; | 146 | }; |
151 | 147 | ||
@@ -164,9 +160,20 @@ struct sta_ampdu_mlme { | |||
164 | * @list: global linked list entry | 160 | * @list: global linked list entry |
165 | * @hnext: hash table linked list pointer | 161 | * @hnext: hash table linked list pointer |
166 | * @local: pointer to the global information | 162 | * @local: pointer to the global information |
163 | * @sdata: TBD | ||
164 | * @key: TBD | ||
165 | * @rate_ctrl: TBD | ||
166 | * @rate_ctrl_priv: TBD | ||
167 | * @lock: used for locking all fields that require locking, see comments | ||
168 | * in the header file. | ||
169 | * @flaglock: spinlock for flags accesses | ||
170 | * @ht_info: HT capabilities of this STA | ||
171 | * @supp_rates: Bitmap of supported rates (per band) | ||
167 | * @addr: MAC address of this STA | 172 | * @addr: MAC address of this STA |
168 | * @aid: STA's unique AID (1..2007, 0 = not assigned yet), | 173 | * @aid: STA's unique AID (1..2007, 0 = not assigned yet), |
169 | * only used in AP (and IBSS?) mode | 174 | * only used in AP (and IBSS?) mode |
175 | * @listen_interval: TBD | ||
176 | * @pin_status: TBD | ||
170 | * @flags: STA flags, see &enum ieee80211_sta_info_flags | 177 | * @flags: STA flags, see &enum ieee80211_sta_info_flags |
171 | * @ps_tx_buf: buffer of frames to transmit to this station | 178 | * @ps_tx_buf: buffer of frames to transmit to this station |
172 | * when it leaves power saving state | 179 | * when it leaves power saving state |
@@ -175,8 +182,41 @@ struct sta_ampdu_mlme { | |||
175 | * power saving state | 182 | * power saving state |
176 | * @rx_packets: Number of MSDUs received from this STA | 183 | * @rx_packets: Number of MSDUs received from this STA |
177 | * @rx_bytes: Number of bytes received from this STA | 184 | * @rx_bytes: Number of bytes received from this STA |
178 | * @supp_rates: Bitmap of supported rates (per band) | 185 | * @wep_weak_iv_count: TBD |
179 | * @ht_info: HT capabilities of this STA | 186 | * @last_rx: TBD |
187 | * @num_duplicates: number of duplicate frames received from this STA | ||
188 | * @rx_fragments: number of received MPDUs | ||
189 | * @rx_dropped: number of dropped MPDUs from this STA | ||
190 | * @last_signal: signal of last received frame from this STA | ||
191 | * @last_qual: qual of last received frame from this STA | ||
192 | * @last_noise: noise of last received frame from this STA | ||
193 | * @last_seq_ctrl: last received seq/frag number from this STA (per RX queue) | ||
194 | * @wme_rx_queue: TBD | ||
195 | * @tx_filtered_count: TBD | ||
196 | * @tx_retry_failed: TBD | ||
197 | * @tx_retry_count: TBD | ||
198 | * @tx_num_consecutive_failures: TBD | ||
199 | * @tx_num_mpdu_ok: TBD | ||
200 | * @tx_num_mpdu_fail: TBD | ||
201 | * @fail_avg: moving percentage of failed MSDUs | ||
202 | * @tx_packets: number of RX/TX MSDUs | ||
203 | * @tx_bytes: TBD | ||
204 | * @tx_fragments: number of transmitted MPDUs | ||
205 | * @txrate_idx: TBD | ||
206 | * @last_txrate_idx: TBD | ||
207 | * @wme_tx_queue: TBD | ||
208 | * @ampdu_mlme: TBD | ||
209 | * @timer_to_tid: identity mapping to ID timers | ||
210 | * @tid_to_tx_q: map tid to tx queue | ||
211 | * @llid: Local link ID | ||
212 | * @plid: Peer link ID | ||
213 | * @reason: Cancel reason on PLINK_HOLDING state | ||
214 | * @plink_retries: Retries in establishment | ||
215 | * @ignore_plink_timer: TBD | ||
216 | * @plink_state plink_state: TBD | ||
217 | * @plink_timeout: TBD | ||
218 | * @plink_timer: TBD | ||
219 | * @debugfs: debug filesystem info | ||
180 | */ | 220 | */ |
181 | struct sta_info { | 221 | struct sta_info { |
182 | /* General information, mostly static */ | 222 | /* General information, mostly static */ |
@@ -187,6 +227,8 @@ struct sta_info { | |||
187 | struct ieee80211_key *key; | 227 | struct ieee80211_key *key; |
188 | struct rate_control_ref *rate_ctrl; | 228 | struct rate_control_ref *rate_ctrl; |
189 | void *rate_ctrl_priv; | 229 | void *rate_ctrl_priv; |
230 | spinlock_t lock; | ||
231 | spinlock_t flaglock; | ||
190 | struct ieee80211_ht_info ht_info; | 232 | struct ieee80211_ht_info ht_info; |
191 | u64 supp_rates[IEEE80211_NUM_BANDS]; | 233 | u64 supp_rates[IEEE80211_NUM_BANDS]; |
192 | u8 addr[ETH_ALEN]; | 234 | u8 addr[ETH_ALEN]; |
@@ -199,7 +241,10 @@ struct sta_info { | |||
199 | */ | 241 | */ |
200 | u8 pin_status; | 242 | u8 pin_status; |
201 | 243 | ||
202 | /* frequently updated information, needs locking? */ | 244 | /* |
245 | * frequently updated, locked with own spinlock (flaglock), | ||
246 | * use the accessors defined below | ||
247 | */ | ||
203 | u32 flags; | 248 | u32 flags; |
204 | 249 | ||
205 | /* | 250 | /* |
@@ -213,14 +258,12 @@ struct sta_info { | |||
213 | unsigned long rx_packets, rx_bytes; | 258 | unsigned long rx_packets, rx_bytes; |
214 | unsigned long wep_weak_iv_count; | 259 | unsigned long wep_weak_iv_count; |
215 | unsigned long last_rx; | 260 | unsigned long last_rx; |
216 | unsigned long num_duplicates; /* number of duplicate frames received | 261 | unsigned long num_duplicates; |
217 | * from this STA */ | 262 | unsigned long rx_fragments; |
218 | unsigned long rx_fragments; /* number of received MPDUs */ | 263 | unsigned long rx_dropped; |
219 | unsigned long rx_dropped; /* number of dropped MPDUs from this STA */ | 264 | int last_signal; |
220 | int last_rssi; /* RSSI of last received frame from this STA */ | 265 | int last_qual; |
221 | int last_signal; /* signal of last received frame from this STA */ | 266 | int last_noise; |
222 | int last_noise; /* noise of last received frame from this STA */ | ||
223 | /* last received seq/frag number from this STA (per RX queue) */ | ||
224 | __le16 last_seq_ctrl[NUM_RX_DATA_QUEUES]; | 267 | __le16 last_seq_ctrl[NUM_RX_DATA_QUEUES]; |
225 | #ifdef CONFIG_MAC80211_DEBUG_COUNTERS | 268 | #ifdef CONFIG_MAC80211_DEBUG_COUNTERS |
226 | unsigned int wme_rx_queue[NUM_RX_DATA_QUEUES]; | 269 | unsigned int wme_rx_queue[NUM_RX_DATA_QUEUES]; |
@@ -237,42 +280,36 @@ struct sta_info { | |||
237 | unsigned int fail_avg; | 280 | unsigned int fail_avg; |
238 | 281 | ||
239 | /* Updated from TX path only, no locking requirements */ | 282 | /* Updated from TX path only, no locking requirements */ |
240 | unsigned long tx_packets; /* number of RX/TX MSDUs */ | 283 | unsigned long tx_packets; |
241 | unsigned long tx_bytes; | 284 | unsigned long tx_bytes; |
242 | unsigned long tx_fragments; /* number of transmitted MPDUs */ | 285 | unsigned long tx_fragments; |
243 | int txrate_idx; | 286 | int txrate_idx; |
244 | int last_txrate_idx; | 287 | int last_txrate_idx; |
288 | u16 tid_seq[IEEE80211_QOS_CTL_TID_MASK + 1]; | ||
245 | #ifdef CONFIG_MAC80211_DEBUG_COUNTERS | 289 | #ifdef CONFIG_MAC80211_DEBUG_COUNTERS |
246 | unsigned int wme_tx_queue[NUM_RX_DATA_QUEUES]; | 290 | unsigned int wme_tx_queue[NUM_RX_DATA_QUEUES]; |
247 | #endif | 291 | #endif |
248 | 292 | ||
249 | /* Debug counters, no locking doesn't matter */ | ||
250 | int channel_use; | ||
251 | int channel_use_raw; | ||
252 | |||
253 | /* | 293 | /* |
254 | * Aggregation information, comes with own locking. | 294 | * Aggregation information, locked with lock. |
255 | */ | 295 | */ |
256 | struct sta_ampdu_mlme ampdu_mlme; | 296 | struct sta_ampdu_mlme ampdu_mlme; |
257 | u8 timer_to_tid[STA_TID_NUM]; /* identity mapping to ID timers */ | 297 | u8 timer_to_tid[STA_TID_NUM]; |
258 | u8 tid_to_tx_q[STA_TID_NUM]; /* map tid to tx queue */ | 298 | u8 tid_to_tx_q[STA_TID_NUM]; |
259 | 299 | ||
260 | #ifdef CONFIG_MAC80211_MESH | 300 | #ifdef CONFIG_MAC80211_MESH |
261 | /* | 301 | /* |
262 | * Mesh peer link attributes | 302 | * Mesh peer link attributes |
263 | * TODO: move to a sub-structure that is referenced with pointer? | 303 | * TODO: move to a sub-structure that is referenced with pointer? |
264 | */ | 304 | */ |
265 | __le16 llid; /* Local link ID */ | 305 | __le16 llid; |
266 | __le16 plid; /* Peer link ID */ | 306 | __le16 plid; |
267 | __le16 reason; /* Cancel reason on PLINK_HOLDING state */ | 307 | __le16 reason; |
268 | u8 plink_retries; /* Retries in establishment */ | 308 | u8 plink_retries; |
269 | bool ignore_plink_timer; | 309 | bool ignore_plink_timer; |
270 | enum plink_state plink_state; | 310 | enum plink_state plink_state; |
271 | u32 plink_timeout; | 311 | u32 plink_timeout; |
272 | struct timer_list plink_timer; | 312 | struct timer_list plink_timer; |
273 | spinlock_t plink_lock; /* For peer_state reads / updates and other | ||
274 | updates in the structure. Ensures robust | ||
275 | transitions for the peerlink FSM */ | ||
276 | #endif | 313 | #endif |
277 | 314 | ||
278 | #ifdef CONFIG_MAC80211_DEBUGFS | 315 | #ifdef CONFIG_MAC80211_DEBUGFS |
@@ -299,6 +336,73 @@ static inline enum plink_state sta_plink_state(struct sta_info *sta) | |||
299 | return PLINK_LISTEN; | 336 | return PLINK_LISTEN; |
300 | } | 337 | } |
301 | 338 | ||
339 | static inline void set_sta_flags(struct sta_info *sta, const u32 flags) | ||
340 | { | ||
341 | unsigned long irqfl; | ||
342 | |||
343 | spin_lock_irqsave(&sta->flaglock, irqfl); | ||
344 | sta->flags |= flags; | ||
345 | spin_unlock_irqrestore(&sta->flaglock, irqfl); | ||
346 | } | ||
347 | |||
348 | static inline void clear_sta_flags(struct sta_info *sta, const u32 flags) | ||
349 | { | ||
350 | unsigned long irqfl; | ||
351 | |||
352 | spin_lock_irqsave(&sta->flaglock, irqfl); | ||
353 | sta->flags &= ~flags; | ||
354 | spin_unlock_irqrestore(&sta->flaglock, irqfl); | ||
355 | } | ||
356 | |||
357 | static inline void set_and_clear_sta_flags(struct sta_info *sta, | ||
358 | const u32 set, const u32 clear) | ||
359 | { | ||
360 | unsigned long irqfl; | ||
361 | |||
362 | spin_lock_irqsave(&sta->flaglock, irqfl); | ||
363 | sta->flags |= set; | ||
364 | sta->flags &= ~clear; | ||
365 | spin_unlock_irqrestore(&sta->flaglock, irqfl); | ||
366 | } | ||
367 | |||
368 | static inline u32 test_sta_flags(struct sta_info *sta, const u32 flags) | ||
369 | { | ||
370 | u32 ret; | ||
371 | unsigned long irqfl; | ||
372 | |||
373 | spin_lock_irqsave(&sta->flaglock, irqfl); | ||
374 | ret = sta->flags & flags; | ||
375 | spin_unlock_irqrestore(&sta->flaglock, irqfl); | ||
376 | |||
377 | return ret; | ||
378 | } | ||
379 | |||
380 | static inline u32 test_and_clear_sta_flags(struct sta_info *sta, | ||
381 | const u32 flags) | ||
382 | { | ||
383 | u32 ret; | ||
384 | unsigned long irqfl; | ||
385 | |||
386 | spin_lock_irqsave(&sta->flaglock, irqfl); | ||
387 | ret = sta->flags & flags; | ||
388 | sta->flags &= ~flags; | ||
389 | spin_unlock_irqrestore(&sta->flaglock, irqfl); | ||
390 | |||
391 | return ret; | ||
392 | } | ||
393 | |||
394 | static inline u32 get_sta_flags(struct sta_info *sta) | ||
395 | { | ||
396 | u32 ret; | ||
397 | unsigned long irqfl; | ||
398 | |||
399 | spin_lock_irqsave(&sta->flaglock, irqfl); | ||
400 | ret = sta->flags; | ||
401 | spin_unlock_irqrestore(&sta->flaglock, irqfl); | ||
402 | |||
403 | return ret; | ||
404 | } | ||
405 | |||
302 | 406 | ||
303 | /* Maximum number of concurrently registered stations */ | 407 | /* Maximum number of concurrently registered stations */ |
304 | #define MAX_STA_COUNT 2007 | 408 | #define MAX_STA_COUNT 2007 |