aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwmc3200wifi
diff options
context:
space:
mode:
authorZhu Yi <yi.zhu@intel.com>2009-07-16 05:34:13 -0400
committerJohn W. Linville <linville@tuxdriver.com>2009-07-24 15:05:21 -0400
commit6e5db0a8454b44bf88fa74cf437a507ec08f436d (patch)
treecb5b4af8a02d2c857749d649f06183b55f32ad28 /drivers/net/wireless/iwmc3200wifi
parentb6c321718e1376b1a55afc63cce090a2c4573417 (diff)
iwmc3200wifi: remove key caches in driver
cfg80211 now guarantees keys are set after connecting. We can remove the key cache code from the driver now. Signed-off-by: Zhu Yi <yi.zhu@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/iwmc3200wifi')
-rw-r--r--drivers/net/wireless/iwmc3200wifi/cfg80211.c43
-rw-r--r--drivers/net/wireless/iwmc3200wifi/commands.c29
2 files changed, 2 insertions, 70 deletions
diff --git a/drivers/net/wireless/iwmc3200wifi/cfg80211.c b/drivers/net/wireless/iwmc3200wifi/cfg80211.c
index 0372658bac99..3f5a08fa401f 100644
--- a/drivers/net/wireless/iwmc3200wifi/cfg80211.c
+++ b/drivers/net/wireless/iwmc3200wifi/cfg80211.c
@@ -158,34 +158,6 @@ static int iwm_key_init(struct iwm_key *key, u8 key_index,
158 return 0; 158 return 0;
159} 159}
160 160
161static int iwm_reset_profile(struct iwm_priv *iwm)
162{
163 int ret;
164
165 if (!iwm->umac_profile_active)
166 return 0;
167
168 /*
169 * If there is a current active profile, but no
170 * default key, it's not worth trying to associate again.
171 */
172 if (iwm->default_key < 0)
173 return 0;
174
175 /*
176 * Here we have an active profile, but a key setting changed.
177 * We thus have to invalidate the current profile, and push the
178 * new one. Keys will be pushed when association takes place.
179 */
180 ret = iwm_invalidate_mlme_profile(iwm);
181 if (ret < 0) {
182 IWM_ERR(iwm, "Couldn't invalidate profile\n");
183 return ret;
184 }
185
186 return iwm_send_mlme_profile(iwm);
187}
188
189static int iwm_cfg80211_add_key(struct wiphy *wiphy, struct net_device *ndev, 161static int iwm_cfg80211_add_key(struct wiphy *wiphy, struct net_device *ndev,
190 u8 key_index, const u8 *mac_addr, 162 u8 key_index, const u8 *mac_addr,
191 struct key_params *params) 163 struct key_params *params)
@@ -245,10 +217,6 @@ static int iwm_cfg80211_del_key(struct wiphy *wiphy, struct net_device *ndev,
245 if (key_index == iwm->default_key) 217 if (key_index == iwm->default_key)
246 iwm->default_key = -1; 218 iwm->default_key = -1;
247 219
248 /* If the interface is down, we just cache this */
249 if (!test_bit(IWM_STATUS_READY, &iwm->status))
250 return 0;
251
252 return iwm_set_key(iwm, 1, key); 220 return iwm_set_key(iwm, 1, key);
253} 221}
254 222
@@ -257,7 +225,6 @@ static int iwm_cfg80211_set_default_key(struct wiphy *wiphy,
257 u8 key_index) 225 u8 key_index)
258{ 226{
259 struct iwm_priv *iwm = ndev_to_iwm(ndev); 227 struct iwm_priv *iwm = ndev_to_iwm(ndev);
260 int ret;
261 228
262 IWM_DBG_WEXT(iwm, DBG, "Default key index is: %d\n", key_index); 229 IWM_DBG_WEXT(iwm, DBG, "Default key index is: %d\n", key_index);
263 230
@@ -268,15 +235,7 @@ static int iwm_cfg80211_set_default_key(struct wiphy *wiphy,
268 235
269 iwm->default_key = key_index; 236 iwm->default_key = key_index;
270 237
271 /* If the interface is down, we just cache this */ 238 return iwm_set_tx_key(iwm, key_index);
272 if (!test_bit(IWM_STATUS_READY, &iwm->status))
273 return 0;
274
275 ret = iwm_set_tx_key(iwm, key_index);
276 if (ret < 0)
277 return ret;
278
279 return iwm_reset_profile(iwm);
280} 239}
281 240
282int iwm_cfg80211_get_station(struct wiphy *wiphy, struct net_device *ndev, 241int iwm_cfg80211_get_station(struct wiphy *wiphy, struct net_device *ndev,
diff --git a/drivers/net/wireless/iwmc3200wifi/commands.c b/drivers/net/wireless/iwmc3200wifi/commands.c
index e6be29704a1d..0d6637005f42 100644
--- a/drivers/net/wireless/iwmc3200wifi/commands.c
+++ b/drivers/net/wireless/iwmc3200wifi/commands.c
@@ -584,12 +584,6 @@ int iwm_set_key(struct iwm_priv *iwm, bool remove, struct iwm_key *key)
584 struct iwm_umac_key_tkip *tkip = (struct iwm_umac_key_tkip *)cmd; 584 struct iwm_umac_key_tkip *tkip = (struct iwm_umac_key_tkip *)cmd;
585 struct iwm_umac_key_ccmp *ccmp = (struct iwm_umac_key_ccmp *)cmd; 585 struct iwm_umac_key_ccmp *ccmp = (struct iwm_umac_key_ccmp *)cmd;
586 586
587 /*
588 * We check if our current profile is valid.
589 * If not, we dont push the key, we just cache them,
590 * so that with the next siwsessid call, the keys
591 * will be actually pushed.
592 */
593 if (!remove) { 587 if (!remove) {
594 ret = iwm_check_profile(iwm); 588 ret = iwm_check_profile(iwm);
595 if (ret < 0) 589 if (ret < 0)
@@ -727,7 +721,7 @@ int iwm_set_key(struct iwm_priv *iwm, bool remove, struct iwm_key *key)
727 721
728int iwm_send_mlme_profile(struct iwm_priv *iwm) 722int iwm_send_mlme_profile(struct iwm_priv *iwm)
729{ 723{
730 int ret, i; 724 int ret;
731 struct iwm_umac_profile profile; 725 struct iwm_umac_profile profile;
732 726
733 memcpy(&profile, iwm->umac_profile, sizeof(profile)); 727 memcpy(&profile, iwm->umac_profile, sizeof(profile));
@@ -742,27 +736,6 @@ int iwm_send_mlme_profile(struct iwm_priv *iwm)
742 return ret; 736 return ret;
743 } 737 }
744 738
745 for (i = 0; i < IWM_NUM_KEYS; i++)
746 if (iwm->keys[i].key_len) {
747 struct iwm_key *key = &iwm->keys[i];
748
749 /* Wait for the profile before sending the keys */
750 wait_event_interruptible_timeout(iwm->mlme_queue,
751 (test_bit(IWM_STATUS_ASSOCIATING, &iwm->status) ||
752 test_bit(IWM_STATUS_ASSOCIATED, &iwm->status)),
753 3 * HZ);
754
755 ret = iwm_set_key(iwm, 0, key);
756 if (ret)
757 return ret;
758
759 if (iwm->default_key == i) {
760 ret = iwm_set_tx_key(iwm, i);
761 if (ret)
762 return ret;
763 }
764 }
765
766 return 0; 739 return 0;
767} 740}
768 741