aboutsummaryrefslogtreecommitdiffstats
path: root/include/net
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2009-02-03 15:41:58 -0500
committerDavid S. Miller <davem@davemloft.net>2009-02-03 15:41:58 -0500
commit1725d409caba16ea5fc694bd50e95e79e8ced11a (patch)
tree688fe26dd4ceda5364692f0ce307aadb6f04f331 /include/net
parentb3ff29d2ccfe3af065a9b393699a8fbf2abd1b15 (diff)
parentb8abde45d7d6ab9e8ceced9b5990eeb1149d0b97 (diff)
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-next-2.6
Diffstat (limited to 'include/net')
-rw-r--r--include/net/cfg80211.h84
-rw-r--r--include/net/mac80211.h212
-rw-r--r--include/net/wireless.h68
3 files changed, 317 insertions, 47 deletions
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 23c0ab74ded6..dd1fd51638fc 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -112,12 +112,14 @@ struct beacon_parameters {
112 * @STATION_FLAG_SHORT_PREAMBLE: station is capable of receiving frames 112 * @STATION_FLAG_SHORT_PREAMBLE: station is capable of receiving frames
113 * with short preambles 113 * with short preambles
114 * @STATION_FLAG_WME: station is WME/QoS capable 114 * @STATION_FLAG_WME: station is WME/QoS capable
115 * @STATION_FLAG_MFP: station uses management frame protection
115 */ 116 */
116enum station_flags { 117enum station_flags {
117 STATION_FLAG_CHANGED = 1<<0, 118 STATION_FLAG_CHANGED = 1<<0,
118 STATION_FLAG_AUTHORIZED = 1<<NL80211_STA_FLAG_AUTHORIZED, 119 STATION_FLAG_AUTHORIZED = 1<<NL80211_STA_FLAG_AUTHORIZED,
119 STATION_FLAG_SHORT_PREAMBLE = 1<<NL80211_STA_FLAG_SHORT_PREAMBLE, 120 STATION_FLAG_SHORT_PREAMBLE = 1<<NL80211_STA_FLAG_SHORT_PREAMBLE,
120 STATION_FLAG_WME = 1<<NL80211_STA_FLAG_WME, 121 STATION_FLAG_WME = 1<<NL80211_STA_FLAG_WME,
122 STATION_FLAG_MFP = 1<<NL80211_STA_FLAG_MFP,
121}; 123};
122 124
123/** 125/**
@@ -355,6 +357,51 @@ enum reg_set_by {
355 REGDOM_SET_BY_COUNTRY_IE, 357 REGDOM_SET_BY_COUNTRY_IE,
356}; 358};
357 359
360/**
361 * enum environment_cap - Environment parsed from country IE
362 * @ENVIRON_ANY: indicates country IE applies to both indoor and
363 * outdoor operation.
364 * @ENVIRON_INDOOR: indicates country IE applies only to indoor operation
365 * @ENVIRON_OUTDOOR: indicates country IE applies only to outdoor operation
366 */
367enum environment_cap {
368 ENVIRON_ANY,
369 ENVIRON_INDOOR,
370 ENVIRON_OUTDOOR,
371};
372
373/**
374 * struct regulatory_request - receipt of last regulatory request
375 *
376 * @wiphy: this is set if this request's initiator is
377 * %REGDOM_SET_BY_COUNTRY_IE or %REGDOM_SET_BY_DRIVER. This
378 * can be used by the wireless core to deal with conflicts
379 * and potentially inform users of which devices specifically
380 * cased the conflicts.
381 * @initiator: indicates who sent this request, could be any of
382 * of those set in reg_set_by, %REGDOM_SET_BY_*
383 * @alpha2: the ISO / IEC 3166 alpha2 country code of the requested
384 * regulatory domain. We have a few special codes:
385 * 00 - World regulatory domain
386 * 99 - built by driver but a specific alpha2 cannot be determined
387 * 98 - result of an intersection between two regulatory domains
388 * @intersect: indicates whether the wireless core should intersect
389 * the requested regulatory domain with the presently set regulatory
390 * domain.
391 * @country_ie_checksum: checksum of the last processed and accepted
392 * country IE
393 * @country_ie_env: lets us know if the AP is telling us we are outdoor,
394 * indoor, or if it doesn't matter
395 */
396struct regulatory_request {
397 struct wiphy *wiphy;
398 enum reg_set_by initiator;
399 char alpha2[2];
400 bool intersect;
401 u32 country_ie_checksum;
402 enum environment_cap country_ie_env;
403};
404
358struct ieee80211_freq_range { 405struct ieee80211_freq_range {
359 u32 start_freq_khz; 406 u32 start_freq_khz;
360 u32 end_freq_khz; 407 u32 end_freq_khz;
@@ -431,6 +478,26 @@ struct ieee80211_txq_params {
431 u8 aifs; 478 u8 aifs;
432}; 479};
433 480
481/**
482 * struct mgmt_extra_ie_params - Extra management frame IE parameters
483 *
484 * Used to add extra IE(s) into management frames. If the driver cannot add the
485 * requested data into all management frames of the specified subtype that are
486 * generated in kernel or firmware/hardware, it must reject the configuration
487 * call. The IE data buffer is added to the end of the specified management
488 * frame body after all other IEs. This addition is not applied to frames that
489 * are injected through a monitor interface.
490 *
491 * @subtype: Management frame subtype
492 * @ies: IE data buffer or %NULL to remove previous data
493 * @ies_len: Length of @ies in octets
494 */
495struct mgmt_extra_ie_params {
496 u8 subtype;
497 u8 *ies;
498 int ies_len;
499};
500
434/* from net/wireless.h */ 501/* from net/wireless.h */
435struct wiphy; 502struct wiphy;
436 503
@@ -450,6 +517,9 @@ struct ieee80211_channel;
450 * wireless extensions but this is subject to reevaluation as soon as this 517 * wireless extensions but this is subject to reevaluation as soon as this
451 * code is used more widely and we have a first user without wext. 518 * code is used more widely and we have a first user without wext.
452 * 519 *
520 * @suspend: wiphy device needs to be suspended
521 * @resume: wiphy device needs to be resumed
522 *
453 * @add_virtual_intf: create a new virtual interface with the given name, 523 * @add_virtual_intf: create a new virtual interface with the given name,
454 * must set the struct wireless_dev's iftype. 524 * must set the struct wireless_dev's iftype.
455 * 525 *
@@ -471,6 +541,8 @@ struct ieee80211_channel;
471 * 541 *
472 * @set_default_key: set the default key on an interface 542 * @set_default_key: set the default key on an interface
473 * 543 *
544 * @set_default_mgmt_key: set the default management frame key on an interface
545 *
474 * @add_beacon: Add a beacon with given parameters, @head, @interval 546 * @add_beacon: Add a beacon with given parameters, @head, @interval
475 * and @dtim_period will be valid, @tail is optional. 547 * and @dtim_period will be valid, @tail is optional.
476 * @set_beacon: Change the beacon parameters for an access point mode 548 * @set_beacon: Change the beacon parameters for an access point mode
@@ -497,8 +569,13 @@ struct ieee80211_channel;
497 * @set_txq_params: Set TX queue parameters 569 * @set_txq_params: Set TX queue parameters
498 * 570 *
499 * @set_channel: Set channel 571 * @set_channel: Set channel
572 *
573 * @set_mgmt_extra_ie: Set extra IE data for management frames
500 */ 574 */
501struct cfg80211_ops { 575struct cfg80211_ops {
576 int (*suspend)(struct wiphy *wiphy);
577 int (*resume)(struct wiphy *wiphy);
578
502 int (*add_virtual_intf)(struct wiphy *wiphy, char *name, 579 int (*add_virtual_intf)(struct wiphy *wiphy, char *name,
503 enum nl80211_iftype type, u32 *flags, 580 enum nl80211_iftype type, u32 *flags,
504 struct vif_params *params); 581 struct vif_params *params);
@@ -518,6 +595,9 @@ struct cfg80211_ops {
518 int (*set_default_key)(struct wiphy *wiphy, 595 int (*set_default_key)(struct wiphy *wiphy,
519 struct net_device *netdev, 596 struct net_device *netdev,
520 u8 key_index); 597 u8 key_index);
598 int (*set_default_mgmt_key)(struct wiphy *wiphy,
599 struct net_device *netdev,
600 u8 key_index);
521 601
522 int (*add_beacon)(struct wiphy *wiphy, struct net_device *dev, 602 int (*add_beacon)(struct wiphy *wiphy, struct net_device *dev,
523 struct beacon_parameters *info); 603 struct beacon_parameters *info);
@@ -564,6 +644,10 @@ struct cfg80211_ops {
564 int (*set_channel)(struct wiphy *wiphy, 644 int (*set_channel)(struct wiphy *wiphy,
565 struct ieee80211_channel *chan, 645 struct ieee80211_channel *chan,
566 enum nl80211_channel_type channel_type); 646 enum nl80211_channel_type channel_type);
647
648 int (*set_mgmt_extra_ie)(struct wiphy *wiphy,
649 struct net_device *dev,
650 struct mgmt_extra_ie_params *params);
567}; 651};
568 652
569/* temporary wext handlers */ 653/* temporary wext handlers */
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 559422fc0943..e2144f0e8728 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -207,7 +207,7 @@ struct ieee80211_bss_conf {
207 u16 beacon_int; 207 u16 beacon_int;
208 u16 assoc_capability; 208 u16 assoc_capability;
209 u64 timestamp; 209 u64 timestamp;
210 u64 basic_rates; 210 u32 basic_rates;
211 struct ieee80211_bss_ht_conf ht; 211 struct ieee80211_bss_ht_conf ht;
212}; 212};
213 213
@@ -262,6 +262,26 @@ enum mac80211_tx_control_flags {
262 IEEE80211_TX_CTL_RATE_CTRL_PROBE = BIT(12), 262 IEEE80211_TX_CTL_RATE_CTRL_PROBE = BIT(12),
263}; 263};
264 264
265/**
266 * enum mac80211_rate_control_flags - per-rate flags set by the
267 * Rate Control algorithm.
268 *
269 * These flags are set by the Rate control algorithm for each rate during tx,
270 * in the @flags member of struct ieee80211_tx_rate.
271 *
272 * @IEEE80211_TX_RC_USE_RTS_CTS: Use RTS/CTS exchange for this rate.
273 * @IEEE80211_TX_RC_USE_CTS_PROTECT: CTS-to-self protection is required.
274 * This is set if the current BSS requires ERP protection.
275 * @IEEE80211_TX_RC_USE_SHORT_PREAMBLE: Use short preamble.
276 * @IEEE80211_TX_RC_MCS: HT rate.
277 * @IEEE80211_TX_RC_GREEN_FIELD: Indicates whether this rate should be used in
278 * Greenfield mode.
279 * @IEEE80211_TX_RC_40_MHZ_WIDTH: Indicates if the Channel Width should be 40 MHz.
280 * @IEEE80211_TX_RC_DUP_DATA: The frame should be transmitted on both of the
281 * adjacent 20 MHz channels, if the current channel type is
282 * NL80211_CHAN_HT40MINUS or NL80211_CHAN_HT40PLUS.
283 * @IEEE80211_TX_RC_SHORT_GI: Short Guard interval should be used for this rate.
284 */
265enum mac80211_rate_control_flags { 285enum mac80211_rate_control_flags {
266 IEEE80211_TX_RC_USE_RTS_CTS = BIT(0), 286 IEEE80211_TX_RC_USE_RTS_CTS = BIT(0),
267 IEEE80211_TX_RC_USE_CTS_PROTECT = BIT(1), 287 IEEE80211_TX_RC_USE_CTS_PROTECT = BIT(1),
@@ -507,11 +527,6 @@ static inline int __deprecated __IEEE80211_CONF_SHORT_SLOT_TIME(void)
507} 527}
508#define IEEE80211_CONF_SHORT_SLOT_TIME (__IEEE80211_CONF_SHORT_SLOT_TIME()) 528#define IEEE80211_CONF_SHORT_SLOT_TIME (__IEEE80211_CONF_SHORT_SLOT_TIME())
509 529
510struct ieee80211_ht_conf {
511 bool enabled;
512 enum nl80211_channel_type channel_type;
513};
514
515/** 530/**
516 * enum ieee80211_conf_changed - denotes which configuration changed 531 * enum ieee80211_conf_changed - denotes which configuration changed
517 * 532 *
@@ -520,10 +535,10 @@ struct ieee80211_ht_conf {
520 * @IEEE80211_CONF_CHANGE_LISTEN_INTERVAL: the listen interval changed 535 * @IEEE80211_CONF_CHANGE_LISTEN_INTERVAL: the listen interval changed
521 * @IEEE80211_CONF_CHANGE_RADIOTAP: the radiotap flag changed 536 * @IEEE80211_CONF_CHANGE_RADIOTAP: the radiotap flag changed
522 * @IEEE80211_CONF_CHANGE_PS: the PS flag changed 537 * @IEEE80211_CONF_CHANGE_PS: the PS flag changed
538 * @IEEE80211_CONF_CHANGE_DYNPS_TIMEOUT: the dynamic PS timeout changed
523 * @IEEE80211_CONF_CHANGE_POWER: the TX power changed 539 * @IEEE80211_CONF_CHANGE_POWER: the TX power changed
524 * @IEEE80211_CONF_CHANGE_CHANNEL: the channel changed 540 * @IEEE80211_CONF_CHANGE_CHANNEL: the channel/channel_type changed
525 * @IEEE80211_CONF_CHANGE_RETRY_LIMITS: retry limits changed 541 * @IEEE80211_CONF_CHANGE_RETRY_LIMITS: retry limits changed
526 * @IEEE80211_CONF_CHANGE_HT: HT configuration changed
527 */ 542 */
528enum ieee80211_conf_changed { 543enum ieee80211_conf_changed {
529 IEEE80211_CONF_CHANGE_RADIO_ENABLED = BIT(0), 544 IEEE80211_CONF_CHANGE_RADIO_ENABLED = BIT(0),
@@ -531,10 +546,10 @@ enum ieee80211_conf_changed {
531 IEEE80211_CONF_CHANGE_LISTEN_INTERVAL = BIT(2), 546 IEEE80211_CONF_CHANGE_LISTEN_INTERVAL = BIT(2),
532 IEEE80211_CONF_CHANGE_RADIOTAP = BIT(3), 547 IEEE80211_CONF_CHANGE_RADIOTAP = BIT(3),
533 IEEE80211_CONF_CHANGE_PS = BIT(4), 548 IEEE80211_CONF_CHANGE_PS = BIT(4),
534 IEEE80211_CONF_CHANGE_POWER = BIT(5), 549 IEEE80211_CONF_CHANGE_DYNPS_TIMEOUT = BIT(5),
535 IEEE80211_CONF_CHANGE_CHANNEL = BIT(6), 550 IEEE80211_CONF_CHANGE_POWER = BIT(6),
536 IEEE80211_CONF_CHANGE_RETRY_LIMITS = BIT(7), 551 IEEE80211_CONF_CHANGE_CHANNEL = BIT(7),
537 IEEE80211_CONF_CHANGE_HT = BIT(8), 552 IEEE80211_CONF_CHANGE_RETRY_LIMITS = BIT(8),
538}; 553};
539 554
540/** 555/**
@@ -547,8 +562,9 @@ enum ieee80211_conf_changed {
547 * @listen_interval: listen interval in units of beacon interval 562 * @listen_interval: listen interval in units of beacon interval
548 * @flags: configuration flags defined above 563 * @flags: configuration flags defined above
549 * @power_level: requested transmit power (in dBm) 564 * @power_level: requested transmit power (in dBm)
565 * @dynamic_ps_timeout: dynamic powersave timeout (in ms)
550 * @channel: the channel to tune to 566 * @channel: the channel to tune to
551 * @ht: the HT configuration for the device 567 * @channel_type: the channel (HT) type
552 * @long_frame_max_tx_count: Maximum number of transmissions for a "long" frame 568 * @long_frame_max_tx_count: Maximum number of transmissions for a "long" frame
553 * (a frame not RTS protected), called "dot11LongRetryLimit" in 802.11, 569 * (a frame not RTS protected), called "dot11LongRetryLimit" in 802.11,
554 * but actually means the number of transmissions not the number of retries 570 * but actually means the number of transmissions not the number of retries
@@ -559,7 +575,7 @@ enum ieee80211_conf_changed {
559struct ieee80211_conf { 575struct ieee80211_conf {
560 int beacon_int; 576 int beacon_int;
561 u32 flags; 577 u32 flags;
562 int power_level; 578 int power_level, dynamic_ps_timeout;
563 579
564 u16 listen_interval; 580 u16 listen_interval;
565 bool radio_enabled; 581 bool radio_enabled;
@@ -567,7 +583,7 @@ struct ieee80211_conf {
567 u8 long_frame_max_tx_count, short_frame_max_tx_count; 583 u8 long_frame_max_tx_count, short_frame_max_tx_count;
568 584
569 struct ieee80211_channel *channel; 585 struct ieee80211_channel *channel;
570 struct ieee80211_ht_conf ht; 586 enum nl80211_channel_type channel_type;
571}; 587};
572 588
573/** 589/**
@@ -630,10 +646,12 @@ struct ieee80211_if_init_conf {
630 * @IEEE80211_IFCC_BSSID: The BSSID changed. 646 * @IEEE80211_IFCC_BSSID: The BSSID changed.
631 * @IEEE80211_IFCC_BEACON: The beacon for this interface changed 647 * @IEEE80211_IFCC_BEACON: The beacon for this interface changed
632 * (currently AP and MESH only), use ieee80211_beacon_get(). 648 * (currently AP and MESH only), use ieee80211_beacon_get().
649 * @IEEE80211_IFCC_BEACON_ENABLED: The enable_beacon value changed.
633 */ 650 */
634enum ieee80211_if_conf_change { 651enum ieee80211_if_conf_change {
635 IEEE80211_IFCC_BSSID = BIT(0), 652 IEEE80211_IFCC_BSSID = BIT(0),
636 IEEE80211_IFCC_BEACON = BIT(1), 653 IEEE80211_IFCC_BEACON = BIT(1),
654 IEEE80211_IFCC_BEACON_ENABLED = BIT(2),
637}; 655};
638 656
639/** 657/**
@@ -641,13 +659,16 @@ enum ieee80211_if_conf_change {
641 * 659 *
642 * @changed: parameters that have changed, see &enum ieee80211_if_conf_change. 660 * @changed: parameters that have changed, see &enum ieee80211_if_conf_change.
643 * @bssid: BSSID of the network we are associated to/creating. 661 * @bssid: BSSID of the network we are associated to/creating.
662 * @enable_beacon: Indicates whether beacons can be sent.
663 * This is valid only for AP/IBSS/MESH modes.
644 * 664 *
645 * This structure is passed to the config_interface() callback of 665 * This structure is passed to the config_interface() callback of
646 * &struct ieee80211_hw. 666 * &struct ieee80211_hw.
647 */ 667 */
648struct ieee80211_if_conf { 668struct ieee80211_if_conf {
649 u32 changed; 669 u32 changed;
650 u8 *bssid; 670 const u8 *bssid;
671 bool enable_beacon;
651}; 672};
652 673
653/** 674/**
@@ -655,11 +676,13 @@ struct ieee80211_if_conf {
655 * @ALG_WEP: WEP40 or WEP104 676 * @ALG_WEP: WEP40 or WEP104
656 * @ALG_TKIP: TKIP 677 * @ALG_TKIP: TKIP
657 * @ALG_CCMP: CCMP (AES) 678 * @ALG_CCMP: CCMP (AES)
679 * @ALG_AES_CMAC: AES-128-CMAC
658 */ 680 */
659enum ieee80211_key_alg { 681enum ieee80211_key_alg {
660 ALG_WEP, 682 ALG_WEP,
661 ALG_TKIP, 683 ALG_TKIP,
662 ALG_CCMP, 684 ALG_CCMP,
685 ALG_AES_CMAC,
663}; 686};
664 687
665/** 688/**
@@ -688,12 +711,16 @@ enum ieee80211_key_len {
688 * generation in software. 711 * generation in software.
689 * @IEEE80211_KEY_FLAG_PAIRWISE: Set by mac80211, this flag indicates 712 * @IEEE80211_KEY_FLAG_PAIRWISE: Set by mac80211, this flag indicates
690 * that the key is pairwise rather then a shared key. 713 * that the key is pairwise rather then a shared key.
714 * @IEEE80211_KEY_FLAG_SW_MGMT: This flag should be set by the driver for a
715 * CCMP key if it requires CCMP encryption of management frames (MFP) to
716 * be done in software.
691 */ 717 */
692enum ieee80211_key_flags { 718enum ieee80211_key_flags {
693 IEEE80211_KEY_FLAG_WMM_STA = 1<<0, 719 IEEE80211_KEY_FLAG_WMM_STA = 1<<0,
694 IEEE80211_KEY_FLAG_GENERATE_IV = 1<<1, 720 IEEE80211_KEY_FLAG_GENERATE_IV = 1<<1,
695 IEEE80211_KEY_FLAG_GENERATE_MMIC= 1<<2, 721 IEEE80211_KEY_FLAG_GENERATE_MMIC= 1<<2,
696 IEEE80211_KEY_FLAG_PAIRWISE = 1<<3, 722 IEEE80211_KEY_FLAG_PAIRWISE = 1<<3,
723 IEEE80211_KEY_FLAG_SW_MGMT = 1<<4,
697}; 724};
698 725
699/** 726/**
@@ -714,8 +741,8 @@ enum ieee80211_key_flags {
714 * - Temporal Encryption Key (128 bits) 741 * - Temporal Encryption Key (128 bits)
715 * - Temporal Authenticator Tx MIC Key (64 bits) 742 * - Temporal Authenticator Tx MIC Key (64 bits)
716 * - Temporal Authenticator Rx MIC Key (64 bits) 743 * - Temporal Authenticator Rx MIC Key (64 bits)
717 * @icv_len: FIXME 744 * @icv_len: The ICV length for this key type
718 * @iv_len: FIXME 745 * @iv_len: The IV length for this key type
719 */ 746 */
720struct ieee80211_key_conf { 747struct ieee80211_key_conf {
721 enum ieee80211_key_alg alg; 748 enum ieee80211_key_alg alg;
@@ -759,7 +786,7 @@ enum set_key_cmd {
759 * sizeof(void *), size is determined in hw information. 786 * sizeof(void *), size is determined in hw information.
760 */ 787 */
761struct ieee80211_sta { 788struct ieee80211_sta {
762 u64 supp_rates[IEEE80211_NUM_BANDS]; 789 u32 supp_rates[IEEE80211_NUM_BANDS];
763 u8 addr[ETH_ALEN]; 790 u8 addr[ETH_ALEN];
764 u16 aid; 791 u16 aid;
765 struct ieee80211_sta_ht_cap ht_cap; 792 struct ieee80211_sta_ht_cap ht_cap;
@@ -854,10 +881,18 @@ enum ieee80211_tkip_key_type {
854 * @IEEE80211_HW_AMPDU_AGGREGATION: 881 * @IEEE80211_HW_AMPDU_AGGREGATION:
855 * Hardware supports 11n A-MPDU aggregation. 882 * Hardware supports 11n A-MPDU aggregation.
856 * 883 *
857 * @IEEE80211_HW_NO_STACK_DYNAMIC_PS: 884 * @IEEE80211_HW_SUPPORTS_PS:
858 * Hardware which has dynamic power save support, meaning 885 * Hardware has power save support (i.e. can go to sleep).
859 * that power save is enabled in idle periods, and don't need support 886 *
860 * from stack. 887 * @IEEE80211_HW_PS_NULLFUNC_STACK:
888 * Hardware requires nullfunc frame handling in stack, implies
889 * stack support for dynamic PS.
890 *
891 * @IEEE80211_HW_SUPPORTS_DYNAMIC_PS:
892 * Hardware has support for dynamic PS.
893 *
894 * @IEEE80211_HW_MFP_CAPABLE:
895 * Hardware supports management frame protection (MFP, IEEE 802.11w).
861 */ 896 */
862enum ieee80211_hw_flags { 897enum ieee80211_hw_flags {
863 IEEE80211_HW_RX_INCLUDES_FCS = 1<<1, 898 IEEE80211_HW_RX_INCLUDES_FCS = 1<<1,
@@ -870,7 +905,10 @@ enum ieee80211_hw_flags {
870 IEEE80211_HW_NOISE_DBM = 1<<8, 905 IEEE80211_HW_NOISE_DBM = 1<<8,
871 IEEE80211_HW_SPECTRUM_MGMT = 1<<9, 906 IEEE80211_HW_SPECTRUM_MGMT = 1<<9,
872 IEEE80211_HW_AMPDU_AGGREGATION = 1<<10, 907 IEEE80211_HW_AMPDU_AGGREGATION = 1<<10,
873 IEEE80211_HW_NO_STACK_DYNAMIC_PS = 1<<11, 908 IEEE80211_HW_SUPPORTS_PS = 1<<11,
909 IEEE80211_HW_PS_NULLFUNC_STACK = 1<<12,
910 IEEE80211_HW_SUPPORTS_DYNAMIC_PS = 1<<13,
911 IEEE80211_HW_MFP_CAPABLE = 1<<14,
874}; 912};
875 913
876/** 914/**
@@ -890,9 +928,8 @@ enum ieee80211_hw_flags {
890 * @workqueue: single threaded workqueue available for driver use, 928 * @workqueue: single threaded workqueue available for driver use,
891 * allocated by mac80211 on registration and flushed when an 929 * allocated by mac80211 on registration and flushed when an
892 * interface is removed. 930 * interface is removed.
893 * NOTICE: All work performed on this workqueue should NEVER 931 * NOTICE: All work performed on this workqueue must not
894 * acquire the RTNL lock (i.e. Don't use the function 932 * acquire the RTNL lock.
895 * ieee80211_iterate_active_interfaces())
896 * 933 *
897 * @priv: pointer to private area that was allocated for driver use 934 * @priv: pointer to private area that was allocated for driver use
898 * along with this structure. 935 * along with this structure.
@@ -952,6 +989,19 @@ struct ieee80211_hw {
952}; 989};
953 990
954/** 991/**
992 * wiphy_to_ieee80211_hw - return a mac80211 driver hw struct from a wiphy
993 *
994 * @wiphy: the &struct wiphy which we want to query
995 *
996 * mac80211 drivers can use this to get to their respective
997 * &struct ieee80211_hw. Drivers wishing to get to their own private
998 * structure can then access it via hw->priv. Note that mac802111 drivers should
999 * not use wiphy_priv() to try to get their private driver structure as this
1000 * is already used internally by mac80211.
1001 */
1002struct ieee80211_hw *wiphy_to_ieee80211_hw(struct wiphy *wiphy);
1003
1004/**
955 * SET_IEEE80211_DEV - set device for 802.11 hardware 1005 * SET_IEEE80211_DEV - set device for 802.11 hardware
956 * 1006 *
957 * @hw: the &struct ieee80211_hw to set the device for 1007 * @hw: the &struct ieee80211_hw to set the device for
@@ -1018,16 +1068,12 @@ ieee80211_get_alt_retry_rate(const struct ieee80211_hw *hw,
1018 * 1068 *
1019 * The set_key() callback in the &struct ieee80211_ops for a given 1069 * The set_key() callback in the &struct ieee80211_ops for a given
1020 * device is called to enable hardware acceleration of encryption and 1070 * device is called to enable hardware acceleration of encryption and
1021 * decryption. The callback takes an @address parameter that will be 1071 * decryption. The callback takes a @sta parameter that will be NULL
1022 * the broadcast address for default keys, the other station's hardware 1072 * for default keys or keys used for transmission only, or point to
1023 * address for individual keys or the zero address for keys that will 1073 * the station information for the peer for individual keys.
1024 * be used only for transmission.
1025 * Multiple transmission keys with the same key index may be used when 1074 * Multiple transmission keys with the same key index may be used when
1026 * VLANs are configured for an access point. 1075 * VLANs are configured for an access point.
1027 * 1076 *
1028 * The @local_address parameter will always be set to our own address,
1029 * this is only relevant if you support multiple local addresses.
1030 *
1031 * When transmitting, the TX control data will use the @hw_key_idx 1077 * When transmitting, the TX control data will use the @hw_key_idx
1032 * selected by the driver by modifying the &struct ieee80211_key_conf 1078 * selected by the driver by modifying the &struct ieee80211_key_conf
1033 * pointed to by the @key parameter to the set_key() function. 1079 * pointed to by the @key parameter to the set_key() function.
@@ -1061,6 +1107,42 @@ ieee80211_get_alt_retry_rate(const struct ieee80211_hw *hw,
1061 */ 1107 */
1062 1108
1063/** 1109/**
1110 * DOC: Powersave support
1111 *
1112 * mac80211 has support for various powersave implementations.
1113 *
1114 * First, it can support hardware that handles all powersaving by
1115 * itself, such hardware should simply set the %IEEE80211_HW_SUPPORTS_PS
1116 * hardware flag. In that case, it will be told about the desired
1117 * powersave mode depending on the association status, and the driver
1118 * must take care of sending nullfunc frames when necessary, i.e. when
1119 * entering and leaving powersave mode. The driver is required to look at
1120 * the AID in beacons and signal to the AP that it woke up when it finds
1121 * traffic directed to it. This mode supports dynamic PS by simply
1122 * enabling/disabling PS.
1123 *
1124 * Additionally, such hardware may set the %IEEE80211_HW_SUPPORTS_DYNAMIC_PS
1125 * flag to indicate that it can support dynamic PS mode itself (see below).
1126 *
1127 * Other hardware designs cannot send nullfunc frames by themselves and also
1128 * need software support for parsing the TIM bitmap. This is also supported
1129 * by mac80211 by combining the %IEEE80211_HW_SUPPORTS_PS and
1130 * %IEEE80211_HW_PS_NULLFUNC_STACK flags. The hardware is of course still
1131 * required to pass up beacons. Additionally, in this case, mac80211 will
1132 * wake up the hardware when multicast traffic is announced in the beacon.
1133 *
1134 * FIXME: I don't think we can be fast enough in software when we want to
1135 * receive multicast traffic?
1136 *
1137 * Dynamic powersave mode is an extension to normal powersave mode in which
1138 * the hardware stays awake for a user-specified period of time after sending
1139 * a frame so that reply frames need not be buffered and therefore delayed
1140 * to the next wakeup. This can either be supported by hardware, in which case
1141 * the driver needs to look at the @dynamic_ps_timeout hardware configuration
1142 * value, or by the stack if all nullfunc handling is in the stack.
1143 */
1144
1145/**
1064 * DOC: Frame filtering 1146 * DOC: Frame filtering
1065 * 1147 *
1066 * mac80211 requires to see many management frames for proper 1148 * mac80211 requires to see many management frames for proper
@@ -1172,6 +1254,8 @@ enum ieee80211_ampdu_mlme_action {
1172 * configuration in the TX control data. This handler should, 1254 * configuration in the TX control data. This handler should,
1173 * preferably, never fail and stop queues appropriately, more 1255 * preferably, never fail and stop queues appropriately, more
1174 * importantly, however, it must never fail for A-MPDU-queues. 1256 * importantly, however, it must never fail for A-MPDU-queues.
1257 * This function should return NETDEV_TX_OK except in very
1258 * limited cases.
1175 * Must be implemented and atomic. 1259 * Must be implemented and atomic.
1176 * 1260 *
1177 * @start: Called before the first netdevice attached to the hardware 1261 * @start: Called before the first netdevice attached to the hardware
@@ -1212,9 +1296,12 @@ enum ieee80211_ampdu_mlme_action {
1212 * 1296 *
1213 * @config: Handler for configuration requests. IEEE 802.11 code calls this 1297 * @config: Handler for configuration requests. IEEE 802.11 code calls this
1214 * function to change hardware configuration, e.g., channel. 1298 * function to change hardware configuration, e.g., channel.
1299 * This function should never fail but returns a negative error code
1300 * if it does.
1215 * 1301 *
1216 * @config_interface: Handler for configuration requests related to interfaces 1302 * @config_interface: Handler for configuration requests related to interfaces
1217 * (e.g. BSSID changes.) 1303 * (e.g. BSSID changes.)
1304 * Returns a negative error code which will be seen in userspace.
1218 * 1305 *
1219 * @bss_info_changed: Handler for configuration requests related to BSS 1306 * @bss_info_changed: Handler for configuration requests related to BSS
1220 * parameters that may vary during BSS's lifespan, and may affect low 1307 * parameters that may vary during BSS's lifespan, and may affect low
@@ -1232,8 +1319,9 @@ enum ieee80211_ampdu_mlme_action {
1232 * 1319 *
1233 * @set_key: See the section "Hardware crypto acceleration" 1320 * @set_key: See the section "Hardware crypto acceleration"
1234 * This callback can sleep, and is only called between add_interface 1321 * This callback can sleep, and is only called between add_interface
1235 * and remove_interface calls, i.e. while the interface with the 1322 * and remove_interface calls, i.e. while the given virtual interface
1236 * given local_address is enabled. 1323 * is enabled.
1324 * Returns a negative error code if the key can't be added.
1237 * 1325 *
1238 * @update_tkip_key: See the section "Hardware crypto acceleration" 1326 * @update_tkip_key: See the section "Hardware crypto acceleration"
1239 * This callback will be called in the context of Rx. Called for drivers 1327 * This callback will be called in the context of Rx. Called for drivers
@@ -1245,8 +1333,10 @@ enum ieee80211_ampdu_mlme_action {
1245 * bands. When the scan finishes, ieee80211_scan_completed() must be 1333 * bands. When the scan finishes, ieee80211_scan_completed() must be
1246 * called; note that it also must be called when the scan cannot finish 1334 * called; note that it also must be called when the scan cannot finish
1247 * because the hardware is turned off! Anything else is a bug! 1335 * because the hardware is turned off! Anything else is a bug!
1336 * Returns a negative error code which will be seen in userspace.
1248 * 1337 *
1249 * @get_stats: return low-level statistics 1338 * @get_stats: Return low-level statistics.
1339 * Returns zero if statistics are available.
1250 * 1340 *
1251 * @get_tkip_seq: If your device implements TKIP encryption in hardware this 1341 * @get_tkip_seq: If your device implements TKIP encryption in hardware this
1252 * callback should be provided to read the TKIP transmit IVs (both IV32 1342 * callback should be provided to read the TKIP transmit IVs (both IV32
@@ -1260,6 +1350,7 @@ enum ieee80211_ampdu_mlme_action {
1260 * 1350 *
1261 * @conf_tx: Configure TX queue parameters (EDCF (aifs, cw_min, cw_max), 1351 * @conf_tx: Configure TX queue parameters (EDCF (aifs, cw_min, cw_max),
1262 * bursting) for a hardware TX queue. 1352 * bursting) for a hardware TX queue.
1353 * Returns a negative error code on failure.
1263 * 1354 *
1264 * @get_tx_stats: Get statistics of the current TX queue status. This is used 1355 * @get_tx_stats: Get statistics of the current TX queue status. This is used
1265 * to get number of currently queued packets (queue length), maximum queue 1356 * to get number of currently queued packets (queue length), maximum queue
@@ -1268,7 +1359,11 @@ enum ieee80211_ampdu_mlme_action {
1268 * hw->ampdu_queues items. 1359 * hw->ampdu_queues items.
1269 * 1360 *
1270 * @get_tsf: Get the current TSF timer value from firmware/hardware. Currently, 1361 * @get_tsf: Get the current TSF timer value from firmware/hardware. Currently,
1271 * this is only used for IBSS mode debugging and, as such, is not a 1362 * this is only used for IBSS mode BSSID merging and debugging. Is not a
1363 * required function. Must be atomic.
1364 *
1365 * @set_tsf: Set the TSF timer to the specified value in the firmware/hardware.
1366 * Currently, this is only used for IBSS mode debugging. Is not a
1272 * required function. Must be atomic. 1367 * required function. Must be atomic.
1273 * 1368 *
1274 * @reset_tsf: Reset the TSF timer and allow firmware/hardware to synchronize 1369 * @reset_tsf: Reset the TSF timer and allow firmware/hardware to synchronize
@@ -1279,13 +1374,15 @@ enum ieee80211_ampdu_mlme_action {
1279 * @tx_last_beacon: Determine whether the last IBSS beacon was sent by us. 1374 * @tx_last_beacon: Determine whether the last IBSS beacon was sent by us.
1280 * This is needed only for IBSS mode and the result of this function is 1375 * This is needed only for IBSS mode and the result of this function is
1281 * used to determine whether to reply to Probe Requests. 1376 * used to determine whether to reply to Probe Requests.
1377 * Returns non-zero if this device sent the last beacon.
1282 * 1378 *
1283 * @ampdu_action: Perform a certain A-MPDU action 1379 * @ampdu_action: Perform a certain A-MPDU action
1284 * The RA/TID combination determines the destination and TID we want 1380 * The RA/TID combination determines the destination and TID we want
1285 * the ampdu action to be performed for. The action is defined through 1381 * the ampdu action to be performed for. The action is defined through
1286 * ieee80211_ampdu_mlme_action. Starting sequence number (@ssn) 1382 * ieee80211_ampdu_mlme_action. Starting sequence number (@ssn)
1287 * is the first frame we expect to perform the action on. notice 1383 * is the first frame we expect to perform the action on. Notice
1288 * that TX/RX_STOP can pass NULL for this parameter. 1384 * that TX/RX_STOP can pass NULL for this parameter.
1385 * Returns a negative error code on failure.
1289 */ 1386 */
1290struct ieee80211_ops { 1387struct ieee80211_ops {
1291 int (*tx)(struct ieee80211_hw *hw, struct sk_buff *skb); 1388 int (*tx)(struct ieee80211_hw *hw, struct sk_buff *skb);
@@ -1310,7 +1407,7 @@ struct ieee80211_ops {
1310 int (*set_tim)(struct ieee80211_hw *hw, struct ieee80211_sta *sta, 1407 int (*set_tim)(struct ieee80211_hw *hw, struct ieee80211_sta *sta,
1311 bool set); 1408 bool set);
1312 int (*set_key)(struct ieee80211_hw *hw, enum set_key_cmd cmd, 1409 int (*set_key)(struct ieee80211_hw *hw, enum set_key_cmd cmd,
1313 const u8 *local_address, const u8 *address, 1410 struct ieee80211_vif *vif, struct ieee80211_sta *sta,
1314 struct ieee80211_key_conf *key); 1411 struct ieee80211_key_conf *key);
1315 void (*update_tkip_key)(struct ieee80211_hw *hw, 1412 void (*update_tkip_key)(struct ieee80211_hw *hw,
1316 struct ieee80211_key_conf *conf, const u8 *address, 1413 struct ieee80211_key_conf *conf, const u8 *address,
@@ -1328,6 +1425,7 @@ struct ieee80211_ops {
1328 int (*get_tx_stats)(struct ieee80211_hw *hw, 1425 int (*get_tx_stats)(struct ieee80211_hw *hw,
1329 struct ieee80211_tx_queue_stats *stats); 1426 struct ieee80211_tx_queue_stats *stats);
1330 u64 (*get_tsf)(struct ieee80211_hw *hw); 1427 u64 (*get_tsf)(struct ieee80211_hw *hw);
1428 void (*set_tsf)(struct ieee80211_hw *hw, u64 tsf);
1331 void (*reset_tsf)(struct ieee80211_hw *hw); 1429 void (*reset_tsf)(struct ieee80211_hw *hw);
1332 int (*tx_last_beacon)(struct ieee80211_hw *hw); 1430 int (*tx_last_beacon)(struct ieee80211_hw *hw);
1333 int (*ampdu_action)(struct ieee80211_hw *hw, 1431 int (*ampdu_action)(struct ieee80211_hw *hw,
@@ -1962,4 +2060,34 @@ rate_lowest_index(struct ieee80211_supported_band *sband,
1962int ieee80211_rate_control_register(struct rate_control_ops *ops); 2060int ieee80211_rate_control_register(struct rate_control_ops *ops);
1963void ieee80211_rate_control_unregister(struct rate_control_ops *ops); 2061void ieee80211_rate_control_unregister(struct rate_control_ops *ops);
1964 2062
2063static inline bool
2064conf_is_ht20(struct ieee80211_conf *conf)
2065{
2066 return conf->channel_type == NL80211_CHAN_HT20;
2067}
2068
2069static inline bool
2070conf_is_ht40_minus(struct ieee80211_conf *conf)
2071{
2072 return conf->channel_type == NL80211_CHAN_HT40MINUS;
2073}
2074
2075static inline bool
2076conf_is_ht40_plus(struct ieee80211_conf *conf)
2077{
2078 return conf->channel_type == NL80211_CHAN_HT40PLUS;
2079}
2080
2081static inline bool
2082conf_is_ht40(struct ieee80211_conf *conf)
2083{
2084 return conf_is_ht40_minus(conf) || conf_is_ht40_plus(conf);
2085}
2086
2087static inline bool
2088conf_is_ht(struct ieee80211_conf *conf)
2089{
2090 return conf->channel_type != NL80211_CHAN_NO_HT;
2091}
2092
1965#endif /* MAC80211_H */ 2093#endif /* MAC80211_H */
diff --git a/include/net/wireless.h b/include/net/wireless.h
index 21c5d966142d..a42c1562d52b 100644
--- a/include/net/wireless.h
+++ b/include/net/wireless.h
@@ -181,12 +181,25 @@ struct ieee80211_supported_band {
181 * struct wiphy - wireless hardware description 181 * struct wiphy - wireless hardware description
182 * @idx: the wiphy index assigned to this item 182 * @idx: the wiphy index assigned to this item
183 * @class_dev: the class device representing /sys/class/ieee80211/<wiphy-name> 183 * @class_dev: the class device representing /sys/class/ieee80211/<wiphy-name>
184 * @fw_handles_regulatory: tells us the firmware for this device 184 * @custom_regulatory: tells us the driver for this device
185 * has its own regulatory solution and cannot identify the 185 * has its own custom regulatory domain and cannot identify the
186 * ISO / IEC 3166 alpha2 it belongs to. When this is enabled 186 * ISO / IEC 3166 alpha2 it belongs to. When this is enabled
187 * we will disregard the first regulatory hint (when the 187 * we will disregard the first regulatory hint (when the
188 * initiator is %REGDOM_SET_BY_CORE). 188 * initiator is %REGDOM_SET_BY_CORE).
189 * @strict_regulatory: tells us the driver for this device will ignore
190 * regulatory domain settings until it gets its own regulatory domain
191 * via its regulatory_hint(). After its gets its own regulatory domain
192 * it will only allow further regulatory domain settings to further
193 * enhance compliance. For example if channel 13 and 14 are disabled
194 * by this regulatory domain no user regulatory domain can enable these
195 * channels at a later time. This can be used for devices which do not
196 * have calibration information gauranteed for frequencies or settings
197 * outside of its regulatory domain.
189 * @reg_notifier: the driver's regulatory notification callback 198 * @reg_notifier: the driver's regulatory notification callback
199 * @regd: the driver's regulatory domain, if one was requested via
200 * the regulatory_hint() API. This can be used by the driver
201 * on the reg_notifier() if it chooses to ignore future
202 * regulatory domain changes caused by other drivers.
190 */ 203 */
191struct wiphy { 204struct wiphy {
192 /* assign these fields before you register the wiphy */ 205 /* assign these fields before you register the wiphy */
@@ -197,7 +210,8 @@ struct wiphy {
197 /* Supported interface modes, OR together BIT(NL80211_IFTYPE_...) */ 210 /* Supported interface modes, OR together BIT(NL80211_IFTYPE_...) */
198 u16 interface_modes; 211 u16 interface_modes;
199 212
200 bool fw_handles_regulatory; 213 bool custom_regulatory;
214 bool strict_regulatory;
201 215
202 /* If multiple wiphys are registered and you're handed e.g. 216 /* If multiple wiphys are registered and you're handed e.g.
203 * a regular netdev with assigned ieee80211_ptr, you won't 217 * a regular netdev with assigned ieee80211_ptr, you won't
@@ -209,10 +223,13 @@ struct wiphy {
209 struct ieee80211_supported_band *bands[IEEE80211_NUM_BANDS]; 223 struct ieee80211_supported_band *bands[IEEE80211_NUM_BANDS];
210 224
211 /* Lets us get back the wiphy on the callback */ 225 /* Lets us get back the wiphy on the callback */
212 int (*reg_notifier)(struct wiphy *wiphy, enum reg_set_by setby); 226 int (*reg_notifier)(struct wiphy *wiphy,
227 struct regulatory_request *request);
213 228
214 /* fields below are read-only, assigned by cfg80211 */ 229 /* fields below are read-only, assigned by cfg80211 */
215 230
231 const struct ieee80211_regdomain *regd;
232
216 /* the item in /sys/class/ieee80211/ points to this, 233 /* the item in /sys/class/ieee80211/ points to this,
217 * you need use set_wiphy_dev() (see below) */ 234 * you need use set_wiphy_dev() (see below) */
218 struct device dev; 235 struct device dev;
@@ -361,7 +378,7 @@ ieee80211_get_channel(struct wiphy *wiphy, int freq)
361 */ 378 */
362struct ieee80211_rate * 379struct ieee80211_rate *
363ieee80211_get_response_rate(struct ieee80211_supported_band *sband, 380ieee80211_get_response_rate(struct ieee80211_supported_band *sband,
364 u64 basic_rates, int bitrate); 381 u32 basic_rates, int bitrate);
365 382
366/** 383/**
367 * regulatory_hint - driver hint to the wireless core a regulatory domain 384 * regulatory_hint - driver hint to the wireless core a regulatory domain
@@ -395,4 +412,45 @@ extern void regulatory_hint(struct wiphy *wiphy, const char *alpha2);
395extern void regulatory_hint_11d(struct wiphy *wiphy, 412extern void regulatory_hint_11d(struct wiphy *wiphy,
396 u8 *country_ie, 413 u8 *country_ie,
397 u8 country_ie_len); 414 u8 country_ie_len);
415
416/**
417 * wiphy_apply_custom_regulatory - apply a custom driver regulatory domain
418 * @wiphy: the wireless device we want to process the regulatory domain on
419 * @regd: the custom regulatory domain to use for this wiphy
420 *
421 * Drivers can sometimes have custom regulatory domains which do not apply
422 * to a specific country. Drivers can use this to apply such custom regulatory
423 * domains. This routine must be called prior to wiphy registration. The
424 * custom regulatory domain will be trusted completely and as such previous
425 * default channel settings will be disregarded. If no rule is found for a
426 * channel on the regulatory domain the channel will be disabled.
427 */
428extern void wiphy_apply_custom_regulatory(
429 struct wiphy *wiphy,
430 const struct ieee80211_regdomain *regd);
431
432/**
433 * freq_reg_info - get regulatory information for the given frequency
434 * @wiphy: the wiphy for which we want to process this rule for
435 * @center_freq: Frequency in KHz for which we want regulatory information for
436 * @bandwidth: the bandwidth requirement you have in KHz, if you do not have one
437 * you can set this to 0. If this frequency is allowed we then set
438 * this value to the maximum allowed bandwidth.
439 * @reg_rule: the regulatory rule which we have for this frequency
440 *
441 * Use this function to get the regulatory rule for a specific frequency on
442 * a given wireless device. If the device has a specific regulatory domain
443 * it wants to follow we respect that unless a country IE has been received
444 * and processed already.
445 *
446 * Returns 0 if it was able to find a valid regulatory rule which does
447 * apply to the given center_freq otherwise it returns non-zero. It will
448 * also return -ERANGE if we determine the given center_freq does not even have
449 * a regulatory rule for a frequency range in the center_freq's band. See
450 * freq_in_rule_band() for our current definition of a band -- this is purely
451 * subjective and right now its 802.11 specific.
452 */
453extern int freq_reg_info(struct wiphy *wiphy, u32 center_freq, u32 *bandwidth,
454 const struct ieee80211_reg_rule **reg_rule);
455
398#endif /* __NET_WIRELESS_H */ 456#endif /* __NET_WIRELESS_H */