svn commit: r282392 - head/sys/dev/wpi

Adrian Chadd adrian at FreeBSD.org
Sun May 3 23:28:55 UTC 2015


Author: adrian
Date: Sun May  3 23:28:54 2015
New Revision: 282392
URL: https://svnweb.freebsd.org/changeset/base/282392

Log:
  Try to fix passive scanning hang on beacon miss.
  
  PR:		kern/197143
  Submitted by:	Andriy Voskoboinyk <s3erios at gmail.com>

Modified:
  head/sys/dev/wpi/if_wpi.c
  head/sys/dev/wpi/if_wpi_debug.h
  head/sys/dev/wpi/if_wpireg.h

Modified: head/sys/dev/wpi/if_wpi.c
==============================================================================
--- head/sys/dev/wpi/if_wpi.c	Sun May  3 23:27:36 2015	(r282391)
+++ head/sys/dev/wpi/if_wpi.c	Sun May  3 23:28:54 2015	(r282392)
@@ -2135,11 +2135,18 @@ wpi_notif_intr(struct wpi_softc *sc)
 			    __func__, misses, le32toh(miss->total), received,
 			    expected);
 
-			if (vap->iv_state == IEEE80211_S_RUN &&
-			    (ic->ic_flags & IEEE80211_F_SCAN) == 0 &&
-			    (misses >= threshold ||
-			    (received == 0 && expected >= threshold)))
-				ieee80211_beacon_miss(ic);
+			if (misses >= threshold ||
+			    (received == 0 && expected >= threshold)) {
+				WPI_RXON_LOCK(sc);
+				if (callout_pending(&sc->scan_timeout)) {
+					wpi_cmd(sc, WPI_CMD_SCAN_ABORT, NULL,
+					    0, 1);
+				}
+				WPI_RXON_UNLOCK(sc);
+				if (vap->iv_state == IEEE80211_S_RUN &&
+				    (ic->ic_flags & IEEE80211_F_SCAN) == 0)
+					ieee80211_beacon_miss(ic);
+			}
 
 			break;
 		}
@@ -2202,17 +2209,21 @@ wpi_notif_intr(struct wpi_softc *sc)
 		{
 			bus_dmamap_sync(sc->rxq.data_dmat, data->map,
 			    BUS_DMASYNC_POSTREAD);
-#ifdef WPI_DEBUG
+
 			struct wpi_stop_scan *scan =
 			    (struct wpi_stop_scan *)(desc + 1);
+
 			DPRINTF(sc, WPI_DEBUG_SCAN,
 			    "scan finished nchan=%d status=%d chan=%d\n",
 			    scan->nchan, scan->status, scan->chan);
-#endif
+
 			WPI_RXON_LOCK(sc);
 			callout_stop(&sc->scan_timeout);
 			WPI_RXON_UNLOCK(sc);
-			ieee80211_scan_next(vap);
+			if (scan->status == WPI_SCAN_ABORTED)
+				ieee80211_cancel_scan(vap);
+			else
+				ieee80211_scan_next(vap);
 			break;
 		}
 		}

Modified: head/sys/dev/wpi/if_wpi_debug.h
==============================================================================
--- head/sys/dev/wpi/if_wpi_debug.h	Sun May  3 23:27:36 2015	(r282391)
+++ head/sys/dev/wpi/if_wpi_debug.h	Sun May  3 23:28:54 2015	(r282392)
@@ -86,6 +86,7 @@ static const char *wpi_cmd_str(int cmd)
 		WPI_DESC(WPI_CMD_SET_LED);
 		WPI_DESC(WPI_CMD_SET_POWER_MODE);
 		WPI_DESC(WPI_CMD_SCAN);
+		WPI_DESC(WPI_CMD_SCAN_ABORT);
 		WPI_DESC(WPI_CMD_SET_BEACON);
 		WPI_DESC(WPI_CMD_TXPOWER);
 		WPI_DESC(WPI_CMD_BT_COEX);

Modified: head/sys/dev/wpi/if_wpireg.h
==============================================================================
--- head/sys/dev/wpi/if_wpireg.h	Sun May  3 23:27:36 2015	(r282391)
+++ head/sys/dev/wpi/if_wpireg.h	Sun May  3 23:28:54 2015	(r282392)
@@ -352,6 +352,7 @@ struct wpi_tx_cmd {
 #define WPI_CMD_SET_LED		 72
 #define WPI_CMD_SET_POWER_MODE	119
 #define WPI_CMD_SCAN		128
+#define WPI_CMD_SCAN_ABORT	129
 #define WPI_CMD_SET_BEACON	145
 #define WPI_CMD_TXPOWER		151
 #define WPI_CMD_BT_COEX		155
@@ -725,6 +726,9 @@ struct wpi_start_scan {
 struct wpi_stop_scan {
 	uint8_t		nchan;
 	uint8_t		status;
+#define WPI_SCAN_COMPLETED	1
+#define WPI_SCAN_ABORTED	2
+
 	uint8_t		reserved;
 	uint8_t		chan;
 	uint64_t	tsf;


More information about the svn-src-head mailing list