On Tue, Oct 06, 2015 at 11:20:12AM +0200, Stefan Sperling wrote:
> On Tue, Oct 06, 2015 at 10:09:00AM +0200, Martin Pieuchot wrote:
> > On 05/10/15(Mon) 23:03, Stefan Sperling wrote:
> > > I find this approach easier to follow and it doesn't mess with
> > > ic->ic_scan_lock which is supposed to be managed by the net80211 layer.
> > > 
> > > Seems to work just as well as the old code.
> > > 
> > > OK?
> > 
> > Mostly.  I'd argue that iwm_stop() should still reset ic_scan_lock to
> > IEEE80211_SCAN_UNLOCKED and not call ieee80211_end_scan().   This is
> > was other wireless driver currently do and I'd suggest that releasing
> > the scan lock could be move to the stack.  So I wouldn't introduce
> > a difference here.
> 
> What annoys me about this is that nothing will wake processes sleeping
> on the scan lock. They will eventually time out, of course. Still ugly.

So how about this?

Index: if_iwm.c
===================================================================
RCS file: /cvs/src/sys/dev/pci/if_iwm.c,v
retrieving revision 1.57
diff -u -p -r1.57 if_iwm.c
--- if_iwm.c    16 Oct 2015 10:04:56 -0000      1.57
+++ if_iwm.c    16 Oct 2015 10:35:39 -0000
@@ -4621,7 +4621,6 @@ iwm_mvm_scan_request(struct iwm_softc *s
                 * to allocate the time events. Warn on it, but maybe we
                 * should try to send the command again with different params.
                 */
-               sc->sc_scanband = 0;
                ret = EIO;
        }
        return ret;
@@ -5325,7 +5324,9 @@ iwm_newstate_task(void *psc)
                if ((error = iwm_mvm_scan_request(sc, IEEE80211_CHAN_2GHZ,
                    ic->ic_des_esslen != 0,
                    ic->ic_des_essid, ic->ic_des_esslen)) != 0) {
-                       printf("%s: could not initiate scan\n", DEVNAME(sc));
+                       printf("%s: could not initiate 2 GHz scan\n",
+                           DEVNAME(sc));
+                       sc->sc_scanband = 0;
                        return;
                }
                ic->ic_state = nstate;
@@ -5410,7 +5411,8 @@ iwm_endscan_cb(void *arg)
                if ((error = iwm_mvm_scan_request(sc,
                    IEEE80211_CHAN_5GHZ, ic->ic_des_esslen != 0,
                    ic->ic_des_essid, ic->ic_des_esslen)) != 0) {
-                       printf("%s: could not initiate scan\n", DEVNAME(sc));
+                       printf("%s: could not initiate 5 GHz scan\n",
+                           DEVNAME(sc));
                        done = 1;
                }
        } else {
@@ -5418,11 +5420,7 @@ iwm_endscan_cb(void *arg)
        }
 
        if (done) {
-               if (!sc->sc_scanband) {
-                       ic->ic_scan_lock = IEEE80211_SCAN_UNLOCKED;
-               } else {
-                       ieee80211_end_scan(&ic->ic_if);
-               }
+               ieee80211_end_scan(&ic->ic_if);
                sc->sc_scanband = 0;
        }
 }

Reply via email to