aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/iwl-sta.c
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2010-06-14 11:32:24 -0400
committerReinette Chatre <reinette.chatre@intel.com>2010-06-21 13:46:37 -0400
commite666674eec98752d82388ae009e9039a62e744e7 (patch)
tree7f68d80d904ae453082c36af018560005e539d97 /drivers/net/wireless/iwlwifi/iwl-sta.c
parent4620fefa59d8aeae400b21d60d9a86aa11ebffa7 (diff)
iwlwifi: use sync commands for keys
Key management can use sync commands instead of asynchronous ones to have better error checking. Also add checks that the commands all should have the mutex held. Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Reinette Chatre <reinette.chatre@intel.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-sta.c')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-sta.c29
1 files changed, 18 insertions, 11 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-sta.c b/drivers/net/wireless/iwlwifi/iwl-sta.c
index a62a03236eb..d39bfac8740 100644
--- a/drivers/net/wireless/iwlwifi/iwl-sta.c
+++ b/drivers/net/wireless/iwlwifi/iwl-sta.c
@@ -834,7 +834,9 @@ static int iwl_set_wep_dynamic_key_info(struct iwl_priv *priv,
834{ 834{
835 unsigned long flags; 835 unsigned long flags;
836 __le16 key_flags = 0; 836 __le16 key_flags = 0;
837 int ret; 837 struct iwl_addsta_cmd sta_cmd;
838
839 lockdep_assert_held(&priv->mutex);
838 840
839 keyconf->flags &= ~IEEE80211_KEY_FLAG_GENERATE_IV; 841 keyconf->flags &= ~IEEE80211_KEY_FLAG_GENERATE_IV;
840 842
@@ -874,11 +876,10 @@ static int iwl_set_wep_dynamic_key_info(struct iwl_priv *priv,
874 priv->stations[sta_id].sta.sta.modify_mask = STA_MODIFY_KEY_MASK; 876 priv->stations[sta_id].sta.sta.modify_mask = STA_MODIFY_KEY_MASK;
875 priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK; 877 priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK;
876 878
877 ret = iwl_send_add_sta(priv, &priv->stations[sta_id].sta, CMD_ASYNC); 879 memcpy(&sta_cmd, &priv->stations[sta_id].sta, sizeof(struct iwl_addsta_cmd));
878
879 spin_unlock_irqrestore(&priv->sta_lock, flags); 880 spin_unlock_irqrestore(&priv->sta_lock, flags);
880 881
881 return ret; 882 return iwl_send_add_sta(priv, &sta_cmd, CMD_SYNC);
882} 883}
883 884
884static int iwl_set_ccmp_dynamic_key_info(struct iwl_priv *priv, 885static int iwl_set_ccmp_dynamic_key_info(struct iwl_priv *priv,
@@ -887,7 +888,9 @@ static int iwl_set_ccmp_dynamic_key_info(struct iwl_priv *priv,
887{ 888{
888 unsigned long flags; 889 unsigned long flags;
889 __le16 key_flags = 0; 890 __le16 key_flags = 0;
890 int ret; 891 struct iwl_addsta_cmd sta_cmd;
892
893 lockdep_assert_held(&priv->mutex);
891 894
892 key_flags |= (STA_KEY_FLG_CCMP | STA_KEY_FLG_MAP_KEY_MSK); 895 key_flags |= (STA_KEY_FLG_CCMP | STA_KEY_FLG_MAP_KEY_MSK);
893 key_flags |= cpu_to_le16(keyconf->keyidx << STA_KEY_FLG_KEYID_POS); 896 key_flags |= cpu_to_le16(keyconf->keyidx << STA_KEY_FLG_KEYID_POS);
@@ -922,11 +925,10 @@ static int iwl_set_ccmp_dynamic_key_info(struct iwl_priv *priv,
922 priv->stations[sta_id].sta.sta.modify_mask = STA_MODIFY_KEY_MASK; 925 priv->stations[sta_id].sta.sta.modify_mask = STA_MODIFY_KEY_MASK;
923 priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK; 926 priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK;
924 927
925 ret = iwl_send_add_sta(priv, &priv->stations[sta_id].sta, CMD_ASYNC); 928 memcpy(&sta_cmd, &priv->stations[sta_id].sta, sizeof(struct iwl_addsta_cmd));
926
927 spin_unlock_irqrestore(&priv->sta_lock, flags); 929 spin_unlock_irqrestore(&priv->sta_lock, flags);
928 930
929 return ret; 931 return iwl_send_add_sta(priv, &sta_cmd, CMD_SYNC);
930} 932}
931 933
932static int iwl_set_tkip_dynamic_key_info(struct iwl_priv *priv, 934static int iwl_set_tkip_dynamic_key_info(struct iwl_priv *priv,
@@ -1016,9 +1018,11 @@ int iwl_remove_dynamic_key(struct iwl_priv *priv,
1016 u8 sta_id) 1018 u8 sta_id)
1017{ 1019{
1018 unsigned long flags; 1020 unsigned long flags;
1019 int ret = 0;
1020 u16 key_flags; 1021 u16 key_flags;
1021 u8 keyidx; 1022 u8 keyidx;
1023 struct iwl_addsta_cmd sta_cmd;
1024
1025 lockdep_assert_held(&priv->mutex);
1022 1026
1023 priv->key_mapping_key--; 1027 priv->key_mapping_key--;
1024 1028
@@ -1065,9 +1069,10 @@ int iwl_remove_dynamic_key(struct iwl_priv *priv,
1065 spin_unlock_irqrestore(&priv->sta_lock, flags); 1069 spin_unlock_irqrestore(&priv->sta_lock, flags);
1066 return 0; 1070 return 0;
1067 } 1071 }
1068 ret = iwl_send_add_sta(priv, &priv->stations[sta_id].sta, CMD_ASYNC); 1072 memcpy(&sta_cmd, &priv->stations[sta_id].sta, sizeof(struct iwl_addsta_cmd));
1069 spin_unlock_irqrestore(&priv->sta_lock, flags); 1073 spin_unlock_irqrestore(&priv->sta_lock, flags);
1070 return ret; 1074
1075 return iwl_send_add_sta(priv, &sta_cmd, CMD_SYNC);
1071} 1076}
1072EXPORT_SYMBOL(iwl_remove_dynamic_key); 1077EXPORT_SYMBOL(iwl_remove_dynamic_key);
1073 1078
@@ -1076,6 +1081,8 @@ int iwl_set_dynamic_key(struct iwl_priv *priv,
1076{ 1081{
1077 int ret; 1082 int ret;
1078 1083
1084 lockdep_assert_held(&priv->mutex);
1085
1079 priv->key_mapping_key++; 1086 priv->key_mapping_key++;
1080 keyconf->hw_key_idx = HW_KEY_DYNAMIC; 1087 keyconf->hw_key_idx = HW_KEY_DYNAMIC;
1081 1088