aboutsummaryrefslogtreecommitdiffstats
path: root/net/wireless/wext-sme.c
diff options
context:
space:
mode:
authorJohannes Berg <johannes@sipsolutions.net>2009-07-16 05:39:04 -0400
committerJohn W. Linville <linville@tuxdriver.com>2009-07-24 15:05:21 -0400
commit25e83c490be421019997146bdec8645f5bcabcd1 (patch)
tree61215246924f8aebcc0fd0a6fd7fc651dcc487bb /net/wireless/wext-sme.c
parentd4b1a6876f99ae1886cd254f649506af6692ac9f (diff)
cfg80211: don't optimise wext calls too much
In the wext code I tried to not reconnect all the time when the user wasn't really sure what they were doing, like setting the BSSID back to the same value it was. However, this optimisation should only be done while associated so that setting the BSSID back to the same value that it was actually triggers a new association if not currently associated. To achieve, that, put the relevant code into the !IDLE case instead. Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Tested-by: Kalle Valo <kalle.valo@iki.fi> Tested-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/wireless/wext-sme.c')
-rw-r--r--net/wireless/wext-sme.c40
1 files changed, 21 insertions, 19 deletions
diff --git a/net/wireless/wext-sme.c b/net/wireless/wext-sme.c
index 82e913aa163e..4c689fd865b0 100644
--- a/net/wireless/wext-sme.c
+++ b/net/wireless/wext-sme.c
@@ -72,13 +72,14 @@ int cfg80211_mgd_wext_siwfreq(struct net_device *dev,
72 cfg80211_lock_rdev(rdev); 72 cfg80211_lock_rdev(rdev);
73 wdev_lock(wdev); 73 wdev_lock(wdev);
74 74
75 if (wdev->wext.connect.channel == chan) {
76 err = 0;
77 goto out;
78 }
79
80 if (wdev->sme_state != CFG80211_SME_IDLE) { 75 if (wdev->sme_state != CFG80211_SME_IDLE) {
81 bool event = true; 76 bool event = true;
77
78 if (wdev->wext.connect.channel == chan) {
79 err = 0;
80 goto out;
81 }
82
82 /* if SSID set, we'll try right again, avoid event */ 83 /* if SSID set, we'll try right again, avoid event */
83 if (wdev->wext.connect.ssid_len) 84 if (wdev->wext.connect.ssid_len)
84 event = false; 85 event = false;
@@ -164,13 +165,14 @@ int cfg80211_mgd_wext_siwessid(struct net_device *dev,
164 165
165 err = 0; 166 err = 0;
166 167
167 if (wdev->wext.connect.ssid && len &&
168 len == wdev->wext.connect.ssid_len &&
169 memcmp(wdev->wext.connect.ssid, ssid, len) == 0)
170 goto out;
171
172 if (wdev->sme_state != CFG80211_SME_IDLE) { 168 if (wdev->sme_state != CFG80211_SME_IDLE) {
173 bool event = true; 169 bool event = true;
170
171 if (wdev->wext.connect.ssid && len &&
172 len == wdev->wext.connect.ssid_len &&
173 memcmp(wdev->wext.connect.ssid, ssid, len) == 0)
174 goto out;
175
174 /* if SSID set now, we'll try to connect, avoid event */ 176 /* if SSID set now, we'll try to connect, avoid event */
175 if (len) 177 if (len)
176 event = false; 178 event = false;
@@ -244,17 +246,17 @@ int cfg80211_mgd_wext_siwap(struct net_device *dev,
244 cfg80211_lock_rdev(wiphy_to_dev(wdev->wiphy)); 246 cfg80211_lock_rdev(wiphy_to_dev(wdev->wiphy));
245 wdev_lock(wdev); 247 wdev_lock(wdev);
246 248
247 err = 0; 249 if (wdev->sme_state != CFG80211_SME_IDLE) {
248 /* both automatic */ 250 err = 0;
249 if (!bssid && !wdev->wext.connect.bssid) 251 /* both automatic */
250 goto out; 252 if (!bssid && !wdev->wext.connect.bssid)
253 goto out;
251 254
252 /* fixed already - and no change */ 255 /* fixed already - and no change */
253 if (wdev->wext.connect.bssid && bssid && 256 if (wdev->wext.connect.bssid && bssid &&
254 compare_ether_addr(bssid, wdev->wext.connect.bssid) == 0) 257 compare_ether_addr(bssid, wdev->wext.connect.bssid) == 0)
255 goto out; 258 goto out;
256 259
257 if (wdev->sme_state != CFG80211_SME_IDLE) {
258 err = __cfg80211_disconnect(wiphy_to_dev(wdev->wiphy), 260 err = __cfg80211_disconnect(wiphy_to_dev(wdev->wiphy),
259 dev, WLAN_REASON_DEAUTH_LEAVING, 261 dev, WLAN_REASON_DEAUTH_LEAVING,
260 false); 262 false);