aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/libertas/assoc.c
diff options
context:
space:
mode:
authorHolger Schurig <hs4233@mail.mn-solutions.de>2007-10-15 06:55:56 -0400
committerDavid S. Miller <davem@davemloft.net>2008-01-28 18:04:46 -0500
commit0765af4493193149505f118d04d9300f0a15c8f5 (patch)
treec40ea368363ab9505204d95495418af1f00b693b /drivers/net/wireless/libertas/assoc.c
parent1007832103d016d1563fab71d4cf2b057a0bcceb (diff)
libertas: clean up association debug messages
This makes the debug output of all association stuff clearer by: * adding some lbs_deb_enter()/lbs_deb_leave() calls * printing the return level in one place * lower-casing some string Signed-off-by: Holger Schurig <hs4233@mail.mn-solutions.de> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/libertas/assoc.c')
-rw-r--r--drivers/net/wireless/libertas/assoc.c136
1 files changed, 64 insertions, 72 deletions
diff --git a/drivers/net/wireless/libertas/assoc.c b/drivers/net/wireless/libertas/assoc.c
index e52b1eead288..f634c9496ec2 100644
--- a/drivers/net/wireless/libertas/assoc.c
+++ b/drivers/net/wireless/libertas/assoc.c
@@ -14,29 +14,6 @@
14static const u8 bssid_any[ETH_ALEN] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }; 14static const u8 bssid_any[ETH_ALEN] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF };
15static const u8 bssid_off[ETH_ALEN] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; 15static const u8 bssid_off[ETH_ALEN] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
16 16
17static void print_assoc_req(const char * extra, struct assoc_request * assoc_req)
18{
19 DECLARE_MAC_BUF(mac);
20 lbs_deb_assoc(
21 "#### Association Request: %s\n"
22 " flags: 0x%08lX\n"
23 " SSID: '%s'\n"
24 " channel: %d\n"
25 " band: %d\n"
26 " mode: %d\n"
27 " BSSID: %s\n"
28 " Encryption:%s%s%s\n"
29 " auth: %d\n",
30 extra, assoc_req->flags,
31 escape_essid(assoc_req->ssid, assoc_req->ssid_len),
32 assoc_req->channel, assoc_req->band, assoc_req->mode,
33 print_mac(mac, assoc_req->bssid),
34 assoc_req->secinfo.WPAenabled ? " WPA" : "",
35 assoc_req->secinfo.WPA2enabled ? " WPA2" : "",
36 assoc_req->secinfo.wep_enabled ? " WEP" : "",
37 assoc_req->secinfo.auth_mode);
38}
39
40 17
41static int assoc_helper_essid(lbs_private *priv, 18static int assoc_helper_essid(lbs_private *priv,
42 struct assoc_request * assoc_req) 19 struct assoc_request * assoc_req)
@@ -55,7 +32,7 @@ static int assoc_helper_essid(lbs_private *priv,
55 if (test_bit(ASSOC_FLAG_CHANNEL, &assoc_req->flags)) 32 if (test_bit(ASSOC_FLAG_CHANNEL, &assoc_req->flags))
56 channel = assoc_req->channel; 33 channel = assoc_req->channel;
57 34
58 lbs_deb_assoc("New SSID requested: '%s'\n", 35 lbs_deb_assoc("SSID '%s' requested\n",
59 escape_essid(assoc_req->ssid, assoc_req->ssid_len)); 36 escape_essid(assoc_req->ssid, assoc_req->ssid_len));
60 if (assoc_req->mode == IW_MODE_INFRA) { 37 if (assoc_req->mode == IW_MODE_INFRA) {
61 lbs_send_specific_ssid_scan(priv, assoc_req->ssid, 38 lbs_send_specific_ssid_scan(priv, assoc_req->ssid,
@@ -64,7 +41,6 @@ static int assoc_helper_essid(lbs_private *priv,
64 bss = lbs_find_ssid_in_list(adapter, assoc_req->ssid, 41 bss = lbs_find_ssid_in_list(adapter, assoc_req->ssid,
65 assoc_req->ssid_len, NULL, IW_MODE_INFRA, channel); 42 assoc_req->ssid_len, NULL, IW_MODE_INFRA, channel);
66 if (bss != NULL) { 43 if (bss != NULL) {
67 lbs_deb_assoc("SSID found in scan list, associating\n");
68 memcpy(&assoc_req->bss, bss, sizeof(struct bss_descriptor)); 44 memcpy(&assoc_req->bss, bss, sizeof(struct bss_descriptor));
69 ret = lbs_associate(priv, assoc_req); 45 ret = lbs_associate(priv, assoc_req);
70 } else { 46 } else {
@@ -138,6 +114,8 @@ static int assoc_helper_associate(lbs_private *priv,
138{ 114{
139 int ret = 0, done = 0; 115 int ret = 0, done = 0;
140 116
117 lbs_deb_enter(LBS_DEB_ASSOC);
118
141 /* If we're given and 'any' BSSID, try associating based on SSID */ 119 /* If we're given and 'any' BSSID, try associating based on SSID */
142 120
143 if (test_bit(ASSOC_FLAG_BSSID, &assoc_req->flags)) { 121 if (test_bit(ASSOC_FLAG_BSSID, &assoc_req->flags)) {
@@ -145,19 +123,14 @@ static int assoc_helper_associate(lbs_private *priv,
145 && compare_ether_addr(bssid_off, assoc_req->bssid)) { 123 && compare_ether_addr(bssid_off, assoc_req->bssid)) {
146 ret = assoc_helper_bssid(priv, assoc_req); 124 ret = assoc_helper_bssid(priv, assoc_req);
147 done = 1; 125 done = 1;
148 if (ret) {
149 lbs_deb_assoc("ASSOC: bssid: ret = %d\n", ret);
150 }
151 } 126 }
152 } 127 }
153 128
154 if (!done && test_bit(ASSOC_FLAG_SSID, &assoc_req->flags)) { 129 if (!done && test_bit(ASSOC_FLAG_SSID, &assoc_req->flags)) {
155 ret = assoc_helper_essid(priv, assoc_req); 130 ret = assoc_helper_essid(priv, assoc_req);
156 if (ret) {
157 lbs_deb_assoc("ASSOC: bssid: ret = %d\n", ret);
158 }
159 } 131 }
160 132
133 lbs_deb_leave_args(LBS_DEB_ASSOC, "ret %d", ret);
161 return ret; 134 return ret;
162} 135}
163 136
@@ -194,18 +167,24 @@ done:
194 167
195static int update_channel(lbs_private * priv) 168static int update_channel(lbs_private * priv)
196{ 169{
170 int ret;
197 /* the channel in f/w could be out of sync, get the current channel */ 171 /* the channel in f/w could be out of sync, get the current channel */
198 return lbs_prepare_and_send_command(priv, CMD_802_11_RF_CHANNEL, 172 lbs_deb_enter(LBS_DEB_ASSOC);
173 ret = lbs_prepare_and_send_command(priv, CMD_802_11_RF_CHANNEL,
199 CMD_OPT_802_11_RF_CHANNEL_GET, 174 CMD_OPT_802_11_RF_CHANNEL_GET,
200 CMD_OPTION_WAITFORRSP, 0, NULL); 175 CMD_OPTION_WAITFORRSP, 0, NULL);
176 lbs_deb_leave_args(LBS_DEB_ASSOC, "ret %d", ret);
177 return ret;
201} 178}
202 179
203void lbs_sync_channel(struct work_struct *work) 180void lbs_sync_channel(struct work_struct *work)
204{ 181{
205 lbs_private *priv = container_of(work, lbs_private, sync_channel); 182 lbs_private *priv = container_of(work, lbs_private, sync_channel);
206 183
184 lbs_deb_enter(LBS_DEB_ASSOC);
207 if (update_channel(priv) != 0) 185 if (update_channel(priv) != 0)
208 lbs_pr_info("Channel synchronization failed."); 186 lbs_pr_info("Channel synchronization failed.");
187 lbs_deb_leave(LBS_DEB_ASSOC);
209} 188}
210 189
211static int assoc_helper_channel(lbs_private *priv, 190static int assoc_helper_channel(lbs_private *priv,
@@ -437,40 +416,51 @@ static int assoc_helper_wpa_ie(lbs_private *priv,
437static int should_deauth_infrastructure(lbs_adapter *adapter, 416static int should_deauth_infrastructure(lbs_adapter *adapter,
438 struct assoc_request * assoc_req) 417 struct assoc_request * assoc_req)
439{ 418{
419 int ret = 0;
420
421 lbs_deb_enter(LBS_DEB_ASSOC);
422
440 if (adapter->connect_status != LBS_CONNECTED) 423 if (adapter->connect_status != LBS_CONNECTED)
441 return 0; 424 return 0;
442 425
443 if (test_bit(ASSOC_FLAG_SSID, &assoc_req->flags)) { 426 if (test_bit(ASSOC_FLAG_SSID, &assoc_req->flags)) {
444 lbs_deb_assoc("Deauthenticating due to new SSID in " 427 lbs_deb_assoc("Deauthenticating due to new SSID\n");
445 " configuration request.\n"); 428 ret = 1;
446 return 1; 429 goto out;
447 } 430 }
448 431
449 if (test_bit(ASSOC_FLAG_SECINFO, &assoc_req->flags)) { 432 if (test_bit(ASSOC_FLAG_SECINFO, &assoc_req->flags)) {
450 if (adapter->secinfo.auth_mode != assoc_req->secinfo.auth_mode) { 433 if (adapter->secinfo.auth_mode != assoc_req->secinfo.auth_mode) {
451 lbs_deb_assoc("Deauthenticating due to updated security " 434 lbs_deb_assoc("Deauthenticating due to new security\n");
452 "info in configuration request.\n"); 435 ret = 1;
453 return 1; 436 goto out;
454 } 437 }
455 } 438 }
456 439
457 if (test_bit(ASSOC_FLAG_BSSID, &assoc_req->flags)) { 440 if (test_bit(ASSOC_FLAG_BSSID, &assoc_req->flags)) {
458 lbs_deb_assoc("Deauthenticating due to new BSSID in " 441 lbs_deb_assoc("Deauthenticating due to new BSSID\n");
459 " configuration request.\n"); 442 ret = 1;
460 return 1; 443 goto out;
461 } 444 }
462 445
463 if (test_bit(ASSOC_FLAG_CHANNEL, &assoc_req->flags)) { 446 if (test_bit(ASSOC_FLAG_CHANNEL, &assoc_req->flags)) {
464 lbs_deb_assoc("Deauthenticating due to channel switch.\n"); 447 lbs_deb_assoc("Deauthenticating due to channel switch\n");
465 return 1; 448 ret = 1;
449 goto out;
466 } 450 }
467 451
468 /* FIXME: deal with 'auto' mode somehow */ 452 /* FIXME: deal with 'auto' mode somehow */
469 if (test_bit(ASSOC_FLAG_MODE, &assoc_req->flags)) { 453 if (test_bit(ASSOC_FLAG_MODE, &assoc_req->flags)) {
470 if (assoc_req->mode != IW_MODE_INFRA) 454 if (assoc_req->mode != IW_MODE_INFRA) {
471 return 1; 455 lbs_deb_assoc("Deauthenticating due to leaving "
456 "infra mode\n");
457 ret = 1;
458 goto out;
459 }
472 } 460 }
473 461
462out:
463 lbs_deb_leave_args(LBS_DEB_ASSOC, "ret %d", ret);
474 return 0; 464 return 0;
475} 465}
476 466
@@ -478,6 +468,8 @@ static int should_deauth_infrastructure(lbs_adapter *adapter,
478static int should_stop_adhoc(lbs_adapter *adapter, 468static int should_stop_adhoc(lbs_adapter *adapter,
479 struct assoc_request * assoc_req) 469 struct assoc_request * assoc_req)
480{ 470{
471 lbs_deb_enter(LBS_DEB_ASSOC);
472
481 if (adapter->connect_status != LBS_CONNECTED) 473 if (adapter->connect_status != LBS_CONNECTED)
482 return 0; 474 return 0;
483 475
@@ -497,6 +489,7 @@ static int should_stop_adhoc(lbs_adapter *adapter,
497 return 1; 489 return 1;
498 } 490 }
499 491
492 lbs_deb_leave(LBS_DEB_ASSOC);
500 return 0; 493 return 0;
501} 494}
502 495
@@ -521,7 +514,24 @@ void lbs_association_worker(struct work_struct *work)
521 if (!assoc_req) 514 if (!assoc_req)
522 goto done; 515 goto done;
523 516
524 print_assoc_req(__func__, assoc_req); 517 lbs_deb_assoc(
518 "Association Request:\n"
519 " flags: 0x%08lx\n"
520 " SSID: '%s'\n"
521 " chann: %d\n"
522 " band: %d\n"
523 " mode: %d\n"
524 " BSSID: %s\n"
525 " secinfo: %s%s%s\n"
526 " auth_mode: %d\n",
527 assoc_req->flags,
528 escape_essid(assoc_req->ssid, assoc_req->ssid_len),
529 assoc_req->channel, assoc_req->band, assoc_req->mode,
530 print_mac(mac, assoc_req->bssid),
531 assoc_req->secinfo.WPAenabled ? " WPA" : "",
532 assoc_req->secinfo.WPA2enabled ? " WPA2" : "",
533 assoc_req->secinfo.wep_enabled ? " WEP" : "",
534 assoc_req->secinfo.auth_mode);
525 535
526 /* If 'any' SSID was specified, find an SSID to associate with */ 536 /* If 'any' SSID was specified, find an SSID to associate with */
527 if (test_bit(ASSOC_FLAG_SSID, &assoc_req->flags) 537 if (test_bit(ASSOC_FLAG_SSID, &assoc_req->flags)
@@ -581,58 +591,40 @@ void lbs_association_worker(struct work_struct *work)
581 /* Send the various configuration bits to the firmware */ 591 /* Send the various configuration bits to the firmware */
582 if (test_bit(ASSOC_FLAG_MODE, &assoc_req->flags)) { 592 if (test_bit(ASSOC_FLAG_MODE, &assoc_req->flags)) {
583 ret = assoc_helper_mode(priv, assoc_req); 593 ret = assoc_helper_mode(priv, assoc_req);
584 if (ret) { 594 if (ret)
585 lbs_deb_assoc("ASSOC(:%d) mode: ret = %d\n",
586 __LINE__, ret);
587 goto out; 595 goto out;
588 }
589 } 596 }
590 597
591 if (test_bit(ASSOC_FLAG_CHANNEL, &assoc_req->flags)) { 598 if (test_bit(ASSOC_FLAG_CHANNEL, &assoc_req->flags)) {
592 ret = assoc_helper_channel(priv, assoc_req); 599 ret = assoc_helper_channel(priv, assoc_req);
593 if (ret) { 600 if (ret)
594 lbs_deb_assoc("ASSOC(:%d) channel: ret = %d\n",
595 __LINE__, ret);
596 goto out; 601 goto out;
597 }
598 } 602 }
599 603
600 if ( test_bit(ASSOC_FLAG_WEP_KEYS, &assoc_req->flags) 604 if ( test_bit(ASSOC_FLAG_WEP_KEYS, &assoc_req->flags)
601 || test_bit(ASSOC_FLAG_WEP_TX_KEYIDX, &assoc_req->flags)) { 605 || test_bit(ASSOC_FLAG_WEP_TX_KEYIDX, &assoc_req->flags)) {
602 ret = assoc_helper_wep_keys(priv, assoc_req); 606 ret = assoc_helper_wep_keys(priv, assoc_req);
603 if (ret) { 607 if (ret)
604 lbs_deb_assoc("ASSOC(:%d) wep_keys: ret = %d\n",
605 __LINE__, ret);
606 goto out; 608 goto out;
607 }
608 } 609 }
609 610
610 if (test_bit(ASSOC_FLAG_SECINFO, &assoc_req->flags)) { 611 if (test_bit(ASSOC_FLAG_SECINFO, &assoc_req->flags)) {
611 ret = assoc_helper_secinfo(priv, assoc_req); 612 ret = assoc_helper_secinfo(priv, assoc_req);
612 if (ret) { 613 if (ret)
613 lbs_deb_assoc("ASSOC(:%d) secinfo: ret = %d\n",
614 __LINE__, ret);
615 goto out; 614 goto out;
616 }
617 } 615 }
618 616
619 if (test_bit(ASSOC_FLAG_WPA_IE, &assoc_req->flags)) { 617 if (test_bit(ASSOC_FLAG_WPA_IE, &assoc_req->flags)) {
620 ret = assoc_helper_wpa_ie(priv, assoc_req); 618 ret = assoc_helper_wpa_ie(priv, assoc_req);
621 if (ret) { 619 if (ret)
622 lbs_deb_assoc("ASSOC(:%d) wpa_ie: ret = %d\n",
623 __LINE__, ret);
624 goto out; 620 goto out;
625 }
626 } 621 }
627 622
628 if (test_bit(ASSOC_FLAG_WPA_MCAST_KEY, &assoc_req->flags) 623 if (test_bit(ASSOC_FLAG_WPA_MCAST_KEY, &assoc_req->flags)
629 || test_bit(ASSOC_FLAG_WPA_UCAST_KEY, &assoc_req->flags)) { 624 || test_bit(ASSOC_FLAG_WPA_UCAST_KEY, &assoc_req->flags)) {
630 ret = assoc_helper_wpa_keys(priv, assoc_req); 625 ret = assoc_helper_wpa_keys(priv, assoc_req);
631 if (ret) { 626 if (ret)
632 lbs_deb_assoc("ASSOC(:%d) wpa_keys: ret = %d\n",
633 __LINE__, ret);
634 goto out; 627 goto out;
635 }
636 } 628 }
637 629
638 /* SSID/BSSID should be the _last_ config option set, because they 630 /* SSID/BSSID should be the _last_ config option set, because they
@@ -696,6 +688,7 @@ struct assoc_request *lbs_get_association_request(lbs_adapter *adapter)
696{ 688{
697 struct assoc_request * assoc_req; 689 struct assoc_request * assoc_req;
698 690
691 lbs_deb_enter(LBS_DEB_ASSOC);
699 if (!adapter->pending_assoc_req) { 692 if (!adapter->pending_assoc_req) {
700 adapter->pending_assoc_req = kzalloc(sizeof(struct assoc_request), 693 adapter->pending_assoc_req = kzalloc(sizeof(struct assoc_request),
701 GFP_KERNEL); 694 GFP_KERNEL);
@@ -762,7 +755,6 @@ struct assoc_request *lbs_get_association_request(lbs_adapter *adapter)
762 assoc_req->wpa_ie_len = adapter->wpa_ie_len; 755 assoc_req->wpa_ie_len = adapter->wpa_ie_len;
763 } 756 }
764 757
765 print_assoc_req(__func__, assoc_req); 758 lbs_deb_leave(LBS_DEB_ASSOC);
766
767 return assoc_req; 759 return assoc_req;
768} 760}