When I updated iwx to -77 firmware I made a mistake in setting up the new version of the scan command, in the particular case of starting a background scan.
One part of the command says that active scan should be used. "Active scan" means the device will send probe requests containing a desired SSID, soliciting immediate probe responses from APs which announce the desired SSID. This avoids having to wait for the usual periodically transmitted beacons on every scanned channel across the supported 2GHz and 5GHz ranges, and thus saves time during the scan. In another part of the same command we are supposed to tell the device which SSID to scan for. The bug I spotted is that during a background scan we do not set any of the bits which select an SSID from the list of SSIDs the device may scan for (we only ever populate this list with one entry, thus always set the first bit). This patch sets the missing bit in the scan command. The device now seems to be using probe requests during background scans as intended. With iwx0 in debug mode I am now seeing a shorter list of APs in /var/log/messages, which always includes APs for the desired SSID and usually omits any unrelated APs. Roaming between APs seems to work well in my testing and background scans seem to complete faster than before. There is a known fatal firmware error with SYSASSERT 0x20002806 which sometimes triggers during background scans. I cannot tell whether this change fixes that issue because I could never trigger the error reliably. Today it didn't show up at all during my testing even without this fix. But this particular firmware error is likely related. Any additional tests? Ok? diff eb1b93f95d68c8a362dbd50b0d6814511573e654 72a06ec90bd2b911539c1fefdd1ae60a844d884e commit - eb1b93f95d68c8a362dbd50b0d6814511573e654 commit + 72a06ec90bd2b911539c1fefdd1ae60a844d884e blob - 26b002045aafdd90cfdfb10d3edd4ea96030ecbc blob + 7c6e8f9620011e7cf11c41a55fce56af24fccb9d --- sys/dev/pci/if_iwx.c +++ sys/dev/pci/if_iwx.c @@ -425,7 +425,7 @@ void iwx_scan_umac_fill_ch_p_v6(struct iwx_softc *, void iwx_scan_umac_fill_general_p_v10(struct iwx_softc *, struct iwx_scan_general_params_v10 *, uint16_t, int); void iwx_scan_umac_fill_ch_p_v6(struct iwx_softc *, - struct iwx_scan_channel_params_v6 *, uint32_t, int, int); + struct iwx_scan_channel_params_v6 *, uint32_t, int); int iwx_umac_scan_v14(struct iwx_softc *, int); void iwx_mcc_update(struct iwx_softc *, struct iwx_mcc_chub_notif *); uint8_t iwx_ridx2rate(struct ieee80211_rateset *, int); @@ -6855,7 +6855,7 @@ iwx_umac_scan_fill_channels(struct iwx_softc *sc, uint8_t iwx_umac_scan_fill_channels(struct iwx_softc *sc, struct iwx_scan_channel_cfg_umac *chan, size_t chan_nitems, - int n_ssids, int bgscan) + int n_ssids, uint32_t channel_cfg_flags) { struct ieee80211com *ic = &sc->sc_ic; struct ieee80211_channel *c; @@ -6886,8 +6886,8 @@ iwx_umac_scan_fill_channels(struct iwx_softc *sc, chan->v1.iter_count = 1; chan->v1.iter_interval = htole16(0); } - if (n_ssids != 0 && !bgscan) - chan->flags = htole32(1 << 0); /* select SSID 0 */ + + chan->flags = htole32(channel_cfg_flags); chan++; nchan++; } @@ -7128,12 +7128,12 @@ iwx_scan_umac_fill_ch_p_v6(struct iwx_softc *sc, void iwx_scan_umac_fill_ch_p_v6(struct iwx_softc *sc, struct iwx_scan_channel_params_v6 *cp, uint32_t channel_cfg_flags, - int n_ssid, int bgscan) + int n_ssid) { cp->flags = IWX_SCAN_CHANNEL_FLAG_ENABLE_CHAN_ORDER; cp->count = iwx_umac_scan_fill_channels(sc, cp->channel_config, - nitems(cp->channel_config), n_ssid, bgscan); + nitems(cp->channel_config), n_ssid, channel_cfg_flags); cp->n_aps_override[0] = IWX_SCAN_ADWELL_N_APS_GO_FRIENDLY; cp->n_aps_override[1] = IWX_SCAN_ADWELL_N_APS_SOCIAL_CHS; @@ -7188,7 +7188,7 @@ iwx_umac_scan_v14(struct iwx_softc *sc, int bgscan) } iwx_scan_umac_fill_ch_p_v6(sc, &scan_p->channel_params, bitmap_ssid, - n_ssid, bgscan); + n_ssid); hcmd.len[0] = sizeof(*cmd); hcmd.data[0] = (void *)cmd;