aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/libertas/assoc.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/libertas/assoc.c')
-rw-r--r--drivers/net/wireless/libertas/assoc.c99
1 files changed, 48 insertions, 51 deletions
diff --git a/drivers/net/wireless/libertas/assoc.c b/drivers/net/wireless/libertas/assoc.c
index 8e6b6b7eca29..187ffd85c4be 100644
--- a/drivers/net/wireless/libertas/assoc.c
+++ b/drivers/net/wireless/libertas/assoc.c
@@ -20,9 +20,9 @@ static int assoc_helper_essid(wlan_private *priv,
20 int ret = 0; 20 int ret = 0;
21 int i; 21 int i;
22 22
23 ENTER(); 23 lbs_deb_enter(LBS_DEB_ASSOC);
24 24
25 lbs_pr_debug(1, "New SSID requested: %s\n", assoc_req->ssid.ssid); 25 lbs_deb_assoc("New SSID requested: %s\n", assoc_req->ssid.ssid);
26 if (assoc_req->mode == IW_MODE_INFRA) { 26 if (assoc_req->mode == IW_MODE_INFRA) {
27 if (adapter->prescan) { 27 if (adapter->prescan) {
28 libertas_send_specific_SSID_scan(priv, &assoc_req->ssid, 1); 28 libertas_send_specific_SSID_scan(priv, &assoc_req->ssid, 1);
@@ -31,7 +31,7 @@ static int assoc_helper_essid(wlan_private *priv,
31 i = libertas_find_SSID_in_list(adapter, &assoc_req->ssid, 31 i = libertas_find_SSID_in_list(adapter, &assoc_req->ssid,
32 NULL, IW_MODE_INFRA); 32 NULL, IW_MODE_INFRA);
33 if (i >= 0) { 33 if (i >= 0) {
34 lbs_pr_debug(1, 34 lbs_deb_assoc(
35 "SSID found in scan list ... associating...\n"); 35 "SSID found in scan list ... associating...\n");
36 36
37 ret = wlan_associate(priv, &adapter->scantable[i]); 37 ret = wlan_associate(priv, &adapter->scantable[i]);
@@ -41,7 +41,7 @@ static int assoc_helper_essid(wlan_private *priv,
41 ETH_ALEN); 41 ETH_ALEN);
42 } 42 }
43 } else { 43 } else {
44 lbs_pr_debug(1, "SSID '%s' not found; cannot associate\n", 44 lbs_deb_assoc("SSID '%s' not found; cannot associate\n",
45 assoc_req->ssid.ssid); 45 assoc_req->ssid.ssid);
46 } 46 }
47 } else if (assoc_req->mode == IW_MODE_ADHOC) { 47 } else if (assoc_req->mode == IW_MODE_ADHOC) {
@@ -54,18 +54,18 @@ static int assoc_helper_essid(wlan_private *priv,
54 i = libertas_find_SSID_in_list(adapter, &assoc_req->ssid, NULL, 54 i = libertas_find_SSID_in_list(adapter, &assoc_req->ssid, NULL,
55 IW_MODE_ADHOC); 55 IW_MODE_ADHOC);
56 if (i >= 0) { 56 if (i >= 0) {
57 lbs_pr_debug(1, "SSID found at %d in List, so join\n", ret); 57 lbs_deb_assoc("SSID found at %d in List, so join\n", ret);
58 libertas_join_adhoc_network(priv, &adapter->scantable[i]); 58 libertas_join_adhoc_network(priv, &adapter->scantable[i]);
59 } else { 59 } else {
60 /* else send START command */ 60 /* else send START command */
61 lbs_pr_debug(1, "SSID not found in list, so creating adhoc" 61 lbs_deb_assoc("SSID not found in list, so creating adhoc"
62 " with SSID '%s'\n", assoc_req->ssid.ssid); 62 " with SSID '%s'\n", assoc_req->ssid.ssid);
63 libertas_start_adhoc_network(priv, &assoc_req->ssid); 63 libertas_start_adhoc_network(priv, &assoc_req->ssid);
64 } 64 }
65 memcpy(&assoc_req->bssid, &adapter->current_addr, ETH_ALEN); 65 memcpy(&assoc_req->bssid, &adapter->current_addr, ETH_ALEN);
66 } 66 }
67 67
68 LEAVE(); 68 lbs_deb_leave_args(LBS_DEB_ASSOC, "ret %d", ret);
69 return ret; 69 return ret;
70} 70}
71 71
@@ -76,23 +76,21 @@ static int assoc_helper_bssid(wlan_private *priv,
76 wlan_adapter *adapter = priv->adapter; 76 wlan_adapter *adapter = priv->adapter;
77 int i, ret = 0; 77 int i, ret = 0;
78 78
79 ENTER(); 79 lbs_deb_enter_args(LBS_DEB_ASSOC, "BSSID" MAC_FMT "\n",
80
81 lbs_pr_debug(1, "ASSOC: WAP: BSSID = " MAC_FMT "\n",
82 MAC_ARG(assoc_req->bssid)); 80 MAC_ARG(assoc_req->bssid));
83 81
84 /* Search for index position in list for requested MAC */ 82 /* Search for index position in list for requested MAC */
85 i = libertas_find_BSSID_in_list(adapter, assoc_req->bssid, 83 i = libertas_find_BSSID_in_list(adapter, assoc_req->bssid,
86 assoc_req->mode); 84 assoc_req->mode);
87 if (i < 0) { 85 if (i < 0) {
88 lbs_pr_debug(1, "ASSOC: WAP: BSSID " MAC_FMT " not found, " 86 lbs_deb_assoc("ASSOC: WAP: BSSID " MAC_FMT " not found, "
89 "cannot associate.\n", MAC_ARG(assoc_req->bssid)); 87 "cannot associate.\n", MAC_ARG(assoc_req->bssid));
90 goto out; 88 goto out;
91 } 89 }
92 90
93 if (assoc_req->mode == IW_MODE_INFRA) { 91 if (assoc_req->mode == IW_MODE_INFRA) {
94 ret = wlan_associate(priv, &adapter->scantable[i]); 92 ret = wlan_associate(priv, &adapter->scantable[i]);
95 lbs_pr_debug(1, "ASSOC: return from wlan_associate(bssd) was %d\n", ret); 93 lbs_deb_assoc("ASSOC: return from wlan_associate(bssd) was %d\n", ret);
96 } else if (assoc_req->mode == IW_MODE_ADHOC) { 94 } else if (assoc_req->mode == IW_MODE_ADHOC) {
97 libertas_join_adhoc_network(priv, &adapter->scantable[i]); 95 libertas_join_adhoc_network(priv, &adapter->scantable[i]);
98 } 96 }
@@ -100,7 +98,7 @@ static int assoc_helper_bssid(wlan_private *priv,
100 sizeof(struct WLAN_802_11_SSID)); 98 sizeof(struct WLAN_802_11_SSID));
101 99
102out: 100out:
103 LEAVE(); 101 lbs_deb_leave_args(LBS_DEB_ASSOC, "ret %d", ret);
104 return ret; 102 return ret;
105} 103}
106 104
@@ -118,7 +116,7 @@ static int assoc_helper_associate(wlan_private *priv,
118 ret = assoc_helper_bssid(priv, assoc_req); 116 ret = assoc_helper_bssid(priv, assoc_req);
119 done = 1; 117 done = 1;
120 if (ret) { 118 if (ret) {
121 lbs_pr_debug(1, "ASSOC: bssid: ret = %d\n", ret); 119 lbs_deb_assoc("ASSOC: bssid: ret = %d\n", ret);
122 } 120 }
123 } 121 }
124 } 122 }
@@ -126,7 +124,7 @@ static int assoc_helper_associate(wlan_private *priv,
126 if (!done && test_bit(ASSOC_FLAG_SSID, &assoc_req->flags)) { 124 if (!done && test_bit(ASSOC_FLAG_SSID, &assoc_req->flags)) {
127 ret = assoc_helper_essid(priv, assoc_req); 125 ret = assoc_helper_essid(priv, assoc_req);
128 if (ret) { 126 if (ret) {
129 lbs_pr_debug(1, "ASSOC: bssid: ret = %d\n", ret); 127 lbs_deb_assoc("ASSOC: bssid: ret = %d\n", ret);
130 } 128 }
131 } 129 }
132 130
@@ -140,12 +138,10 @@ static int assoc_helper_mode(wlan_private *priv,
140 wlan_adapter *adapter = priv->adapter; 138 wlan_adapter *adapter = priv->adapter;
141 int ret = 0; 139 int ret = 0;
142 140
143 ENTER(); 141 lbs_deb_enter(LBS_DEB_ASSOC);
144 142
145 if (assoc_req->mode == adapter->mode) { 143 if (assoc_req->mode == adapter->mode)
146 LEAVE(); 144 goto done;
147 return 0;
148 }
149 145
150 if (assoc_req->mode == IW_MODE_INFRA) { 146 if (assoc_req->mode == IW_MODE_INFRA) {
151 if (adapter->psstate != PS_STATE_FULL_POWER) 147 if (adapter->psstate != PS_STATE_FULL_POWER)
@@ -160,7 +156,8 @@ static int assoc_helper_mode(wlan_private *priv,
160 OID_802_11_INFRASTRUCTURE_MODE, 156 OID_802_11_INFRASTRUCTURE_MODE,
161 (void *) (size_t) assoc_req->mode); 157 (void *) (size_t) assoc_req->mode);
162 158
163 LEAVE(); 159done:
160 lbs_deb_leave_args(LBS_DEB_ASSOC, "ret %d", ret);
164 return ret; 161 return ret;
165} 162}
166 163
@@ -172,7 +169,7 @@ static int assoc_helper_wep_keys(wlan_private *priv,
172 int i; 169 int i;
173 int ret = 0; 170 int ret = 0;
174 171
175 ENTER(); 172 lbs_deb_enter(LBS_DEB_ASSOC);
176 173
177 /* Set or remove WEP keys */ 174 /* Set or remove WEP keys */
178 if ( assoc_req->wep_keys[0].len 175 if ( assoc_req->wep_keys[0].len
@@ -216,7 +213,7 @@ static int assoc_helper_wep_keys(wlan_private *priv,
216 mutex_unlock(&adapter->lock); 213 mutex_unlock(&adapter->lock);
217 214
218out: 215out:
219 LEAVE(); 216 lbs_deb_leave_args(LBS_DEB_ASSOC, "ret %d", ret);
220 return ret; 217 return ret;
221} 218}
222 219
@@ -226,14 +223,14 @@ static int assoc_helper_secinfo(wlan_private *priv,
226 wlan_adapter *adapter = priv->adapter; 223 wlan_adapter *adapter = priv->adapter;
227 int ret = 0; 224 int ret = 0;
228 225
229 ENTER(); 226 lbs_deb_enter(LBS_DEB_ASSOC);
230 227
231 memcpy(&adapter->secinfo, &assoc_req->secinfo, 228 memcpy(&adapter->secinfo, &assoc_req->secinfo,
232 sizeof(struct wlan_802_11_security)); 229 sizeof(struct wlan_802_11_security));
233 230
234 ret = libertas_set_mac_packet_filter(priv); 231 ret = libertas_set_mac_packet_filter(priv);
235 232
236 LEAVE(); 233 lbs_deb_leave_args(LBS_DEB_ASSOC, "ret %d", ret);
237 return ret; 234 return ret;
238} 235}
239 236
@@ -243,7 +240,7 @@ static int assoc_helper_wpa_keys(wlan_private *priv,
243{ 240{
244 int ret = 0; 241 int ret = 0;
245 242
246 ENTER(); 243 lbs_deb_enter(LBS_DEB_ASSOC);
247 244
248 /* enable/Disable RSN */ 245 /* enable/Disable RSN */
249 ret = libertas_prepare_and_send_command(priv, 246 ret = libertas_prepare_and_send_command(priv,
@@ -261,7 +258,7 @@ static int assoc_helper_wpa_keys(wlan_private *priv,
261 0, assoc_req); 258 0, assoc_req);
262 259
263out: 260out:
264 LEAVE(); 261 lbs_deb_leave_args(LBS_DEB_ASSOC, "ret %d", ret);
265 return ret; 262 return ret;
266} 263}
267 264
@@ -272,7 +269,7 @@ static int assoc_helper_wpa_ie(wlan_private *priv,
272 wlan_adapter *adapter = priv->adapter; 269 wlan_adapter *adapter = priv->adapter;
273 int ret = 0; 270 int ret = 0;
274 271
275 ENTER(); 272 lbs_deb_enter(LBS_DEB_ASSOC);
276 273
277 if (assoc_req->secinfo.WPAenabled || assoc_req->secinfo.WPA2enabled) { 274 if (assoc_req->secinfo.WPAenabled || assoc_req->secinfo.WPA2enabled) {
278 memcpy(&adapter->wpa_ie, &assoc_req->wpa_ie, assoc_req->wpa_ie_len); 275 memcpy(&adapter->wpa_ie, &assoc_req->wpa_ie, assoc_req->wpa_ie_len);
@@ -282,7 +279,7 @@ static int assoc_helper_wpa_ie(wlan_private *priv,
282 adapter->wpa_ie_len = 0; 279 adapter->wpa_ie_len = 0;
283 } 280 }
284 281
285 LEAVE(); 282 lbs_deb_leave_args(LBS_DEB_ASSOC, "ret %d", ret);
286 return ret; 283 return ret;
287} 284}
288 285
@@ -294,21 +291,21 @@ static int should_deauth_infrastructure(wlan_adapter *adapter,
294 return 0; 291 return 0;
295 292
296 if (test_bit(ASSOC_FLAG_SSID, &assoc_req->flags)) { 293 if (test_bit(ASSOC_FLAG_SSID, &assoc_req->flags)) {
297 lbs_pr_debug(1, "Deauthenticating due to new SSID in " 294 lbs_deb_assoc("Deauthenticating due to new SSID in "
298 " configuration request.\n"); 295 " configuration request.\n");
299 return 1; 296 return 1;
300 } 297 }
301 298
302 if (test_bit(ASSOC_FLAG_SECINFO, &assoc_req->flags)) { 299 if (test_bit(ASSOC_FLAG_SECINFO, &assoc_req->flags)) {
303 if (adapter->secinfo.auth_mode != assoc_req->secinfo.auth_mode) { 300 if (adapter->secinfo.auth_mode != assoc_req->secinfo.auth_mode) {
304 lbs_pr_debug(1, "Deauthenticating due to updated security " 301 lbs_deb_assoc("Deauthenticating due to updated security "
305 "info in configuration request.\n"); 302 "info in configuration request.\n");
306 return 1; 303 return 1;
307 } 304 }
308 } 305 }
309 306
310 if (test_bit(ASSOC_FLAG_BSSID, &assoc_req->flags)) { 307 if (test_bit(ASSOC_FLAG_BSSID, &assoc_req->flags)) {
311 lbs_pr_debug(1, "Deauthenticating due to new BSSID in " 308 lbs_deb_assoc("Deauthenticating due to new BSSID in "
312 " configuration request.\n"); 309 " configuration request.\n");
313 return 1; 310 return 1;
314 } 311 }
@@ -353,19 +350,17 @@ void libertas_association_worker(struct work_struct *work)
353 int ret = 0; 350 int ret = 0;
354 int find_any_ssid = 0; 351 int find_any_ssid = 0;
355 352
356 ENTER(); 353 lbs_deb_enter(LBS_DEB_ASSOC);
357 354
358 mutex_lock(&adapter->lock); 355 mutex_lock(&adapter->lock);
359 assoc_req = adapter->assoc_req; 356 assoc_req = adapter->assoc_req;
360 adapter->assoc_req = NULL; 357 adapter->assoc_req = NULL;
361 mutex_unlock(&adapter->lock); 358 mutex_unlock(&adapter->lock);
362 359
363 if (!assoc_req) { 360 if (!assoc_req)
364 LEAVE(); 361 goto done;
365 return;
366 }
367 362
368 lbs_pr_debug(1, "ASSOC: starting new association request: flags = 0x%lX\n", 363 lbs_deb_assoc("ASSOC: starting new association request: flags = 0x%lX\n",
369 assoc_req->flags); 364 assoc_req->flags);
370 365
371 /* If 'any' SSID was specified, find an SSID to associate with */ 366 /* If 'any' SSID was specified, find an SSID to associate with */
@@ -386,7 +381,7 @@ void libertas_association_worker(struct work_struct *work)
386 ret = libertas_find_best_network_SSID(priv, &assoc_req->ssid, 381 ret = libertas_find_best_network_SSID(priv, &assoc_req->ssid,
387 assoc_req->mode, &new_mode); 382 assoc_req->mode, &new_mode);
388 if (ret) { 383 if (ret) {
389 lbs_pr_debug(1, "Could not find best network\n"); 384 lbs_deb_assoc("Could not find best network\n");
390 ret = -ENETUNREACH; 385 ret = -ENETUNREACH;
391 goto out; 386 goto out;
392 } 387 }
@@ -406,7 +401,7 @@ void libertas_association_worker(struct work_struct *work)
406 if (should_deauth_infrastructure(adapter, assoc_req)) { 401 if (should_deauth_infrastructure(adapter, assoc_req)) {
407 ret = libertas_send_deauthentication(priv); 402 ret = libertas_send_deauthentication(priv);
408 if (ret) { 403 if (ret) {
409 lbs_pr_debug(1, "Deauthentication due to new " 404 lbs_deb_assoc("Deauthentication due to new "
410 "configuration request failed: %d\n", 405 "configuration request failed: %d\n",
411 ret); 406 ret);
412 } 407 }
@@ -415,7 +410,7 @@ void libertas_association_worker(struct work_struct *work)
415 if (should_stop_adhoc(adapter, assoc_req)) { 410 if (should_stop_adhoc(adapter, assoc_req)) {
416 ret = libertas_stop_adhoc_network(priv); 411 ret = libertas_stop_adhoc_network(priv);
417 if (ret) { 412 if (ret) {
418 lbs_pr_debug(1, "Teardown of AdHoc network due to " 413 lbs_deb_assoc("Teardown of AdHoc network due to "
419 "new configuration request failed: %d\n", 414 "new configuration request failed: %d\n",
420 ret); 415 ret);
421 } 416 }
@@ -427,7 +422,7 @@ void libertas_association_worker(struct work_struct *work)
427 if (test_bit(ASSOC_FLAG_MODE, &assoc_req->flags)) { 422 if (test_bit(ASSOC_FLAG_MODE, &assoc_req->flags)) {
428 ret = assoc_helper_mode(priv, assoc_req); 423 ret = assoc_helper_mode(priv, assoc_req);
429 if (ret) { 424 if (ret) {
430lbs_pr_debug(1, "ASSOC(:%d) mode: ret = %d\n", __LINE__, ret); 425lbs_deb_assoc("ASSOC(:%d) mode: ret = %d\n", __LINE__, ret);
431 goto out; 426 goto out;
432 } 427 }
433 } 428 }
@@ -436,7 +431,7 @@ lbs_pr_debug(1, "ASSOC(:%d) mode: ret = %d\n", __LINE__, ret);
436 || test_bit(ASSOC_FLAG_WEP_TX_KEYIDX, &assoc_req->flags)) { 431 || test_bit(ASSOC_FLAG_WEP_TX_KEYIDX, &assoc_req->flags)) {
437 ret = assoc_helper_wep_keys(priv, assoc_req); 432 ret = assoc_helper_wep_keys(priv, assoc_req);
438 if (ret) { 433 if (ret) {
439lbs_pr_debug(1, "ASSOC(:%d) wep_keys: ret = %d\n", __LINE__, ret); 434lbs_deb_assoc("ASSOC(:%d) wep_keys: ret = %d\n", __LINE__, ret);
440 goto out; 435 goto out;
441 } 436 }
442 } 437 }
@@ -444,7 +439,7 @@ lbs_pr_debug(1, "ASSOC(:%d) wep_keys: ret = %d\n", __LINE__, ret);
444 if (test_bit(ASSOC_FLAG_SECINFO, &assoc_req->flags)) { 439 if (test_bit(ASSOC_FLAG_SECINFO, &assoc_req->flags)) {
445 ret = assoc_helper_secinfo(priv, assoc_req); 440 ret = assoc_helper_secinfo(priv, assoc_req);
446 if (ret) { 441 if (ret) {
447lbs_pr_debug(1, "ASSOC(:%d) secinfo: ret = %d\n", __LINE__, ret); 442lbs_deb_assoc("ASSOC(:%d) secinfo: ret = %d\n", __LINE__, ret);
448 goto out; 443 goto out;
449 } 444 }
450 } 445 }
@@ -452,7 +447,7 @@ lbs_pr_debug(1, "ASSOC(:%d) secinfo: ret = %d\n", __LINE__, ret);
452 if (test_bit(ASSOC_FLAG_WPA_IE, &assoc_req->flags)) { 447 if (test_bit(ASSOC_FLAG_WPA_IE, &assoc_req->flags)) {
453 ret = assoc_helper_wpa_ie(priv, assoc_req); 448 ret = assoc_helper_wpa_ie(priv, assoc_req);
454 if (ret) { 449 if (ret) {
455lbs_pr_debug(1, "ASSOC(:%d) wpa_ie: ret = %d\n", __LINE__, ret); 450lbs_deb_assoc("ASSOC(:%d) wpa_ie: ret = %d\n", __LINE__, ret);
456 goto out; 451 goto out;
457 } 452 }
458 } 453 }
@@ -461,7 +456,7 @@ lbs_pr_debug(1, "ASSOC(:%d) wpa_ie: ret = %d\n", __LINE__, ret);
461 || test_bit(ASSOC_FLAG_WPA_UCAST_KEY, &assoc_req->flags)) { 456 || test_bit(ASSOC_FLAG_WPA_UCAST_KEY, &assoc_req->flags)) {
462 ret = assoc_helper_wpa_keys(priv, assoc_req); 457 ret = assoc_helper_wpa_keys(priv, assoc_req);
463 if (ret) { 458 if (ret) {
464lbs_pr_debug(1, "ASSOC(:%d) wpa_keys: ret = %d\n", __LINE__, ret); 459lbs_deb_assoc("ASSOC(:%d) wpa_keys: ret = %d\n", __LINE__, ret);
465 goto out; 460 goto out;
466 } 461 }
467 } 462 }
@@ -475,19 +470,19 @@ lbs_pr_debug(1, "ASSOC(:%d) wpa_keys: ret = %d\n", __LINE__, ret);
475 470
476 ret = assoc_helper_associate(priv, assoc_req); 471 ret = assoc_helper_associate(priv, assoc_req);
477 if (ret) { 472 if (ret) {
478 lbs_pr_debug(1, "ASSOC: association attempt unsuccessful: %d\n", 473 lbs_deb_assoc("ASSOC: association attempt unsuccessful: %d\n",
479 ret); 474 ret);
480 success = 0; 475 success = 0;
481 } 476 }
482 477
483 if (adapter->connect_status != libertas_connected) { 478 if (adapter->connect_status != libertas_connected) {
484 lbs_pr_debug(1, "ASSOC: assoication attempt unsuccessful, " 479 lbs_deb_assoc("ASSOC: assoication attempt unsuccessful, "
485 "not connected.\n"); 480 "not connected.\n");
486 success = 0; 481 success = 0;
487 } 482 }
488 483
489 if (success) { 484 if (success) {
490 lbs_pr_debug(1, "ASSOC: association attempt successful. " 485 lbs_deb_assoc("ASSOC: association attempt successful. "
491 "Associated to '%s' (" MAC_FMT ")\n", 486 "Associated to '%s' (" MAC_FMT ")\n",
492 assoc_req->ssid.ssid, MAC_ARG(assoc_req->bssid)); 487 assoc_req->ssid.ssid, MAC_ARG(assoc_req->bssid));
493 libertas_prepare_and_send_command(priv, 488 libertas_prepare_and_send_command(priv,
@@ -505,11 +500,13 @@ lbs_pr_debug(1, "ASSOC(:%d) wpa_keys: ret = %d\n", __LINE__, ret);
505 500
506out: 501out:
507 if (ret) { 502 if (ret) {
508 lbs_pr_debug(1, "ASSOC: reconfiguration attempt unsuccessful: %d\n", 503 lbs_deb_assoc("ASSOC: reconfiguration attempt unsuccessful: %d\n",
509 ret); 504 ret);
510 } 505 }
511 kfree(assoc_req); 506 kfree(assoc_req);
512 LEAVE(); 507
508done:
509 lbs_deb_leave(LBS_DEB_ASSOC);
513} 510}
514 511
515 512