[PATCH] libertas: fix scanning from associate path
authorMarcelo Tosatti <mtosatti@redhat.com>
Fri, 25 May 2007 04:33:28 +0000 (00:33 -0400)
committerJohn W. Linville <linville@tuxdriver.com>
Mon, 11 Jun 2007 18:28:37 +0000 (14:28 -0400)
The previous scan fix did not account for scan paths other than set_scan()
that need to do a full scan at once.

Add a "full_scan" parameter to wlan_scan_networks() to control such
behaviour.

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/libertas/debugfs.c
drivers/net/wireless/libertas/scan.c
drivers/net/wireless/libertas/scan.h

index 1f06b0752d06a48e56c19769ca84e955440e0711..d77bec9f5d1570ad4c9a92afed3f4cb2da1a7ddf 100644 (file)
@@ -387,7 +387,7 @@ static ssize_t libertas_setuserscan(struct file *file,
        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);
 
index c9f573716f77a8bbabe92095ccfb2c82f5fc4638..966a89367061ccdf46ff957c641b167683a892ae 100644 (file)
@@ -614,7 +614,8 @@ static int wlan_scan_channel_list(wlan_private * priv,
                                  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;
@@ -723,11 +724,11 @@ static int wlan_scan_channel_list(wlan_private * priv,
                /* 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;
        }
 
        priv->adapter->last_scanned_channel = ptmpchan->channumber;
@@ -753,7 +754,8 @@ static int wlan_scan_channel_list(wlan_private * priv,
  *  @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;
@@ -813,7 +815,8 @@ int wlan_scan_networks(wlan_private * priv,
                                     scan_cfg,
                                     pchantlvout,
                                     scan_chan_list,
-                                    puserscanin);
+                                    puserscanin,
+                                    full_scan);
 
        /*  Process the resulting scan table:
         *    - Remove any bad ssids
@@ -1388,7 +1391,7 @@ int libertas_find_best_network_SSID(wlan_private * priv,
 
        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);
@@ -1431,7 +1434,7 @@ int libertas_set_scan(struct net_device *dev, struct iw_request_info *info,
 
        ENTER();
 
-       wlan_scan_networks(priv, NULL);
+       wlan_scan_networks(priv, NULL, 0);
 
        if (adapter->surpriseremoved)
                return -1;
@@ -1468,7 +1471,7 @@ int libertas_send_specific_SSID_scan(wlan_private * priv,
               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);
@@ -1500,7 +1503,7 @@ int libertas_send_specific_BSSID_scan(wlan_private * priv, u8 * bssid, u8 keeppr
        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,
@@ -1549,8 +1552,13 @@ int libertas_get_scan(struct net_device *dev, struct iw_request_info *info,
         * if there's either commands in the queue or one being
         * processed return -EAGAIN for iwlist to retry later.
         */
-    if (adapter->nr_cmd_pending)
+       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",
index 405f4f0fe575b2164295c6475cc78c1634e76558..26287caaf9b7c5e75e9b1a3f81fcbf256090cb27 100644 (file)
@@ -199,7 +199,8 @@ extern int libertas_ret_80211_scan(wlan_private * priv,
                                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;