> Date: Fri, 20 May 2016 11:19:26 +0200 > From: Stefan Sperling <s...@stsp.name> > > The new iwm(4) firmware (see [1]) scans 2GHz and 5 GHz bands in one go. > [1] http://marc.info/?l=openbsd-tech&m=146356530605833&w=2 > > Our net80211 stack isn't set up to handle this correctly. > With the new firmware (and diff from [1]), you'll see no scan results > at all if you run: > > ifconfig iwm0 nwid some-nwid-that-doesnt-exist-on-2ghz > ifconfig iwm0 scan > > This happens because the net80211 stack clears scan results from memory > before results are returned to ifconfig, and retries on a different band. > The driver however insists that it is already done scanning everything, > and does nothing (a SCAN->SCAN transition is a no-op in the driver). > So the second scan attempt times out, and ifconfig gets no results. > > This diff adds a 'scan all bands' capability which the driver can advertise > to tell the net80211 layer that it should not retry the scan on a different > band. Setting this flag in the iwm(4) driver then fixes the issue. > > (Note that the comment immediately below refers to a 'next mode' instead of > 'next band' because it dates from a time when a mode implied a band, as in > 11b -> 2GHz and 11a -> 5 GHz. Nowadays, we have 11n mode uses both bands.) > > ok?
The name feels a bit wrong. Perhaps IEEE80211_C_SINGLESCAN? Anyway, doesn't really matter. ok kettenis@ > Index: ieee80211_node.c > =================================================================== > RCS file: /cvs/src/sys/net80211/ieee80211_node.c,v > retrieving revision 1.102 > diff -u -p -r1.102 ieee80211_node.c > --- ieee80211_node.c 18 May 2016 08:15:28 -0000 1.102 > +++ ieee80211_node.c 20 May 2016 09:05:39 -0000 > @@ -581,6 +581,10 @@ ieee80211_end_scan(struct ifnet *ifp) > goto wakeup; > } > #endif > + /* If the device scans all bands at once, we're done. */ > + if (ic->ic_caps & IEEE80211_C_SCANALLBAND) > + goto wakeup; > + > /* > * Scan the next mode if nothing has been found. This > * is necessary if the device supports different > Index: ieee80211_var.h > =================================================================== > RCS file: /cvs/src/sys/net80211/ieee80211_var.h,v > retrieving revision 1.71 > diff -u -p -r1.71 ieee80211_var.h > --- ieee80211_var.h 25 Jan 2016 11:27:11 -0000 1.71 > +++ ieee80211_var.h 20 May 2016 08:56:14 -0000 > @@ -369,6 +369,7 @@ extern struct ieee80211com_head ieee8021 > #define IEEE80211_C_RSN 0x00001000 /* CAPABILITY: RSN > avail */ > #define IEEE80211_C_MFP 0x00002000 /* CAPABILITY: MFP > avail */ > #define IEEE80211_C_RAWCTL 0x00004000 /* CAPABILITY: raw ctl */ > +#define IEEE80211_C_SCANALLBAND 0x00008000 /* CAPABILITY: scan all > bands */ > > /* flags for ieee80211_fix_rate() */ > #define IEEE80211_F_DOSORT 0x00000001 /* sort rate list */ > >