ipw2200: restart adapter only when abort_scan doesn't work
authorZhu Yi <yi.zhu@intel.com>
Tue, 30 Mar 2010 01:36:16 +0000 (09:36 +0800)
committerJohn W. Linville <linville@tuxdriver.com>
Wed, 31 Mar 2010 18:46:40 +0000 (14:46 -0400)
When a scan watchdog is fired, try to send abort scan command
first before restarting the adapter. This avoids reconnection for
some users when scan hang is detected.

This fixed bug https://bugzilla.kernel.org/show_bug.cgi?id=15419

Reported-by: Maurizio Avogadro <mavoga@gmail.com>
Tested-by: Maurizio Avogadro <mavoga@gmail.com>
Signed-off-by: Zhu Yi <yi.zhu@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/ipw2x00/ipw2200.c

index fcdbe8b..7fa2a3e 100644 (file)
@@ -2348,16 +2348,25 @@ static void ipw_bg_adapter_restart(struct work_struct *work)
        mutex_unlock(&priv->mutex);
 }
 
-#define IPW_SCAN_CHECK_WATCHDOG (5 * HZ)
+static void ipw_abort_scan(struct ipw_priv *priv);
+
+#define IPW_SCAN_CHECK_WATCHDOG        (5 * HZ)
 
 static void ipw_scan_check(void *data)
 {
        struct ipw_priv *priv = data;
-       if (priv->status & (STATUS_SCANNING | STATUS_SCAN_ABORTING)) {
+
+       if (priv->status & STATUS_SCAN_ABORTING) {
                IPW_DEBUG_SCAN("Scan completion watchdog resetting "
                               "adapter after (%dms).\n",
                               jiffies_to_msecs(IPW_SCAN_CHECK_WATCHDOG));
                queue_work(priv->workqueue, &priv->adapter_restart);
+       } else if (priv->status & STATUS_SCANNING) {
+               IPW_DEBUG_SCAN("Scan completion watchdog aborting scan "
+                              "after (%dms).\n",
+                              jiffies_to_msecs(IPW_SCAN_CHECK_WATCHDOG));
+               ipw_abort_scan(priv);
+               queue_delayed_work(priv->workqueue, &priv->scan_check, HZ);
        }
 }