can't associate

Marcelo Tosatti marcelo at kvack.org
Sat Feb 17 21:50:40 EST 2007


On Sat, Feb 17, 2007 at 04:14:36PM +0100, Holger Schurig wrote:
> > Can you please enable debugging (CONFIG_LIBERTAS_USB_DEBUG) and save
> > the output somewhere?
> 
> I think the scanning code is buggy.
> 
> I added some debug statements and get this output:
> 
> 16:58:45 usb8xxx: Enter: wlan_scan_create_channel_list:319
> 16:58:45 //HS scantype 0
> 16:58:45 //HS enable11d 0
> 16:58:45 //HS using region_channel 0
> 16:58:45 //HS scanregion->nrcfp 11
>          //HS scanregion->band 0
>          //HS nextchan 0, chanidx 0
>          //HS nextchan 1, chanidx 1
>          //HS nextchan 2, chanidx 2
>          //HS nextchan 3, chanidx 3
>          //HS nextchan 4, chanidx 4
>          //HS nextchan 5, chanidx 5
>          //HS nextchan 6, chanidx 6
>          //HS nextchan 7, chanidx 7
>          //HS nextchan 8, chanidx 8
>          //HS nextchan 9, chanidx 9
>          //HS nextchan 10, chanidx 10
> usb8xxx: Leave: wlan_scan_create_channel_list:397
> 
> So the code creates a list of 11 channels. But later, I see only this:
> 
> 16:58:45 usb8xxx: Enter: wlan_scan_channel_list:669
> 16:58:45 usb8xxx: Scan: Chan(  1), Radio(0), mode(0,1), Dur(100)
> 16:58:45 usb8xxx: Scan: Chan(  2), Radio(0), mode(0,1), Dur(100)
> 16:58:45 usb8xxx: Enter: libertas_prepare_and_send_command:1148
> 
> that are all channels that get scanned.

Holger,

The recent change to scan only two channels on set_scan() is causing
this problem.

Can you please try to associate with the following patch:


