aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomas Winkler <tomas.winkler@intel.com>2008-11-12 16:14:05 -0500
committerJohn W. Linville <linville@tuxdriver.com>2008-11-25 16:41:06 -0500
commit9f58671e8d4f4896acea30020308ce72bf94ec6e (patch)
tree8c8df09be1ed592ef0640e8f1b9a681e358c571c
parentcee53ddb46eb520079335d0868d0e81c8d311089 (diff)
iwlwifi: consolidate station management code
This patch moves code around and group most of the station management code into iwl-sta.c No functional changes (yet) Signed-off-by: Tomas Winkler <tomas.winkler@intel.com> Signed-off-by: Reinette Chatre <reinette.chatre@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-4965.c2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-5000.c2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn.c47
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-core.h2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-dev.h5
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-rx.c75
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-sta.c134
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-sta.h13
8 files changed, 148 insertions, 132 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.c b/drivers/net/wireless/iwlwifi/iwl-4965.c
index c43cf2f072cd..17f409864eb6 100644
--- a/drivers/net/wireless/iwlwifi/iwl-4965.c
+++ b/drivers/net/wireless/iwlwifi/iwl-4965.c
@@ -1909,7 +1909,7 @@ static int iwl4965_txq_agg_enable(struct iwl_priv *priv, int txq_id,
1909 ra_tid = BUILD_RAxTID(sta_id, tid); 1909 ra_tid = BUILD_RAxTID(sta_id, tid);
1910 1910
1911 /* Modify device's station table to Tx this TID */ 1911 /* Modify device's station table to Tx this TID */
1912 iwl_sta_modify_enable_tid_tx(priv, sta_id, tid); 1912 iwl_sta_tx_modify_enable_tid(priv, sta_id, tid);
1913 1913
1914 spin_lock_irqsave(&priv->lock, flags); 1914 spin_lock_irqsave(&priv->lock, flags);
1915 ret = iwl_grab_nic_access(priv); 1915 ret = iwl_grab_nic_access(priv);
diff --git a/drivers/net/wireless/iwlwifi/iwl-5000.c b/drivers/net/wireless/iwlwifi/iwl-5000.c
index ee3613db3132..b6d7e91e8dd1 100644
--- a/drivers/net/wireless/iwlwifi/iwl-5000.c
+++ b/drivers/net/wireless/iwlwifi/iwl-5000.c
@@ -969,7 +969,7 @@ static int iwl5000_txq_agg_enable(struct iwl_priv *priv, int txq_id,
969 ra_tid = BUILD_RAxTID(sta_id, tid); 969 ra_tid = BUILD_RAxTID(sta_id, tid);
970 970
971 /* Modify device's station table to Tx this TID */ 971 /* Modify device's station table to Tx this TID */
972 iwl_sta_modify_enable_tid_tx(priv, sta_id, tid); 972 iwl_sta_tx_modify_enable_tid(priv, sta_id, tid);
973 973
974 spin_lock_irqsave(&priv->lock, flags); 974 spin_lock_irqsave(&priv->lock, flags);
975 ret = iwl_grab_nic_access(priv); 975 ret = iwl_grab_nic_access(priv);
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c
index 8fa4f7a2dc1a..03acad24f677 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn.c
@@ -3058,49 +3058,11 @@ static void iwl_mac_update_tkip_key(struct ieee80211_hw *hw,
3058 struct ieee80211_key_conf *keyconf, const u8 *addr, 3058 struct ieee80211_key_conf *keyconf, const u8 *addr,
3059 u32 iv32, u16 *phase1key) 3059 u32 iv32, u16 *phase1key)
3060{ 3060{
3061 struct iwl_priv *priv = hw->priv;
3062 u8 sta_id = IWL_INVALID_STATION;
3063 unsigned long flags;
3064 __le16 key_flags = 0;
3065 int i;
3066 3061
3062 struct iwl_priv *priv = hw->priv;
3067 IWL_DEBUG_MAC80211("enter\n"); 3063 IWL_DEBUG_MAC80211("enter\n");
3068 3064
3069 sta_id = iwl_find_station(priv, addr); 3065 iwl_update_tkip_key(priv, keyconf, addr, iv32, phase1key);
3070 if (sta_id == IWL_INVALID_STATION) {
3071 IWL_DEBUG_MAC80211("leave - %pM not in station map.\n",
3072 addr);
3073 return;
3074 }
3075
3076 if (iwl_scan_cancel(priv)) {
3077 /* cancel scan failed, just live w/ bad key and rely
3078 briefly on SW decryption */
3079 return;
3080 }
3081
3082 key_flags |= (STA_KEY_FLG_TKIP | STA_KEY_FLG_MAP_KEY_MSK);
3083 key_flags |= cpu_to_le16(keyconf->keyidx << STA_KEY_FLG_KEYID_POS);
3084 key_flags &= ~STA_KEY_FLG_INVALID;
3085
3086 if (sta_id == priv->hw_params.bcast_sta_id)
3087 key_flags |= STA_KEY_MULTICAST_MSK;
3088
3089 spin_lock_irqsave(&priv->sta_lock, flags);
3090
3091 priv->stations[sta_id].sta.key.key_flags = key_flags;
3092 priv->stations[sta_id].sta.key.tkip_rx_tsc_byte2 = (u8) iv32;
3093
3094 for (i = 0; i < 5; i++)
3095 priv->stations[sta_id].sta.key.tkip_rx_ttak[i] =
3096 cpu_to_le16(phase1key[i]);
3097
3098 priv->stations[sta_id].sta.sta.modify_mask = STA_MODIFY_KEY_MASK;
3099 priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK;
3100
3101 iwl_send_add_sta(priv, &priv->stations[sta_id].sta, CMD_ASYNC);
3102
3103 spin_unlock_irqrestore(&priv->sta_lock, flags);
3104 3066
3105 IWL_DEBUG_MAC80211("leave\n"); 3067 IWL_DEBUG_MAC80211("leave\n");
3106} 3068}
@@ -3239,10 +3201,10 @@ static int iwl_mac_ampdu_action(struct ieee80211_hw *hw,
3239 switch (action) { 3201 switch (action) {
3240 case IEEE80211_AMPDU_RX_START: 3202 case IEEE80211_AMPDU_RX_START:
3241 IWL_DEBUG_HT("start Rx\n"); 3203 IWL_DEBUG_HT("start Rx\n");
3242 return iwl_rx_agg_start(priv, sta->addr, tid, *ssn); 3204 return iwl_sta_rx_agg_start(priv, sta->addr, tid, *ssn);
3243 case IEEE80211_AMPDU_RX_STOP: 3205 case IEEE80211_AMPDU_RX_STOP:
3244 IWL_DEBUG_HT("stop Rx\n"); 3206 IWL_DEBUG_HT("stop Rx\n");
3245 return iwl_rx_agg_stop(priv, sta->addr, tid); 3207 return iwl_sta_rx_agg_stop(priv, sta->addr, tid);
3246 case IEEE80211_AMPDU_TX_START: 3208 case IEEE80211_AMPDU_TX_START:
3247 IWL_DEBUG_HT("start Tx\n"); 3209 IWL_DEBUG_HT("start Tx\n");
3248 return iwl_tx_agg_start(priv, sta->addr, tid, ssn); 3210 return iwl_tx_agg_start(priv, sta->addr, tid, ssn);
@@ -3256,6 +3218,7 @@ static int iwl_mac_ampdu_action(struct ieee80211_hw *hw,
3256 } 3218 }
3257 return 0; 3219 return 0;
3258} 3220}
3221
3259static int iwl_mac_get_tx_stats(struct ieee80211_hw *hw, 3222static int iwl_mac_get_tx_stats(struct ieee80211_hw *hw,
3260 struct ieee80211_tx_queue_stats *stats) 3223 struct ieee80211_tx_queue_stats *stats)
3261{ 3224{
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.h b/drivers/net/wireless/iwlwifi/iwl-core.h
index ff966b8a0c6d..5d4e2e28bdbe 100644
--- a/drivers/net/wireless/iwlwifi/iwl-core.h
+++ b/drivers/net/wireless/iwlwifi/iwl-core.h
@@ -206,8 +206,6 @@ int iwl_rx_queue_update_write_ptr(struct iwl_priv *priv,
206void iwl_rx_queue_reset(struct iwl_priv *priv, struct iwl_rx_queue *rxq); 206void iwl_rx_queue_reset(struct iwl_priv *priv, struct iwl_rx_queue *rxq);
207void iwl_rx_replenish(struct iwl_priv *priv); 207void iwl_rx_replenish(struct iwl_priv *priv);
208int iwl_rx_init(struct iwl_priv *priv, struct iwl_rx_queue *rxq); 208int iwl_rx_init(struct iwl_priv *priv, struct iwl_rx_queue *rxq);
209int iwl_rx_agg_start(struct iwl_priv *priv, const u8 *addr, int tid, u16 ssn);
210int iwl_rx_agg_stop(struct iwl_priv *priv, const u8 *addr, int tid);
211int iwl_rx_queue_restock(struct iwl_priv *priv); 209int iwl_rx_queue_restock(struct iwl_priv *priv);
212int iwl_rx_queue_space(const struct iwl_rx_queue *q); 210int iwl_rx_queue_space(const struct iwl_rx_queue *q);
213void iwl_rx_allocate(struct iwl_priv *priv); 211void iwl_rx_allocate(struct iwl_priv *priv);
diff --git a/drivers/net/wireless/iwlwifi/iwl-dev.h b/drivers/net/wireless/iwlwifi/iwl-dev.h
index bd3df55e4953..0e97d6a13225 100644
--- a/drivers/net/wireless/iwlwifi/iwl-dev.h
+++ b/drivers/net/wireless/iwlwifi/iwl-dev.h
@@ -574,11 +574,6 @@ struct iwl_hw_params {
574 * iwl4965_mac_ <-- mac80211 callback 574 * iwl4965_mac_ <-- mac80211 callback
575 * 575 *
576 ****************************************************************************/ 576 ****************************************************************************/
577struct iwl_addsta_cmd;
578extern int iwl_send_add_sta(struct iwl_priv *priv,
579 struct iwl_addsta_cmd *sta, u8 flags);
580extern u8 iwl_add_station_flags(struct iwl_priv *priv, const u8 *addr,
581 int is_ap, u8 flags, struct ieee80211_sta_ht_cap *ht_info);
582extern void iwl_update_chain_flags(struct iwl_priv *priv); 577extern void iwl_update_chain_flags(struct iwl_priv *priv);
583extern int iwl_set_pwr_src(struct iwl_priv *priv, enum iwl_pwr_src src); 578extern int iwl_set_pwr_src(struct iwl_priv *priv, enum iwl_pwr_src src);
584extern const u8 iwl_bcast_addr[ETH_ALEN]; 579extern const u8 iwl_bcast_addr[ETH_ALEN];
diff --git a/drivers/net/wireless/iwlwifi/iwl-rx.c b/drivers/net/wireless/iwlwifi/iwl-rx.c
index 876afd4cab9e..8d2b73e194da 100644
--- a/drivers/net/wireless/iwlwifi/iwl-rx.c
+++ b/drivers/net/wireless/iwlwifi/iwl-rx.c
@@ -499,49 +499,6 @@ void iwl_rx_missed_beacon_notif(struct iwl_priv *priv,
499} 499}
500EXPORT_SYMBOL(iwl_rx_missed_beacon_notif); 500EXPORT_SYMBOL(iwl_rx_missed_beacon_notif);
501 501
502int iwl_rx_agg_start(struct iwl_priv *priv, const u8 *addr, int tid, u16 ssn)
503{
504 unsigned long flags;
505 int sta_id;
506
507 sta_id = iwl_find_station(priv, addr);
508 if (sta_id == IWL_INVALID_STATION)
509 return -ENXIO;
510
511 spin_lock_irqsave(&priv->sta_lock, flags);
512 priv->stations[sta_id].sta.station_flags_msk = 0;
513 priv->stations[sta_id].sta.sta.modify_mask = STA_MODIFY_ADDBA_TID_MSK;
514 priv->stations[sta_id].sta.add_immediate_ba_tid = (u8)tid;
515 priv->stations[sta_id].sta.add_immediate_ba_ssn = cpu_to_le16(ssn);
516 priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK;
517 spin_unlock_irqrestore(&priv->sta_lock, flags);
518
519 return iwl_send_add_sta(priv, &priv->stations[sta_id].sta,
520 CMD_ASYNC);
521}
522EXPORT_SYMBOL(iwl_rx_agg_start);
523
524int iwl_rx_agg_stop(struct iwl_priv *priv, const u8 *addr, int tid)
525{
526 unsigned long flags;
527 int sta_id;
528
529 sta_id = iwl_find_station(priv, addr);
530 if (sta_id == IWL_INVALID_STATION)
531 return -ENXIO;
532
533 spin_lock_irqsave(&priv->sta_lock, flags);
534 priv->stations[sta_id].sta.station_flags_msk = 0;
535 priv->stations[sta_id].sta.sta.modify_mask = STA_MODIFY_DELBA_TID_MSK;
536 priv->stations[sta_id].sta.remove_immediate_ba_tid = (u8)tid;
537 priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK;
538 spin_unlock_irqrestore(&priv->sta_lock, flags);
539
540 return iwl_send_add_sta(priv, &priv->stations[sta_id].sta,
541 CMD_ASYNC);
542}
543EXPORT_SYMBOL(iwl_rx_agg_stop);
544
545 502
546/* Calculate noise level, based on measurements during network silence just 503/* Calculate noise level, based on measurements during network silence just
547 * before arriving beacon. This measurement can be done only if we know 504 * before arriving beacon. This measurement can be done only if we know
@@ -1017,38 +974,6 @@ static inline int iwl_calc_rssi(struct iwl_priv *priv,
1017} 974}
1018 975
1019 976
1020static void iwl_sta_modify_ps_wake(struct iwl_priv *priv, int sta_id)
1021{
1022 unsigned long flags;
1023
1024 spin_lock_irqsave(&priv->sta_lock, flags);
1025 priv->stations[sta_id].sta.station_flags &= ~STA_FLG_PWR_SAVE_MSK;
1026 priv->stations[sta_id].sta.station_flags_msk = STA_FLG_PWR_SAVE_MSK;
1027 priv->stations[sta_id].sta.sta.modify_mask = 0;
1028 priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK;
1029 spin_unlock_irqrestore(&priv->sta_lock, flags);
1030
1031 iwl_send_add_sta(priv, &priv->stations[sta_id].sta, CMD_ASYNC);
1032}
1033
1034static void iwl_update_ps_mode(struct iwl_priv *priv, u16 ps_bit, u8 *addr)
1035{
1036 /* FIXME: need locking over ps_status ??? */
1037 u8 sta_id = iwl_find_station(priv, addr);
1038
1039 if (sta_id != IWL_INVALID_STATION) {
1040 u8 sta_awake = priv->stations[sta_id].
1041 ps_status == STA_PS_STATUS_WAKE;
1042
1043 if (sta_awake && ps_bit)
1044 priv->stations[sta_id].ps_status = STA_PS_STATUS_SLEEP;
1045 else if (!sta_awake && !ps_bit) {
1046 iwl_sta_modify_ps_wake(priv, sta_id);
1047 priv->stations[sta_id].ps_status = STA_PS_STATUS_WAKE;
1048 }
1049 }
1050}
1051
1052/* This is necessary only for a number of statistics, see the caller. */ 977/* This is necessary only for a number of statistics, see the caller. */
1053static int iwl_is_network_packet(struct iwl_priv *priv, 978static int iwl_is_network_packet(struct iwl_priv *priv,
1054 struct ieee80211_hdr *header) 979 struct ieee80211_hdr *header)
diff --git a/drivers/net/wireless/iwlwifi/iwl-sta.c b/drivers/net/wireless/iwlwifi/iwl-sta.c
index 0c5f1221b8f3..109136a09c54 100644
--- a/drivers/net/wireless/iwlwifi/iwl-sta.c
+++ b/drivers/net/wireless/iwlwifi/iwl-sta.c
@@ -132,7 +132,7 @@ static int iwl_add_sta_callback(struct iwl_priv *priv,
132 return 1; 132 return 1;
133} 133}
134 134
135int iwl_send_add_sta(struct iwl_priv *priv, 135static int iwl_send_add_sta(struct iwl_priv *priv,
136 struct iwl_addsta_cmd *sta, u8 flags) 136 struct iwl_addsta_cmd *sta, u8 flags)
137{ 137{
138 struct iwl_rx_packet *res = NULL; 138 struct iwl_rx_packet *res = NULL;
@@ -180,7 +180,6 @@ int iwl_send_add_sta(struct iwl_priv *priv,
180 180
181 return ret; 181 return ret;
182} 182}
183EXPORT_SYMBOL(iwl_send_add_sta);
184 183
185static void iwl_set_ht_add_station(struct iwl_priv *priv, u8 index, 184static void iwl_set_ht_add_station(struct iwl_priv *priv, u8 index,
186 struct ieee80211_sta_ht_cap *sta_ht_inf) 185 struct ieee80211_sta_ht_cap *sta_ht_inf)
@@ -703,6 +702,55 @@ static int iwl_set_tkip_dynamic_key_info(struct iwl_priv *priv,
703 return ret; 702 return ret;
704} 703}
705 704
705void iwl_update_tkip_key(struct iwl_priv *priv,
706 struct ieee80211_key_conf *keyconf,
707 const u8 *addr, u32 iv32, u16 *phase1key)
708{
709 u8 sta_id = IWL_INVALID_STATION;
710 unsigned long flags;
711 __le16 key_flags = 0;
712 int i;
713 DECLARE_MAC_BUF(mac);
714
715 sta_id = iwl_find_station(priv, addr);
716 if (sta_id == IWL_INVALID_STATION) {
717 IWL_DEBUG_MAC80211("leave - %pM not in station map.\n",
718 addr);
719 return;
720 }
721
722 if (iwl_scan_cancel(priv)) {
723 /* cancel scan failed, just live w/ bad key and rely
724 briefly on SW decryption */
725 return;
726 }
727
728 key_flags |= (STA_KEY_FLG_TKIP | STA_KEY_FLG_MAP_KEY_MSK);
729 key_flags |= cpu_to_le16(keyconf->keyidx << STA_KEY_FLG_KEYID_POS);
730 key_flags &= ~STA_KEY_FLG_INVALID;
731
732 if (sta_id == priv->hw_params.bcast_sta_id)
733 key_flags |= STA_KEY_MULTICAST_MSK;
734
735 spin_lock_irqsave(&priv->sta_lock, flags);
736
737 priv->stations[sta_id].sta.key.key_flags = key_flags;
738 priv->stations[sta_id].sta.key.tkip_rx_tsc_byte2 = (u8) iv32;
739
740 for (i = 0; i < 5; i++)
741 priv->stations[sta_id].sta.key.tkip_rx_ttak[i] =
742 cpu_to_le16(phase1key[i]);
743
744 priv->stations[sta_id].sta.sta.modify_mask = STA_MODIFY_KEY_MASK;
745 priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK;
746
747 iwl_send_add_sta(priv, &priv->stations[sta_id].sta, CMD_ASYNC);
748
749 spin_unlock_irqrestore(&priv->sta_lock, flags);
750
751}
752EXPORT_SYMBOL(iwl_update_tkip_key);
753
706int iwl_remove_dynamic_key(struct iwl_priv *priv, 754int iwl_remove_dynamic_key(struct iwl_priv *priv,
707 struct ieee80211_key_conf *keyconf, 755 struct ieee80211_key_conf *keyconf,
708 u8 sta_id) 756 u8 sta_id)
@@ -989,9 +1037,9 @@ int iwl_get_sta_id(struct iwl_priv *priv, struct ieee80211_hdr *hdr)
989EXPORT_SYMBOL(iwl_get_sta_id); 1037EXPORT_SYMBOL(iwl_get_sta_id);
990 1038
991/** 1039/**
992 * iwl_sta_modify_enable_tid_tx - Enable Tx for this TID in station table 1040 * iwl_sta_tx_modify_enable_tid - Enable Tx for this TID in station table
993 */ 1041 */
994void iwl_sta_modify_enable_tid_tx(struct iwl_priv *priv, int sta_id, int tid) 1042void iwl_sta_tx_modify_enable_tid(struct iwl_priv *priv, int sta_id, int tid)
995{ 1043{
996 unsigned long flags; 1044 unsigned long flags;
997 1045
@@ -1004,5 +1052,81 @@ void iwl_sta_modify_enable_tid_tx(struct iwl_priv *priv, int sta_id, int tid)
1004 1052
1005 iwl_send_add_sta(priv, &priv->stations[sta_id].sta, CMD_ASYNC); 1053 iwl_send_add_sta(priv, &priv->stations[sta_id].sta, CMD_ASYNC);
1006} 1054}
1007EXPORT_SYMBOL(iwl_sta_modify_enable_tid_tx); 1055EXPORT_SYMBOL(iwl_sta_tx_modify_enable_tid);
1056
1057int iwl_sta_rx_agg_start(struct iwl_priv *priv,
1058 const u8 *addr, int tid, u16 ssn)
1059{
1060 unsigned long flags;
1061 int sta_id;
1062
1063 sta_id = iwl_find_station(priv, addr);
1064 if (sta_id == IWL_INVALID_STATION)
1065 return -ENXIO;
1066
1067 spin_lock_irqsave(&priv->sta_lock, flags);
1068 priv->stations[sta_id].sta.station_flags_msk = 0;
1069 priv->stations[sta_id].sta.sta.modify_mask = STA_MODIFY_ADDBA_TID_MSK;
1070 priv->stations[sta_id].sta.add_immediate_ba_tid = (u8)tid;
1071 priv->stations[sta_id].sta.add_immediate_ba_ssn = cpu_to_le16(ssn);
1072 priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK;
1073 spin_unlock_irqrestore(&priv->sta_lock, flags);
1074
1075 return iwl_send_add_sta(priv, &priv->stations[sta_id].sta,
1076 CMD_ASYNC);
1077}
1078EXPORT_SYMBOL(iwl_sta_rx_agg_start);
1079
1080int iwl_sta_rx_agg_stop(struct iwl_priv *priv, const u8 *addr, int tid)
1081{
1082 unsigned long flags;
1083 int sta_id;
1084
1085 sta_id = iwl_find_station(priv, addr);
1086 if (sta_id == IWL_INVALID_STATION)
1087 return -ENXIO;
1088
1089 spin_lock_irqsave(&priv->sta_lock, flags);
1090 priv->stations[sta_id].sta.station_flags_msk = 0;
1091 priv->stations[sta_id].sta.sta.modify_mask = STA_MODIFY_DELBA_TID_MSK;
1092 priv->stations[sta_id].sta.remove_immediate_ba_tid = (u8)tid;
1093 priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK;
1094 spin_unlock_irqrestore(&priv->sta_lock, flags);
1095
1096 return iwl_send_add_sta(priv, &priv->stations[sta_id].sta,
1097 CMD_ASYNC);
1098}
1099EXPORT_SYMBOL(iwl_sta_rx_agg_stop);
1100
1101static void iwl_sta_modify_ps_wake(struct iwl_priv *priv, int sta_id)
1102{
1103 unsigned long flags;
1104
1105 spin_lock_irqsave(&priv->sta_lock, flags);
1106 priv->stations[sta_id].sta.station_flags &= ~STA_FLG_PWR_SAVE_MSK;
1107 priv->stations[sta_id].sta.station_flags_msk = STA_FLG_PWR_SAVE_MSK;
1108 priv->stations[sta_id].sta.sta.modify_mask = 0;
1109 priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK;
1110 spin_unlock_irqrestore(&priv->sta_lock, flags);
1111
1112 iwl_send_add_sta(priv, &priv->stations[sta_id].sta, CMD_ASYNC);
1113}
1114
1115void iwl_update_ps_mode(struct iwl_priv *priv, u16 ps_bit, u8 *addr)
1116{
1117 /* FIXME: need locking over ps_status ??? */
1118 u8 sta_id = iwl_find_station(priv, addr);
1119
1120 if (sta_id != IWL_INVALID_STATION) {
1121 u8 sta_awake = priv->stations[sta_id].
1122 ps_status == STA_PS_STATUS_WAKE;
1123
1124 if (sta_awake && ps_bit)
1125 priv->stations[sta_id].ps_status = STA_PS_STATUS_SLEEP;
1126 else if (!sta_awake && !ps_bit) {
1127 iwl_sta_modify_ps_wake(priv, sta_id);
1128 priv->stations[sta_id].ps_status = STA_PS_STATUS_WAKE;
1129 }
1130 }
1131}
1008 1132
diff --git a/drivers/net/wireless/iwlwifi/iwl-sta.h b/drivers/net/wireless/iwlwifi/iwl-sta.h
index 221b93e670a6..61eede5b30cb 100644
--- a/drivers/net/wireless/iwlwifi/iwl-sta.h
+++ b/drivers/net/wireless/iwlwifi/iwl-sta.h
@@ -47,9 +47,20 @@ int iwl_set_dynamic_key(struct iwl_priv *priv,
47 struct ieee80211_key_conf *key, u8 sta_id); 47 struct ieee80211_key_conf *key, u8 sta_id);
48int iwl_remove_dynamic_key(struct iwl_priv *priv, 48int iwl_remove_dynamic_key(struct iwl_priv *priv,
49 struct ieee80211_key_conf *key, u8 sta_id); 49 struct ieee80211_key_conf *key, u8 sta_id);
50void iwl_update_tkip_key(struct iwl_priv *priv,
51 struct ieee80211_key_conf *keyconf,
52 const u8 *addr, u32 iv32, u16 *phase1key);
53
50int iwl_rxon_add_station(struct iwl_priv *priv, const u8 *addr, int is_ap); 54int iwl_rxon_add_station(struct iwl_priv *priv, const u8 *addr, int is_ap);
51int iwl_remove_station(struct iwl_priv *priv, const u8 *addr, int is_ap); 55int iwl_remove_station(struct iwl_priv *priv, const u8 *addr, int is_ap);
52int iwl_get_sta_id(struct iwl_priv *priv, struct ieee80211_hdr *hdr); 56int iwl_get_sta_id(struct iwl_priv *priv, struct ieee80211_hdr *hdr);
53void iwl_sta_modify_enable_tid_tx(struct iwl_priv *priv, int sta_id, int tid);
54int iwl_get_ra_sta_id(struct iwl_priv *priv, struct ieee80211_hdr *hdr); 57int iwl_get_ra_sta_id(struct iwl_priv *priv, struct ieee80211_hdr *hdr);
58u8 iwl_add_station_flags(struct iwl_priv *priv, const u8 *addr,
59 int is_ap, u8 flags,
60 struct ieee80211_sta_ht_cap *ht_info);
61void iwl_sta_tx_modify_enable_tid(struct iwl_priv *priv, int sta_id, int tid);
62int iwl_sta_rx_agg_start(struct iwl_priv *priv,
63 const u8 *addr, int tid, u16 ssn);
64int iwl_sta_rx_agg_stop(struct iwl_priv *priv, const u8 *addr, int tid);
65void iwl_update_ps_mode(struct iwl_priv *priv, u16 ps_bit, u8 *addr);
55#endif /* __iwl_sta_h__ */ 66#endif /* __iwl_sta_h__ */