aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/ieee80211_i.h
diff options
context:
space:
mode:
Diffstat (limited to 'net/mac80211/ieee80211_i.h')
-rw-r--r--net/mac80211/ieee80211_i.h394
1 files changed, 211 insertions, 183 deletions
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
index 10d316e455de..241533e1bc03 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -2,7 +2,7 @@
2 * Copyright 2002-2005, Instant802 Networks, Inc. 2 * Copyright 2002-2005, Instant802 Networks, Inc.
3 * Copyright 2005, Devicescape Software, Inc. 3 * Copyright 2005, Devicescape Software, Inc.
4 * Copyright 2006-2007 Jiri Benc <jbenc@suse.cz> 4 * Copyright 2006-2007 Jiri Benc <jbenc@suse.cz>
5 * Copyright 2007-2008 Johannes Berg <johannes@sipsolutions.net> 5 * Copyright 2007-2010 Johannes Berg <johannes@sipsolutions.net>
6 * 6 *
7 * This program is free software; you can redistribute it and/or modify 7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as 8 * it under the terms of the GNU General Public License version 2 as
@@ -23,6 +23,7 @@
23#include <linux/types.h> 23#include <linux/types.h>
24#include <linux/spinlock.h> 24#include <linux/spinlock.h>
25#include <linux/etherdevice.h> 25#include <linux/etherdevice.h>
26#include <net/ieee80211_radiotap.h>
26#include <net/cfg80211.h> 27#include <net/cfg80211.h>
27#include <net/mac80211.h> 28#include <net/mac80211.h>
28#include "key.h" 29#include "key.h"
@@ -57,6 +58,15 @@ struct ieee80211_local;
57 58
58#define TU_TO_EXP_TIME(x) (jiffies + usecs_to_jiffies((x) * 1024)) 59#define TU_TO_EXP_TIME(x) (jiffies + usecs_to_jiffies((x) * 1024))
59 60
61#define IEEE80211_DEFAULT_UAPSD_QUEUES \
62 (IEEE80211_WMM_IE_STA_QOSINFO_AC_BK | \
63 IEEE80211_WMM_IE_STA_QOSINFO_AC_BE | \
64 IEEE80211_WMM_IE_STA_QOSINFO_AC_VI | \
65 IEEE80211_WMM_IE_STA_QOSINFO_AC_VO)
66
67#define IEEE80211_DEFAULT_MAX_SP_LEN \
68 IEEE80211_WMM_IE_STA_QOSINFO_SP_ALL
69
60struct ieee80211_fragment_entry { 70struct ieee80211_fragment_entry {
61 unsigned long first_frag_time; 71 unsigned long first_frag_time;
62 unsigned int seq; 72 unsigned int seq;
@@ -70,9 +80,6 @@ struct ieee80211_fragment_entry {
70 80
71 81
72struct ieee80211_bss { 82struct ieee80211_bss {
73 /* Yes, this is a hack */
74 struct cfg80211_bss cbss;
75
76 /* don't want to look up all the time */ 83 /* don't want to look up all the time */
77 size_t ssid_len; 84 size_t ssid_len;
78 u8 ssid[IEEE80211_MAX_SSID_LEN]; 85 u8 ssid[IEEE80211_MAX_SSID_LEN];
@@ -80,6 +87,7 @@ struct ieee80211_bss {
80 u8 dtim_period; 87 u8 dtim_period;
81 88
82 bool wmm_used; 89 bool wmm_used;
90 bool uapsd_supported;
83 91
84 unsigned long last_probe_resp; 92 unsigned long last_probe_resp;
85 93
@@ -139,7 +147,6 @@ typedef unsigned __bitwise__ ieee80211_tx_result;
139 147
140struct ieee80211_tx_data { 148struct ieee80211_tx_data {
141 struct sk_buff *skb; 149 struct sk_buff *skb;
142 struct net_device *dev;
143 struct ieee80211_local *local; 150 struct ieee80211_local *local;
144 struct ieee80211_sub_if_data *sdata; 151 struct ieee80211_sub_if_data *sdata;
145 struct sta_info *sta; 152 struct sta_info *sta;
@@ -162,21 +169,17 @@ typedef unsigned __bitwise__ ieee80211_rx_result;
162/* frame is destined to interface currently processed (incl. multicast frames) */ 169/* frame is destined to interface currently processed (incl. multicast frames) */
163#define IEEE80211_RX_RA_MATCH BIT(1) 170#define IEEE80211_RX_RA_MATCH BIT(1)
164#define IEEE80211_RX_AMSDU BIT(2) 171#define IEEE80211_RX_AMSDU BIT(2)
165#define IEEE80211_RX_CMNTR_REPORTED BIT(3) 172#define IEEE80211_RX_FRAGMENTED BIT(3)
166#define IEEE80211_RX_FRAGMENTED BIT(4) 173/* only add flags here that do not change with subframes of an aMPDU */
167 174
168struct ieee80211_rx_data { 175struct ieee80211_rx_data {
169 struct sk_buff *skb; 176 struct sk_buff *skb;
170 struct net_device *dev;
171 struct ieee80211_local *local; 177 struct ieee80211_local *local;
172 struct ieee80211_sub_if_data *sdata; 178 struct ieee80211_sub_if_data *sdata;
173 struct sta_info *sta; 179 struct sta_info *sta;
174 struct ieee80211_key *key; 180 struct ieee80211_key *key;
175 struct ieee80211_rx_status *status;
176 struct ieee80211_rate *rate;
177 181
178 unsigned int flags; 182 unsigned int flags;
179 int sent_ps_buffered;
180 int queue; 183 int queue;
181 u32 tkip_iv32; 184 u32 tkip_iv32;
182 u16 tkip_iv16; 185 u16 tkip_iv16;
@@ -209,6 +212,9 @@ struct ieee80211_if_wds {
209 212
210struct ieee80211_if_vlan { 213struct ieee80211_if_vlan {
211 struct list_head list; 214 struct list_head list;
215
216 /* used for all tx if the VLAN is configured to 4-addr mode */
217 struct sta_info *sta;
212}; 218};
213 219
214struct mesh_stats { 220struct mesh_stats {
@@ -228,31 +234,77 @@ struct mesh_preq_queue {
228 u8 flags; 234 u8 flags;
229}; 235};
230 236
231enum ieee80211_mgd_state { 237enum ieee80211_work_type {
232 IEEE80211_MGD_STATE_IDLE, 238 IEEE80211_WORK_ABORT,
233 IEEE80211_MGD_STATE_PROBE, 239 IEEE80211_WORK_DIRECT_PROBE,
234 IEEE80211_MGD_STATE_AUTH, 240 IEEE80211_WORK_AUTH,
235 IEEE80211_MGD_STATE_ASSOC, 241 IEEE80211_WORK_ASSOC,
242 IEEE80211_WORK_REMAIN_ON_CHANNEL,
236}; 243};
237 244
238struct ieee80211_mgd_work { 245/**
246 * enum work_done_result - indicates what to do after work was done
247 *
248 * @WORK_DONE_DESTROY: This work item is no longer needed, destroy.
249 * @WORK_DONE_REQUEUE: This work item was reset to be reused, and
250 * should be requeued.
251 */
252enum work_done_result {
253 WORK_DONE_DESTROY,
254 WORK_DONE_REQUEUE,
255};
256
257struct ieee80211_work {
239 struct list_head list; 258 struct list_head list;
240 struct ieee80211_bss *bss; 259
241 int ie_len; 260 struct rcu_head rcu_head;
242 u8 prev_bssid[ETH_ALEN]; 261
243 u8 ssid[IEEE80211_MAX_SSID_LEN]; 262 struct ieee80211_sub_if_data *sdata;
244 u8 ssid_len; 263
264 enum work_done_result (*done)(struct ieee80211_work *wk,
265 struct sk_buff *skb);
266
267 struct ieee80211_channel *chan;
268 enum nl80211_channel_type chan_type;
269
245 unsigned long timeout; 270 unsigned long timeout;
246 enum ieee80211_mgd_state state; 271 enum ieee80211_work_type type;
247 u16 auth_alg, auth_transaction;
248 272
249 int tries; 273 u8 filter_ta[ETH_ALEN];
250 274
251 u8 key[WLAN_KEY_LEN_WEP104]; 275 bool started;
252 u8 key_len, key_idx; 276
277 union {
278 struct {
279 int tries;
280 u16 algorithm, transaction;
281 u8 ssid[IEEE80211_MAX_SSID_LEN];
282 u8 ssid_len;
283 u8 key[WLAN_KEY_LEN_WEP104];
284 u8 key_len, key_idx;
285 bool privacy;
286 } probe_auth;
287 struct {
288 struct cfg80211_bss *bss;
289 const u8 *supp_rates;
290 const u8 *ht_information_ie;
291 enum ieee80211_smps_mode smps;
292 int tries;
293 u16 capability;
294 u8 prev_bssid[ETH_ALEN];
295 u8 ssid[IEEE80211_MAX_SSID_LEN];
296 u8 ssid_len;
297 u8 supp_rates_len;
298 bool wmm_used, use_11n, uapsd_used;
299 } assoc;
300 struct {
301 u32 duration;
302 } remain;
303 };
253 304
305 int ie_len;
254 /* must be last */ 306 /* must be last */
255 u8 ie[0]; /* for auth or assoc frame, not probe */ 307 u8 ie[0];
256}; 308};
257 309
258/* flags used in struct ieee80211_if_managed.flags */ 310/* flags used in struct ieee80211_if_managed.flags */
@@ -260,15 +312,11 @@ enum ieee80211_sta_flags {
260 IEEE80211_STA_BEACON_POLL = BIT(0), 312 IEEE80211_STA_BEACON_POLL = BIT(0),
261 IEEE80211_STA_CONNECTION_POLL = BIT(1), 313 IEEE80211_STA_CONNECTION_POLL = BIT(1),
262 IEEE80211_STA_CONTROL_PORT = BIT(2), 314 IEEE80211_STA_CONTROL_PORT = BIT(2),
263 IEEE80211_STA_WMM_ENABLED = BIT(3),
264 IEEE80211_STA_DISABLE_11N = BIT(4), 315 IEEE80211_STA_DISABLE_11N = BIT(4),
265 IEEE80211_STA_CSA_RECEIVED = BIT(5), 316 IEEE80211_STA_CSA_RECEIVED = BIT(5),
266 IEEE80211_STA_MFP_ENABLED = BIT(6), 317 IEEE80211_STA_MFP_ENABLED = BIT(6),
267}; 318 IEEE80211_STA_UAPSD_ENABLED = BIT(7),
268 319 IEEE80211_STA_NULLFUNC_ACKED = BIT(8),
269/* flags for MLME request */
270enum ieee80211_sta_request {
271 IEEE80211_STA_REQ_SCAN,
272}; 320};
273 321
274struct ieee80211_if_managed { 322struct ieee80211_if_managed {
@@ -285,21 +333,18 @@ struct ieee80211_if_managed {
285 int probe_send_count; 333 int probe_send_count;
286 334
287 struct mutex mtx; 335 struct mutex mtx;
288 struct ieee80211_bss *associated; 336 struct cfg80211_bss *associated;
289 struct ieee80211_mgd_work *old_associate_work;
290 struct list_head work_list;
291 337
292 u8 bssid[ETH_ALEN]; 338 u8 bssid[ETH_ALEN];
293 339
294 u16 aid; 340 u16 aid;
295 u16 capab;
296 341
297 struct sk_buff_head skb_queue; 342 struct sk_buff_head skb_queue;
298 343
299 unsigned long timers_running; /* used for quiesce/restart */ 344 unsigned long timers_running; /* used for quiesce/restart */
300 bool powersave; /* powersave requested for this iface */ 345 bool powersave; /* powersave requested for this iface */
301 346 enum ieee80211_smps_mode req_smps, /* requested smps mode */
302 unsigned long request; 347 ap_smps; /* smps mode AP thinks we're in */
303 348
304 unsigned int flags; 349 unsigned int flags;
305 350
@@ -312,6 +357,8 @@ struct ieee80211_if_managed {
312 } mfp; /* management frame protection */ 357 } mfp; /* management frame protection */
313 358
314 int wmm_last_param_set; 359 int wmm_last_param_set;
360
361 u8 use_4addr;
315}; 362};
316 363
317enum ieee80211_ibss_request { 364enum ieee80211_ibss_request {
@@ -353,6 +400,7 @@ struct ieee80211_if_mesh {
353 struct work_struct work; 400 struct work_struct work;
354 struct timer_list housekeeping_timer; 401 struct timer_list housekeeping_timer;
355 struct timer_list mesh_path_timer; 402 struct timer_list mesh_path_timer;
403 struct timer_list mesh_path_root_timer;
356 struct sk_buff_head skb_queue; 404 struct sk_buff_head skb_queue;
357 405
358 unsigned long timers_running; 406 unsigned long timers_running;
@@ -362,23 +410,23 @@ struct ieee80211_if_mesh {
362 u8 mesh_id[IEEE80211_MAX_MESH_ID_LEN]; 410 u8 mesh_id[IEEE80211_MAX_MESH_ID_LEN];
363 size_t mesh_id_len; 411 size_t mesh_id_len;
364 /* Active Path Selection Protocol Identifier */ 412 /* Active Path Selection Protocol Identifier */
365 u8 mesh_pp_id[4]; 413 u8 mesh_pp_id;
366 /* Active Path Selection Metric Identifier */ 414 /* Active Path Selection Metric Identifier */
367 u8 mesh_pm_id[4]; 415 u8 mesh_pm_id;
368 /* Congestion Control Mode Identifier */ 416 /* Congestion Control Mode Identifier */
369 u8 mesh_cc_id[4]; 417 u8 mesh_cc_id;
370 /* Synchronization Protocol Identifier */ 418 /* Synchronization Protocol Identifier */
371 u8 mesh_sp_id[4]; 419 u8 mesh_sp_id;
372 /* Authentication Protocol Identifier */ 420 /* Authentication Protocol Identifier */
373 u8 mesh_auth_id[4]; 421 u8 mesh_auth_id;
374 /* Local mesh Destination Sequence Number */ 422 /* Local mesh Sequence Number */
375 u32 dsn; 423 u32 sn;
376 /* Last used PREQ ID */ 424 /* Last used PREQ ID */
377 u32 preq_id; 425 u32 preq_id;
378 atomic_t mpaths; 426 atomic_t mpaths;
379 /* Timestamp of last DSN update */ 427 /* Timestamp of last SN update */
380 unsigned long last_dsn_update; 428 unsigned long last_sn_update;
381 /* Timestamp of last DSN sent */ 429 /* Timestamp of last SN sent */
382 unsigned long last_preq; 430 unsigned long last_preq;
383 struct mesh_rmc *rmc; 431 struct mesh_rmc *rmc;
384 spinlock_t mesh_preq_queue_lock; 432 spinlock_t mesh_preq_queue_lock;
@@ -430,6 +478,8 @@ struct ieee80211_sub_if_data {
430 478
431 int drop_unencrypted; 479 int drop_unencrypted;
432 480
481 char name[IFNAMSIZ];
482
433 /* 483 /*
434 * keep track of whether the HT opmode (stored in 484 * keep track of whether the HT opmode (stored in
435 * vif.bss_info.ht_operation_mode) is valid. 485 * vif.bss_info.ht_operation_mode) is valid.
@@ -455,8 +505,8 @@ struct ieee80211_sub_if_data {
455 */ 505 */
456 struct ieee80211_if_ap *bss; 506 struct ieee80211_if_ap *bss;
457 507
458 int force_unicast_rateidx; /* forced TX rateidx for unicast frames */ 508 /* bitmap of allowed (non-MCS) rate indexes for rate control */
459 int max_ratectrl_rateidx; /* max TX rateidx for rate control */ 509 u32 rc_rateidx_mask[IEEE80211_NUM_BANDS];
460 510
461 union { 511 union {
462 struct ieee80211_if_ap ap; 512 struct ieee80211_if_ap ap;
@@ -471,74 +521,11 @@ struct ieee80211_sub_if_data {
471 } u; 521 } u;
472 522
473#ifdef CONFIG_MAC80211_DEBUGFS 523#ifdef CONFIG_MAC80211_DEBUGFS
474 struct dentry *debugfsdir;
475 union {
476 struct {
477 struct dentry *drop_unencrypted;
478 struct dentry *bssid;
479 struct dentry *aid;
480 struct dentry *capab;
481 struct dentry *force_unicast_rateidx;
482 struct dentry *max_ratectrl_rateidx;
483 } sta;
484 struct {
485 struct dentry *drop_unencrypted;
486 struct dentry *num_sta_ps;
487 struct dentry *dtim_count;
488 struct dentry *force_unicast_rateidx;
489 struct dentry *max_ratectrl_rateidx;
490 struct dentry *num_buffered_multicast;
491 } ap;
492 struct {
493 struct dentry *drop_unencrypted;
494 struct dentry *peer;
495 struct dentry *force_unicast_rateidx;
496 struct dentry *max_ratectrl_rateidx;
497 } wds;
498 struct {
499 struct dentry *drop_unencrypted;
500 struct dentry *force_unicast_rateidx;
501 struct dentry *max_ratectrl_rateidx;
502 } vlan;
503 struct {
504 struct dentry *mode;
505 } monitor;
506 } debugfs;
507 struct { 524 struct {
525 struct dentry *dir;
508 struct dentry *default_key; 526 struct dentry *default_key;
509 struct dentry *default_mgmt_key; 527 struct dentry *default_mgmt_key;
510 } common_debugfs; 528 } debugfs;
511
512#ifdef CONFIG_MAC80211_MESH
513 struct dentry *mesh_stats_dir;
514 struct {
515 struct dentry *fwded_mcast;
516 struct dentry *fwded_unicast;
517 struct dentry *fwded_frames;
518 struct dentry *dropped_frames_ttl;
519 struct dentry *dropped_frames_no_route;
520 struct dentry *estab_plinks;
521 struct timer_list mesh_path_timer;
522 } mesh_stats;
523
524 struct dentry *mesh_config_dir;
525 struct {
526 struct dentry *dot11MeshRetryTimeout;
527 struct dentry *dot11MeshConfirmTimeout;
528 struct dentry *dot11MeshHoldingTimeout;
529 struct dentry *dot11MeshMaxRetries;
530 struct dentry *dot11MeshTTL;
531 struct dentry *auto_open_plinks;
532 struct dentry *dot11MeshMaxPeerLinks;
533 struct dentry *dot11MeshHWMPactivePathTimeout;
534 struct dentry *dot11MeshHWMPpreqMinInterval;
535 struct dentry *dot11MeshHWMPnetDiameterTraversalTime;
536 struct dentry *dot11MeshHWMPmaxPREQretries;
537 struct dentry *path_refresh_time;
538 struct dentry *min_discovery_timeout;
539 } mesh_config;
540#endif
541
542#endif 529#endif
543 /* must be last, dynamically sized area in this! */ 530 /* must be last, dynamically sized area in this! */
544 struct ieee80211_vif vif; 531 struct ieee80211_vif vif;
@@ -625,6 +612,15 @@ struct ieee80211_local {
625 const struct ieee80211_ops *ops; 612 const struct ieee80211_ops *ops;
626 613
627 /* 614 /*
615 * work stuff, potentially off-channel (in the future)
616 */
617 struct mutex work_mtx;
618 struct list_head work_list;
619 struct timer_list work_timer;
620 struct work_struct work_work;
621 struct sk_buff_head work_skb_queue;
622
623 /*
628 * private workqueue to mac80211. mac80211 makes this accessible 624 * private workqueue to mac80211. mac80211 makes this accessible
629 * via ieee80211_queue_work() 625 * via ieee80211_queue_work()
630 */ 626 */
@@ -639,7 +635,6 @@ struct ieee80211_local {
639 /* number of interfaces with corresponding FIF_ flags */ 635 /* number of interfaces with corresponding FIF_ flags */
640 int fif_fcsfail, fif_plcpfail, fif_control, fif_other_bss, fif_pspoll; 636 int fif_fcsfail, fif_plcpfail, fif_control, fif_other_bss, fif_pspoll;
641 unsigned int filter_flags; /* FIF_* */ 637 unsigned int filter_flags; /* FIF_* */
642 struct iw_statistics wstats;
643 638
644 /* protects the aggregated multicast list and filter calls */ 639 /* protects the aggregated multicast list and filter calls */
645 spinlock_t filter_lock; 640 spinlock_t filter_lock;
@@ -647,6 +642,9 @@ struct ieee80211_local {
647 /* used for uploading changed mc list */ 642 /* used for uploading changed mc list */
648 struct work_struct reconfig_filter; 643 struct work_struct reconfig_filter;
649 644
645 /* used to reconfigure hardware SM PS */
646 struct work_struct recalc_smps;
647
650 /* aggregated multicast list */ 648 /* aggregated multicast list */
651 struct dev_addr_list *mc_list; 649 struct dev_addr_list *mc_list;
652 int mc_count; 650 int mc_count;
@@ -691,15 +689,18 @@ struct ieee80211_local {
691 689
692 /* Station data */ 690 /* Station data */
693 /* 691 /*
694 * The lock only protects the list, hash, timer and counter 692 * The mutex only protects the list and counter,
695 * against manipulation, reads are done in RCU. Additionally, 693 * reads are done in RCU.
696 * the lock protects each BSS's TIM bitmap. 694 * Additionally, the lock protects the hash table,
695 * the pending list and each BSS's TIM bitmap.
697 */ 696 */
697 struct mutex sta_mtx;
698 spinlock_t sta_lock; 698 spinlock_t sta_lock;
699 unsigned long num_sta; 699 unsigned long num_sta;
700 struct list_head sta_list; 700 struct list_head sta_list, sta_pending_list;
701 struct sta_info *sta_hash[STA_HASH_SIZE]; 701 struct sta_info *sta_hash[STA_HASH_SIZE];
702 struct timer_list sta_cleanup; 702 struct timer_list sta_cleanup;
703 struct work_struct sta_finish_work;
703 int sta_generation; 704 int sta_generation;
704 705
705 struct sk_buff_head pending[IEEE80211_MAX_QUEUES]; 706 struct sk_buff_head pending[IEEE80211_MAX_QUEUES];
@@ -738,10 +739,9 @@ struct ieee80211_local {
738 unsigned long scanning; 739 unsigned long scanning;
739 struct cfg80211_ssid scan_ssid; 740 struct cfg80211_ssid scan_ssid;
740 struct cfg80211_scan_request *int_scan_req; 741 struct cfg80211_scan_request *int_scan_req;
741 struct cfg80211_scan_request *scan_req; 742 struct cfg80211_scan_request *scan_req, *hw_scan_req;
742 struct ieee80211_channel *scan_channel; 743 struct ieee80211_channel *scan_channel;
743 const u8 *orig_ies; 744 enum ieee80211_band hw_scan_band;
744 int orig_ies_len;
745 int scan_channel_idx; 745 int scan_channel_idx;
746 int scan_ies_len; 746 int scan_ies_len;
747 747
@@ -751,6 +751,10 @@ struct ieee80211_local {
751 enum nl80211_channel_type oper_channel_type; 751 enum nl80211_channel_type oper_channel_type;
752 struct ieee80211_channel *oper_channel, *csa_channel; 752 struct ieee80211_channel *oper_channel, *csa_channel;
753 753
754 /* Temporary remain-on-channel for off-channel operations */
755 struct ieee80211_channel *tmp_channel;
756 enum nl80211_channel_type tmp_channel_type;
757
754 /* SNMP counters */ 758 /* SNMP counters */
755 /* dot11CountersTable */ 759 /* dot11CountersTable */
756 u32 dot11TransmittedFragmentCount; 760 u32 dot11TransmittedFragmentCount;
@@ -770,10 +774,6 @@ struct ieee80211_local {
770 assoc_led_name[32], radio_led_name[32]; 774 assoc_led_name[32], radio_led_name[32];
771#endif 775#endif
772 776
773#ifdef CONFIG_MAC80211_DEBUGFS
774 struct work_struct sta_debugfs_add;
775#endif
776
777#ifdef CONFIG_MAC80211_DEBUG_COUNTERS 777#ifdef CONFIG_MAC80211_DEBUG_COUNTERS
778 /* TX/RX handler statistics */ 778 /* TX/RX handler statistics */
779 unsigned int tx_handlers_drop; 779 unsigned int tx_handlers_drop;
@@ -807,7 +807,22 @@ struct ieee80211_local {
807 int wifi_wme_noack_test; 807 int wifi_wme_noack_test;
808 unsigned int wmm_acm; /* bit field of ACM bits (BIT(802.1D tag)) */ 808 unsigned int wmm_acm; /* bit field of ACM bits (BIT(802.1D tag)) */
809 809
810 /*
811 * Bitmask of enabled u-apsd queues,
812 * IEEE80211_WMM_IE_STA_QOSINFO_AC_BE & co. Needs a new association
813 * to take effect.
814 */
815 unsigned int uapsd_queues;
816
817 /*
818 * Maximum number of buffered frames AP can deliver during a
819 * service period, IEEE80211_WMM_IE_STA_QOSINFO_SP_ALL or similar.
820 * Needs a new association to take effect.
821 */
822 unsigned int uapsd_max_sp_len;
823
810 bool pspolling; 824 bool pspolling;
825 bool offchannel_ps_enabled;
811 /* 826 /*
812 * PS can only be enabled when we have exactly one managed 827 * PS can only be enabled when we have exactly one managed
813 * interface (and monitors) in PS, this then points there. 828 * interface (and monitors) in PS, this then points there.
@@ -821,58 +836,13 @@ struct ieee80211_local {
821 int user_power_level; /* in dBm */ 836 int user_power_level; /* in dBm */
822 int power_constr_level; /* in dBm */ 837 int power_constr_level; /* in dBm */
823 838
839 enum ieee80211_smps_mode smps_mode;
840
824 struct work_struct restart_work; 841 struct work_struct restart_work;
825 842
826#ifdef CONFIG_MAC80211_DEBUGFS 843#ifdef CONFIG_MAC80211_DEBUGFS
827 struct local_debugfsdentries { 844 struct local_debugfsdentries {
828 struct dentry *rcdir; 845 struct dentry *rcdir;
829 struct dentry *rcname;
830 struct dentry *frequency;
831 struct dentry *total_ps_buffered;
832 struct dentry *wep_iv;
833 struct dentry *tsf;
834 struct dentry *queues;
835 struct dentry *reset;
836 struct dentry *noack;
837 struct dentry *statistics;
838 struct local_debugfsdentries_statsdentries {
839 struct dentry *transmitted_fragment_count;
840 struct dentry *multicast_transmitted_frame_count;
841 struct dentry *failed_count;
842 struct dentry *retry_count;
843 struct dentry *multiple_retry_count;
844 struct dentry *frame_duplicate_count;
845 struct dentry *received_fragment_count;
846 struct dentry *multicast_received_frame_count;
847 struct dentry *transmitted_frame_count;
848 struct dentry *wep_undecryptable_count;
849 struct dentry *num_scans;
850#ifdef CONFIG_MAC80211_DEBUG_COUNTERS
851 struct dentry *tx_handlers_drop;
852 struct dentry *tx_handlers_queued;
853 struct dentry *tx_handlers_drop_unencrypted;
854 struct dentry *tx_handlers_drop_fragment;
855 struct dentry *tx_handlers_drop_wep;
856 struct dentry *tx_handlers_drop_not_assoc;
857 struct dentry *tx_handlers_drop_unauth_port;
858 struct dentry *rx_handlers_drop;
859 struct dentry *rx_handlers_queued;
860 struct dentry *rx_handlers_drop_nullfunc;
861 struct dentry *rx_handlers_drop_defrag;
862 struct dentry *rx_handlers_drop_short;
863 struct dentry *rx_handlers_drop_passive_scan;
864 struct dentry *tx_expand_skb_head;
865 struct dentry *tx_expand_skb_head_cloned;
866 struct dentry *rx_expand_skb_head;
867 struct dentry *rx_expand_skb_head2;
868 struct dentry *rx_handlers_fragments;
869 struct dentry *tx_status_drop;
870#endif
871 struct dentry *dot11ACKFailureCount;
872 struct dentry *dot11RTSFailureCount;
873 struct dentry *dot11FCSErrorCount;
874 struct dentry *dot11RTSSuccessCount;
875 } stats;
876 struct dentry *stations; 846 struct dentry *stations;
877 struct dentry *keys; 847 struct dentry *keys;
878 } debugfs; 848 } debugfs;
@@ -885,8 +855,9 @@ IEEE80211_DEV_TO_SUB_IF(struct net_device *dev)
885 return netdev_priv(dev); 855 return netdev_priv(dev);
886} 856}
887 857
888/* this struct represents 802.11n's RA/TID combination */ 858/* this struct represents 802.11n's RA/TID combination along with our vif */
889struct ieee80211_ra_tid { 859struct ieee80211_ra_tid {
860 struct ieee80211_vif *vif;
890 u8 ra[ETH_ALEN]; 861 u8 ra[ETH_ALEN];
891 u16 tid; 862 u16 tid;
892}; 863};
@@ -913,12 +884,13 @@ struct ieee802_11_elems {
913 u8 *wmm_param; 884 u8 *wmm_param;
914 struct ieee80211_ht_cap *ht_cap_elem; 885 struct ieee80211_ht_cap *ht_cap_elem;
915 struct ieee80211_ht_info *ht_info_elem; 886 struct ieee80211_ht_info *ht_info_elem;
916 u8 *mesh_config; 887 struct ieee80211_meshconf_ie *mesh_config;
917 u8 *mesh_id; 888 u8 *mesh_id;
918 u8 *peer_link; 889 u8 *peer_link;
919 u8 *preq; 890 u8 *preq;
920 u8 *prep; 891 u8 *prep;
921 u8 *perr; 892 u8 *perr;
893 struct ieee80211_rann_ie *rann;
922 u8 *ch_switch_elem; 894 u8 *ch_switch_elem;
923 u8 *country_elem; 895 u8 *country_elem;
924 u8 *pwr_constr_elem; 896 u8 *pwr_constr_elem;
@@ -940,7 +912,6 @@ struct ieee802_11_elems {
940 u8 ext_supp_rates_len; 912 u8 ext_supp_rates_len;
941 u8 wmm_info_len; 913 u8 wmm_info_len;
942 u8 wmm_param_len; 914 u8 wmm_param_len;
943 u8 mesh_config_len;
944 u8 mesh_id_len; 915 u8 mesh_id_len;
945 u8 peer_link_len; 916 u8 peer_link_len;
946 u8 preq_len; 917 u8 preq_len;
@@ -981,6 +952,8 @@ void ieee80211_bss_info_change_notify(struct ieee80211_sub_if_data *sdata,
981void ieee80211_configure_filter(struct ieee80211_local *local); 952void ieee80211_configure_filter(struct ieee80211_local *local);
982u32 ieee80211_reset_erp_info(struct ieee80211_sub_if_data *sdata); 953u32 ieee80211_reset_erp_info(struct ieee80211_sub_if_data *sdata);
983 954
955extern bool ieee80211_disable_40mhz_24ghz;
956
984/* STA code */ 957/* STA code */
985void ieee80211_sta_setup_sdata(struct ieee80211_sub_if_data *sdata); 958void ieee80211_sta_setup_sdata(struct ieee80211_sub_if_data *sdata);
986int ieee80211_mgd_auth(struct ieee80211_sub_if_data *sdata, 959int ieee80211_mgd_auth(struct ieee80211_sub_if_data *sdata,
@@ -993,6 +966,10 @@ int ieee80211_mgd_deauth(struct ieee80211_sub_if_data *sdata,
993int ieee80211_mgd_disassoc(struct ieee80211_sub_if_data *sdata, 966int ieee80211_mgd_disassoc(struct ieee80211_sub_if_data *sdata,
994 struct cfg80211_disassoc_request *req, 967 struct cfg80211_disassoc_request *req,
995 void *cookie); 968 void *cookie);
969int ieee80211_mgd_action(struct ieee80211_sub_if_data *sdata,
970 struct ieee80211_channel *chan,
971 enum nl80211_channel_type channel_type,
972 const u8 *buf, size_t len, u64 *cookie);
996ieee80211_rx_result ieee80211_sta_rx_mgmt(struct ieee80211_sub_if_data *sdata, 973ieee80211_rx_result ieee80211_sta_rx_mgmt(struct ieee80211_sub_if_data *sdata,
997 struct sk_buff *skb); 974 struct sk_buff *skb);
998void ieee80211_send_pspoll(struct ieee80211_local *local, 975void ieee80211_send_pspoll(struct ieee80211_local *local,
@@ -1012,7 +989,8 @@ void ieee80211_ibss_setup_sdata(struct ieee80211_sub_if_data *sdata);
1012ieee80211_rx_result 989ieee80211_rx_result
1013ieee80211_ibss_rx_mgmt(struct ieee80211_sub_if_data *sdata, struct sk_buff *skb); 990ieee80211_ibss_rx_mgmt(struct ieee80211_sub_if_data *sdata, struct sk_buff *skb);
1014struct sta_info *ieee80211_ibss_add_sta(struct ieee80211_sub_if_data *sdata, 991struct sta_info *ieee80211_ibss_add_sta(struct ieee80211_sub_if_data *sdata,
1015 u8 *bssid, u8 *addr, u32 supp_rates); 992 u8 *bssid, u8 *addr, u32 supp_rates,
993 gfp_t gfp);
1016int ieee80211_ibss_join(struct ieee80211_sub_if_data *sdata, 994int ieee80211_ibss_join(struct ieee80211_sub_if_data *sdata,
1017 struct cfg80211_ibss_params *params); 995 struct cfg80211_ibss_params *params);
1018int ieee80211_ibss_leave(struct ieee80211_sub_if_data *sdata); 996int ieee80211_ibss_leave(struct ieee80211_sub_if_data *sdata);
@@ -1044,7 +1022,15 @@ ieee80211_rx_bss_get(struct ieee80211_local *local, u8 *bssid, int freq,
1044void ieee80211_rx_bss_put(struct ieee80211_local *local, 1022void ieee80211_rx_bss_put(struct ieee80211_local *local,
1045 struct ieee80211_bss *bss); 1023 struct ieee80211_bss *bss);
1046 1024
1025/* off-channel helpers */
1026void ieee80211_offchannel_stop_beaconing(struct ieee80211_local *local);
1027void ieee80211_offchannel_stop_station(struct ieee80211_local *local);
1028void ieee80211_offchannel_return(struct ieee80211_local *local,
1029 bool enable_beaconing);
1030
1047/* interface handling */ 1031/* interface handling */
1032int ieee80211_iface_init(void);
1033void ieee80211_iface_exit(void);
1048int ieee80211_if_add(struct ieee80211_local *local, const char *name, 1034int ieee80211_if_add(struct ieee80211_local *local, const char *name,
1049 struct net_device **new_dev, enum nl80211_iftype type, 1035 struct net_device **new_dev, enum nl80211_iftype type,
1050 struct vif_params *params); 1036 struct vif_params *params);
@@ -1055,6 +1041,11 @@ void ieee80211_remove_interfaces(struct ieee80211_local *local);
1055u32 __ieee80211_recalc_idle(struct ieee80211_local *local); 1041u32 __ieee80211_recalc_idle(struct ieee80211_local *local);
1056void ieee80211_recalc_idle(struct ieee80211_local *local); 1042void ieee80211_recalc_idle(struct ieee80211_local *local);
1057 1043
1044static inline bool ieee80211_sdata_running(struct ieee80211_sub_if_data *sdata)
1045{
1046 return netif_running(sdata->dev);
1047}
1048
1058/* tx handling */ 1049/* tx handling */
1059void ieee80211_clear_tx_pending(struct ieee80211_local *local); 1050void ieee80211_clear_tx_pending(struct ieee80211_local *local);
1060void ieee80211_tx_pending(unsigned long data); 1051void ieee80211_tx_pending(unsigned long data);
@@ -1063,6 +1054,18 @@ netdev_tx_t ieee80211_monitor_start_xmit(struct sk_buff *skb,
1063netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb, 1054netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb,
1064 struct net_device *dev); 1055 struct net_device *dev);
1065 1056
1057/*
1058 * radiotap header for status frames
1059 */
1060struct ieee80211_tx_status_rtap_hdr {
1061 struct ieee80211_radiotap_header hdr;
1062 u8 rate;
1063 u8 padding_for_rate;
1064 __le16 tx_flags;
1065 u8 data_retries;
1066} __attribute__ ((packed));
1067
1068
1066/* HT */ 1069/* HT */
1067void ieee80211_ht_cap_ie_to_sta_ht_cap(struct ieee80211_supported_band *sband, 1070void ieee80211_ht_cap_ie_to_sta_ht_cap(struct ieee80211_supported_band *sband,
1068 struct ieee80211_ht_cap *ht_cap_ie, 1071 struct ieee80211_ht_cap *ht_cap_ie,
@@ -1071,6 +1074,9 @@ void ieee80211_send_bar(struct ieee80211_sub_if_data *sdata, u8 *ra, u16 tid, u1
1071void ieee80211_send_delba(struct ieee80211_sub_if_data *sdata, 1074void ieee80211_send_delba(struct ieee80211_sub_if_data *sdata,
1072 const u8 *da, u16 tid, 1075 const u8 *da, u16 tid,
1073 u16 initiator, u16 reason_code); 1076 u16 initiator, u16 reason_code);
1077int ieee80211_send_smps_action(struct ieee80211_sub_if_data *sdata,
1078 enum ieee80211_smps_mode smps, const u8 *da,
1079 const u8 *bssid);
1074 1080
1075void ieee80211_sta_stop_rx_ba_session(struct ieee80211_sub_if_data *sdata, u8 *da, 1081void ieee80211_sta_stop_rx_ba_session(struct ieee80211_sub_if_data *sdata, u8 *da,
1076 u16 tid, u16 initiator, u16 reason); 1082 u16 tid, u16 initiator, u16 reason);
@@ -1132,8 +1138,7 @@ void mac80211_ev_michael_mic_failure(struct ieee80211_sub_if_data *sdata, int ke
1132 struct ieee80211_hdr *hdr, const u8 *tsc, 1138 struct ieee80211_hdr *hdr, const u8 *tsc,
1133 gfp_t gfp); 1139 gfp_t gfp);
1134void ieee80211_set_wmm_default(struct ieee80211_sub_if_data *sdata); 1140void ieee80211_set_wmm_default(struct ieee80211_sub_if_data *sdata);
1135void ieee80211_tx_skb(struct ieee80211_sub_if_data *sdata, struct sk_buff *skb, 1141void ieee80211_tx_skb(struct ieee80211_sub_if_data *sdata, struct sk_buff *skb);
1136 int encrypt);
1137void ieee802_11_parse_elems(u8 *start, size_t len, 1142void ieee802_11_parse_elems(u8 *start, size_t len,
1138 struct ieee802_11_elems *elems); 1143 struct ieee802_11_elems *elems);
1139u32 ieee802_11_parse_elems_crc(u8 *start, size_t len, 1144u32 ieee802_11_parse_elems_crc(u8 *start, size_t len,
@@ -1170,7 +1175,8 @@ void ieee80211_send_auth(struct ieee80211_sub_if_data *sdata,
1170 u8 *extra, size_t extra_len, const u8 *bssid, 1175 u8 *extra, size_t extra_len, const u8 *bssid,
1171 const u8 *key, u8 key_len, u8 key_idx); 1176 const u8 *key, u8 key_len, u8 key_idx);
1172int ieee80211_build_preq_ies(struct ieee80211_local *local, u8 *buffer, 1177int ieee80211_build_preq_ies(struct ieee80211_local *local, u8 *buffer,
1173 const u8 *ie, size_t ie_len); 1178 const u8 *ie, size_t ie_len,
1179 enum ieee80211_band band);
1174void ieee80211_send_probe_req(struct ieee80211_sub_if_data *sdata, u8 *dst, 1180void ieee80211_send_probe_req(struct ieee80211_sub_if_data *sdata, u8 *dst,
1175 const u8 *ssid, size_t ssid_len, 1181 const u8 *ssid, size_t ssid_len,
1176 const u8 *ie, size_t ie_len); 1182 const u8 *ie, size_t ie_len);
@@ -1181,6 +1187,28 @@ void ieee80211_sta_def_wmm_params(struct ieee80211_sub_if_data *sdata,
1181u32 ieee80211_sta_get_rates(struct ieee80211_local *local, 1187u32 ieee80211_sta_get_rates(struct ieee80211_local *local,
1182 struct ieee802_11_elems *elems, 1188 struct ieee802_11_elems *elems,
1183 enum ieee80211_band band); 1189 enum ieee80211_band band);
1190int __ieee80211_request_smps(struct ieee80211_sub_if_data *sdata,
1191 enum ieee80211_smps_mode smps_mode);
1192void ieee80211_recalc_smps(struct ieee80211_local *local,
1193 struct ieee80211_sub_if_data *forsdata);
1194
1195size_t ieee80211_ie_split(const u8 *ies, size_t ielen,
1196 const u8 *ids, int n_ids, size_t offset);
1197size_t ieee80211_ie_split_vendor(const u8 *ies, size_t ielen, size_t offset);
1198
1199/* internal work items */
1200void ieee80211_work_init(struct ieee80211_local *local);
1201void ieee80211_add_work(struct ieee80211_work *wk);
1202void free_work(struct ieee80211_work *wk);
1203void ieee80211_work_purge(struct ieee80211_sub_if_data *sdata);
1204ieee80211_rx_result ieee80211_work_rx_mgmt(struct ieee80211_sub_if_data *sdata,
1205 struct sk_buff *skb);
1206int ieee80211_wk_remain_on_channel(struct ieee80211_sub_if_data *sdata,
1207 struct ieee80211_channel *chan,
1208 enum nl80211_channel_type channel_type,
1209 unsigned int duration, u64 *cookie);
1210int ieee80211_wk_cancel_remain_on_channel(
1211 struct ieee80211_sub_if_data *sdata, u64 cookie);
1184 1212
1185#ifdef CONFIG_MAC80211_NOINLINE 1213#ifdef CONFIG_MAC80211_NOINLINE
1186#define debug_noinline noinline 1214#define debug_noinline noinline