diff options
author | Johannes Berg <johannes.berg@intel.com> | 2010-03-30 13:11:46 -0400 |
---|---|---|
committer | Reinette Chatre <reinette.chatre@intel.com> | 2010-04-09 14:27:31 -0400 |
commit | 335348b1702cf78c9e79987a3d66e85a05c98b5c (patch) | |
tree | 92cb89d0b0da052129346aac9c22fbbe22dff633 /drivers/net | |
parent | 678b385d07835c6c21371c12eaaa3fba4de05168 (diff) |
iwlwifi: make WEP key restoring explicit
The firmware clears default WEP keys on
transitions to !associated, so we need
to restore them just like stations. This
is rather implicit as part of sending a
station right now, which is odd. Make it
explicit instead and only for agn since
3945 doesn't use hw crypto for WEP.
Due to that, iwl_send_static_wepkey_cmd
is now only used in iwl-sta.c and can be
static.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Reinette Chatre <reinette.chatre@intel.com>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-agn.c | 25 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-dev.h | 1 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-sta.c | 14 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-sta.h | 2 |
4 files changed, 20 insertions, 22 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c index 978604f8ae9..8a3b0edf83b 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn.c | |||
@@ -158,6 +158,11 @@ int iwl_commit_rxon(struct iwl_priv *priv) | |||
158 | } | 158 | } |
159 | iwl_clear_ucode_stations(priv, false); | 159 | iwl_clear_ucode_stations(priv, false); |
160 | iwl_restore_stations(priv); | 160 | iwl_restore_stations(priv); |
161 | ret = iwl_restore_default_wep_keys(priv); | ||
162 | if (ret) { | ||
163 | IWL_ERR(priv, "Failed to restore WEP keys (%d)\n", ret); | ||
164 | return ret; | ||
165 | } | ||
161 | } | 166 | } |
162 | 167 | ||
163 | IWL_DEBUG_INFO(priv, "Sending RXON\n" | 168 | IWL_DEBUG_INFO(priv, "Sending RXON\n" |
@@ -185,6 +190,11 @@ int iwl_commit_rxon(struct iwl_priv *priv) | |||
185 | memcpy(active_rxon, &priv->staging_rxon, sizeof(*active_rxon)); | 190 | memcpy(active_rxon, &priv->staging_rxon, sizeof(*active_rxon)); |
186 | iwl_clear_ucode_stations(priv, false); | 191 | iwl_clear_ucode_stations(priv, false); |
187 | iwl_restore_stations(priv); | 192 | iwl_restore_stations(priv); |
193 | ret = iwl_restore_default_wep_keys(priv); | ||
194 | if (ret) { | ||
195 | IWL_ERR(priv, "Failed to restore WEP keys (%d)\n", ret); | ||
196 | return ret; | ||
197 | } | ||
188 | } | 198 | } |
189 | 199 | ||
190 | priv->start_calib = 0; | 200 | priv->start_calib = 0; |
@@ -3030,19 +3040,6 @@ static void iwl_mac_sta_notify(struct ieee80211_hw *hw, | |||
3030 | } | 3040 | } |
3031 | } | 3041 | } |
3032 | 3042 | ||
3033 | /** | ||
3034 | * iwl_restore_wepkeys - Restore WEP keys to device | ||
3035 | */ | ||
3036 | static void iwl_restore_wepkeys(struct iwl_priv *priv) | ||
3037 | { | ||
3038 | mutex_lock(&priv->mutex); | ||
3039 | if (priv->iw_mode == NL80211_IFTYPE_STATION && | ||
3040 | priv->default_wep_key && | ||
3041 | iwl_send_static_wepkey_cmd(priv, 0)) | ||
3042 | IWL_ERR(priv, "Could not send WEP static key\n"); | ||
3043 | mutex_unlock(&priv->mutex); | ||
3044 | } | ||
3045 | |||
3046 | static int iwlagn_mac_sta_add(struct ieee80211_hw *hw, | 3043 | static int iwlagn_mac_sta_add(struct ieee80211_hw *hw, |
3047 | struct ieee80211_vif *vif, | 3044 | struct ieee80211_vif *vif, |
3048 | struct ieee80211_sta *sta) | 3045 | struct ieee80211_sta *sta) |
@@ -3069,8 +3066,6 @@ static int iwlagn_mac_sta_add(struct ieee80211_hw *hw, | |||
3069 | return ret; | 3066 | return ret; |
3070 | } | 3067 | } |
3071 | 3068 | ||
3072 | iwl_restore_wepkeys(priv); | ||
3073 | |||
3074 | /* Initialize rate scaling */ | 3069 | /* Initialize rate scaling */ |
3075 | IWL_DEBUG_INFO(priv, "Initializing rate scaling for station %pM\n", | 3070 | IWL_DEBUG_INFO(priv, "Initializing rate scaling for station %pM\n", |
3076 | sta->addr); | 3071 | sta->addr); |
diff --git a/drivers/net/wireless/iwlwifi/iwl-dev.h b/drivers/net/wireless/iwlwifi/iwl-dev.h index 4319bda487d..95c2bc3c79e 100644 --- a/drivers/net/wireless/iwlwifi/iwl-dev.h +++ b/drivers/net/wireless/iwlwifi/iwl-dev.h | |||
@@ -1167,7 +1167,6 @@ struct iwl_priv { | |||
1167 | int num_stations; | 1167 | int num_stations; |
1168 | struct iwl_station_entry stations[IWL_STATION_COUNT]; | 1168 | struct iwl_station_entry stations[IWL_STATION_COUNT]; |
1169 | struct iwl_wep_key wep_keys[WEP_KEYS_MAX]; /* protected by mutex */ | 1169 | struct iwl_wep_key wep_keys[WEP_KEYS_MAX]; /* protected by mutex */ |
1170 | u8 default_wep_key; | ||
1171 | u8 key_mapping_key; | 1170 | u8 key_mapping_key; |
1172 | unsigned long ucode_key_table; | 1171 | unsigned long ucode_key_table; |
1173 | 1172 | ||
diff --git a/drivers/net/wireless/iwlwifi/iwl-sta.c b/drivers/net/wireless/iwlwifi/iwl-sta.c index e34ac0355c7..be3d222d8f2 100644 --- a/drivers/net/wireless/iwlwifi/iwl-sta.c +++ b/drivers/net/wireless/iwlwifi/iwl-sta.c | |||
@@ -759,7 +759,7 @@ int iwl_get_free_ucode_key_index(struct iwl_priv *priv) | |||
759 | } | 759 | } |
760 | EXPORT_SYMBOL(iwl_get_free_ucode_key_index); | 760 | EXPORT_SYMBOL(iwl_get_free_ucode_key_index); |
761 | 761 | ||
762 | int iwl_send_static_wepkey_cmd(struct iwl_priv *priv, u8 send_if_empty) | 762 | static int iwl_send_static_wepkey_cmd(struct iwl_priv *priv, u8 send_if_empty) |
763 | { | 763 | { |
764 | int i, not_empty = 0; | 764 | int i, not_empty = 0; |
765 | u8 buff[sizeof(struct iwl_wep_cmd) + | 765 | u8 buff[sizeof(struct iwl_wep_cmd) + |
@@ -803,7 +803,14 @@ int iwl_send_static_wepkey_cmd(struct iwl_priv *priv, u8 send_if_empty) | |||
803 | else | 803 | else |
804 | return 0; | 804 | return 0; |
805 | } | 805 | } |
806 | EXPORT_SYMBOL(iwl_send_static_wepkey_cmd); | 806 | |
807 | int iwl_restore_default_wep_keys(struct iwl_priv *priv) | ||
808 | { | ||
809 | WARN_ON(!mutex_is_locked(&priv->mutex)); | ||
810 | |||
811 | return iwl_send_static_wepkey_cmd(priv, 0); | ||
812 | } | ||
813 | EXPORT_SYMBOL(iwl_restore_default_wep_keys); | ||
807 | 814 | ||
808 | int iwl_remove_default_wep_key(struct iwl_priv *priv, | 815 | int iwl_remove_default_wep_key(struct iwl_priv *priv, |
809 | struct ieee80211_key_conf *keyconf) | 816 | struct ieee80211_key_conf *keyconf) |
@@ -819,7 +826,6 @@ int iwl_remove_default_wep_key(struct iwl_priv *priv, | |||
819 | IWL_ERR(priv, "index %d not used in uCode key table.\n", | 826 | IWL_ERR(priv, "index %d not used in uCode key table.\n", |
820 | keyconf->keyidx); | 827 | keyconf->keyidx); |
821 | 828 | ||
822 | priv->default_wep_key--; | ||
823 | memset(&priv->wep_keys[keyconf->keyidx], 0, sizeof(priv->wep_keys[0])); | 829 | memset(&priv->wep_keys[keyconf->keyidx], 0, sizeof(priv->wep_keys[0])); |
824 | if (iwl_is_rfkill(priv)) { | 830 | if (iwl_is_rfkill(priv)) { |
825 | IWL_DEBUG_WEP(priv, "Not sending REPLY_WEPKEY command due to RFKILL.\n"); | 831 | IWL_DEBUG_WEP(priv, "Not sending REPLY_WEPKEY command due to RFKILL.\n"); |
@@ -851,8 +857,6 @@ int iwl_set_default_wep_key(struct iwl_priv *priv, | |||
851 | keyconf->hw_key_idx = HW_KEY_DEFAULT; | 857 | keyconf->hw_key_idx = HW_KEY_DEFAULT; |
852 | priv->stations[IWL_AP_ID].keyinfo.alg = ALG_WEP; | 858 | priv->stations[IWL_AP_ID].keyinfo.alg = ALG_WEP; |
853 | 859 | ||
854 | priv->default_wep_key++; | ||
855 | |||
856 | if (test_and_set_bit(keyconf->keyidx, &priv->ucode_key_table)) | 860 | if (test_and_set_bit(keyconf->keyidx, &priv->ucode_key_table)) |
857 | IWL_ERR(priv, "index %d already used in uCode key table.\n", | 861 | IWL_ERR(priv, "index %d already used in uCode key table.\n", |
858 | keyconf->keyidx); | 862 | keyconf->keyidx); |
diff --git a/drivers/net/wireless/iwlwifi/iwl-sta.h b/drivers/net/wireless/iwlwifi/iwl-sta.h index 87a34997a75..42cd2f4a01c 100644 --- a/drivers/net/wireless/iwlwifi/iwl-sta.h +++ b/drivers/net/wireless/iwlwifi/iwl-sta.h | |||
@@ -44,11 +44,11 @@ | |||
44 | */ | 44 | */ |
45 | u8 iwl_find_station(struct iwl_priv *priv, const u8 *bssid); | 45 | u8 iwl_find_station(struct iwl_priv *priv, const u8 *bssid); |
46 | 46 | ||
47 | int iwl_send_static_wepkey_cmd(struct iwl_priv *priv, u8 send_if_empty); | ||
48 | int iwl_remove_default_wep_key(struct iwl_priv *priv, | 47 | int iwl_remove_default_wep_key(struct iwl_priv *priv, |
49 | struct ieee80211_key_conf *key); | 48 | struct ieee80211_key_conf *key); |
50 | int iwl_set_default_wep_key(struct iwl_priv *priv, | 49 | int iwl_set_default_wep_key(struct iwl_priv *priv, |
51 | struct ieee80211_key_conf *key); | 50 | struct ieee80211_key_conf *key); |
51 | int iwl_restore_default_wep_keys(struct iwl_priv *priv); | ||
52 | int iwl_set_dynamic_key(struct iwl_priv *priv, | 52 | int iwl_set_dynamic_key(struct iwl_priv *priv, |
53 | struct ieee80211_key_conf *key, u8 sta_id); | 53 | struct ieee80211_key_conf *key, u8 sta_id); |
54 | int iwl_remove_dynamic_key(struct iwl_priv *priv, | 54 | int iwl_remove_dynamic_key(struct iwl_priv *priv, |