Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F170860409
D7342.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
3 KB
Referenced Files
None
Subscribers
None
D7342.diff
View Options
Index: sys/dev/iwm/if_iwm.c
===================================================================
--- sys/dev/iwm/if_iwm.c
+++ sys/dev/iwm/if_iwm.c
@@ -4694,6 +4694,7 @@
iwm_led_blink_stop(sc);
sc->sc_tx_timer = 0;
iwm_stop_device(sc);
+ sc->sc_flags &= ~IWM_FLAG_SCAN_RUNNING;
}
static void
@@ -5240,13 +5241,17 @@
case IWM_SCAN_OFFLOAD_COMPLETE: {
struct iwm_periodic_scan_complete *notif;
SYNC_RESP_STRUCT(notif, pkt);
+
+ if (sc->sc_flags & IWM_FLAG_SCAN_RUNNING) {
+ sc->sc_flags &= ~IWM_FLAG_SCAN_RUNNING;
+ ieee80211_runtask(&sc->sc_ic, &sc->sc_es_task);
+ }
break;
}
case IWM_SCAN_ITERATION_COMPLETE: {
struct iwm_lmac_scan_complete_notif *notif;
SYNC_RESP_STRUCT(notif, pkt);
- ieee80211_runtask(&sc->sc_ic, &sc->sc_es_task);
break;
}
@@ -5257,9 +5262,11 @@
IWM_DPRINTF(sc, IWM_DEBUG_SCAN,
"UMAC scan complete, status=0x%x\n",
notif->status);
-#if 0 /* XXX This would be a duplicate scan end call */
- taskqueue_enqueue(sc->sc_tq, &sc->sc_es_task);
-#endif
+
+ if (sc->sc_flags & IWM_FLAG_SCAN_RUNNING) {
+ sc->sc_flags &= ~IWM_FLAG_SCAN_RUNNING;
+ ieee80211_runtask(&sc->sc_ic, &sc->sc_es_task);
+ }
break;
}
@@ -5270,7 +5277,6 @@
IWM_DPRINTF(sc, IWM_DEBUG_SCAN, "UMAC scan iteration "
"complete, status=0x%x, %d channels scanned\n",
notif->status, notif->scanned_channels);
- ieee80211_runtask(&sc->sc_ic, &sc->sc_es_task);
break;
}
@@ -6012,15 +6018,21 @@
int error;
IWM_LOCK(sc);
+ if (sc->sc_flags & IWM_FLAG_SCAN_RUNNING) {
+ /* This should not be possible */
+ device_printf(sc->sc_dev,
+ "%s: Previous scan not completed yet\n", __func__);
+ }
if (isset(sc->sc_enabled_capa, IWM_UCODE_TLV_CAPA_UMAC_SCAN))
error = iwm_mvm_umac_scan(sc);
else
error = iwm_mvm_lmac_scan(sc);
if (error != 0) {
- device_printf(sc->sc_dev, "could not initiate 2 GHz scan\n");
+ device_printf(sc->sc_dev, "could not initiate scan\n");
IWM_UNLOCK(sc);
ieee80211_cancel_scan(vap);
} else {
+ sc->sc_flags |= IWM_FLAG_SCAN_RUNNING;
iwm_led_blink_start(sc);
IWM_UNLOCK(sc);
}
@@ -6036,7 +6048,23 @@
iwm_led_blink_stop(sc);
if (vap->iv_state == IEEE80211_S_RUN)
iwm_mvm_led_enable(sc);
+ if (sc->sc_flags & IWM_FLAG_SCAN_RUNNING) {
+ /*
+ * Removing IWM_FLAG_SCAN_RUNNING now, is fine because
+ * both iwm_scan_end and iwm_scan_start run in the ic->ic_tq
+ * taskqueue.
+ */
+ sc->sc_flags &= ~IWM_FLAG_SCAN_RUNNING;
+ iwm_mvm_scan_stop_wait(sc);
+ }
IWM_UNLOCK(sc);
+
+ /*
+ * Make sure we don't race, if sc_es_task is still enqueued here.
+ * This is to make sure that it won't call ieee80211_scan_done
+ * when we have already started the next scan.
+ */
+ taskqueue_cancel(ic->ic_tq, &sc->sc_es_task, NULL);
}
static void
Index: sys/dev/iwm/if_iwmvar.h
===================================================================
--- sys/dev/iwm/if_iwmvar.h
+++ sys/dev/iwm/if_iwmvar.h
@@ -410,6 +410,7 @@
#define IWM_FLAG_RFKILL (1 << 3)
#define IWM_FLAG_BUSY (1 << 4)
#define IWM_FLAG_SCANNING (1 << 5)
+#define IWM_FLAG_SCAN_RUNNING (1 << 6)
struct intr_config_hook sc_preinit_hook;
struct callout sc_watchdog_to;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Sep 8, 2:36 AM (22 h, 54 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
38498213
Default Alt Text
D7342.diff (3 KB)
Attached To
Mode
D7342: [iwm] Use iwm_mvm_scan_stop_wait to properly abort scans.
Attached
Detach File
Event Timeline
Log In to Comment