aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/libertas/scan.c
diff options
context:
space:
mode:
authorHolger Schurig <hs4233@mail.mn-solutions.de>2007-05-25 11:27:16 -0400
committerJohn W. Linville <linville@tuxdriver.com>2007-06-11 14:28:37 -0400
commit9012b28a407511fb355f6d2176a12d4653489672 (patch)
tree771b0f7adb9dbab5c907981bd4fa3a7f6219587d /drivers/net/wireless/libertas/scan.c
parent46868202b2dd22156460a220553a223f406f4f22 (diff)
[PATCH] libertas: make debug configurable
The debug output of libertas was either not present or it was overwhelming. This patch adds the possibility to specify a bitmask for the area of interest. One should then only get the desired output. 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/scan.c')
-rw-r--r--drivers/net/wireless/libertas/scan.c174
1 files changed, 91 insertions, 83 deletions
diff --git a/drivers/net/wireless/libertas/scan.c b/drivers/net/wireless/libertas/scan.c
index 966a8936706..4e3a7b60a86 100644
--- a/drivers/net/wireless/libertas/scan.c
+++ b/drivers/net/wireless/libertas/scan.c
@@ -86,7 +86,7 @@
86 */ 86 */
87static int is_network_compatible(wlan_adapter * adapter, int index, u8 mode) 87static int is_network_compatible(wlan_adapter * adapter, int index, u8 mode)
88{ 88{
89 ENTER(); 89 lbs_deb_enter(LBS_DEB_ASSOC);
90 90
91 if (adapter->scantable[index].mode == mode) { 91 if (adapter->scantable[index].mode == mode) {
92 if ( !adapter->secinfo.wep_enabled 92 if ( !adapter->secinfo.wep_enabled
@@ -96,15 +96,13 @@ static int is_network_compatible(wlan_adapter * adapter, int index, u8 mode)
96 && adapter->scantable[index].rsn_ie[0] != WPA2_IE 96 && adapter->scantable[index].rsn_ie[0] != WPA2_IE
97 && !adapter->scantable[index].privacy) { 97 && !adapter->scantable[index].privacy) {
98 /* no security */ 98 /* no security */
99 LEAVE(); 99 goto done;
100 return index;
101 } else if ( adapter->secinfo.wep_enabled 100 } else if ( adapter->secinfo.wep_enabled
102 && !adapter->secinfo.WPAenabled 101 && !adapter->secinfo.WPAenabled
103 && !adapter->secinfo.WPA2enabled 102 && !adapter->secinfo.WPA2enabled
104 && adapter->scantable[index].privacy) { 103 && adapter->scantable[index].privacy) {
105 /* static WEP enabled */ 104 /* static WEP enabled */
106 LEAVE(); 105 goto done;
107 return index;
108 } else if ( !adapter->secinfo.wep_enabled 106 } else if ( !adapter->secinfo.wep_enabled
109 && adapter->secinfo.WPAenabled 107 && adapter->secinfo.WPAenabled
110 && !adapter->secinfo.WPA2enabled 108 && !adapter->secinfo.WPA2enabled
@@ -113,7 +111,7 @@ static int is_network_compatible(wlan_adapter * adapter, int index, u8 mode)
113 && adapter->scantable[index].privacy */ 111 && adapter->scantable[index].privacy */
114 ) { 112 ) {
115 /* WPA enabled */ 113 /* WPA enabled */
116 lbs_pr_debug(1, 114 lbs_deb_scan(
117 "is_network_compatible() WPA: index=%d wpa_ie=%#x " 115 "is_network_compatible() WPA: index=%d wpa_ie=%#x "
118 "wpa2_ie=%#x WEP=%s WPA=%s WPA2=%s " 116 "wpa2_ie=%#x WEP=%s WPA=%s WPA2=%s "
119 "privacy=%#x\n", index, 117 "privacy=%#x\n", index,
@@ -123,8 +121,7 @@ static int is_network_compatible(wlan_adapter * adapter, int index, u8 mode)
123 adapter->secinfo.WPAenabled ? "e" : "d", 121 adapter->secinfo.WPAenabled ? "e" : "d",
124 adapter->secinfo.WPA2enabled ? "e" : "d", 122 adapter->secinfo.WPA2enabled ? "e" : "d",
125 adapter->scantable[index].privacy); 123 adapter->scantable[index].privacy);
126 LEAVE(); 124 goto done;
127 return index;
128 } else if ( !adapter->secinfo.wep_enabled 125 } else if ( !adapter->secinfo.wep_enabled
129 && !adapter->secinfo.WPAenabled 126 && !adapter->secinfo.WPAenabled
130 && adapter->secinfo.WPA2enabled 127 && adapter->secinfo.WPA2enabled
@@ -133,7 +130,7 @@ static int is_network_compatible(wlan_adapter * adapter, int index, u8 mode)
133 && adapter->scantable[index].privacy */ 130 && adapter->scantable[index].privacy */
134 ) { 131 ) {
135 /* WPA2 enabled */ 132 /* WPA2 enabled */
136 lbs_pr_debug(1, 133 lbs_deb_scan(
137 "is_network_compatible() WPA2: index=%d wpa_ie=%#x " 134 "is_network_compatible() WPA2: index=%d wpa_ie=%#x "
138 "wpa2_ie=%#x WEP=%s WPA=%s WPA2=%s " 135 "wpa2_ie=%#x WEP=%s WPA=%s WPA2=%s "
139 "privacy=%#x\n", index, 136 "privacy=%#x\n", index,
@@ -143,8 +140,7 @@ static int is_network_compatible(wlan_adapter * adapter, int index, u8 mode)
143 adapter->secinfo.WPAenabled ? "e" : "d", 140 adapter->secinfo.WPAenabled ? "e" : "d",
144 adapter->secinfo.WPA2enabled ? "e" : "d", 141 adapter->secinfo.WPA2enabled ? "e" : "d",
145 adapter->scantable[index].privacy); 142 adapter->scantable[index].privacy);
146 LEAVE(); 143 goto done;
147 return index;
148 } else if ( !adapter->secinfo.wep_enabled 144 } else if ( !adapter->secinfo.wep_enabled
149 && !adapter->secinfo.WPAenabled 145 && !adapter->secinfo.WPAenabled
150 && !adapter->secinfo.WPA2enabled 146 && !adapter->secinfo.WPA2enabled
@@ -152,19 +148,18 @@ static int is_network_compatible(wlan_adapter * adapter, int index, u8 mode)
152 && (adapter->scantable[index].rsn_ie[0] != WPA2_IE) 148 && (adapter->scantable[index].rsn_ie[0] != WPA2_IE)
153 && adapter->scantable[index].privacy) { 149 && adapter->scantable[index].privacy) {
154 /* dynamic WEP enabled */ 150 /* dynamic WEP enabled */
155 lbs_pr_debug(1, 151 lbs_deb_scan(
156 "is_network_compatible() dynamic WEP: index=%d " 152 "is_network_compatible() dynamic WEP: index=%d "
157 "wpa_ie=%#x wpa2_ie=%#x privacy=%#x\n", 153 "wpa_ie=%#x wpa2_ie=%#x privacy=%#x\n",
158 index, 154 index,
159 adapter->scantable[index].wpa_ie[0], 155 adapter->scantable[index].wpa_ie[0],
160 adapter->scantable[index].rsn_ie[0], 156 adapter->scantable[index].rsn_ie[0],
161 adapter->scantable[index].privacy); 157 adapter->scantable[index].privacy);
162 LEAVE(); 158 goto done;
163 return index;
164 } 159 }
165 160
166 /* security doesn't match */ 161 /* security doesn't match */
167 lbs_pr_debug(1, 162 lbs_deb_scan(
168 "is_network_compatible() FAILED: index=%d wpa_ie=%#x " 163 "is_network_compatible() FAILED: index=%d wpa_ie=%#x "
169 "wpa2_ie=%#x WEP=%s WPA=%s WPA2=%s privacy=%#x\n", 164 "wpa2_ie=%#x WEP=%s WPA=%s WPA2=%s privacy=%#x\n",
170 index, 165 index,
@@ -174,13 +169,16 @@ static int is_network_compatible(wlan_adapter * adapter, int index, u8 mode)
174 adapter->secinfo.WPAenabled ? "e" : "d", 169 adapter->secinfo.WPAenabled ? "e" : "d",
175 adapter->secinfo.WPA2enabled ? "e" : "d", 170 adapter->secinfo.WPA2enabled ? "e" : "d",
176 adapter->scantable[index].privacy); 171 adapter->scantable[index].privacy);
177 LEAVE(); 172 index = -ECONNREFUSED;
178 return -ECONNREFUSED; 173 goto done;
179 } 174 }
180 175
181 /* mode doesn't match */ 176 /* mode doesn't match */
182 LEAVE(); 177 index = -ENETUNREACH;
183 return -ENETUNREACH; 178
179done:
180 lbs_deb_leave_args(LBS_DEB_SCAN, "index %d", index);
181 return index;
184} 182}
185 183
186/** 184/**
@@ -246,7 +244,7 @@ static void wlan_scan_process_results(wlan_private * priv)
246 } 244 }
247 245
248 for (i = 0; i < adapter->numinscantable; i++) { 246 for (i = 0; i < adapter->numinscantable; i++) {
249 lbs_pr_debug(1, "Scan:(%02d) %02x:%02x:%02x:%02x:%02x:%02x, " 247 lbs_deb_scan("Scan:(%02d) %02x:%02x:%02x:%02x:%02x:%02x, "
250 "RSSI[%03d], SSID[%s]\n", 248 "RSSI[%03d], SSID[%s]\n",
251 i, 249 i,
252 adapter->scantable[i].macaddress[0], 250 adapter->scantable[i].macaddress[0],
@@ -529,7 +527,7 @@ wlan_scan_setup_scan_config(wlan_private * priv,
529 527
530 if (puserscanin && puserscanin->chanlist[0].channumber) { 528 if (puserscanin && puserscanin->chanlist[0].channumber) {
531 529
532 lbs_pr_debug(1, "Scan: Using supplied channel list\n"); 530 lbs_deb_scan("Scan: Using supplied channel list\n");
533 531
534 for (chanidx = 0; 532 for (chanidx = 0;
535 chanidx < WLAN_IOCTL_USER_SCAN_CHAN_MAX 533 chanidx < WLAN_IOCTL_USER_SCAN_CHAN_MAX
@@ -573,11 +571,11 @@ wlan_scan_setup_scan_config(wlan_private * priv,
573 == 571 ==
574 priv->adapter->curbssparams.channel)) { 572 priv->adapter->curbssparams.channel)) {
575 *pscancurrentonly = 1; 573 *pscancurrentonly = 1;
576 lbs_pr_debug(1, "Scan: Scanning current channel only"); 574 lbs_deb_scan("Scan: Scanning current channel only");
577 } 575 }
578 576
579 } else { 577 } else {
580 lbs_pr_debug(1, "Scan: Creating full region channel list\n"); 578 lbs_deb_scan("Scan: Creating full region channel list\n");
581 wlan_scan_create_channel_list(priv, pscanchanlist, 579 wlan_scan_create_channel_list(priv, pscanchanlist,
582 *pfilteredscan); 580 *pfilteredscan);
583 } 581 }
@@ -626,10 +624,10 @@ static int wlan_scan_channel_list(wlan_private * priv,
626 int scanned = 0; 624 int scanned = 0;
627 union iwreq_data wrqu; 625 union iwreq_data wrqu;
628 626
629 ENTER(); 627 lbs_deb_enter(LBS_DEB_ASSOC);
630 628
631 if (pscancfgout == 0 || pchantlvout == 0 || pscanchanlist == 0) { 629 if (pscancfgout == 0 || pchantlvout == 0 || pscanchanlist == 0) {
632 lbs_pr_debug(1, "Scan: Null detect: %p, %p, %p\n", 630 lbs_deb_scan("Scan: Null detect: %p, %p, %p\n",
633 pscancfgout, pchantlvout, pscanchanlist); 631 pscancfgout, pchantlvout, pscanchanlist);
634 return -1; 632 return -1;
635 } 633 }
@@ -663,7 +661,7 @@ static int wlan_scan_channel_list(wlan_private * priv,
663 while (tlvidx < maxchanperscan && ptmpchan->channumber 661 while (tlvidx < maxchanperscan && ptmpchan->channumber
664 && !doneearly && scanned < 2) { 662 && !doneearly && scanned < 2) {
665 663
666 lbs_pr_debug(1, 664 lbs_deb_scan(
667 "Scan: Chan(%3d), Radio(%d), mode(%d,%d), Dur(%d)\n", 665 "Scan: Chan(%3d), Radio(%d), mode(%d,%d), Dur(%d)\n",
668 ptmpchan->channumber, ptmpchan->radiotype, 666 ptmpchan->channumber, ptmpchan->radiotype,
669 ptmpchan->chanscanmode.passivescan, 667 ptmpchan->chanscanmode.passivescan,
@@ -726,7 +724,8 @@ static int wlan_scan_channel_list(wlan_private * priv,
726 0, 0, pscancfgout); 724 0, 0, pscancfgout);
727 if (scanned >= 2 && !full_scan) { 725 if (scanned >= 2 && !full_scan) {
728 priv->adapter->last_scanned_channel = ptmpchan->channumber; 726 priv->adapter->last_scanned_channel = ptmpchan->channumber;
729 return 0; 727 ret = 0;
728 goto done;
730 } 729 }
731 scanned = 0; 730 scanned = 0;
732 } 731 }
@@ -736,7 +735,8 @@ static int wlan_scan_channel_list(wlan_private * priv,
736 memset(&wrqu, 0, sizeof(union iwreq_data)); 735 memset(&wrqu, 0, sizeof(union iwreq_data));
737 wireless_send_event(priv->wlan_dev.netdev, SIOCGIWSCAN, &wrqu, NULL); 736 wireless_send_event(priv->wlan_dev.netdev, SIOCGIWSCAN, &wrqu, NULL);
738 737
739 LEAVE(); 738done:
739 lbs_deb_leave_args(LBS_DEB_SCAN, "ret %d", ret);
740 return ret; 740 return ret;
741} 741}
742 742
@@ -767,7 +767,7 @@ int wlan_scan_networks(wlan_private * priv,
767 int maxchanperscan; 767 int maxchanperscan;
768 int ret; 768 int ret;
769 769
770 ENTER(); 770 lbs_deb_enter(LBS_DEB_ASSOC);
771 771
772 scan_chan_list = kzalloc(sizeof(struct chanscanparamset) * 772 scan_chan_list = kzalloc(sizeof(struct chanscanparamset) *
773 WLAN_IOCTL_USER_SCAN_CHAN_MAX, GFP_KERNEL); 773 WLAN_IOCTL_USER_SCAN_CHAN_MAX, GFP_KERNEL);
@@ -836,7 +836,7 @@ out:
836 if (scan_chan_list) 836 if (scan_chan_list)
837 kfree(scan_chan_list); 837 kfree(scan_chan_list);
838 838
839 LEAVE(); 839 lbs_deb_leave_args(LBS_DEB_SCAN, "ret %d", ret);
840 return ret; 840 return ret;
841} 841}
842 842
@@ -867,7 +867,7 @@ void wlan_ret_802_11_scan_get_tlv_ptrs(struct mrvlietypes_data * ptlv,
867 tlvbufleft = tlvbufsize; 867 tlvbufleft = tlvbufsize;
868 *ptsftlv = NULL; 868 *ptsftlv = NULL;
869 869
870 lbs_pr_debug(1, "SCAN_RESP: tlvbufsize = %d\n", tlvbufsize); 870 lbs_deb_scan("SCAN_RESP: tlvbufsize = %d\n", tlvbufsize);
871 lbs_dbg_hex("SCAN_RESP: TLV Buf", (u8 *) ptlv, tlvbufsize); 871 lbs_dbg_hex("SCAN_RESP: TLV Buf", (u8 *) ptlv, tlvbufsize);
872 872
873 while (tlvbufleft >= sizeof(struct mrvlietypesheader)) { 873 while (tlvbufleft >= sizeof(struct mrvlietypesheader)) {
@@ -880,7 +880,7 @@ void wlan_ret_802_11_scan_get_tlv_ptrs(struct mrvlietypes_data * ptlv,
880 break; 880 break;
881 881
882 default: 882 default:
883 lbs_pr_debug(1, "SCAN_RESP: Unhandled TLV = %d\n", 883 lbs_deb_scan("SCAN_RESP: Unhandled TLV = %d\n",
884 tlvtype); 884 tlvtype);
885 /* Give up, this seems corrupted */ 885 /* Give up, this seems corrupted */
886 return; 886 return;
@@ -921,13 +921,14 @@ static int InterpretBSSDescriptionWithIE(struct bss_descriptor * pBSSEntry,
921 u16 beaconsize; 921 u16 beaconsize;
922 u8 founddatarateie; 922 u8 founddatarateie;
923 int bytesleftforcurrentbeacon; 923 int bytesleftforcurrentbeacon;
924 int ret;
924 925
925 struct IE_WPA *pIe; 926 struct IE_WPA *pIe;
926 const u8 oui01[4] = { 0x00, 0x50, 0xf2, 0x01 }; 927 const u8 oui01[4] = { 0x00, 0x50, 0xf2, 0x01 };
927 928
928 struct ieeetypes_countryinfoset *pcountryinfo; 929 struct ieeetypes_countryinfoset *pcountryinfo;
929 930
930 ENTER(); 931 lbs_deb_enter(LBS_DEB_ASSOC);
931 932
932 founddatarateie = 0; 933 founddatarateie = 0;
933 ratesize = 0; 934 ratesize = 0;
@@ -959,7 +960,7 @@ static int InterpretBSSDescriptionWithIE(struct bss_descriptor * pBSSEntry,
959 bytesleftforcurrentbeacon = beaconsize; 960 bytesleftforcurrentbeacon = beaconsize;
960 961
961 memcpy(pBSSEntry->macaddress, pcurrentptr, ETH_ALEN); 962 memcpy(pBSSEntry->macaddress, pcurrentptr, ETH_ALEN);
962 lbs_pr_debug(1, "InterpretIE: AP MAC Addr-%x:%x:%x:%x:%x:%x\n", 963 lbs_deb_scan("InterpretIE: AP MAC Addr-%x:%x:%x:%x:%x:%x\n",
963 pBSSEntry->macaddress[0], pBSSEntry->macaddress[1], 964 pBSSEntry->macaddress[0], pBSSEntry->macaddress[1],
964 pBSSEntry->macaddress[2], pBSSEntry->macaddress[3], 965 pBSSEntry->macaddress[2], pBSSEntry->macaddress[3],
965 pBSSEntry->macaddress[4], pBSSEntry->macaddress[5]); 966 pBSSEntry->macaddress[4], pBSSEntry->macaddress[5]);
@@ -968,7 +969,7 @@ static int InterpretBSSDescriptionWithIE(struct bss_descriptor * pBSSEntry,
968 bytesleftforcurrentbeacon -= ETH_ALEN; 969 bytesleftforcurrentbeacon -= ETH_ALEN;
969 970
970 if (bytesleftforcurrentbeacon < 12) { 971 if (bytesleftforcurrentbeacon < 12) {
971 lbs_pr_debug(1, "InterpretIE: Not enough bytes left\n"); 972 lbs_deb_scan("InterpretIE: Not enough bytes left\n");
972 return -1; 973 return -1;
973 } 974 }
974 975
@@ -979,7 +980,7 @@ static int InterpretBSSDescriptionWithIE(struct bss_descriptor * pBSSEntry,
979 980
980 /* RSSI is 1 byte long */ 981 /* RSSI is 1 byte long */
981 pBSSEntry->rssi = le32_to_cpu((long)(*pcurrentptr)); 982 pBSSEntry->rssi = le32_to_cpu((long)(*pcurrentptr));
982 lbs_pr_debug(1, "InterpretIE: RSSI=%02X\n", *pcurrentptr); 983 lbs_deb_scan("InterpretIE: RSSI=%02X\n", *pcurrentptr);
983 pcurrentptr += 1; 984 pcurrentptr += 1;
984 bytesleftforcurrentbeacon -= 1; 985 bytesleftforcurrentbeacon -= 1;
985 986
@@ -997,7 +998,7 @@ static int InterpretBSSDescriptionWithIE(struct bss_descriptor * pBSSEntry,
997 998
998 /* capability information is 2 bytes long */ 999 /* capability information is 2 bytes long */
999 memcpy(&fixedie.capabilities, pcurrentptr, 2); 1000 memcpy(&fixedie.capabilities, pcurrentptr, 2);
1000 lbs_pr_debug(1, "InterpretIE: fixedie.capabilities=0x%X\n", 1001 lbs_deb_scan("InterpretIE: fixedie.capabilities=0x%X\n",
1001 fixedie.capabilities); 1002 fixedie.capabilities);
1002 fixedie.capabilities = le16_to_cpu(fixedie.capabilities); 1003 fixedie.capabilities = le16_to_cpu(fixedie.capabilities);
1003 pcap = (struct ieeetypes_capinfo *) & fixedie.capabilities; 1004 pcap = (struct ieeetypes_capinfo *) & fixedie.capabilities;
@@ -1006,14 +1007,14 @@ static int InterpretBSSDescriptionWithIE(struct bss_descriptor * pBSSEntry,
1006 bytesleftforcurrentbeacon -= 2; 1007 bytesleftforcurrentbeacon -= 2;
1007 1008
1008 /* rest of the current buffer are IE's */ 1009 /* rest of the current buffer are IE's */
1009 lbs_pr_debug(1, "InterpretIE: IElength for this AP = %d\n", 1010 lbs_deb_scan("InterpretIE: IElength for this AP = %d\n",
1010 bytesleftforcurrentbeacon); 1011 bytesleftforcurrentbeacon);
1011 1012
1012 lbs_dbg_hex("InterpretIE: IE info", (u8 *) pcurrentptr, 1013 lbs_dbg_hex("InterpretIE: IE info", (u8 *) pcurrentptr,
1013 bytesleftforcurrentbeacon); 1014 bytesleftforcurrentbeacon);
1014 1015
1015 if (pcap->privacy) { 1016 if (pcap->privacy) {
1016 lbs_pr_debug(1, "InterpretIE: AP WEP enabled\n"); 1017 lbs_deb_scan("InterpretIE: AP WEP enabled\n");
1017 pBSSEntry->privacy = wlan802_11privfilter8021xWEP; 1018 pBSSEntry->privacy = wlan802_11privfilter8021xWEP;
1018 } else { 1019 } else {
1019 pBSSEntry->privacy = wlan802_11privfilteracceptall; 1020 pBSSEntry->privacy = wlan802_11privfilteracceptall;
@@ -1031,7 +1032,7 @@ static int InterpretBSSDescriptionWithIE(struct bss_descriptor * pBSSEntry,
1031 elemlen = *((u8 *) pcurrentptr + 1); 1032 elemlen = *((u8 *) pcurrentptr + 1);
1032 1033
1033 if (bytesleftforcurrentbeacon < elemlen) { 1034 if (bytesleftforcurrentbeacon < elemlen) {
1034 lbs_pr_debug(1, "InterpretIE: error in processing IE, " 1035 lbs_deb_scan("InterpretIE: error in processing IE, "
1035 "bytes left < IE length\n"); 1036 "bytes left < IE length\n");
1036 bytesleftforcurrentbeacon = 0; 1037 bytesleftforcurrentbeacon = 0;
1037 continue; 1038 continue;
@@ -1043,7 +1044,7 @@ static int InterpretBSSDescriptionWithIE(struct bss_descriptor * pBSSEntry,
1043 pBSSEntry->ssid.ssidlength = elemlen; 1044 pBSSEntry->ssid.ssidlength = elemlen;
1044 memcpy(pBSSEntry->ssid.ssid, (pcurrentptr + 2), 1045 memcpy(pBSSEntry->ssid.ssid, (pcurrentptr + 2),
1045 elemlen); 1046 elemlen);
1046 lbs_pr_debug(1, "ssid: %32s", pBSSEntry->ssid.ssid); 1047 lbs_deb_scan("ssid: %32s", pBSSEntry->ssid.ssid);
1047 break; 1048 break;
1048 1049
1049 case SUPPORTED_RATES: 1050 case SUPPORTED_RATES:
@@ -1056,7 +1057,7 @@ static int InterpretBSSDescriptionWithIE(struct bss_descriptor * pBSSEntry,
1056 break; 1057 break;
1057 1058
1058 case EXTRA_IE: 1059 case EXTRA_IE:
1059 lbs_pr_debug(1, "InterpretIE: EXTRA_IE Found!\n"); 1060 lbs_deb_scan("InterpretIE: EXTRA_IE Found!\n");
1060 pBSSEntry->extra_ie = 1; 1061 pBSSEntry->extra_ie = 1;
1061 break; 1062 break;
1062 1063
@@ -1108,12 +1109,12 @@ static int InterpretBSSDescriptionWithIE(struct bss_descriptor * pBSSEntry,
1108 if (pcountryinfo->len < 1109 if (pcountryinfo->len <
1109 sizeof(pcountryinfo->countrycode) 1110 sizeof(pcountryinfo->countrycode)
1110 || pcountryinfo->len > 254) { 1111 || pcountryinfo->len > 254) {
1111 lbs_pr_debug(1, "InterpretIE: 11D- Err " 1112 lbs_deb_scan("InterpretIE: 11D- Err "
1112 "CountryInfo len =%d min=%zd max=254\n", 1113 "CountryInfo len =%d min=%zd max=254\n",
1113 pcountryinfo->len, 1114 pcountryinfo->len,
1114 sizeof(pcountryinfo->countrycode)); 1115 sizeof(pcountryinfo->countrycode));
1115 LEAVE(); 1116 ret = -1;
1116 return -1; 1117 goto done;
1117 } 1118 }
1118 1119
1119 memcpy(&pBSSEntry->countryinfo, 1120 memcpy(&pBSSEntry->countryinfo,
@@ -1188,8 +1189,11 @@ static int InterpretBSSDescriptionWithIE(struct bss_descriptor * pBSSEntry,
1188 bytesleftforcurrentbeacon -= (elemlen + 2); 1189 bytesleftforcurrentbeacon -= (elemlen + 2);
1189 1190
1190 } /* while (bytesleftforcurrentbeacon > 2) */ 1191 } /* while (bytesleftforcurrentbeacon > 2) */
1192 ret = 0;
1191 1193
1192 return 0; 1194done:
1195 lbs_deb_leave_args(LBS_DEB_SCAN, "ret %d", ret);
1196 return ret;
1193} 1197}
1194 1198
1195/** 1199/**
@@ -1228,7 +1232,7 @@ int libertas_find_BSSID_in_list(wlan_adapter * adapter, u8 * bssid, u8 mode)
1228 if (!bssid) 1232 if (!bssid)
1229 return -EFAULT; 1233 return -EFAULT;
1230 1234
1231 lbs_pr_debug(1, "FindBSSID: Num of BSSIDs = %d\n", 1235 lbs_deb_scan("FindBSSID: Num of BSSIDs = %d\n",
1232 adapter->numinscantable); 1236 adapter->numinscantable);
1233 1237
1234 /* Look through the scan table for a compatible match. The ret return 1238 /* Look through the scan table for a compatible match. The ret return
@@ -1272,7 +1276,7 @@ int libertas_find_SSID_in_list(wlan_adapter * adapter,
1272 int i; 1276 int i;
1273 int j; 1277 int j;
1274 1278
1275 lbs_pr_debug(1, "Num of Entries in Table = %d\n", adapter->numinscantable); 1279 lbs_deb_scan("Num of Entries in Table = %d\n", adapter->numinscantable);
1276 1280
1277 for (i = 0; i < adapter->numinscantable; i++) { 1281 for (i = 0; i < adapter->numinscantable; i++) {
1278 if (!libertas_SSID_cmp(&adapter->scantable[i].ssid, ssid) && 1282 if (!libertas_SSID_cmp(&adapter->scantable[i].ssid, ssid) &&
@@ -1337,9 +1341,9 @@ int libertas_find_best_SSID_in_list(wlan_adapter * adapter, u8 mode)
1337 u8 bestrssi = 0; 1341 u8 bestrssi = 0;
1338 int i; 1342 int i;
1339 1343
1340 ENTER(); 1344 lbs_deb_enter(LBS_DEB_ASSOC);
1341 1345
1342 lbs_pr_debug(1, "Num of BSSIDs = %d\n", adapter->numinscantable); 1346 lbs_deb_scan("Num of BSSIDs = %d\n", adapter->numinscantable);
1343 1347
1344 for (i = 0; i < adapter->numinscantable; i++) { 1348 for (i = 0; i < adapter->numinscantable; i++) {
1345 switch (mode) { 1349 switch (mode) {
@@ -1366,7 +1370,7 @@ int libertas_find_best_SSID_in_list(wlan_adapter * adapter, u8 mode)
1366 } 1370 }
1367 } 1371 }
1368 1372
1369 LEAVE(); 1373 lbs_deb_leave_args(LBS_DEB_SCAN, "bestnet %d", bestnet);
1370 return bestnet; 1374 return bestnet;
1371} 1375}
1372 1376
@@ -1387,7 +1391,7 @@ int libertas_find_best_network_SSID(wlan_private * priv,
1387 struct bss_descriptor *preqbssid; 1391 struct bss_descriptor *preqbssid;
1388 int i; 1392 int i;
1389 1393
1390 ENTER(); 1394 lbs_deb_enter(LBS_DEB_ASSOC);
1391 1395
1392 memset(pSSID, 0, sizeof(struct WLAN_802_11_SSID)); 1396 memset(pSSID, 0, sizeof(struct WLAN_802_11_SSID));
1393 1397
@@ -1412,7 +1416,7 @@ int libertas_find_best_network_SSID(wlan_private * priv,
1412 } 1416 }
1413 1417
1414out: 1418out:
1415 LEAVE(); 1419 lbs_deb_leave_args(LBS_DEB_SCAN, "ret %d", ret);
1416 return ret; 1420 return ret;
1417} 1421}
1418 1422
@@ -1432,14 +1436,14 @@ int libertas_set_scan(struct net_device *dev, struct iw_request_info *info,
1432 wlan_private *priv = dev->priv; 1436 wlan_private *priv = dev->priv;
1433 wlan_adapter *adapter = priv->adapter; 1437 wlan_adapter *adapter = priv->adapter;
1434 1438
1435 ENTER(); 1439 lbs_deb_enter(LBS_DEB_SCAN);
1436 1440
1437 wlan_scan_networks(priv, NULL, 0); 1441 wlan_scan_networks(priv, NULL, 0);
1438 1442
1439 if (adapter->surpriseremoved) 1443 if (adapter->surpriseremoved)
1440 return -1; 1444 return -1;
1441 1445
1442 LEAVE(); 1446 lbs_deb_leave(LBS_DEB_SCAN);
1443 return 0; 1447 return 0;
1444} 1448}
1445 1449
@@ -1459,7 +1463,7 @@ int libertas_send_specific_SSID_scan(wlan_private * priv,
1459 wlan_adapter *adapter = priv->adapter; 1463 wlan_adapter *adapter = priv->adapter;
1460 struct wlan_ioctl_user_scan_cfg scancfg; 1464 struct wlan_ioctl_user_scan_cfg scancfg;
1461 1465
1462 ENTER(); 1466 lbs_deb_enter(LBS_DEB_ASSOC);
1463 1467
1464 if (prequestedssid == NULL) { 1468 if (prequestedssid == NULL) {
1465 return -1; 1469 return -1;
@@ -1476,7 +1480,7 @@ int libertas_send_specific_SSID_scan(wlan_private * priv,
1476 return -1; 1480 return -1;
1477 wait_event_interruptible(adapter->cmd_pending, !adapter->nr_cmd_pending); 1481 wait_event_interruptible(adapter->cmd_pending, !adapter->nr_cmd_pending);
1478 1482
1479 LEAVE(); 1483 lbs_deb_leave(LBS_DEB_ASSOC);
1480 return 0; 1484 return 0;
1481} 1485}
1482 1486
@@ -1493,7 +1497,7 @@ int libertas_send_specific_BSSID_scan(wlan_private * priv, u8 * bssid, u8 keeppr
1493{ 1497{
1494 struct wlan_ioctl_user_scan_cfg scancfg; 1498 struct wlan_ioctl_user_scan_cfg scancfg;
1495 1499
1496 ENTER(); 1500 lbs_deb_enter(LBS_DEB_ASSOC);
1497 1501
1498 if (bssid == NULL) { 1502 if (bssid == NULL) {
1499 return -1; 1503 return -1;
@@ -1509,7 +1513,7 @@ int libertas_send_specific_BSSID_scan(wlan_private * priv, u8 * bssid, u8 keeppr
1509 wait_event_interruptible(priv->adapter->cmd_pending, 1513 wait_event_interruptible(priv->adapter->cmd_pending,
1510 !priv->adapter->nr_cmd_pending); 1514 !priv->adapter->nr_cmd_pending);
1511 1515
1512 LEAVE(); 1516 lbs_deb_leave(LBS_DEB_ASSOC);
1513 return 0; 1517 return 0;
1514} 1518}
1515 1519
@@ -1546,7 +1550,7 @@ int libertas_get_scan(struct net_device *dev, struct iw_request_info *info,
1546 u8 buf[16 + 256 * 2]; 1550 u8 buf[16 + 256 * 2];
1547 u8 *ptr; 1551 u8 *ptr;
1548 1552
1549 ENTER(); 1553 lbs_deb_enter(LBS_DEB_ASSOC);
1550 1554
1551 /* 1555 /*
1552 * if there's either commands in the queue or one being 1556 * if there's either commands in the queue or one being
@@ -1561,10 +1565,10 @@ int libertas_get_scan(struct net_device *dev, struct iw_request_info *info,
1561 } 1565 }
1562 1566
1563 if (adapter->connect_status == libertas_connected) 1567 if (adapter->connect_status == libertas_connected)
1564 lbs_pr_debug(1, "Current ssid: %32s\n", 1568 lbs_deb_scan("Current ssid: %32s\n",
1565 adapter->curbssparams.ssid.ssid); 1569 adapter->curbssparams.ssid.ssid);
1566 1570
1567 lbs_pr_debug(1, "Scan: Get: numinscantable = %d\n", 1571 lbs_deb_scan("Scan: Get: numinscantable = %d\n",
1568 adapter->numinscantable); 1572 adapter->numinscantable);
1569 1573
1570 /* The old API using SIOCGIWAPLIST had a hard limit of IW_MAX_AP. 1574 /* The old API using SIOCGIWAPLIST had a hard limit of IW_MAX_AP.
@@ -1574,7 +1578,7 @@ int libertas_get_scan(struct net_device *dev, struct iw_request_info *info,
1574 */ 1578 */
1575 for (i = 0; i < adapter->numinscantable; i++) { 1579 for (i = 0; i < adapter->numinscantable; i++) {
1576 if ((current_ev + MAX_SCAN_CELL_SIZE) >= end_buf) { 1580 if ((current_ev + MAX_SCAN_CELL_SIZE) >= end_buf) {
1577 lbs_pr_debug(1, "i=%d break out: current_ev=%p end_buf=%p " 1581 lbs_deb_scan("i=%d break out: current_ev=%p end_buf=%p "
1578 "MAX_SCAN_CELL_SIZE=%zd\n", 1582 "MAX_SCAN_CELL_SIZE=%zd\n",
1579 i, current_ev, end_buf, MAX_SCAN_CELL_SIZE); 1583 i, current_ev, end_buf, MAX_SCAN_CELL_SIZE);
1580 break; 1584 break;
@@ -1582,13 +1586,13 @@ int libertas_get_scan(struct net_device *dev, struct iw_request_info *info,
1582 1586
1583 pscantable = &adapter->scantable[i]; 1587 pscantable = &adapter->scantable[i];
1584 1588
1585 lbs_pr_debug(1, "i=%d ssid: %32s\n", i, pscantable->ssid.ssid); 1589 lbs_deb_scan("i=%d ssid: %32s\n", i, pscantable->ssid.ssid);
1586 1590
1587 cfp = 1591 cfp =
1588 libertas_find_cfp_by_band_and_channel(adapter, 0, 1592 libertas_find_cfp_by_band_and_channel(adapter, 0,
1589 pscantable->channel); 1593 pscantable->channel);
1590 if (!cfp) { 1594 if (!cfp) {
1591 lbs_pr_debug(1, "Invalid channel number %d\n", 1595 lbs_deb_scan("Invalid channel number %d\n",
1592 pscantable->channel); 1596 pscantable->channel);
1593 continue; 1597 continue;
1594 } 1598 }
@@ -1767,9 +1771,9 @@ int libertas_get_scan(struct net_device *dev, struct iw_request_info *info,
1767 ptr += sprintf(ptr, "extra_ie"); 1771 ptr += sprintf(ptr, "extra_ie");
1768 iwe.u.data.length = strlen(buf); 1772 iwe.u.data.length = strlen(buf);
1769 1773
1770 lbs_pr_debug(1, "iwe.u.data.length %d\n", 1774 lbs_deb_scan("iwe.u.data.length %d\n",
1771 iwe.u.data.length); 1775 iwe.u.data.length);
1772 lbs_pr_debug(1, "BUF: %s \n", buf); 1776 lbs_deb_scan("BUF: %s \n", buf);
1773 1777
1774 iwe.cmd = IWEVCUSTOM; 1778 iwe.cmd = IWEVCUSTOM;
1775 iwe.len = IW_EV_POINT_LEN + iwe.u.data.length; 1779 iwe.len = IW_EV_POINT_LEN + iwe.u.data.length;
@@ -1790,7 +1794,7 @@ int libertas_get_scan(struct net_device *dev, struct iw_request_info *info,
1790 dwrq->length = (current_ev - extra); 1794 dwrq->length = (current_ev - extra);
1791 dwrq->flags = 0; 1795 dwrq->flags = 0;
1792 1796
1793 LEAVE(); 1797 lbs_deb_leave(LBS_DEB_ASSOC);
1794 return 0; 1798 return 0;
1795} 1799}
1796 1800
@@ -1820,7 +1824,7 @@ int libertas_cmd_80211_scan(wlan_private * priv,
1820 struct cmd_ds_802_11_scan *pscan = &cmd->params.scan; 1824 struct cmd_ds_802_11_scan *pscan = &cmd->params.scan;
1821 struct wlan_scan_cmd_config *pscancfg; 1825 struct wlan_scan_cmd_config *pscancfg;
1822 1826
1823 ENTER(); 1827 lbs_deb_enter(LBS_DEB_ASSOC);
1824 1828
1825 pscancfg = pdata_buf; 1829 pscancfg = pdata_buf;
1826 1830
@@ -1836,9 +1840,10 @@ int libertas_cmd_80211_scan(wlan_private * priv,
1836 + sizeof(pscan->BSSID) 1840 + sizeof(pscan->BSSID)
1837 + pscancfg->tlvbufferlen + S_DS_GEN); 1841 + pscancfg->tlvbufferlen + S_DS_GEN);
1838 1842
1839 lbs_pr_debug(1, "SCAN_CMD: command=%x, size=%x, seqnum=%x\n", 1843 lbs_deb_scan("SCAN_CMD: command=%x, size=%x, seqnum=%x\n",
1840 cmd->command, cmd->size, cmd->seqnum); 1844 cmd->command, cmd->size, cmd->seqnum);
1841 LEAVE(); 1845
1846 lbs_deb_leave(LBS_DEB_ASSOC);
1842 return 0; 1847 return 0;
1843} 1848}
1844 1849
@@ -1881,24 +1886,25 @@ int libertas_ret_80211_scan(wlan_private * priv, struct cmd_ds_command *resp)
1881 int idx; 1886 int idx;
1882 int tlvbufsize; 1887 int tlvbufsize;
1883 u64 tsfval; 1888 u64 tsfval;
1889 int ret;
1884 1890
1885 ENTER(); 1891 lbs_deb_enter(LBS_DEB_ASSOC);
1886 1892
1887 pscan = &resp->params.scanresp; 1893 pscan = &resp->params.scanresp;
1888 1894
1889 if (pscan->nr_sets > MRVDRV_MAX_BSSID_LIST) { 1895 if (pscan->nr_sets > MRVDRV_MAX_BSSID_LIST) {
1890 lbs_pr_debug(1, 1896 lbs_deb_scan(
1891 "SCAN_RESP: Invalid number of AP returned (%d)!!\n", 1897 "SCAN_RESP: Invalid number of AP returned (%d)!!\n",
1892 pscan->nr_sets); 1898 pscan->nr_sets);
1893 LEAVE(); 1899 ret = -1;
1894 return -1; 1900 goto done;
1895 } 1901 }
1896 1902
1897 bytesleft = le16_to_cpu(pscan->bssdescriptsize); 1903 bytesleft = le16_to_cpu(pscan->bssdescriptsize);
1898 lbs_pr_debug(1, "SCAN_RESP: bssdescriptsize %d\n", bytesleft); 1904 lbs_deb_scan("SCAN_RESP: bssdescriptsize %d\n", bytesleft);
1899 1905
1900 scanrespsize = le16_to_cpu(resp->size); 1906 scanrespsize = le16_to_cpu(resp->size);
1901 lbs_pr_debug(1, "SCAN_RESP: returned %d AP before parsing\n", 1907 lbs_deb_scan("SCAN_RESP: returned %d AP before parsing\n",
1902 pscan->nr_sets); 1908 pscan->nr_sets);
1903 1909
1904 numintable = adapter->numinscantable; 1910 numintable = adapter->numinscantable;
@@ -1935,7 +1941,7 @@ int libertas_ret_80211_scan(wlan_private * priv, struct cmd_ds_command *resp)
1935 0) 1941 0)
1936 && CHECK_SSID_IS_VALID(&newbssentry.ssid)) { 1942 && CHECK_SSID_IS_VALID(&newbssentry.ssid)) {
1937 1943
1938 lbs_pr_debug(1, 1944 lbs_deb_scan(
1939 "SCAN_RESP: BSSID = %02x:%02x:%02x:%02x:%02x:%02x\n", 1945 "SCAN_RESP: BSSID = %02x:%02x:%02x:%02x:%02x:%02x\n",
1940 newbssentry.macaddress[0], 1946 newbssentry.macaddress[0],
1941 newbssentry.macaddress[1], 1947 newbssentry.macaddress[1],
@@ -1968,7 +1974,7 @@ int libertas_ret_80211_scan(wlan_private * priv, struct cmd_ds_command *resp)
1968 ssid, 1974 ssid,
1969 newbssentry.ssid.ssidlength) == 1975 newbssentry.ssid.ssidlength) ==
1970 0)) { 1976 0)) {
1971 lbs_pr_debug(1, 1977 lbs_deb_scan(
1972 "SCAN_RESP: Duplicate of index: %d\n", 1978 "SCAN_RESP: Duplicate of index: %d\n",
1973 bssIdx); 1979 bssIdx);
1974 break; 1980 break;
@@ -2012,18 +2018,20 @@ int libertas_ret_80211_scan(wlan_private * priv, struct cmd_ds_command *resp)
2012 } else { 2018 } else {
2013 2019
2014 /* error parsing/interpreting the scan response, skipped */ 2020 /* error parsing/interpreting the scan response, skipped */
2015 lbs_pr_debug(1, "SCAN_RESP: " 2021 lbs_deb_scan("SCAN_RESP: "
2016 "InterpretBSSDescriptionWithIE returned ERROR\n"); 2022 "InterpretBSSDescriptionWithIE returned ERROR\n");
2017 } 2023 }
2018 } 2024 }
2019 2025
2020 lbs_pr_debug(1, "SCAN_RESP: Scanned %2d APs, %d valid, %d total\n", 2026 lbs_deb_scan("SCAN_RESP: Scanned %2d APs, %d valid, %d total\n",
2021 pscan->nr_sets, numintable - adapter->numinscantable, 2027 pscan->nr_sets, numintable - adapter->numinscantable,
2022 numintable); 2028 numintable);
2023 2029
2024 /* Update the total number of BSSIDs in the scan table */ 2030 /* Update the total number of BSSIDs in the scan table */
2025 adapter->numinscantable = numintable; 2031 adapter->numinscantable = numintable;
2032 ret = 0;
2026 2033
2027 LEAVE(); 2034done:
2028 return 0; 2035 lbs_deb_leave_args(LBS_DEB_SCAN, "ret %d", ret);
2036 return ret;
2029} 2037}