Bluetooth: Fix race condition on l2cap_ertm_send()
[safe/jmp/linux-2.6] / include / net / mac80211.h
index f56d6f4..54aa16b 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Copyright 2002-2005, Devicescape Software, Inc.
  * Copyright 2006-2007 Jiri Benc <jbenc@suse.cz>
- * Copyright 2007-2008 Johannes Berg <johannes@sipsolutions.net>
+ * Copyright 2007-2010 Johannes Berg <johannes@sipsolutions.net>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 as
@@ -117,19 +117,6 @@ struct ieee80211_tx_queue_params {
        bool uapsd;
 };
 
-/**
- * struct ieee80211_tx_queue_stats - transmit queue statistics
- *
- * @len: number of packets in queue
- * @limit: queue length limit
- * @count: number of frames sent
- */
-struct ieee80211_tx_queue_stats {
-       unsigned int len;
-       unsigned int limit;
-       unsigned int count;
-};
-
 struct ieee80211_low_level_stats {
        unsigned int dot11ACKFailureCount;
        unsigned int dot11RTSFailureCount;
@@ -157,6 +144,8 @@ struct ieee80211_low_level_stats {
  *     new beacon (beaconing modes)
  * @BSS_CHANGED_BEACON_ENABLED: Beaconing should be
  *     enabled/disabled (beaconing modes)
+ * @BSS_CHANGED_CQM: Connection quality monitor config changed
+ * @BSS_CHANGED_IBSS: IBSS join status changed
  */
 enum ieee80211_bss_change {
        BSS_CHANGED_ASSOC               = 1<<0,
@@ -169,6 +158,8 @@ enum ieee80211_bss_change {
        BSS_CHANGED_BSSID               = 1<<7,
        BSS_CHANGED_BEACON              = 1<<8,
        BSS_CHANGED_BEACON_ENABLED      = 1<<9,
+       BSS_CHANGED_CQM                 = 1<<10,
+       BSS_CHANGED_IBSS                = 1<<11,
 };
 
 /**
@@ -178,6 +169,8 @@ enum ieee80211_bss_change {
  * to that BSS) that can change during the lifetime of the BSS.
  *
  * @assoc: association status
+ * @ibss_joined: indicates whether this station is part of an IBSS
+ *     or not
  * @aid: association ID number, valid only when @assoc is true
  * @use_cts_prot: use CTS protection
  * @use_short_preamble: use 802.11b short preamble;
@@ -186,7 +179,8 @@ enum ieee80211_bss_change {
  * @use_short_slot: use short slot time (only relevant for ERP);
  *     if the hardware cannot handle this it must set the
  *     IEEE80211_HW_2GHZ_SHORT_SLOT_INCAPABLE hardware flag
- * @dtim_period: num of beacons before the next DTIM, for PSM
+ * @dtim_period: num of beacons before the next DTIM, for beaconing,
+ *     not valid in station mode (cf. hw conf ps_dtim_period)
  * @timestamp: beacon timestamp
  * @beacon_int: beacon interval
  * @assoc_capability: capabilities taken from assoc resp
@@ -197,11 +191,14 @@ enum ieee80211_bss_change {
  * @enable_beacon: whether beaconing should be enabled or not
  * @ht_operation_mode: HT operation mode (like in &struct ieee80211_ht_info).
  *     This field is only valid when the channel type is one of the HT types.
+ * @cqm_rssi_thold: Connection quality monitor RSSI threshold, a zero value
+ *     implies disabled
+ * @cqm_rssi_hyst: Connection quality monitor RSSI hysteresis
  */
 struct ieee80211_bss_conf {
        const u8 *bssid;
        /* association related data */
-       bool assoc;
+       bool assoc, ibss_joined;
        u16 aid;
        /* erp related data */
        bool use_cts_prot;
@@ -214,6 +211,8 @@ struct ieee80211_bss_conf {
        u64 timestamp;
        u32 basic_rates;
        u16 ht_operation_mode;
+       s32 cqm_rssi_thold;
+       u32 cqm_rssi_hyst;
 };
 
 /**
@@ -274,6 +273,14 @@ struct ieee80211_bss_conf {
  * @IEEE80211_TX_INTFL_RETRANSMISSION: This frame is being retransmitted
  *     after TX status because the destination was asleep, it must not
  *     be modified again (no seqno assignment, crypto, etc.)
+ * @IEEE80211_TX_INTFL_HAS_RADIOTAP: This frame was injected and still
+ *     has a radiotap header at skb->data.
+ * @IEEE80211_TX_INTFL_NL80211_FRAME_TX: Frame was requested through nl80211
+ *     MLME command (internal to mac80211 to figure out whether to send TX
+ *     status to user space)
+ * @IEEE80211_TX_CTL_LDPC: tells the driver to use LDPC for this frame
+ * @IEEE80211_TX_CTL_STBC: Enables Space-Time Block Coding (STBC) for this
+ *     frame and selects the maximum number of streams that it can use.
  */
 enum mac80211_tx_control_flags {
        IEEE80211_TX_CTL_REQ_TX_STATUS          = BIT(0),
@@ -295,6 +302,11 @@ enum mac80211_tx_control_flags {
        IEEE80211_TX_CTL_PSPOLL_RESPONSE        = BIT(17),
        IEEE80211_TX_CTL_MORE_FRAMES            = BIT(18),
        IEEE80211_TX_INTFL_RETRANSMISSION       = BIT(19),
+       IEEE80211_TX_INTFL_HAS_RADIOTAP         = BIT(20),
+       IEEE80211_TX_INTFL_NL80211_FRAME_TX     = BIT(21),
+       IEEE80211_TX_CTL_LDPC                   = BIT(22),
+       IEEE80211_TX_CTL_STBC                   = BIT(23) | BIT(24),
+#define IEEE80211_TX_CTL_STBC_SHIFT            23
 };
 
 /**
@@ -393,11 +405,11 @@ struct ieee80211_tx_rate {
  * @status: union for status data
  * @driver_data: array of driver_data pointers
  * @ampdu_ack_len: number of acked aggregated frames.
- *     relevant only if IEEE80211_TX_STATUS_AMPDU was set.
+ *     relevant only if IEEE80211_TX_STAT_AMPDU was set.
  * @ampdu_ack_map: block ack bit map for the aggregation.
- *     relevant only if IEEE80211_TX_STATUS_AMPDU was set.
+ *     relevant only if IEEE80211_TX_STAT_AMPDU was set.
  * @ampdu_len: number of aggregated frames.
- *     relevant only if IEEE80211_TX_STATUS_AMPDU was set.
+ *     relevant only if IEEE80211_TX_STAT_AMPDU was set.
  * @ack_signal: signal strength of the ACK frame
  */
 struct ieee80211_tx_info {
@@ -548,7 +560,6 @@ enum mac80211_rx_flags {
  * @signal: signal strength when receiving this frame, either in dBm, in dB or
  *     unspecified depending on the hardware capabilities flags
  *     @IEEE80211_HW_SIGNAL_*
- * @noise: noise when receiving this frame, in dBm.
  * @antenna: antenna used
  * @rate_idx: index of data rate into band's supported rates or MCS index if
  *     HT rates are use (RX_FLAG_HT)
@@ -559,7 +570,6 @@ struct ieee80211_rx_status {
        enum ieee80211_band band;
        int freq;
        int signal;
-       int noise;
        int antenna;
        int rate_idx;
        int flag;
@@ -585,11 +595,15 @@ struct ieee80211_rx_status {
  *     may turn the device off as much as possible. Typically, this flag will
  *     be set when an interface is set UP but not associated or scanning, but
  *     it can also be unset in that case when monitor interfaces are active.
+ * @IEEE80211_CONF_QOS: Enable 802.11e QoS also know as WMM (Wireless
+ *      Multimedia). On some drivers (iwlwifi is one of know) we have
+ *      to enable/disable QoS explicitly.
  */
 enum ieee80211_conf_flags {
        IEEE80211_CONF_MONITOR          = (1<<0),
        IEEE80211_CONF_PS               = (1<<1),
        IEEE80211_CONF_IDLE             = (1<<2),
+       IEEE80211_CONF_QOS              = (1<<3),
 };
 
 
@@ -604,6 +618,7 @@ enum ieee80211_conf_flags {
  * @IEEE80211_CONF_CHANGE_RETRY_LIMITS: retry limits changed
  * @IEEE80211_CONF_CHANGE_IDLE: Idle flag changed
  * @IEEE80211_CONF_CHANGE_SMPS: Spatial multiplexing powersave mode changed
+ * @IEEE80211_CONF_CHANGE_QOS: Quality of service was enabled or disabled
  */
 enum ieee80211_conf_changed {
        IEEE80211_CONF_CHANGE_SMPS              = BIT(1),
@@ -614,6 +629,7 @@ enum ieee80211_conf_changed {
        IEEE80211_CONF_CHANGE_CHANNEL           = BIT(6),
        IEEE80211_CONF_CHANGE_RETRY_LIMITS      = BIT(7),
        IEEE80211_CONF_CHANGE_IDLE              = BIT(8),
+       IEEE80211_CONF_CHANGE_QOS               = BIT(9),
 };
 
 /**
@@ -648,9 +664,15 @@ enum ieee80211_smps_mode {
  *     value will be only achievable between DTIM frames, the hardware
  *     needs to check for the multicast traffic bit in DTIM beacons.
  *     This variable is valid only when the CONF_PS flag is set.
+ * @ps_dtim_period: The DTIM period of the AP we're connected to, for use
+ *     in power saving. Power saving will not be enabled until a beacon
+ *     has been received and the DTIM period is known.
  * @dynamic_ps_timeout: The dynamic powersave timeout (in ms), see the
  *     powersave documentation below. This variable is valid only when
  *     the CONF_PS flag is set.
+ * @dynamic_ps_forced_timeout: The dynamic powersave timeout (in ms) configured
+ *     by cfg80211 (essentially, wext) If set, this value overrules the value
+ *     chosen by mac80211 based on ps qos network latency.
  *
  * @power_level: requested transmit power (in dBm)
  *
@@ -670,10 +692,11 @@ enum ieee80211_smps_mode {
  */
 struct ieee80211_conf {
        u32 flags;
-       int power_level, dynamic_ps_timeout;
+       int power_level, dynamic_ps_timeout, dynamic_ps_forced_timeout;
        int max_sleep_period;
 
        u16 listen_interval;
+       u8 ps_dtim_period;
 
        u8 long_frame_max_tx_count, short_frame_max_tx_count;
 
@@ -780,6 +803,7 @@ struct ieee80211_key_conf {
        u8 iv_len;
        u8 hw_key_idx;
        u8 flags;
+       u8 *ap_addr;
        s8 keyidx;
        u8 keylen;
        u8 key[0];
@@ -806,7 +830,7 @@ enum set_key_cmd {
  * mac80211, any ieee80211_sta pointer you get access to must
  * either be protected by rcu_read_lock() explicitly or implicitly,
  * or you must take good care to not use such a pointer after a
- * call to your sta_notify callback that removed it.
+ * call to your sta_remove callback that removed it.
  *
  * @addr: MAC address
  * @aid: AID we assigned to the station if we're an AP
@@ -832,8 +856,8 @@ struct ieee80211_sta {
  * indicates addition and removal of a station to station table,
  * or if a associated station made a power state transition.
  *
- * @STA_NOTIFY_ADD: a station was added to the station table
- * @STA_NOTIFY_REMOVE: a station being removed from the station table
+ * @STA_NOTIFY_ADD: (DEPRECATED) a station was added to the station table
+ * @STA_NOTIFY_REMOVE: (DEPRECATED) a station being removed from the station table
  * @STA_NOTIFY_SLEEP: a station is now sleeping
  * @STA_NOTIFY_AWAKE: a sleeping station woke up
  */
@@ -908,10 +932,6 @@ enum ieee80211_tkip_key_type {
  *     one milliwatt. This is the preferred method since it is standardized
  *     between different devices. @max_signal does not need to be set.
  *
- * @IEEE80211_HW_NOISE_DBM:
- *     Hardware can provide noise (radio interference) values in units dBm,
- *      decibel difference from one milliwatt.
- *
  * @IEEE80211_HW_SPECTRUM_MGMT:
  *     Hardware supports spectrum management defined in 802.11h
  *     Measurement, Channel Switch, Quieting, TPC
@@ -950,6 +970,22 @@ enum ieee80211_tkip_key_type {
  *     Hardware supports Unscheduled Automatic Power Save Delivery
  *     (U-APSD) in managed mode. The mode is configured with
  *     conf_tx() operation.
+ *
+ * @IEEE80211_HW_REPORTS_TX_ACK_STATUS:
+ *     Hardware can provide ack status reports of Tx frames to
+ *     the stack.
+ *
+ * @IEEE80211_HW_CONNECTION_MONITOR:
+ *      The hardware performs its own connection monitoring, including
+ *      periodic keep-alives to the AP and probing the AP on beacon loss.
+ *      When this flag is set, signaling beacon-loss will cause an immediate
+ *      change to disassociated state.
+ *
+ * @IEEE80211_HW_SUPPORTS_CQM_RSSI:
+ *     Hardware can do connection quality monitoring - i.e. it can monitor
+ *     connection quality related parameters, such as the RSSI level and
+ *     provide notifications if configured trigger levels are reached.
+ *
  */
 enum ieee80211_hw_flags {
        IEEE80211_HW_HAS_RATE_CONTROL                   = 1<<0,
@@ -959,7 +995,7 @@ enum ieee80211_hw_flags {
        IEEE80211_HW_2GHZ_SHORT_PREAMBLE_INCAPABLE      = 1<<4,
        IEEE80211_HW_SIGNAL_UNSPEC                      = 1<<5,
        IEEE80211_HW_SIGNAL_DBM                         = 1<<6,
-       IEEE80211_HW_NOISE_DBM                          = 1<<7,
+       /* use this hole */
        IEEE80211_HW_SPECTRUM_MGMT                      = 1<<8,
        IEEE80211_HW_AMPDU_AGGREGATION                  = 1<<9,
        IEEE80211_HW_SUPPORTS_PS                        = 1<<10,
@@ -970,6 +1006,9 @@ enum ieee80211_hw_flags {
        IEEE80211_HW_SUPPORTS_STATIC_SMPS               = 1<<15,
        IEEE80211_HW_SUPPORTS_DYNAMIC_SMPS              = 1<<16,
        IEEE80211_HW_SUPPORTS_UAPSD                     = 1<<17,
+       IEEE80211_HW_REPORTS_TX_ACK_STATUS              = 1<<18,
+       IEEE80211_HW_CONNECTION_MONITOR                 = 1<<19,
+       IEEE80211_HW_SUPPORTS_CQM_RSSI                  = 1<<20,
 };
 
 /**
@@ -1489,7 +1528,7 @@ enum ieee80211_ampdu_mlme_action {
  * @update_tkip_key: See the section "Hardware crypto acceleration"
  *     This callback will be called in the context of Rx. Called for drivers
  *     which set IEEE80211_KEY_FLAG_TKIP_REQ_RX_P1_KEY.
- *     The callback can sleep.
+ *     The callback must be atomic.
  *
  * @hw_scan: Ask the hardware to service the scan request, no need to start
  *     the scan state machine in stack. The scan must honour the channel
@@ -1526,22 +1565,20 @@ enum ieee80211_ampdu_mlme_action {
  * @set_rts_threshold: Configuration of RTS threshold (if device needs it)
  *     The callback can sleep.
  *
- * @sta_notify: Notifies low level driver about addition, removal or power
- *     state transition of an associated station, AP,  IBSS/WDS/mesh peer etc.
- *     Must be atomic.
+ * @sta_add: Notifies low level driver about addition of an associated station,
+ *     AP, IBSS/WDS/mesh peer etc. This callback can sleep.
+ *
+ * @sta_remove: Notifies low level driver about removal of an associated
+ *     station, AP, IBSS/WDS/mesh peer etc. This callback can sleep.
+ *
+ * @sta_notify: Notifies low level driver about power state transition of an
+ *     associated station, AP,  IBSS/WDS/mesh peer etc. Must be atomic.
  *
  * @conf_tx: Configure TX queue parameters (EDCF (aifs, cw_min, cw_max),
  *     bursting) for a hardware TX queue.
  *     Returns a negative error code on failure.
  *     The callback can sleep.
  *
- * @get_tx_stats: Get statistics of the current TX queue status. This is used
- *     to get number of currently queued packets (queue length), maximum queue
- *     size (limit), and total number of packets sent using each TX queue
- *     (count). The 'stats' pointer points to an array that has hw->queues
- *     items.
- *     The callback must be atomic.
- *
  * @get_tsf: Get the current TSF timer value from firmware/hardware. Currently,
  *     this is only used for IBSS mode BSSID merging and debugging. Is not a
  *     required function.
@@ -1603,7 +1640,7 @@ struct ieee80211_ops {
                                 struct ieee80211_bss_conf *info,
                                 u32 changed);
        u64 (*prepare_multicast)(struct ieee80211_hw *hw,
-                                int mc_count, struct dev_addr_list *mc_list);
+                                struct netdev_hw_addr_list *mc_list);
        void (*configure_filter)(struct ieee80211_hw *hw,
                                 unsigned int changed_flags,
                                 unsigned int *total_flags,
@@ -1618,7 +1655,7 @@ struct ieee80211_ops {
                                struct ieee80211_key_conf *conf,
                                struct ieee80211_sta *sta,
                                u32 iv32, u16 *phase1key);
-       int (*hw_scan)(struct ieee80211_hw *hw,
+       int (*hw_scan)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
                       struct cfg80211_scan_request *req);
        void (*sw_scan_start)(struct ieee80211_hw *hw);
        void (*sw_scan_complete)(struct ieee80211_hw *hw);
@@ -1627,12 +1664,14 @@ struct ieee80211_ops {
        void (*get_tkip_seq)(struct ieee80211_hw *hw, u8 hw_key_idx,
                             u32 *iv32, u16 *iv16);
        int (*set_rts_threshold)(struct ieee80211_hw *hw, u32 value);
+       int (*sta_add)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
+                      struct ieee80211_sta *sta);
+       int (*sta_remove)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
+                         struct ieee80211_sta *sta);
        void (*sta_notify)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
                        enum sta_notify_cmd, struct ieee80211_sta *sta);
        int (*conf_tx)(struct ieee80211_hw *hw, u16 queue,
                       const struct ieee80211_tx_queue_params *params);
-       int (*get_tx_stats)(struct ieee80211_hw *hw,
-                           struct ieee80211_tx_queue_stats *stats);
        u64 (*get_tsf)(struct ieee80211_hw *hw);
        void (*set_tsf)(struct ieee80211_hw *hw, u64 tsf);
        void (*reset_tsf)(struct ieee80211_hw *hw);
@@ -1641,7 +1680,8 @@ struct ieee80211_ops {
                            struct ieee80211_vif *vif,
                            enum ieee80211_ampdu_mlme_action action,
                            struct ieee80211_sta *sta, u16 tid, u16 *ssn);
-
+       int (*get_survey)(struct ieee80211_hw *hw, int idx,
+               struct survey_info *survey);
        void (*rfkill_poll)(struct ieee80211_hw *hw);
        void (*set_coverage_class)(struct ieee80211_hw *hw, u8 coverage_class);
 #ifdef CONFIG_NL80211_TESTMODE
@@ -1797,7 +1837,10 @@ void ieee80211_restart_hw(struct ieee80211_hw *hw);
  * ieee80211_rx - receive frame
  *
  * Use this function to hand received frames to mac80211. The receive
- * buffer in @skb must start with an IEEE 802.11 header.
+ * buffer in @skb must start with an IEEE 802.11 header. In case of a
+ * paged @skb is used, the driver is recommended to put the ieee80211
+ * header of the frame on the linear part of the @skb to avoid memory
+ * allocation and/or memcpy by the stack.
  *
  * This function may not be called in IRQ context. Calls to this function
  * for a single hardware must be synchronized against each other. Calls to
@@ -2359,12 +2402,42 @@ void ieee80211_sta_block_awake(struct ieee80211_hw *hw,
  *
  * @vif: &struct ieee80211_vif pointer from the add_interface callback.
  *
- * When beacon filtering is enabled with IEEE80211_HW_BEACON_FILTERING and
- * IEEE80211_CONF_PS is set, the driver needs to inform whenever the
+ * When beacon filtering is enabled with %IEEE80211_HW_BEACON_FILTERING and
+ * %IEEE80211_CONF_PS is set, the driver needs to inform whenever the
  * hardware is not receiving beacons with this function.
  */
 void ieee80211_beacon_loss(struct ieee80211_vif *vif);
 
+/**
+ * ieee80211_connection_loss - inform hardware has lost connection to the AP
+ *
+ * @vif: &struct ieee80211_vif pointer from the add_interface callback.
+ *
+ * When beacon filtering is enabled with %IEEE80211_HW_BEACON_FILTERING, and
+ * %IEEE80211_CONF_PS and %IEEE80211_HW_CONNECTION_MONITOR are set, the driver
+ * needs to inform if the connection to the AP has been lost.
+ *
+ * This function will cause immediate change to disassociated state,
+ * without connection recovery attempts.
+ */
+void ieee80211_connection_loss(struct ieee80211_vif *vif);
+
+/**
+ * ieee80211_cqm_rssi_notify - inform a configured connection quality monitoring
+ *     rssi threshold triggered
+ *
+ * @vif: &struct ieee80211_vif pointer from the add_interface callback.
+ * @rssi_event: the RSSI trigger event type
+ * @gfp: context flags
+ *
+ * When the %IEEE80211_HW_SUPPORTS_CQM_RSSI is set, and a connection quality
+ * monitoring is configured with an rssi threshold, the driver will inform
+ * whenever the rssi level reaches the threshold.
+ */
+void ieee80211_cqm_rssi_notify(struct ieee80211_vif *vif,
+                              enum nl80211_cqm_rssi_threshold_event rssi_event,
+                              gfp_t gfp);
+
 /* Rate control API */
 
 /**
@@ -2421,7 +2494,8 @@ struct rate_control_ops {
                          struct ieee80211_sta *sta, void *priv_sta);
        void (*rate_update)(void *priv, struct ieee80211_supported_band *sband,
                            struct ieee80211_sta *sta,
-                           void *priv_sta, u32 changed);
+                           void *priv_sta, u32 changed,
+                           enum nl80211_channel_type oper_chan_type);
        void (*free_sta)(void *priv, struct ieee80211_sta *sta,
                         void *priv_sta);