aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSamuel Ortiz <samuel.ortiz@intel.com>2009-06-15 15:59:54 -0400
committerJohn W. Linville <linville@tuxdriver.com>2009-07-10 14:57:52 -0400
commit3549716484a95fd16f7fcf8b68699bd4c803b382 (patch)
treef1fd8ce07afec9562f178455a03aacf1faa43dc5
parent191506ecbce03f09f6afa76f1af069574bf99bec (diff)
iwmc3200wifi: cache keys when interface is down
When the interface is down and one sets a WEP key from userspace, we should be able to simply cache it. Since that implies setting part of the profile's security settings, we now alloc/free the umac_profile at probe/remove time, and no longer at interface bring up/down time. Simply resetting it during the latter is enough. Signed-off-by: Samuel Ortiz <samuel.ortiz@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r--drivers/net/wireless/iwmc3200wifi/cfg80211.c12
-rw-r--r--drivers/net/wireless/iwmc3200wifi/main.c20
-rw-r--r--drivers/net/wireless/iwmc3200wifi/netdev.c15
3 files changed, 28 insertions, 19 deletions
diff --git a/drivers/net/wireless/iwmc3200wifi/cfg80211.c b/drivers/net/wireless/iwmc3200wifi/cfg80211.c
index 739bd9b0ddea..0cdd7ef68b78 100644
--- a/drivers/net/wireless/iwmc3200wifi/cfg80211.c
+++ b/drivers/net/wireless/iwmc3200wifi/cfg80211.c
@@ -271,6 +271,10 @@ static int iwm_cfg80211_del_key(struct wiphy *wiphy, struct net_device *ndev,
271 if (key_index == iwm->default_key) 271 if (key_index == iwm->default_key)
272 iwm->default_key = -1; 272 iwm->default_key = -1;
273 273
274 /* If the interface is down, we just cache this */
275 if (!test_bit(IWM_STATUS_READY, &iwm->status))
276 return 0;
277
274 return iwm_set_key(iwm, 1, key); 278 return iwm_set_key(iwm, 1, key);
275} 279}
276 280
@@ -288,12 +292,16 @@ static int iwm_cfg80211_set_default_key(struct wiphy *wiphy,
288 return -EINVAL; 292 return -EINVAL;
289 } 293 }
290 294
295 iwm->default_key = key_index;
296
297 /* If the interface is down, we just cache this */
298 if (!test_bit(IWM_STATUS_READY, &iwm->status))
299 return 0;
300
291 ret = iwm_set_tx_key(iwm, key_index); 301 ret = iwm_set_tx_key(iwm, key_index);
292 if (ret < 0) 302 if (ret < 0)
293 return ret; 303 return ret;
294 304
295 iwm->default_key = key_index;
296
297 return iwm_reset_profile(iwm); 305 return iwm_reset_profile(iwm);
298} 306}
299 307
diff --git a/drivers/net/wireless/iwmc3200wifi/main.c b/drivers/net/wireless/iwmc3200wifi/main.c
index 7f56c06a53db..930056b013f3 100644
--- a/drivers/net/wireless/iwmc3200wifi/main.c
+++ b/drivers/net/wireless/iwmc3200wifi/main.c
@@ -643,19 +643,10 @@ int __iwm_up(struct iwm_priv *iwm)
643 } 643 }
644 } 644 }
645 645
646 iwm->umac_profile = kmalloc(sizeof(struct iwm_umac_profile),
647 GFP_KERNEL);
648 if (!iwm->umac_profile) {
649 IWM_ERR(iwm, "Couldn't alloc memory for profile\n");
650 goto err_fw;
651 }
652
653 iwm_init_default_profile(iwm, iwm->umac_profile);
654
655 ret = iwm_channels_init(iwm); 646 ret = iwm_channels_init(iwm);
656 if (ret < 0) { 647 if (ret < 0) {
657 IWM_ERR(iwm, "Couldn't init channels\n"); 648 IWM_ERR(iwm, "Couldn't init channels\n");
658 goto err_profile; 649 goto err_fw;
659 } 650 }
660 651
661 /* Set the READY bit to indicate interface is brought up successfully */ 652 /* Set the READY bit to indicate interface is brought up successfully */
@@ -663,10 +654,6 @@ int __iwm_up(struct iwm_priv *iwm)
663 654
664 return 0; 655 return 0;
665 656
666 err_profile:
667 kfree(iwm->umac_profile);
668 iwm->umac_profile = NULL;
669
670 err_fw: 657 err_fw:
671 iwm_eeprom_exit(iwm); 658 iwm_eeprom_exit(iwm);
672 659
@@ -705,10 +692,9 @@ int __iwm_down(struct iwm_priv *iwm)
705 clear_bit(IWM_STATUS_READY, &iwm->status); 692 clear_bit(IWM_STATUS_READY, &iwm->status);
706 693
707 iwm_eeprom_exit(iwm); 694 iwm_eeprom_exit(iwm);
708 kfree(iwm->umac_profile);
709 iwm->umac_profile = NULL;
710 iwm_bss_list_clean(iwm); 695 iwm_bss_list_clean(iwm);
711 696 iwm_init_default_profile(iwm, iwm->umac_profile);
697 iwm->umac_profile_active = false;
712 iwm->default_key = -1; 698 iwm->default_key = -1;
713 iwm->core_enabled = 0; 699 iwm->core_enabled = 0;
714 700
diff --git a/drivers/net/wireless/iwmc3200wifi/netdev.c b/drivers/net/wireless/iwmc3200wifi/netdev.c
index aaa20c6885c8..d4deb4b471e5 100644
--- a/drivers/net/wireless/iwmc3200wifi/netdev.c
+++ b/drivers/net/wireless/iwmc3200wifi/netdev.c
@@ -48,6 +48,7 @@
48#include <linux/netdevice.h> 48#include <linux/netdevice.h>
49 49
50#include "iwm.h" 50#include "iwm.h"
51#include "commands.h"
51#include "cfg80211.h" 52#include "cfg80211.h"
52#include "debug.h" 53#include "debug.h"
53 54
@@ -135,8 +136,20 @@ void *iwm_if_alloc(int sizeof_bus, struct device *dev,
135 SET_NETDEV_DEV(ndev, wiphy_dev(wdev->wiphy)); 136 SET_NETDEV_DEV(ndev, wiphy_dev(wdev->wiphy));
136 wdev->netdev = ndev; 137 wdev->netdev = ndev;
137 138
139 iwm->umac_profile = kmalloc(sizeof(struct iwm_umac_profile),
140 GFP_KERNEL);
141 if (!iwm->umac_profile) {
142 dev_err(dev, "Couldn't alloc memory for profile\n");
143 goto out_profile;
144 }
145
146 iwm_init_default_profile(iwm, iwm->umac_profile);
147
138 return iwm; 148 return iwm;
139 149
150 out_profile:
151 free_netdev(ndev);
152
140 out_priv: 153 out_priv:
141 iwm_priv_deinit(iwm); 154 iwm_priv_deinit(iwm);
142 155
@@ -153,6 +166,8 @@ void iwm_if_free(struct iwm_priv *iwm)
153 free_netdev(iwm_to_ndev(iwm)); 166 free_netdev(iwm_to_ndev(iwm));
154 iwm_wdev_free(iwm); 167 iwm_wdev_free(iwm);
155 iwm_priv_deinit(iwm); 168 iwm_priv_deinit(iwm);
169 kfree(iwm->umac_profile);
170 iwm->umac_profile = NULL;
156} 171}
157 172
158int iwm_if_add(struct iwm_priv *iwm) 173int iwm_if_add(struct iwm_priv *iwm)