Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input
[pandora-kernel.git] / net / mac80211 / sta_info.h
index 97a61c3..109db78 100644 (file)
@@ -32,7 +32,7 @@
  * @WLAN_STA_WDS: Station is one of our WDS peers.
  * @WLAN_STA_PSPOLL: Station has just PS-polled us.
  * @WLAN_STA_CLEAR_PS_FILT: Clear PS filter in hardware (using the
- *     IEEE80211_TXCTL_CLEAR_PS_FILT control flag) when the next
+ *     IEEE80211_TX_CTL_CLEAR_PS_FILT control flag) when the next
  *     frame to this station is transmitted.
  */
 enum ieee80211_sta_info_flags {
@@ -160,9 +160,20 @@ struct sta_ampdu_mlme {
  * @list: global linked list entry
  * @hnext: hash table linked list pointer
  * @local: pointer to the global information
+ * @sdata: TBD
+ * @key: TBD
+ * @rate_ctrl: TBD
+ * @rate_ctrl_priv: TBD
+ * @lock: used for locking all fields that require locking, see comments
+ *     in the header file.
+ * @flaglock: spinlock for flags accesses
+ * @ht_info: HT capabilities of this STA
+ * @supp_rates: Bitmap of supported rates (per band)
  * @addr: MAC address of this STA
  * @aid: STA's unique AID (1..2007, 0 = not assigned yet),
  *     only used in AP (and IBSS?) mode
+ * @listen_interval: TBD
+ * @pin_status: TBD
  * @flags: STA flags, see &enum ieee80211_sta_info_flags
  * @ps_tx_buf: buffer of frames to transmit to this station
  *     when it leaves power saving state
@@ -171,10 +182,41 @@ struct sta_ampdu_mlme {
  *     power saving state
  * @rx_packets: Number of MSDUs received from this STA
  * @rx_bytes: Number of bytes received from this STA
- * @supp_rates: Bitmap of supported rates (per band)
- * @ht_info: HT capabilities of this STA
- * @lock: used for locking all fields that require locking, see comments
- *     in the header file.
+ * @wep_weak_iv_count: TBD
+ * @last_rx: TBD
+ * @num_duplicates: number of duplicate frames received from this STA
+ * @rx_fragments: number of received MPDUs
+ * @rx_dropped: number of dropped MPDUs from this STA
+ * @last_signal: signal of last received frame from this STA
+ * @last_qual: qual of last received frame from this STA
+ * @last_noise: noise of last received frame from this STA
+ * @last_seq_ctrl: last received seq/frag number from this STA (per RX queue)
+ * @wme_rx_queue: TBD
+ * @tx_filtered_count: TBD
+ * @tx_retry_failed: TBD
+ * @tx_retry_count: TBD
+ * @tx_num_consecutive_failures: TBD
+ * @tx_num_mpdu_ok: TBD
+ * @tx_num_mpdu_fail: TBD
+ * @fail_avg: moving percentage of failed MSDUs
+ * @tx_packets: number of RX/TX MSDUs
+ * @tx_bytes: TBD
+ * @tx_fragments: number of transmitted MPDUs
+ * @txrate_idx: TBD
+ * @last_txrate_idx: TBD
+ * @wme_tx_queue: TBD
+ * @ampdu_mlme: TBD
+ * @timer_to_tid: identity mapping to ID timers
+ * @tid_to_tx_q: map tid to tx queue
+ * @llid: Local link ID
+ * @plid: Peer link ID
+ * @reason: Cancel reason on PLINK_HOLDING state
+ * @plink_retries: Retries in establishment
+ * @ignore_plink_timer: TBD
+ * @plink_state plink_state: TBD
+ * @plink_timeout: TBD
+ * @plink_timer: TBD
+ * @debugfs: debug filesystem info
  */
 struct sta_info {
        /* General information, mostly static */
@@ -186,6 +228,7 @@ struct sta_info {
        struct rate_control_ref *rate_ctrl;
        void *rate_ctrl_priv;
        spinlock_t lock;
+       spinlock_t flaglock;
        struct ieee80211_ht_info ht_info;
        u64 supp_rates[IEEE80211_NUM_BANDS];
        u8 addr[ETH_ALEN];
@@ -198,7 +241,10 @@ struct sta_info {
         */
        u8 pin_status;
 
-       /* frequently updated information, locked with lock spinlock */
+       /*
+        * frequently updated, locked with own spinlock (flaglock),
+        * use the accessors defined below
+        */
        u32 flags;
 
        /*
@@ -212,14 +258,12 @@ struct sta_info {
        unsigned long rx_packets, rx_bytes;
        unsigned long wep_weak_iv_count;
        unsigned long last_rx;
-       unsigned long num_duplicates; /* number of duplicate frames received
-                                      * from this STA */
-       unsigned long rx_fragments; /* number of received MPDUs */
-       unsigned long rx_dropped; /* number of dropped MPDUs from this STA */
-       int last_rssi; /* RSSI of last received frame from this STA */
-       int last_signal; /* signal of last received frame from this STA */
-       int last_noise; /* noise of last received frame from this STA */
-       /* last received seq/frag number from this STA (per RX queue) */
+       unsigned long num_duplicates;
+       unsigned long rx_fragments;
+       unsigned long rx_dropped;
+       int last_signal;
+       int last_qual;
+       int last_noise;
        __le16 last_seq_ctrl[NUM_RX_DATA_QUEUES];
 #ifdef CONFIG_MAC80211_DEBUG_COUNTERS
        unsigned int wme_rx_queue[NUM_RX_DATA_QUEUES];
@@ -236,35 +280,32 @@ struct sta_info {
        unsigned int fail_avg;
 
        /* Updated from TX path only, no locking requirements */
-       unsigned long tx_packets; /* number of RX/TX MSDUs */
+       unsigned long tx_packets;
        unsigned long tx_bytes;
-       unsigned long tx_fragments; /* number of transmitted MPDUs */
+       unsigned long tx_fragments;
        int txrate_idx;
        int last_txrate_idx;
+       u16 tid_seq[IEEE80211_QOS_CTL_TID_MASK + 1];
 #ifdef CONFIG_MAC80211_DEBUG_COUNTERS
        unsigned int wme_tx_queue[NUM_RX_DATA_QUEUES];
 #endif
 
-       /* Debug counters, no locking doesn't matter */
-       int channel_use;
-       int channel_use_raw;
-
        /*
         * Aggregation information, locked with lock.
         */
        struct sta_ampdu_mlme ampdu_mlme;
-       u8 timer_to_tid[STA_TID_NUM];   /* identity mapping to ID timers */
-       u8 tid_to_tx_q[STA_TID_NUM];    /* map tid to tx queue */
+       u8 timer_to_tid[STA_TID_NUM];
+       u8 tid_to_tx_q[STA_TID_NUM];
 
 #ifdef CONFIG_MAC80211_MESH
        /*
         * Mesh peer link attributes
         * TODO: move to a sub-structure that is referenced with pointer?
         */
-       __le16 llid;            /* Local link ID */
-       __le16 plid;            /* Peer link ID */
-       __le16 reason;          /* Cancel reason on PLINK_HOLDING state */
-       u8 plink_retries;       /* Retries in establishment */
+       __le16 llid;
+       __le16 plid;
+       __le16 reason;
+       u8 plink_retries;
        bool ignore_plink_timer;
        enum plink_state plink_state;
        u32 plink_timeout;
@@ -297,34 +338,41 @@ static inline enum plink_state sta_plink_state(struct sta_info *sta)
 
 static inline void set_sta_flags(struct sta_info *sta, const u32 flags)
 {
-       spin_lock_bh(&sta->lock);
+       unsigned long irqfl;
+
+       spin_lock_irqsave(&sta->flaglock, irqfl);
        sta->flags |= flags;
-       spin_unlock_bh(&sta->lock);
+       spin_unlock_irqrestore(&sta->flaglock, irqfl);
 }
 
 static inline void clear_sta_flags(struct sta_info *sta, const u32 flags)
 {
-       spin_lock_bh(&sta->lock);
+       unsigned long irqfl;
+
+       spin_lock_irqsave(&sta->flaglock, irqfl);
        sta->flags &= ~flags;
-       spin_unlock_bh(&sta->lock);
+       spin_unlock_irqrestore(&sta->flaglock, irqfl);
 }
 
 static inline void set_and_clear_sta_flags(struct sta_info *sta,
                                           const u32 set, const u32 clear)
 {
-       spin_lock_bh(&sta->lock);
+       unsigned long irqfl;
+
+       spin_lock_irqsave(&sta->flaglock, irqfl);
        sta->flags |= set;
        sta->flags &= ~clear;
-       spin_unlock_bh(&sta->lock);
+       spin_unlock_irqrestore(&sta->flaglock, irqfl);
 }
 
 static inline u32 test_sta_flags(struct sta_info *sta, const u32 flags)
 {
        u32 ret;
+       unsigned long irqfl;
 
-       spin_lock_bh(&sta->lock);
+       spin_lock_irqsave(&sta->flaglock, irqfl);
        ret = sta->flags & flags;
-       spin_unlock_bh(&sta->lock);
+       spin_unlock_irqrestore(&sta->flaglock, irqfl);
 
        return ret;
 }
@@ -333,11 +381,12 @@ static inline u32 test_and_clear_sta_flags(struct sta_info *sta,
                                           const u32 flags)
 {
        u32 ret;
+       unsigned long irqfl;
 
-       spin_lock_bh(&sta->lock);
+       spin_lock_irqsave(&sta->flaglock, irqfl);
        ret = sta->flags & flags;
        sta->flags &= ~flags;
-       spin_unlock_bh(&sta->lock);
+       spin_unlock_irqrestore(&sta->flaglock, irqfl);
 
        return ret;
 }
@@ -345,10 +394,11 @@ static inline u32 test_and_clear_sta_flags(struct sta_info *sta,
 static inline u32 get_sta_flags(struct sta_info *sta)
 {
        u32 ret;
+       unsigned long irqfl;
 
-       spin_lock_bh(&sta->lock);
+       spin_lock_irqsave(&sta->flaglock, irqfl);
        ret = sta->flags;
-       spin_unlock_bh(&sta->lock);
+       spin_unlock_irqrestore(&sta->flaglock, irqfl);
 
        return ret;
 }