diff --git a/drivers/net/wireless/libertas/debugfs.c b/drivers/net/wireless/libertas/debugfs.c
index 2af9709..e03ed50 100644
--- a/drivers/net/wireless/libertas/debugfs.c
+++ b/drivers/net/wireless/libertas/debugfs.c
@@ -386,7 +386,7 @@ static ssize_t libertas_setuserscan(stru
 	libertas_parse_probes(buf, count, scan_cfg);
 	libertas_parse_type(buf, count, scan_cfg);
 
-	wlan_scan_networks(priv, scan_cfg);
+	wlan_scan_networks(priv, scan_cfg, 1);
 	wait_event_interruptible(priv->adapter->cmd_pending, 
 			   	 !priv->adapter->nr_cmd_pending);
 
diff --git a/drivers/net/wireless/libertas/scan.c b/drivers/net/wireless/libertas/scan.c
index 32f6ba1..a6f41e6 100644
--- a/drivers/net/wireless/libertas/scan.c
+++ b/drivers/net/wireless/libertas/scan.c
@@ -640,7 +640,8 @@ static int wlan_scan_channel_list(wlan_p
 				  struct wlan_scan_cmd_config * pscancfgout,
 				  struct mrvlietypes_chanlistparamset * pchantlvout,
 				  struct chanscanparamset * pscanchanlist,
-				  const struct wlan_ioctl_user_scan_cfg * puserscanin)
+				  const struct wlan_ioctl_user_scan_cfg * puserscanin,
+                  int full_scan)
 {
 	struct chanscanparamset *ptmpchan;
 	struct chanscanparamset *pstartchan;
@@ -750,10 +751,11 @@ static int wlan_scan_channel_list(wlan_p
 		/* Send the scan command to the firmware with the specified cfg */
 		ret = libertas_prepare_and_send_command(priv, cmd_802_11_scan, 0,
 					    0, 0, pscancfgout);
-		if (scanned >= 2) {
+		if (scanned >= 2 && full_scan) {
 	    	priv->adapter->last_scanned_channel = ptmpchan->channumber;
 	    	return 0;
 		}
+        scanned = 0;
 
 	}
 
@@ -780,7 +782,8 @@ static int wlan_scan_channel_list(wlan_p
  *  @return              0 or < 0 if error
  */
 int wlan_scan_networks(wlan_private * priv,
-			      const struct wlan_ioctl_user_scan_cfg * puserscanin)
+			      const struct wlan_ioctl_user_scan_cfg * puserscanin,
+                  int full_scan)
 {
 	wlan_adapter *adapter = priv->adapter;
 	struct mrvlietypes_chanlistparamset *pchantlvout;
@@ -840,7 +843,8 @@ int wlan_scan_networks(wlan_private * pr
 				     scan_cfg,
 				     pchantlvout,
 				     scan_chan_list,
-				     puserscanin);
+				     puserscanin,
+                     full_scan);
 
 	/*  Process the resulting scan table:
 	 *    - Remove any bad ssids
@@ -1422,7 +1426,7 @@ int libertas_find_best_network_SSID(wlan
 
 	memset(pSSID, 0, sizeof(struct WLAN_802_11_SSID));
 
-	wlan_scan_networks(priv, NULL);
+	wlan_scan_networks(priv, NULL, 1);
 	if (adapter->surpriseremoved)
 		return -1;
 	wait_event_interruptible(adapter->cmd_pending, !adapter->nr_cmd_pending);
@@ -1465,7 +1469,7 @@ int libertas_set_scan(struct net_device 
 
 	ENTER();
 
-	wlan_scan_networks(priv, NULL);
+	wlan_scan_networks(priv, NULL, 0);
 
 	if (adapter->surpriseremoved)
 		return -1;
@@ -1502,7 +1506,7 @@ int libertas_send_specific_SSID_scan(wla
 	       prequestedssid->ssidlength);
 	scancfg.keeppreviousscan = keeppreviousscan;
 
-	wlan_scan_networks(priv, &scancfg);
+	wlan_scan_networks(priv, &scancfg, 1);
 	if (adapter->surpriseremoved)
 		return -1;
 	wait_event_interruptible(adapter->cmd_pending, !adapter->nr_cmd_pending);
@@ -1534,7 +1538,7 @@ int libertas_send_specific_BSSID_scan(wl
 	memcpy(scancfg.specificBSSID, bssid, sizeof(scancfg.specificBSSID));
 	scancfg.keeppreviousscan = keeppreviousscan;
 
-	wlan_scan_networks(priv, &scancfg);
+	wlan_scan_networks(priv, &scancfg, 1);
 	if (priv->adapter->surpriseremoved)
 		return -1;
 	wait_event_interruptible(priv->adapter->cmd_pending,
@@ -1586,6 +1590,11 @@ #define RSSI_DIFF    ((u8)(PERFECT_RSSI 
     if (adapter->nr_cmd_pending)
 		return -EAGAIN;
 
+    if (adapter->last_scanned_channel) {
+        wlan_scan_networks(priv, NULL, 0);
+        return -EAGAIN;
+    }
+
 	if (adapter->connect_status == libertas_connected)
 		lbs_pr_debug(1, "Current ssid: %32s\n",
 		       adapter->curbssparams.ssid.ssid);
diff --git a/drivers/net/wireless/libertas/scan.h b/drivers/net/wireless/libertas/scan.h
index 4ddcaf3..1144d76 100644
--- a/drivers/net/wireless/libertas/scan.h
+++ b/drivers/net/wireless/libertas/scan.h
@@ -201,7 +201,8 @@ extern int libertas_ret_80211_scan(wlan_
 				struct cmd_ds_command *resp);
 
 int wlan_scan_networks(wlan_private * priv,
-                const struct wlan_ioctl_user_scan_cfg * puserscanin);
+                const struct wlan_ioctl_user_scan_cfg * puserscanin,
+                int full_scan);
 
 struct ifreq;
 




More information about the libertas-dev mailing list