aboutsummaryrefslogtreecommitdiffstats
path: root/include/net/mac80211.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/net/mac80211.h')
-rw-r--r--include/net/mac80211.h342
1 files changed, 252 insertions, 90 deletions
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 559422fc0943..3b83a80e3fe0 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -93,12 +93,9 @@ struct ieee80211_ht_bss_info {
93 * enum ieee80211_max_queues - maximum number of queues 93 * enum ieee80211_max_queues - maximum number of queues
94 * 94 *
95 * @IEEE80211_MAX_QUEUES: Maximum number of regular device queues. 95 * @IEEE80211_MAX_QUEUES: Maximum number of regular device queues.
96 * @IEEE80211_MAX_AMPDU_QUEUES: Maximum number of queues usable
97 * for A-MPDU operation.
98 */ 96 */
99enum ieee80211_max_queues { 97enum ieee80211_max_queues {
100 IEEE80211_MAX_QUEUES = 16, 98 IEEE80211_MAX_QUEUES = 4,
101 IEEE80211_MAX_AMPDU_QUEUES = 16,
102}; 99};
103 100
104/** 101/**
@@ -207,7 +204,7 @@ struct ieee80211_bss_conf {
207 u16 beacon_int; 204 u16 beacon_int;
208 u16 assoc_capability; 205 u16 assoc_capability;
209 u64 timestamp; 206 u64 timestamp;
210 u64 basic_rates; 207 u32 basic_rates;
211 struct ieee80211_bss_ht_conf ht; 208 struct ieee80211_bss_ht_conf ht;
212}; 209};
213 210
@@ -245,6 +242,12 @@ struct ieee80211_bss_conf {
245 * @IEEE80211_TX_CTL_RATE_CTRL_PROBE: internal to mac80211, can be 242 * @IEEE80211_TX_CTL_RATE_CTRL_PROBE: internal to mac80211, can be
246 * set by rate control algorithms to indicate probe rate, will 243 * set by rate control algorithms to indicate probe rate, will
247 * be cleared for fragmented frames (except on the last fragment) 244 * be cleared for fragmented frames (except on the last fragment)
245 * @IEEE80211_TX_INTFL_RCALGO: mac80211 internal flag, do not test or
246 * set this flag in the driver; indicates that the rate control
247 * algorithm was used and should be notified of TX status
248 * @IEEE80211_TX_INTFL_NEED_TXPROCESSING: completely internal to mac80211,
249 * used to indicate that a pending frame requires TX processing before
250 * it can be sent out.
248 */ 251 */
249enum mac80211_tx_control_flags { 252enum mac80211_tx_control_flags {
250 IEEE80211_TX_CTL_REQ_TX_STATUS = BIT(0), 253 IEEE80211_TX_CTL_REQ_TX_STATUS = BIT(0),
@@ -260,8 +263,30 @@ enum mac80211_tx_control_flags {
260 IEEE80211_TX_STAT_AMPDU = BIT(10), 263 IEEE80211_TX_STAT_AMPDU = BIT(10),
261 IEEE80211_TX_STAT_AMPDU_NO_BACK = BIT(11), 264 IEEE80211_TX_STAT_AMPDU_NO_BACK = BIT(11),
262 IEEE80211_TX_CTL_RATE_CTRL_PROBE = BIT(12), 265 IEEE80211_TX_CTL_RATE_CTRL_PROBE = BIT(12),
266 IEEE80211_TX_INTFL_RCALGO = BIT(13),
267 IEEE80211_TX_INTFL_NEED_TXPROCESSING = BIT(14),
263}; 268};
264 269
270/**
271 * enum mac80211_rate_control_flags - per-rate flags set by the
272 * Rate Control algorithm.
273 *
274 * These flags are set by the Rate control algorithm for each rate during tx,
275 * in the @flags member of struct ieee80211_tx_rate.
276 *
277 * @IEEE80211_TX_RC_USE_RTS_CTS: Use RTS/CTS exchange for this rate.
278 * @IEEE80211_TX_RC_USE_CTS_PROTECT: CTS-to-self protection is required.
279 * This is set if the current BSS requires ERP protection.
280 * @IEEE80211_TX_RC_USE_SHORT_PREAMBLE: Use short preamble.
281 * @IEEE80211_TX_RC_MCS: HT rate.
282 * @IEEE80211_TX_RC_GREEN_FIELD: Indicates whether this rate should be used in
283 * Greenfield mode.
284 * @IEEE80211_TX_RC_40_MHZ_WIDTH: Indicates if the Channel Width should be 40 MHz.
285 * @IEEE80211_TX_RC_DUP_DATA: The frame should be transmitted on both of the
286 * adjacent 20 MHz channels, if the current channel type is
287 * NL80211_CHAN_HT40MINUS or NL80211_CHAN_HT40PLUS.
288 * @IEEE80211_TX_RC_SHORT_GI: Short Guard interval should be used for this rate.
289 */
265enum mac80211_rate_control_flags { 290enum mac80211_rate_control_flags {
266 IEEE80211_TX_RC_USE_RTS_CTS = BIT(0), 291 IEEE80211_TX_RC_USE_RTS_CTS = BIT(0),
267 IEEE80211_TX_RC_USE_CTS_PROTECT = BIT(1), 292 IEEE80211_TX_RC_USE_CTS_PROTECT = BIT(1),
@@ -500,17 +525,6 @@ enum ieee80211_conf_flags {
500 IEEE80211_CONF_PS = (1<<1), 525 IEEE80211_CONF_PS = (1<<1),
501}; 526};
502 527
503/* XXX: remove all this once drivers stop trying to use it */
504static inline int __deprecated __IEEE80211_CONF_SHORT_SLOT_TIME(void)
505{
506 return 0;
507}
508#define IEEE80211_CONF_SHORT_SLOT_TIME (__IEEE80211_CONF_SHORT_SLOT_TIME())
509
510struct ieee80211_ht_conf {
511 bool enabled;
512 enum nl80211_channel_type channel_type;
513};
514 528
515/** 529/**
516 * enum ieee80211_conf_changed - denotes which configuration changed 530 * enum ieee80211_conf_changed - denotes which configuration changed
@@ -520,10 +534,10 @@ struct ieee80211_ht_conf {
520 * @IEEE80211_CONF_CHANGE_LISTEN_INTERVAL: the listen interval changed 534 * @IEEE80211_CONF_CHANGE_LISTEN_INTERVAL: the listen interval changed
521 * @IEEE80211_CONF_CHANGE_RADIOTAP: the radiotap flag changed 535 * @IEEE80211_CONF_CHANGE_RADIOTAP: the radiotap flag changed
522 * @IEEE80211_CONF_CHANGE_PS: the PS flag changed 536 * @IEEE80211_CONF_CHANGE_PS: the PS flag changed
537 * @IEEE80211_CONF_CHANGE_DYNPS_TIMEOUT: the dynamic PS timeout changed
523 * @IEEE80211_CONF_CHANGE_POWER: the TX power changed 538 * @IEEE80211_CONF_CHANGE_POWER: the TX power changed
524 * @IEEE80211_CONF_CHANGE_CHANNEL: the channel changed 539 * @IEEE80211_CONF_CHANGE_CHANNEL: the channel/channel_type changed
525 * @IEEE80211_CONF_CHANGE_RETRY_LIMITS: retry limits changed 540 * @IEEE80211_CONF_CHANGE_RETRY_LIMITS: retry limits changed
526 * @IEEE80211_CONF_CHANGE_HT: HT configuration changed
527 */ 541 */
528enum ieee80211_conf_changed { 542enum ieee80211_conf_changed {
529 IEEE80211_CONF_CHANGE_RADIO_ENABLED = BIT(0), 543 IEEE80211_CONF_CHANGE_RADIO_ENABLED = BIT(0),
@@ -531,10 +545,10 @@ enum ieee80211_conf_changed {
531 IEEE80211_CONF_CHANGE_LISTEN_INTERVAL = BIT(2), 545 IEEE80211_CONF_CHANGE_LISTEN_INTERVAL = BIT(2),
532 IEEE80211_CONF_CHANGE_RADIOTAP = BIT(3), 546 IEEE80211_CONF_CHANGE_RADIOTAP = BIT(3),
533 IEEE80211_CONF_CHANGE_PS = BIT(4), 547 IEEE80211_CONF_CHANGE_PS = BIT(4),
534 IEEE80211_CONF_CHANGE_POWER = BIT(5), 548 IEEE80211_CONF_CHANGE_DYNPS_TIMEOUT = BIT(5),
535 IEEE80211_CONF_CHANGE_CHANNEL = BIT(6), 549 IEEE80211_CONF_CHANGE_POWER = BIT(6),
536 IEEE80211_CONF_CHANGE_RETRY_LIMITS = BIT(7), 550 IEEE80211_CONF_CHANGE_CHANNEL = BIT(7),
537 IEEE80211_CONF_CHANGE_HT = BIT(8), 551 IEEE80211_CONF_CHANGE_RETRY_LIMITS = BIT(8),
538}; 552};
539 553
540/** 554/**
@@ -547,8 +561,9 @@ enum ieee80211_conf_changed {
547 * @listen_interval: listen interval in units of beacon interval 561 * @listen_interval: listen interval in units of beacon interval
548 * @flags: configuration flags defined above 562 * @flags: configuration flags defined above
549 * @power_level: requested transmit power (in dBm) 563 * @power_level: requested transmit power (in dBm)
564 * @dynamic_ps_timeout: dynamic powersave timeout (in ms)
550 * @channel: the channel to tune to 565 * @channel: the channel to tune to
551 * @ht: the HT configuration for the device 566 * @channel_type: the channel (HT) type
552 * @long_frame_max_tx_count: Maximum number of transmissions for a "long" frame 567 * @long_frame_max_tx_count: Maximum number of transmissions for a "long" frame
553 * (a frame not RTS protected), called "dot11LongRetryLimit" in 802.11, 568 * (a frame not RTS protected), called "dot11LongRetryLimit" in 802.11,
554 * but actually means the number of transmissions not the number of retries 569 * but actually means the number of transmissions not the number of retries
@@ -559,7 +574,7 @@ enum ieee80211_conf_changed {
559struct ieee80211_conf { 574struct ieee80211_conf {
560 int beacon_int; 575 int beacon_int;
561 u32 flags; 576 u32 flags;
562 int power_level; 577 int power_level, dynamic_ps_timeout;
563 578
564 u16 listen_interval; 579 u16 listen_interval;
565 bool radio_enabled; 580 bool radio_enabled;
@@ -567,7 +582,7 @@ struct ieee80211_conf {
567 u8 long_frame_max_tx_count, short_frame_max_tx_count; 582 u8 long_frame_max_tx_count, short_frame_max_tx_count;
568 583
569 struct ieee80211_channel *channel; 584 struct ieee80211_channel *channel;
570 struct ieee80211_ht_conf ht; 585 enum nl80211_channel_type channel_type;
571}; 586};
572 587
573/** 588/**
@@ -630,10 +645,12 @@ struct ieee80211_if_init_conf {
630 * @IEEE80211_IFCC_BSSID: The BSSID changed. 645 * @IEEE80211_IFCC_BSSID: The BSSID changed.
631 * @IEEE80211_IFCC_BEACON: The beacon for this interface changed 646 * @IEEE80211_IFCC_BEACON: The beacon for this interface changed
632 * (currently AP and MESH only), use ieee80211_beacon_get(). 647 * (currently AP and MESH only), use ieee80211_beacon_get().
648 * @IEEE80211_IFCC_BEACON_ENABLED: The enable_beacon value changed.
633 */ 649 */
634enum ieee80211_if_conf_change { 650enum ieee80211_if_conf_change {
635 IEEE80211_IFCC_BSSID = BIT(0), 651 IEEE80211_IFCC_BSSID = BIT(0),
636 IEEE80211_IFCC_BEACON = BIT(1), 652 IEEE80211_IFCC_BEACON = BIT(1),
653 IEEE80211_IFCC_BEACON_ENABLED = BIT(2),
637}; 654};
638 655
639/** 656/**
@@ -641,13 +658,16 @@ enum ieee80211_if_conf_change {
641 * 658 *
642 * @changed: parameters that have changed, see &enum ieee80211_if_conf_change. 659 * @changed: parameters that have changed, see &enum ieee80211_if_conf_change.
643 * @bssid: BSSID of the network we are associated to/creating. 660 * @bssid: BSSID of the network we are associated to/creating.
661 * @enable_beacon: Indicates whether beacons can be sent.
662 * This is valid only for AP/IBSS/MESH modes.
644 * 663 *
645 * This structure is passed to the config_interface() callback of 664 * This structure is passed to the config_interface() callback of
646 * &struct ieee80211_hw. 665 * &struct ieee80211_hw.
647 */ 666 */
648struct ieee80211_if_conf { 667struct ieee80211_if_conf {
649 u32 changed; 668 u32 changed;
650 u8 *bssid; 669 const u8 *bssid;
670 bool enable_beacon;
651}; 671};
652 672
653/** 673/**
@@ -655,11 +675,13 @@ struct ieee80211_if_conf {
655 * @ALG_WEP: WEP40 or WEP104 675 * @ALG_WEP: WEP40 or WEP104
656 * @ALG_TKIP: TKIP 676 * @ALG_TKIP: TKIP
657 * @ALG_CCMP: CCMP (AES) 677 * @ALG_CCMP: CCMP (AES)
678 * @ALG_AES_CMAC: AES-128-CMAC
658 */ 679 */
659enum ieee80211_key_alg { 680enum ieee80211_key_alg {
660 ALG_WEP, 681 ALG_WEP,
661 ALG_TKIP, 682 ALG_TKIP,
662 ALG_CCMP, 683 ALG_CCMP,
684 ALG_AES_CMAC,
663}; 685};
664 686
665/** 687/**
@@ -688,12 +710,16 @@ enum ieee80211_key_len {
688 * generation in software. 710 * generation in software.
689 * @IEEE80211_KEY_FLAG_PAIRWISE: Set by mac80211, this flag indicates 711 * @IEEE80211_KEY_FLAG_PAIRWISE: Set by mac80211, this flag indicates
690 * that the key is pairwise rather then a shared key. 712 * that the key is pairwise rather then a shared key.
713 * @IEEE80211_KEY_FLAG_SW_MGMT: This flag should be set by the driver for a
714 * CCMP key if it requires CCMP encryption of management frames (MFP) to
715 * be done in software.
691 */ 716 */
692enum ieee80211_key_flags { 717enum ieee80211_key_flags {
693 IEEE80211_KEY_FLAG_WMM_STA = 1<<0, 718 IEEE80211_KEY_FLAG_WMM_STA = 1<<0,
694 IEEE80211_KEY_FLAG_GENERATE_IV = 1<<1, 719 IEEE80211_KEY_FLAG_GENERATE_IV = 1<<1,
695 IEEE80211_KEY_FLAG_GENERATE_MMIC= 1<<2, 720 IEEE80211_KEY_FLAG_GENERATE_MMIC= 1<<2,
696 IEEE80211_KEY_FLAG_PAIRWISE = 1<<3, 721 IEEE80211_KEY_FLAG_PAIRWISE = 1<<3,
722 IEEE80211_KEY_FLAG_SW_MGMT = 1<<4,
697}; 723};
698 724
699/** 725/**
@@ -714,8 +740,8 @@ enum ieee80211_key_flags {
714 * - Temporal Encryption Key (128 bits) 740 * - Temporal Encryption Key (128 bits)
715 * - Temporal Authenticator Tx MIC Key (64 bits) 741 * - Temporal Authenticator Tx MIC Key (64 bits)
716 * - Temporal Authenticator Rx MIC Key (64 bits) 742 * - Temporal Authenticator Rx MIC Key (64 bits)
717 * @icv_len: FIXME 743 * @icv_len: The ICV length for this key type
718 * @iv_len: FIXME 744 * @iv_len: The IV length for this key type
719 */ 745 */
720struct ieee80211_key_conf { 746struct ieee80211_key_conf {
721 enum ieee80211_key_alg alg; 747 enum ieee80211_key_alg alg;
@@ -759,7 +785,7 @@ enum set_key_cmd {
759 * sizeof(void *), size is determined in hw information. 785 * sizeof(void *), size is determined in hw information.
760 */ 786 */
761struct ieee80211_sta { 787struct ieee80211_sta {
762 u64 supp_rates[IEEE80211_NUM_BANDS]; 788 u32 supp_rates[IEEE80211_NUM_BANDS];
763 u8 addr[ETH_ALEN]; 789 u8 addr[ETH_ALEN];
764 u16 aid; 790 u16 aid;
765 struct ieee80211_sta_ht_cap ht_cap; 791 struct ieee80211_sta_ht_cap ht_cap;
@@ -833,11 +859,6 @@ enum ieee80211_tkip_key_type {
833 * expect values between 0 and @max_signal. 859 * expect values between 0 and @max_signal.
834 * If possible please provide dB or dBm instead. 860 * If possible please provide dB or dBm instead.
835 * 861 *
836 * @IEEE80211_HW_SIGNAL_DB:
837 * Hardware gives signal values in dB, decibel difference from an
838 * arbitrary, fixed reference. We expect values between 0 and @max_signal.
839 * If possible please provide dBm instead.
840 *
841 * @IEEE80211_HW_SIGNAL_DBM: 862 * @IEEE80211_HW_SIGNAL_DBM:
842 * Hardware gives signal values in dBm, decibel difference from 863 * Hardware gives signal values in dBm, decibel difference from
843 * one milliwatt. This is the preferred method since it is standardized 864 * one milliwatt. This is the preferred method since it is standardized
@@ -854,10 +875,22 @@ enum ieee80211_tkip_key_type {
854 * @IEEE80211_HW_AMPDU_AGGREGATION: 875 * @IEEE80211_HW_AMPDU_AGGREGATION:
855 * Hardware supports 11n A-MPDU aggregation. 876 * Hardware supports 11n A-MPDU aggregation.
856 * 877 *
857 * @IEEE80211_HW_NO_STACK_DYNAMIC_PS: 878 * @IEEE80211_HW_SUPPORTS_PS:
858 * Hardware which has dynamic power save support, meaning 879 * 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 880 *
860 * from stack. 881 * @IEEE80211_HW_PS_NULLFUNC_STACK:
882 * Hardware requires nullfunc frame handling in stack, implies
883 * stack support for dynamic PS.
884 *
885 * @IEEE80211_HW_SUPPORTS_DYNAMIC_PS:
886 * Hardware has support for dynamic PS.
887 *
888 * @IEEE80211_HW_MFP_CAPABLE:
889 * Hardware supports management frame protection (MFP, IEEE 802.11w).
890 *
891 * @IEEE80211_HW_BEACON_FILTER:
892 * Hardware supports dropping of irrelevant beacon frames to
893 * avoid waking up cpu.
861 */ 894 */
862enum ieee80211_hw_flags { 895enum ieee80211_hw_flags {
863 IEEE80211_HW_RX_INCLUDES_FCS = 1<<1, 896 IEEE80211_HW_RX_INCLUDES_FCS = 1<<1,
@@ -865,12 +898,15 @@ enum ieee80211_hw_flags {
865 IEEE80211_HW_2GHZ_SHORT_SLOT_INCAPABLE = 1<<3, 898 IEEE80211_HW_2GHZ_SHORT_SLOT_INCAPABLE = 1<<3,
866 IEEE80211_HW_2GHZ_SHORT_PREAMBLE_INCAPABLE = 1<<4, 899 IEEE80211_HW_2GHZ_SHORT_PREAMBLE_INCAPABLE = 1<<4,
867 IEEE80211_HW_SIGNAL_UNSPEC = 1<<5, 900 IEEE80211_HW_SIGNAL_UNSPEC = 1<<5,
868 IEEE80211_HW_SIGNAL_DB = 1<<6, 901 IEEE80211_HW_SIGNAL_DBM = 1<<6,
869 IEEE80211_HW_SIGNAL_DBM = 1<<7, 902 IEEE80211_HW_NOISE_DBM = 1<<7,
870 IEEE80211_HW_NOISE_DBM = 1<<8, 903 IEEE80211_HW_SPECTRUM_MGMT = 1<<8,
871 IEEE80211_HW_SPECTRUM_MGMT = 1<<9, 904 IEEE80211_HW_AMPDU_AGGREGATION = 1<<9,
872 IEEE80211_HW_AMPDU_AGGREGATION = 1<<10, 905 IEEE80211_HW_SUPPORTS_PS = 1<<10,
873 IEEE80211_HW_NO_STACK_DYNAMIC_PS = 1<<11, 906 IEEE80211_HW_PS_NULLFUNC_STACK = 1<<11,
907 IEEE80211_HW_SUPPORTS_DYNAMIC_PS = 1<<12,
908 IEEE80211_HW_MFP_CAPABLE = 1<<13,
909 IEEE80211_HW_BEACON_FILTER = 1<<14,
874}; 910};
875 911
876/** 912/**
@@ -890,9 +926,8 @@ enum ieee80211_hw_flags {
890 * @workqueue: single threaded workqueue available for driver use, 926 * @workqueue: single threaded workqueue available for driver use,
891 * allocated by mac80211 on registration and flushed when an 927 * allocated by mac80211 on registration and flushed when an
892 * interface is removed. 928 * interface is removed.
893 * NOTICE: All work performed on this workqueue should NEVER 929 * NOTICE: All work performed on this workqueue must not
894 * acquire the RTNL lock (i.e. Don't use the function 930 * acquire the RTNL lock.
895 * ieee80211_iterate_active_interfaces())
896 * 931 *
897 * @priv: pointer to private area that was allocated for driver use 932 * @priv: pointer to private area that was allocated for driver use
898 * along with this structure. 933 * along with this structure.
@@ -914,12 +949,6 @@ enum ieee80211_hw_flags {
914 * data packets. WMM/QoS requires at least four, these 949 * data packets. WMM/QoS requires at least four, these
915 * queues need to have configurable access parameters. 950 * queues need to have configurable access parameters.
916 * 951 *
917 * @ampdu_queues: number of available hardware transmit queues
918 * for A-MPDU packets, these have no access parameters
919 * because they're used only for A-MPDU frames. Note that
920 * mac80211 will not currently use any of the regular queues
921 * for aggregation.
922 *
923 * @rate_control_algorithm: rate control algorithm for this hardware. 952 * @rate_control_algorithm: rate control algorithm for this hardware.
924 * If unset (NULL), the default algorithm will be used. Must be 953 * If unset (NULL), the default algorithm will be used. Must be
925 * set before calling ieee80211_register_hw(). 954 * set before calling ieee80211_register_hw().
@@ -944,7 +973,6 @@ struct ieee80211_hw {
944 int vif_data_size; 973 int vif_data_size;
945 int sta_data_size; 974 int sta_data_size;
946 u16 queues; 975 u16 queues;
947 u16 ampdu_queues;
948 u16 max_listen_interval; 976 u16 max_listen_interval;
949 s8 max_signal; 977 s8 max_signal;
950 u8 max_rates; 978 u8 max_rates;
@@ -952,6 +980,19 @@ struct ieee80211_hw {
952}; 980};
953 981
954/** 982/**
983 * wiphy_to_ieee80211_hw - return a mac80211 driver hw struct from a wiphy
984 *
985 * @wiphy: the &struct wiphy which we want to query
986 *
987 * mac80211 drivers can use this to get to their respective
988 * &struct ieee80211_hw. Drivers wishing to get to their own private
989 * structure can then access it via hw->priv. Note that mac802111 drivers should
990 * not use wiphy_priv() to try to get their private driver structure as this
991 * is already used internally by mac80211.
992 */
993struct ieee80211_hw *wiphy_to_ieee80211_hw(struct wiphy *wiphy);
994
995/**
955 * SET_IEEE80211_DEV - set device for 802.11 hardware 996 * SET_IEEE80211_DEV - set device for 802.11 hardware
956 * 997 *
957 * @hw: the &struct ieee80211_hw to set the device for 998 * @hw: the &struct ieee80211_hw to set the device for
@@ -973,16 +1014,6 @@ static inline void SET_IEEE80211_PERM_ADDR(struct ieee80211_hw *hw, u8 *addr)
973 memcpy(hw->wiphy->perm_addr, addr, ETH_ALEN); 1014 memcpy(hw->wiphy->perm_addr, addr, ETH_ALEN);
974} 1015}
975 1016
976static inline int ieee80211_num_regular_queues(struct ieee80211_hw *hw)
977{
978 return hw->queues;
979}
980
981static inline int ieee80211_num_queues(struct ieee80211_hw *hw)
982{
983 return hw->queues + hw->ampdu_queues;
984}
985
986static inline struct ieee80211_rate * 1017static inline struct ieee80211_rate *
987ieee80211_get_tx_rate(const struct ieee80211_hw *hw, 1018ieee80211_get_tx_rate(const struct ieee80211_hw *hw,
988 const struct ieee80211_tx_info *c) 1019 const struct ieee80211_tx_info *c)
@@ -1018,16 +1049,12 @@ ieee80211_get_alt_retry_rate(const struct ieee80211_hw *hw,
1018 * 1049 *
1019 * The set_key() callback in the &struct ieee80211_ops for a given 1050 * The set_key() callback in the &struct ieee80211_ops for a given
1020 * device is called to enable hardware acceleration of encryption and 1051 * device is called to enable hardware acceleration of encryption and
1021 * decryption. The callback takes an @address parameter that will be 1052 * decryption. The callback takes a @sta parameter that will be NULL
1022 * the broadcast address for default keys, the other station's hardware 1053 * 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 1054 * 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 1055 * Multiple transmission keys with the same key index may be used when
1026 * VLANs are configured for an access point. 1056 * VLANs are configured for an access point.
1027 * 1057 *
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 1058 * When transmitting, the TX control data will use the @hw_key_idx
1032 * selected by the driver by modifying the &struct ieee80211_key_conf 1059 * selected by the driver by modifying the &struct ieee80211_key_conf
1033 * pointed to by the @key parameter to the set_key() function. 1060 * pointed to by the @key parameter to the set_key() function.
@@ -1061,6 +1088,60 @@ ieee80211_get_alt_retry_rate(const struct ieee80211_hw *hw,
1061 */ 1088 */
1062 1089
1063/** 1090/**
1091 * DOC: Powersave support
1092 *
1093 * mac80211 has support for various powersave implementations.
1094 *
1095 * First, it can support hardware that handles all powersaving by
1096 * itself, such hardware should simply set the %IEEE80211_HW_SUPPORTS_PS
1097 * hardware flag. In that case, it will be told about the desired
1098 * powersave mode depending on the association status, and the driver
1099 * must take care of sending nullfunc frames when necessary, i.e. when
1100 * entering and leaving powersave mode. The driver is required to look at
1101 * the AID in beacons and signal to the AP that it woke up when it finds
1102 * traffic directed to it. This mode supports dynamic PS by simply
1103 * enabling/disabling PS.
1104 *
1105 * Additionally, such hardware may set the %IEEE80211_HW_SUPPORTS_DYNAMIC_PS
1106 * flag to indicate that it can support dynamic PS mode itself (see below).
1107 *
1108 * Other hardware designs cannot send nullfunc frames by themselves and also
1109 * need software support for parsing the TIM bitmap. This is also supported
1110 * by mac80211 by combining the %IEEE80211_HW_SUPPORTS_PS and
1111 * %IEEE80211_HW_PS_NULLFUNC_STACK flags. The hardware is of course still
1112 * required to pass up beacons. Additionally, in this case, mac80211 will
1113 * wake up the hardware when multicast traffic is announced in the beacon.
1114 *
1115 * FIXME: I don't think we can be fast enough in software when we want to
1116 * receive multicast traffic?
1117 *
1118 * Dynamic powersave mode is an extension to normal powersave mode in which
1119 * the hardware stays awake for a user-specified period of time after sending
1120 * a frame so that reply frames need not be buffered and therefore delayed
1121 * to the next wakeup. This can either be supported by hardware, in which case
1122 * the driver needs to look at the @dynamic_ps_timeout hardware configuration
1123 * value, or by the stack if all nullfunc handling is in the stack.
1124 */
1125
1126/**
1127 * DOC: Beacon filter support
1128 *
1129 * Some hardware have beacon filter support to reduce host cpu wakeups
1130 * which will reduce system power consumption. It usuallly works so that
1131 * the firmware creates a checksum of the beacon but omits all constantly
1132 * changing elements (TSF, TIM etc). Whenever the checksum changes the
1133 * beacon is forwarded to the host, otherwise it will be just dropped. That
1134 * way the host will only receive beacons where some relevant information
1135 * (for example ERP protection or WMM settings) have changed.
1136 *
1137 * Beacon filter support is informed with %IEEE80211_HW_BEACON_FILTER flag.
1138 * The driver needs to enable beacon filter support whenever power save is
1139 * enabled, that is %IEEE80211_CONF_PS is set. When power save is enabled,
1140 * the stack will not check for beacon miss at all and the driver needs to
1141 * notify about complete loss of beacons with ieee80211_beacon_loss().
1142 */
1143
1144/**
1064 * DOC: Frame filtering 1145 * DOC: Frame filtering
1065 * 1146 *
1066 * mac80211 requires to see many management frames for proper 1147 * mac80211 requires to see many management frames for proper
@@ -1149,14 +1230,14 @@ enum ieee80211_filter_flags {
1149 * @IEEE80211_AMPDU_RX_STOP: stop Rx aggregation 1230 * @IEEE80211_AMPDU_RX_STOP: stop Rx aggregation
1150 * @IEEE80211_AMPDU_TX_START: start Tx aggregation 1231 * @IEEE80211_AMPDU_TX_START: start Tx aggregation
1151 * @IEEE80211_AMPDU_TX_STOP: stop Tx aggregation 1232 * @IEEE80211_AMPDU_TX_STOP: stop Tx aggregation
1152 * @IEEE80211_AMPDU_TX_RESUME: resume TX aggregation 1233 * @IEEE80211_AMPDU_TX_OPERATIONAL: TX aggregation has become operational
1153 */ 1234 */
1154enum ieee80211_ampdu_mlme_action { 1235enum ieee80211_ampdu_mlme_action {
1155 IEEE80211_AMPDU_RX_START, 1236 IEEE80211_AMPDU_RX_START,
1156 IEEE80211_AMPDU_RX_STOP, 1237 IEEE80211_AMPDU_RX_STOP,
1157 IEEE80211_AMPDU_TX_START, 1238 IEEE80211_AMPDU_TX_START,
1158 IEEE80211_AMPDU_TX_STOP, 1239 IEEE80211_AMPDU_TX_STOP,
1159 IEEE80211_AMPDU_TX_RESUME, 1240 IEEE80211_AMPDU_TX_OPERATIONAL,
1160}; 1241};
1161 1242
1162/** 1243/**
@@ -1172,6 +1253,8 @@ enum ieee80211_ampdu_mlme_action {
1172 * configuration in the TX control data. This handler should, 1253 * configuration in the TX control data. This handler should,
1173 * preferably, never fail and stop queues appropriately, more 1254 * preferably, never fail and stop queues appropriately, more
1174 * importantly, however, it must never fail for A-MPDU-queues. 1255 * importantly, however, it must never fail for A-MPDU-queues.
1256 * This function should return NETDEV_TX_OK except in very
1257 * limited cases.
1175 * Must be implemented and atomic. 1258 * Must be implemented and atomic.
1176 * 1259 *
1177 * @start: Called before the first netdevice attached to the hardware 1260 * @start: Called before the first netdevice attached to the hardware
@@ -1212,9 +1295,12 @@ enum ieee80211_ampdu_mlme_action {
1212 * 1295 *
1213 * @config: Handler for configuration requests. IEEE 802.11 code calls this 1296 * @config: Handler for configuration requests. IEEE 802.11 code calls this
1214 * function to change hardware configuration, e.g., channel. 1297 * function to change hardware configuration, e.g., channel.
1298 * This function should never fail but returns a negative error code
1299 * if it does.
1215 * 1300 *
1216 * @config_interface: Handler for configuration requests related to interfaces 1301 * @config_interface: Handler for configuration requests related to interfaces
1217 * (e.g. BSSID changes.) 1302 * (e.g. BSSID changes.)
1303 * Returns a negative error code which will be seen in userspace.
1218 * 1304 *
1219 * @bss_info_changed: Handler for configuration requests related to BSS 1305 * @bss_info_changed: Handler for configuration requests related to BSS
1220 * parameters that may vary during BSS's lifespan, and may affect low 1306 * parameters that may vary during BSS's lifespan, and may affect low
@@ -1232,8 +1318,9 @@ enum ieee80211_ampdu_mlme_action {
1232 * 1318 *
1233 * @set_key: See the section "Hardware crypto acceleration" 1319 * @set_key: See the section "Hardware crypto acceleration"
1234 * This callback can sleep, and is only called between add_interface 1320 * This callback can sleep, and is only called between add_interface
1235 * and remove_interface calls, i.e. while the interface with the 1321 * and remove_interface calls, i.e. while the given virtual interface
1236 * given local_address is enabled. 1322 * is enabled.
1323 * Returns a negative error code if the key can't be added.
1237 * 1324 *
1238 * @update_tkip_key: See the section "Hardware crypto acceleration" 1325 * @update_tkip_key: See the section "Hardware crypto acceleration"
1239 * This callback will be called in the context of Rx. Called for drivers 1326 * This callback will be called in the context of Rx. Called for drivers
@@ -1241,12 +1328,22 @@ enum ieee80211_ampdu_mlme_action {
1241 * 1328 *
1242 * @hw_scan: Ask the hardware to service the scan request, no need to start 1329 * @hw_scan: Ask the hardware to service the scan request, no need to start
1243 * the scan state machine in stack. The scan must honour the channel 1330 * the scan state machine in stack. The scan must honour the channel
1244 * configuration done by the regulatory agent in the wiphy's registered 1331 * configuration done by the regulatory agent in the wiphy's
1245 * bands. When the scan finishes, ieee80211_scan_completed() must be 1332 * registered bands. The hardware (or the driver) needs to make sure
1246 * called; note that it also must be called when the scan cannot finish 1333 * that power save is disabled. When the scan finishes,
1247 * because the hardware is turned off! Anything else is a bug! 1334 * ieee80211_scan_completed() must be called; note that it also must
1335 * be called when the scan cannot finish because the hardware is
1336 * turned off! Anything else is a bug! Returns a negative error code
1337 * which will be seen in userspace.
1338 *
1339 * @sw_scan_start: Notifier function that is called just before a software scan
1340 * is started. Can be NULL, if the driver doesn't need this notification.
1341 *
1342 * @sw_scan_complete: Notifier function that is called just after a software scan
1343 * finished. Can be NULL, if the driver doesn't need this notification.
1248 * 1344 *
1249 * @get_stats: return low-level statistics 1345 * @get_stats: Return low-level statistics.
1346 * Returns zero if statistics are available.
1250 * 1347 *
1251 * @get_tkip_seq: If your device implements TKIP encryption in hardware this 1348 * @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 1349 * callback should be provided to read the TKIP transmit IVs (both IV32
@@ -1260,16 +1357,21 @@ enum ieee80211_ampdu_mlme_action {
1260 * 1357 *
1261 * @conf_tx: Configure TX queue parameters (EDCF (aifs, cw_min, cw_max), 1358 * @conf_tx: Configure TX queue parameters (EDCF (aifs, cw_min, cw_max),
1262 * bursting) for a hardware TX queue. 1359 * bursting) for a hardware TX queue.
1360 * Returns a negative error code on failure.
1263 * 1361 *
1264 * @get_tx_stats: Get statistics of the current TX queue status. This is used 1362 * @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 1363 * to get number of currently queued packets (queue length), maximum queue
1266 * size (limit), and total number of packets sent using each TX queue 1364 * size (limit), and total number of packets sent using each TX queue
1267 * (count). The 'stats' pointer points to an array that has hw->queues + 1365 * (count). The 'stats' pointer points to an array that has hw->queues
1268 * hw->ampdu_queues items. 1366 * items.
1269 * 1367 *
1270 * @get_tsf: Get the current TSF timer value from firmware/hardware. Currently, 1368 * @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 1369 * this is only used for IBSS mode BSSID merging and debugging. Is not a
1272 * required function. Must be atomic. 1370 * required function.
1371 *
1372 * @set_tsf: Set the TSF timer to the specified value in the firmware/hardware.
1373 * Currently, this is only used for IBSS mode debugging. Is not a
1374 * required function.
1273 * 1375 *
1274 * @reset_tsf: Reset the TSF timer and allow firmware/hardware to synchronize 1376 * @reset_tsf: Reset the TSF timer and allow firmware/hardware to synchronize
1275 * with other STAs in the IBSS. This is only used in IBSS mode. This 1377 * with other STAs in the IBSS. This is only used in IBSS mode. This
@@ -1279,13 +1381,15 @@ enum ieee80211_ampdu_mlme_action {
1279 * @tx_last_beacon: Determine whether the last IBSS beacon was sent by us. 1381 * @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 1382 * This is needed only for IBSS mode and the result of this function is
1281 * used to determine whether to reply to Probe Requests. 1383 * used to determine whether to reply to Probe Requests.
1384 * Returns non-zero if this device sent the last beacon.
1282 * 1385 *
1283 * @ampdu_action: Perform a certain A-MPDU action 1386 * @ampdu_action: Perform a certain A-MPDU action
1284 * The RA/TID combination determines the destination and TID we want 1387 * The RA/TID combination determines the destination and TID we want
1285 * the ampdu action to be performed for. The action is defined through 1388 * the ampdu action to be performed for. The action is defined through
1286 * ieee80211_ampdu_mlme_action. Starting sequence number (@ssn) 1389 * ieee80211_ampdu_mlme_action. Starting sequence number (@ssn)
1287 * is the first frame we expect to perform the action on. notice 1390 * is the first frame we expect to perform the action on. Notice
1288 * that TX/RX_STOP can pass NULL for this parameter. 1391 * that TX/RX_STOP can pass NULL for this parameter.
1392 * Returns a negative error code on failure.
1289 */ 1393 */
1290struct ieee80211_ops { 1394struct ieee80211_ops {
1291 int (*tx)(struct ieee80211_hw *hw, struct sk_buff *skb); 1395 int (*tx)(struct ieee80211_hw *hw, struct sk_buff *skb);
@@ -1310,12 +1414,15 @@ struct ieee80211_ops {
1310 int (*set_tim)(struct ieee80211_hw *hw, struct ieee80211_sta *sta, 1414 int (*set_tim)(struct ieee80211_hw *hw, struct ieee80211_sta *sta,
1311 bool set); 1415 bool set);
1312 int (*set_key)(struct ieee80211_hw *hw, enum set_key_cmd cmd, 1416 int (*set_key)(struct ieee80211_hw *hw, enum set_key_cmd cmd,
1313 const u8 *local_address, const u8 *address, 1417 struct ieee80211_vif *vif, struct ieee80211_sta *sta,
1314 struct ieee80211_key_conf *key); 1418 struct ieee80211_key_conf *key);
1315 void (*update_tkip_key)(struct ieee80211_hw *hw, 1419 void (*update_tkip_key)(struct ieee80211_hw *hw,
1316 struct ieee80211_key_conf *conf, const u8 *address, 1420 struct ieee80211_key_conf *conf, const u8 *address,
1317 u32 iv32, u16 *phase1key); 1421 u32 iv32, u16 *phase1key);
1318 int (*hw_scan)(struct ieee80211_hw *hw, u8 *ssid, size_t len); 1422 int (*hw_scan)(struct ieee80211_hw *hw,
1423 struct cfg80211_scan_request *req);
1424 void (*sw_scan_start)(struct ieee80211_hw *hw);
1425 void (*sw_scan_complete)(struct ieee80211_hw *hw);
1319 int (*get_stats)(struct ieee80211_hw *hw, 1426 int (*get_stats)(struct ieee80211_hw *hw,
1320 struct ieee80211_low_level_stats *stats); 1427 struct ieee80211_low_level_stats *stats);
1321 void (*get_tkip_seq)(struct ieee80211_hw *hw, u8 hw_key_idx, 1428 void (*get_tkip_seq)(struct ieee80211_hw *hw, u8 hw_key_idx,
@@ -1328,6 +1435,7 @@ struct ieee80211_ops {
1328 int (*get_tx_stats)(struct ieee80211_hw *hw, 1435 int (*get_tx_stats)(struct ieee80211_hw *hw,
1329 struct ieee80211_tx_queue_stats *stats); 1436 struct ieee80211_tx_queue_stats *stats);
1330 u64 (*get_tsf)(struct ieee80211_hw *hw); 1437 u64 (*get_tsf)(struct ieee80211_hw *hw);
1438 void (*set_tsf)(struct ieee80211_hw *hw, u64 tsf);
1331 void (*reset_tsf)(struct ieee80211_hw *hw); 1439 void (*reset_tsf)(struct ieee80211_hw *hw);
1332 int (*tx_last_beacon)(struct ieee80211_hw *hw); 1440 int (*tx_last_beacon)(struct ieee80211_hw *hw);
1333 int (*ampdu_action)(struct ieee80211_hw *hw, 1441 int (*ampdu_action)(struct ieee80211_hw *hw,
@@ -1752,8 +1860,9 @@ void ieee80211_wake_queues(struct ieee80211_hw *hw);
1752 * mac80211 that the scan finished. 1860 * mac80211 that the scan finished.
1753 * 1861 *
1754 * @hw: the hardware that finished the scan 1862 * @hw: the hardware that finished the scan
1863 * @aborted: set to true if scan was aborted
1755 */ 1864 */
1756void ieee80211_scan_completed(struct ieee80211_hw *hw); 1865void ieee80211_scan_completed(struct ieee80211_hw *hw, bool aborted);
1757 1866
1758/** 1867/**
1759 * ieee80211_iterate_active_interfaces - iterate active interfaces 1868 * ieee80211_iterate_active_interfaces - iterate active interfaces
@@ -1882,10 +1991,30 @@ void ieee80211_stop_tx_ba_cb_irqsafe(struct ieee80211_hw *hw, const u8 *ra,
1882struct ieee80211_sta *ieee80211_find_sta(struct ieee80211_hw *hw, 1991struct ieee80211_sta *ieee80211_find_sta(struct ieee80211_hw *hw,
1883 const u8 *addr); 1992 const u8 *addr);
1884 1993
1994/**
1995 * ieee80211_beacon_loss - inform hardware does not receive beacons
1996 *
1997 * @vif: &struct ieee80211_vif pointer from &struct ieee80211_if_init_conf.
1998 *
1999 * When beacon filtering is enabled with IEEE80211_HW_BEACON_FILTERING and
2000 * IEEE80211_CONF_PS is set, the driver needs to inform whenever the
2001 * hardware is not receiving beacons with this function.
2002 */
2003void ieee80211_beacon_loss(struct ieee80211_vif *vif);
1885 2004
1886/* Rate control API */ 2005/* Rate control API */
1887 2006
1888/** 2007/**
2008 * enum rate_control_changed - flags to indicate which parameter changed
2009 *
2010 * @IEEE80211_RC_HT_CHANGED: The HT parameters of the operating channel have
2011 * changed, rate control algorithm can update its internal state if needed.
2012 */
2013enum rate_control_changed {
2014 IEEE80211_RC_HT_CHANGED = BIT(0)
2015};
2016
2017/**
1889 * struct ieee80211_tx_rate_control - rate control information for/from RC algo 2018 * struct ieee80211_tx_rate_control - rate control information for/from RC algo
1890 * 2019 *
1891 * @hw: The hardware the algorithm is invoked for. 2020 * @hw: The hardware the algorithm is invoked for.
@@ -1921,6 +2050,9 @@ struct rate_control_ops {
1921 void *(*alloc_sta)(void *priv, struct ieee80211_sta *sta, gfp_t gfp); 2050 void *(*alloc_sta)(void *priv, struct ieee80211_sta *sta, gfp_t gfp);
1922 void (*rate_init)(void *priv, struct ieee80211_supported_band *sband, 2051 void (*rate_init)(void *priv, struct ieee80211_supported_band *sband,
1923 struct ieee80211_sta *sta, void *priv_sta); 2052 struct ieee80211_sta *sta, void *priv_sta);
2053 void (*rate_update)(void *priv, struct ieee80211_supported_band *sband,
2054 struct ieee80211_sta *sta,
2055 void *priv_sta, u32 changed);
1924 void (*free_sta)(void *priv, struct ieee80211_sta *sta, 2056 void (*free_sta)(void *priv, struct ieee80211_sta *sta,
1925 void *priv_sta); 2057 void *priv_sta);
1926 2058
@@ -1962,4 +2094,34 @@ rate_lowest_index(struct ieee80211_supported_band *sband,
1962int ieee80211_rate_control_register(struct rate_control_ops *ops); 2094int ieee80211_rate_control_register(struct rate_control_ops *ops);
1963void ieee80211_rate_control_unregister(struct rate_control_ops *ops); 2095void ieee80211_rate_control_unregister(struct rate_control_ops *ops);
1964 2096
2097static inline bool
2098conf_is_ht20(struct ieee80211_conf *conf)
2099{
2100 return conf->channel_type == NL80211_CHAN_HT20;
2101}
2102
2103static inline bool
2104conf_is_ht40_minus(struct ieee80211_conf *conf)
2105{
2106 return conf->channel_type == NL80211_CHAN_HT40MINUS;
2107}
2108
2109static inline bool
2110conf_is_ht40_plus(struct ieee80211_conf *conf)
2111{
2112 return conf->channel_type == NL80211_CHAN_HT40PLUS;
2113}
2114
2115static inline bool
2116conf_is_ht40(struct ieee80211_conf *conf)
2117{
2118 return conf_is_ht40_minus(conf) || conf_is_ht40_plus(conf);
2119}
2120
2121static inline bool
2122conf_is_ht(struct ieee80211_conf *conf)
2123{
2124 return conf->channel_type != NL80211_CHAN_NO_HT;
2125}
2126
1965#endif /* MAC80211_H */ 2127#endif /* MAC80211_H */