iwlwifi: consolidate station management code
[deliverable/linux.git] / drivers / net / wireless / iwlwifi / iwl-sta.c
index 6283a3a707f58dad2f5cb17bfcb82ed05a57a148..109136a09c548add050f3834cacd0699bcec48ad 100644 (file)
@@ -45,10 +45,9 @@ u8 iwl_find_station(struct iwl_priv *priv, const u8 *addr)
        int start = 0;
        int ret = IWL_INVALID_STATION;
        unsigned long flags;
-       DECLARE_MAC_BUF(mac);
 
-       if ((priv->iw_mode == IEEE80211_IF_TYPE_IBSS) ||
-           (priv->iw_mode == IEEE80211_IF_TYPE_AP))
+       if ((priv->iw_mode == NL80211_IFTYPE_ADHOC) ||
+           (priv->iw_mode == NL80211_IFTYPE_AP))
                start = IWL_STA_ID;
 
        if (is_broadcast_ether_addr(addr))
@@ -63,8 +62,8 @@ u8 iwl_find_station(struct iwl_priv *priv, const u8 *addr)
                        goto out;
                }
 
-       IWL_DEBUG_ASSOC_LIMIT("can not find STA %s total %d\n",
-                             print_mac(mac, addr), priv->num_stations);
+       IWL_DEBUG_ASSOC_LIMIT("can not find STA %pM total %d\n",
+                             addr, priv->num_stations);
 
  out:
        spin_unlock_irqrestore(&priv->sta_lock, flags);
