From: stsp Date: Sat, 26 Aug 2023 09:05:34 +0000 (+0000) Subject: fix iwx scan command such that the driver selects an SSID during bgscan X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=dd37084bb9bbc1cb63137a98072e149306cc2e2a;p=openbsd fix iwx scan command such that the driver selects an SSID during bgscan The driver was asking firmware to send probe requests during background scans without having any SSID selected, which doesn't make sense. With that fixed I see faster background scans that no longer display every AP in range in debug logs, while relevant APs always show up. This is a possible fix for fatal firmware error 0x20002806 which is known to be related to bad scan commands and appeared with our upgrade to the -77 firmware API. Not yet confirmed because it is difficult to trigger this error on purpose. Apparently this change also repairs stability issues on AX210. I have never seen such issues first-hand and have no clue how they might relate to this change. One plausible theory is that our bogus bgscan command would trigger bad side-effects in firmware. Tested: ax200: jmc@, stsp@ ax210: Laurence Tratt, sf@ --- diff --git a/sys/dev/pci/if_iwx.c b/sys/dev/pci/if_iwx.c index 26b002045aa..01bf04f48a0 100644 --- a/sys/dev/pci/if_iwx.c +++ b/sys/dev/pci/if_iwx.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_iwx.c,v 1.175 2023/07/05 15:07:28 stsp Exp $ */ +/* $OpenBSD: if_iwx.c,v 1.176 2023/08/26 09:05:34 stsp Exp $ */ /* * Copyright (c) 2014, 2016 genua gmbh @@ -425,7 +425,7 @@ void iwx_scan_umac_dwell_v10(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_rm_sta(struct iwx_softc *sc, struct iwx_node *in) 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_general_p_v10(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;