@@ -74,7 +73,7 @@ EXPORT_SYMBOL(iwl_find_station);
 
 int iwl_get_ra_sta_id(struct iwl_priv *priv, struct ieee80211_hdr *hdr)
 {
-       if (priv->iw_mode == IEEE80211_IF_TYPE_STA) {
+       if (priv->iw_mode == NL80211_IFTYPE_STATION) {
                return IWL_AP_ID;
        } else {
                u8 *da = ieee80211_get_DA(hdr);
@@ -86,7 +85,6 @@ EXPORT_SYMBOL(iwl_get_ra_sta_id);
 static void iwl_sta_ucode_activate(struct iwl_priv *priv, u8 sta_id)
 {
        unsigned long flags;
-       DECLARE_MAC_BUF(mac);
 
        spin_lock_irqsave(&priv->sta_lock, flags);
 
@@ -94,8 +92,8 @@ static void iwl_sta_ucode_activate(struct iwl_priv *priv, u8 sta_id)
                IWL_ERROR("ACTIVATE a non DRIVER active station %d\n", sta_id);
 
        priv->stations[sta_id].used |= IWL_STA_UCODE_ACTIVE;
-       IWL_DEBUG_ASSOC("Added STA to Ucode: %s\n",
-                       print_mac(mac, priv->stations[sta_id].sta.sta.addr));
+       IWL_DEBUG_ASSOC("Added STA to Ucode: %pM\n",
+                       priv->stations[sta_id].sta.sta.addr);
 
        spin_unlock_irqrestore(&priv->sta_lock, flags);
 }
@@ -104,7 +102,9 @@ static int iwl_add_sta_callback(struct iwl_priv *priv,
                                   struct iwl_cmd *cmd, struct sk_buff *skb)
 {
        struct iwl_rx_packet *res = NULL;
-       u8 sta_id = cmd->cmd.addsta.sta.sta_id;
+       struct iwl_addsta_cmd *addsta =
+               (struct iwl_addsta_cmd *)cmd->cmd.payload;
+       u8 sta_id = addsta->sta.sta_id;
 
        if (!skb) {
                IWL_ERROR("Error: Response NULL in REPLY_ADD_STA.\n");
@@ -132,7 +132,7 @@ static int iwl_add_sta_callback(struct iwl_priv *priv,
        return 1;
 }
 
-int iwl_send_add_sta(struct iwl_priv *priv,
+static int iwl_send_add_sta(struct iwl_priv *priv,
                     struct iwl_addsta_cmd *sta, u8 flags)
 {
        struct iwl_rx_packet *res = NULL;
@@ -180,10 +180,9 @@ int iwl_send_add_sta(struct iwl_priv *priv,
 
        return ret;
 }
-EXPORT_SYMBOL(iwl_send_add_sta);
 
 static void iwl_set_ht_add_station(struct iwl_priv *priv, u8 index,
-                                  struct ieee80211_ht_info *sta_ht_inf)
+                                  struct ieee80211_sta_ht_cap *sta_ht_inf)
 {
        __le32 sta_flags;
        u8 mimo_ps_mode;
@@ -191,20 +190,20 @@ static void iwl_set_ht_add_station(struct iwl_priv *priv, u8 index,
        if (!sta_ht_inf || !sta_ht_inf->ht_supported)
                goto done;
 
-       mimo_ps_mode = (sta_ht_inf->cap & IEEE80211_HT_CAP_MIMO_PS) >> 2;
+       mimo_ps_mode = (sta_ht_inf->cap & IEEE80211_HT_CAP_SM_PS) >> 2;
 
        sta_flags = priv->stations[index].sta.station_flags;
 
        sta_flags &= ~(STA_FLG_RTS_MIMO_PROT_MSK | STA_FLG_MIMO_DIS_MSK);
 
        switch (mimo_ps_mode) {
-       case WLAN_HT_CAP_MIMO_PS_STATIC:
+       case WLAN_HT_CAP_SM_PS_STATIC:
                sta_flags |= STA_FLG_MIMO_DIS_MSK;
                break;
-       case WLAN_HT_CAP_MIMO_PS_DYNAMIC:
+       case WLAN_HT_CAP_SM_PS_DYNAMIC:
                sta_flags |= STA_FLG_RTS_MIMO_PROT_MSK;
                break;
-       case WLAN_HT_CAP_MIMO_PS_DISABLED:
+       case WLAN_HT_CAP_SM_PS_DISABLED:
                break;
        default:
                IWL_WARNING("Invalid MIMO PS mode %d\n", mimo_ps_mode);
@@ -231,13 +230,12 @@ static void iwl_set_ht_add_station(struct iwl_priv *priv, u8 index,
  * iwl_add_station_flags - Add station to tables in driver and device
  */
 u8 iwl_add_station_flags(struct iwl_priv *priv, const u8 *addr, int is_ap,
-                        u8 flags, struct ieee80211_ht_info *ht_info)
+                        u8 flags, struct ieee80211_sta_ht_cap *ht_info)
 {
        int i;
        int sta_id = IWL_INVALID_STATION;
        struct iwl_station_entry *station;
        unsigned long flags_spin;
-       DECLARE_MAC_BUF(mac);
 
        spin_lock_irqsave(&priv->sta_lock, flags_spin);
        if (is_ap)
@@ -273,8 +271,8 @@ u8 iwl_add_station_flags(struct iwl_priv *priv, const u8 *addr, int is_ap,
 
        station = &priv->stations[sta_id];
        station->used = IWL_STA_DRIVER_ACTIVE;
-       IWL_DEBUG_ASSOC("Add STA to driver ID %d: %s\n",
-                       sta_id, print_mac(mac, addr));
+       IWL_DEBUG_ASSOC("Add STA to driver ID %d: %pM\n",
+                       sta_id, addr);
        priv->num_stations++;
 
        /* Set up the REPLY_ADD_STA command to send to device */
@@ -286,7 +284,7 @@ u8 iwl_add_station_flags(struct iwl_priv *priv, const u8 *addr, int is_ap,
 
        /* BCAST station and IBSS stations do not work in HT mode */
        if (sta_id != priv->hw_params.bcast_sta_id &&
-           priv->iw_mode != IEEE80211_IF_TYPE_IBSS)
+           priv->iw_mode != NL80211_IFTYPE_ADHOC)
                iwl_set_ht_add_station(priv, sta_id, ht_info);
 
        spin_unlock_irqrestore(&priv->sta_lock, flags_spin);
@@ -301,14 +299,11 @@ EXPORT_SYMBOL(iwl_add_station_flags);
 static void iwl_sta_ucode_deactivate(struct iwl_priv *priv, const char *addr)
 {
        unsigned long flags;
-       DECLARE_MAC_BUF(mac);
-
        u8 sta_id = iwl_find_station(priv, addr);
 
        BUG_ON(sta_id == IWL_INVALID_STATION);
 
-       IWL_DEBUG_ASSOC("Removed STA from Ucode: %s\n",
-                       print_mac(mac, addr));
+       IWL_DEBUG_ASSOC("Removed STA from Ucode: %pM\n", addr);
 
        spin_lock_irqsave(&priv->sta_lock, flags);
 
@@ -326,7 +321,9 @@ static int iwl_remove_sta_callback(struct iwl_priv *priv,
                                   struct iwl_cmd *cmd, struct sk_buff *skb)
 {
        struct iwl_rx_packet *res = NULL;
-       const char *addr = cmd->cmd.rm_sta.addr;
+       struct iwl_rem_sta_cmd *rm_sta =
+                (struct iwl_rem_sta_cmd *)cmd->cmd.payload;
+       const char *addr = rm_sta->addr;
 
        if (!skb) {
                IWL_ERROR("Error: Response NULL in REPLY_REMOVE_STA.\n");
@@ -415,7 +412,6 @@ int iwl_remove_station(struct iwl_priv *priv, const u8 *addr, int is_ap)
        int sta_id = IWL_INVALID_STATION;
        int i, ret = -EINVAL;
        unsigned long flags;
-       DECLARE_MAC_BUF(mac);
 
        spin_lock_irqsave(&priv->sta_lock, flags);
 
@@ -435,18 +431,18 @@ int iwl_remove_station(struct iwl_priv *priv, const u8 *addr, int is_ap)
        if (unlikely(sta_id == IWL_INVALID_STATION))
                goto out;
 
-       IWL_DEBUG_ASSOC("Removing STA from driver:%d  %s\n",
-               sta_id, print_mac(mac, addr));
+       IWL_DEBUG_ASSOC("Removing STA from driver:%d  %pM\n",
+               sta_id, addr);
 
        if (!(priv->stations[sta_id].used & IWL_STA_DRIVER_ACTIVE)) {
-               IWL_ERROR("Removing %s but non DRIVER active\n",
-                               print_mac(mac, addr));
+               IWL_ERROR("Removing %pM but non DRIVER active\n",
+                               addr);
                goto out;
        }
 
        if (!(priv->stations[sta_id].used & IWL_STA_UCODE_ACTIVE)) {
-               IWL_ERROR("Removing %s but non UCODE active\n",
-                               print_mac(mac, addr));
+               IWL_ERROR("Removing %pM but non UCODE active\n",
+                               addr);
                goto out;
        }
 
@@ -696,7 +692,7 @@ static int iwl_set_tkip_dynamic_key_info(struct iwl_priv *priv,
        /* else, we are overriding an existing key => no need to allocated room
         * in uCode. */
 
-       /* This copy is acutally not needed: we get the key with each TX */
+       /* This copy is actually not needed: we get the key with each TX */
        memcpy(priv->stations[sta_id].keyinfo.key, keyconf->key, 16);
 
        memcpy(priv->stations[sta_id].sta.key.key, keyconf->key, 16);
@@ -706,6 +702,55 @@ static int iwl_set_tkip_dynamic_key_info(struct iwl_priv *priv,
        return ret;
 }
 
+void iwl_update_tkip_key(struct iwl_priv *priv,
+                       struct ieee80211_key_conf *keyconf,
+                       const u8 *addr, u32 iv32, u16 *phase1key)
+{
+       u8 sta_id = IWL_INVALID_STATION;
+       unsigned long flags;
+       __le16 key_flags = 0;
+       int i;
+       DECLARE_MAC_BUF(mac);
+
+       sta_id = iwl_find_station(priv, addr);
+       if (sta_id == IWL_INVALID_STATION) {
+               IWL_DEBUG_MAC80211("leave - %pM not in station map.\n",
+                                  addr);
+               return;
+       }
+
+       if (iwl_scan_cancel(priv)) {
+               /* cancel scan failed, just live w/ bad key and rely
+                  briefly on SW decryption */
+               return;
+       }
+
+       key_flags |= (STA_KEY_FLG_TKIP | STA_KEY_FLG_MAP_KEY_MSK);
+       key_flags |= cpu_to_le16(keyconf->keyidx << STA_KEY_FLG_KEYID_POS);
+       key_flags &= ~STA_KEY_FLG_INVALID;
+
+       if (sta_id == priv->hw_params.bcast_sta_id)
+               key_flags |= STA_KEY_MULTICAST_MSK;
+
+       spin_lock_irqsave(&priv->sta_lock, flags);
+
+       priv->stations[sta_id].sta.key.key_flags = key_flags;
+       priv->stations[sta_id].sta.key.tkip_rx_tsc_byte2 = (u8) iv32;
+
+       for (i = 0; i < 5; i++)
+               priv->stations[sta_id].sta.key.tkip_rx_ttak[i] =
+                       cpu_to_le16(phase1key[i]);
+
+       priv->stations[sta_id].sta.sta.modify_mask = STA_MODIFY_KEY_MASK;
+       priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK;
+
+       iwl_send_add_sta(priv, &priv->stations[sta_id].sta, CMD_ASYNC);
+
+       spin_unlock_irqrestore(&priv->sta_lock, flags);
+
+}
+EXPORT_SYMBOL(iwl_update_tkip_key);
+
 int iwl_remove_dynamic_key(struct iwl_priv *priv,
                                struct ieee80211_key_conf *keyconf,
                                u8 sta_id)
@@ -791,7 +836,7 @@ static void iwl_dump_lq_cmd(struct iwl_priv *priv,
 {
        int i;
        IWL_DEBUG_RATE("lq station id 0x%x\n", lq->sta_id);
-       IWL_DEBUG_RATE("lq dta 0x%X 0x%X\n",
+       IWL_DEBUG_RATE("lq ant 0x%X 0x%X\n",
                       lq->general_params.single_stream_ant_msk,
                       lq->general_params.dual_stream_ant_msk);
 
@@ -817,7 +862,7 @@ int iwl_send_lq_cmd(struct iwl_priv *priv,
        };
 
        if ((lq->sta_id == 0xFF) &&
-           (priv->iw_mode == IEEE80211_IF_TYPE_IBSS))
+           (priv->iw_mode == NL80211_IFTYPE_ADHOC))
                return -EINVAL;
 
        if (lq->sta_id == 0xFF)
@@ -852,7 +897,7 @@ static void iwl_sta_init_lq(struct iwl_priv *priv, const u8 *addr, int is_ap)
        struct iwl_link_quality_cmd link_cmd = {
                .reserved1 = 0,
        };
-       u16 rate_flags;
+       u32 rate_flags;
 
        /* Set up the rate scaling to start at selected rate, fall back
         * all the way down to 1M in IEEE order, and then spin on 1M */
@@ -868,15 +913,16 @@ static void iwl_sta_init_lq(struct iwl_priv *priv, const u8 *addr, int is_ap)
                if (r >= IWL_FIRST_CCK_RATE && r <= IWL_LAST_CCK_RATE)
                        rate_flags |= RATE_MCS_CCK_MSK;
 
-               /* Use Tx antenna B only */
-               rate_flags |= RATE_MCS_ANT_B_MSK; /*FIXME:RS*/
+               rate_flags |= first_antenna(priv->hw_params.valid_tx_ant) <<
+                               RATE_MCS_ANT_POS;
 
                link_cmd.rs_table[i].rate_n_flags =
                        iwl_hw_set_rate_n_flags(iwl_rates[r].plcp, rate_flags);
-               r = iwl4965_get_prev_ieee_rate(r);
+               r = iwl_get_prev_ieee_rate(r);
        }
 
-       link_cmd.general_params.single_stream_ant_msk = 2;
+       link_cmd.general_params.single_stream_ant_msk =
+                               first_antenna(priv->hw_params.valid_tx_ant);
        link_cmd.general_params.dual_stream_ant_msk = 3;
        link_cmd.agg_params.agg_dis_start_th = 3;
        link_cmd.agg_params.agg_time_limit = cpu_to_le16(4000);
@@ -892,24 +938,35 @@ static void iwl_sta_init_lq(struct iwl_priv *priv, const u8 *addr, int is_ap)
  * iwl_rxon_add_station - add station into station table.
  *
  * there is only one AP station with id= IWL_AP_ID
- * NOTE: mutex must be held before calling this fnction
+ * NOTE: mutex must be held before calling this function
  */
 int iwl_rxon_add_station(struct iwl_priv *priv, const u8 *addr, int is_ap)
 {
+       struct ieee80211_sta *sta;
+       struct ieee80211_sta_ht_cap ht_config;
+       struct ieee80211_sta_ht_cap *cur_ht_config = NULL;
        u8 sta_id;
 
        /* Add station to device's station table */
-       struct ieee80211_conf *conf = &priv->hw->conf;
-       struct ieee80211_ht_info *cur_ht_config = &conf->ht_conf;
-
-       if ((is_ap) &&
-           (conf->flags & IEEE80211_CONF_SUPPORT_HT_MODE) &&
-           (priv->iw_mode == IEEE80211_IF_TYPE_STA))
-               sta_id = iwl_add_station_flags(priv, addr, is_ap,
-                                                  0, cur_ht_config);
-       else
-               sta_id = iwl_add_station_flags(priv, addr, is_ap,
-                                                  0, NULL);
+
+       /*
+        * XXX: This check is definitely not correct, if we're an AP
+        *      it'll always be false which is not what we want, but
+        *      it doesn't look like iwlagn is prepared to be an HT
+        *      AP anyway.
+        */
+       if (priv->current_ht_config.is_ht) {
+               rcu_read_lock();
+               sta = ieee80211_find_sta(priv->hw, addr);
+               if (sta) {
+                       memcpy(&ht_config, &sta->ht_cap, sizeof(ht_config));
+                       cur_ht_config = &ht_config;
+               }
+               rcu_read_unlock();
+       }
+
+       sta_id = iwl_add_station_flags(priv, addr, is_ap,
+                                      0, cur_ht_config);
 
        /* Set up default rate scaling table in device's station table */
        iwl_sta_init_lq(priv, addr, is_ap);
@@ -927,7 +984,6 @@ int iwl_get_sta_id(struct iwl_priv *priv, struct ieee80211_hdr *hdr)
 {
        int sta_id;
        u16 fc = le16_to_cpu(hdr->frame_control);
-       DECLARE_MAC_BUF(mac);
 
        /* If this frame is broadcast or management, use broadcast station id */
        if (((fc & IEEE80211_FCTL_FTYPE) != IEEE80211_FTYPE_DATA) ||
@@ -938,11 +994,11 @@ int iwl_get_sta_id(struct iwl_priv *priv, struct ieee80211_hdr *hdr)
 
        /* If we are a client station in a BSS network, use the special
         * AP station entry (that's the only station we communicate with) */
-       case IEEE80211_IF_TYPE_STA:
+       case NL80211_IFTYPE_STATION:
                return IWL_AP_ID;
 
        /* If we are an AP, then find the station, or use BCAST */
-       case IEEE80211_IF_TYPE_AP:
+       case NL80211_IFTYPE_AP:
                sta_id = iwl_find_station(priv, hdr->addr1);
                if (sta_id != IWL_INVALID_STATION)
                        return sta_id;
@@ -950,7 +1006,7 @@ int iwl_get_sta_id(struct iwl_priv *priv, struct ieee80211_hdr *hdr)
 
        /* If this frame is going out to an IBSS network, find the station,
         * or create a new station table entry */
-       case IEEE80211_IF_TYPE_IBSS:
+       case NL80211_IFTYPE_ADHOC:
                sta_id = iwl_find_station(priv, hdr->addr1);
                if (sta_id != IWL_INVALID_STATION)
                        return sta_id;
@@ -962,12 +1018,17 @@ int iwl_get_sta_id(struct iwl_priv *priv, struct ieee80211_hdr *hdr)
                if (sta_id != IWL_INVALID_STATION)
                        return sta_id;
 
-               IWL_DEBUG_DROP("Station %s not in station map. "
+               IWL_DEBUG_DROP("Station %pM not in station map. "
                               "Defaulting to broadcast...\n",
-                              print_mac(mac, hdr->addr1));
+                              hdr->addr1);
                iwl_print_hex_dump(priv, IWL_DL_DROP, (u8 *) hdr, sizeof(*hdr));
                return priv->hw_params.bcast_sta_id;
 
+       /* If we are in monitor mode, use BCAST. This is required for
+        * packet injection. */
+       case NL80211_IFTYPE_MONITOR:
+               return priv->hw_params.bcast_sta_id;
+
        default:
                IWL_WARNING("Unknown mode of operation: %d\n", priv->iw_mode);
                return priv->hw_params.bcast_sta_id;
@@ -976,9 +1037,9 @@ int iwl_get_sta_id(struct iwl_priv *priv, struct ieee80211_hdr *hdr)
 EXPORT_SYMBOL(iwl_get_sta_id);
 
 /**
- * iwl_sta_modify_enable_tid_tx - Enable Tx for this TID in station table
+ * iwl_sta_tx_modify_enable_tid - Enable Tx for this TID in station table
  */
-void iwl_sta_modify_enable_tid_tx(struct iwl_priv *priv, int sta_id, int tid)
+void iwl_sta_tx_modify_enable_tid(struct iwl_priv *priv, int sta_id, int tid)
 {
        unsigned long flags;
 
@@ -991,5 +1052,81 @@ void iwl_sta_modify_enable_tid_tx(struct iwl_priv *priv, int sta_id, int tid)
 
        iwl_send_add_sta(priv, &priv->stations[sta_id].sta, CMD_ASYNC);
 }
-EXPORT_SYMBOL(iwl_sta_modify_enable_tid_tx);
+EXPORT_SYMBOL(iwl_sta_tx_modify_enable_tid);
+
+int iwl_sta_rx_agg_start(struct iwl_priv *priv,
+                        const u8 *addr, int tid, u16 ssn)
+{
+       unsigned long flags;
+       int sta_id;
+
+       sta_id = iwl_find_station(priv, addr);
+       if (sta_id == IWL_INVALID_STATION)
+               return -ENXIO;
+
+       spin_lock_irqsave(&priv->sta_lock, flags);
+       priv->stations[sta_id].sta.station_flags_msk = 0;
+       priv->stations[sta_id].sta.sta.modify_mask = STA_MODIFY_ADDBA_TID_MSK;
+       priv->stations[sta_id].sta.add_immediate_ba_tid = (u8)tid;
+       priv->stations[sta_id].sta.add_immediate_ba_ssn = cpu_to_le16(ssn);
+       priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK;
+       spin_unlock_irqrestore(&priv->sta_lock, flags);
+
+       return iwl_send_add_sta(priv, &priv->stations[sta_id].sta,
+                                       CMD_ASYNC);
+}
+EXPORT_SYMBOL(iwl_sta_rx_agg_start);
+
+int iwl_sta_rx_agg_stop(struct iwl_priv *priv, const u8 *addr, int tid)
+{
+       unsigned long flags;
+       int sta_id;
+
+       sta_id = iwl_find_station(priv, addr);
+       if (sta_id == IWL_INVALID_STATION)
+               return -ENXIO;
+
+       spin_lock_irqsave(&priv->sta_lock, flags);
+       priv->stations[sta_id].sta.station_flags_msk = 0;
+       priv->stations[sta_id].sta.sta.modify_mask = STA_MODIFY_DELBA_TID_MSK;
+       priv->stations[sta_id].sta.remove_immediate_ba_tid = (u8)tid;
+       priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK;
+       spin_unlock_irqrestore(&priv->sta_lock, flags);
+
+       return iwl_send_add_sta(priv, &priv->stations[sta_id].sta,
+                                       CMD_ASYNC);
+}
+EXPORT_SYMBOL(iwl_sta_rx_agg_stop);
+
+static void iwl_sta_modify_ps_wake(struct iwl_priv *priv, int sta_id)
+{
+       unsigned long flags;
+
+       spin_lock_irqsave(&priv->sta_lock, flags);
+       priv->stations[sta_id].sta.station_flags &= ~STA_FLG_PWR_SAVE_MSK;
+       priv->stations[sta_id].sta.station_flags_msk = STA_FLG_PWR_SAVE_MSK;
+       priv->stations[sta_id].sta.sta.modify_mask = 0;
+       priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK;
+       spin_unlock_irqrestore(&priv->sta_lock, flags);
+
+       iwl_send_add_sta(priv, &priv->stations[sta_id].sta, CMD_ASYNC);
+}
+
+void iwl_update_ps_mode(struct iwl_priv *priv, u16 ps_bit, u8 *addr)
+{
+       /* FIXME: need locking over ps_status ??? */
+       u8 sta_id = iwl_find_station(priv, addr);
+
+       if (sta_id != IWL_INVALID_STATION) {
+               u8 sta_awake = priv->stations[sta_id].
+                               ps_status == STA_PS_STATUS_WAKE;
+
+               if (sta_awake && ps_bit)
+                       priv->stations[sta_id].ps_status = STA_PS_STATUS_SLEEP;
+               else if (!sta_awake && !ps_bit) {
+                       iwl_sta_modify_ps_wake(priv, sta_id);
+                       priv->stations[sta_id].ps_status = STA_PS_STATUS_WAKE;
+               }
+       }
+}
 
This page took 0.03158 seconds and 5 git commands to generate.