Changeset View
Changeset View
Standalone View
Standalone View
sys/net80211/ieee80211_proto.c
Show First 20 Lines • Show All 2,463 Lines • ▼ Show 20 Lines | wakeupwaiting(struct ieee80211vap *vap0) | ||||
*/ | */ | ||||
TAILQ_FOREACH(vap, &ic->ic_vaps, iv_next) { | TAILQ_FOREACH(vap, &ic->ic_vaps, iv_next) { | ||||
if (vap == vap0) | if (vap == vap0) | ||||
continue; | continue; | ||||
if (vap->iv_flags_ext & IEEE80211_FEXT_SCANWAIT) { | if (vap->iv_flags_ext & IEEE80211_FEXT_SCANWAIT) { | ||||
vap->iv_flags_ext &= ~IEEE80211_FEXT_SCANWAIT; | vap->iv_flags_ext &= ~IEEE80211_FEXT_SCANWAIT; | ||||
/* NB: sta's cannot go INIT->RUN */ | /* NB: sta's cannot go INIT->RUN */ | ||||
/* NB: iv_newstate may drop the lock */ | /* NB: iv_newstate may drop the lock */ | ||||
/* | |||||
* This is problematic if the interface has OACTIVE | |||||
* set. Only the deferred ieee80211_newstate_cb() | |||||
* will end up actually /clearing/ the OACTIVE | |||||
* flag on a state transition to RUN from a non-RUN | |||||
* state. | |||||
* | |||||
* But, we're not actually deferring this callback; | |||||
* and when the deferred call occurs it shows up as | |||||
* a RUN->RUN transition! So the flag isn't/wasn't | |||||
* cleared! | |||||
* | |||||
* I'm also not sure if it's correct to actually | |||||
* do the transitions here fully through the deferred | |||||
* paths either as other things can be invoked as | |||||
* part of that state machine. | |||||
* | |||||
* So just keep this in mind when looking at what | |||||
* the markwaiting/wakeupwaiting routines are doing | |||||
* and how they invoke vap state changes. | |||||
*/ | |||||
vap->iv_newstate(vap, | vap->iv_newstate(vap, | ||||
vap->iv_opmode == IEEE80211_M_STA ? | vap->iv_opmode == IEEE80211_M_STA ? | ||||
IEEE80211_S_SCAN : IEEE80211_S_RUN, 0); | IEEE80211_S_SCAN : IEEE80211_S_RUN, 0); | ||||
IEEE80211_LOCK_ASSERT(ic); | IEEE80211_LOCK_ASSERT(ic); | ||||
} | } | ||||
} | } | ||||
} | } | ||||
▲ Show 20 Lines • Show All 56 Lines • ▼ Show 20 Lines | if (rc != 0) { | ||||
/* State transition failed */ | /* State transition failed */ | ||||
KASSERT(rc != EINPROGRESS, ("iv_newstate was deferred")); | KASSERT(rc != EINPROGRESS, ("iv_newstate was deferred")); | ||||
KASSERT(nstate != IEEE80211_S_INIT, | KASSERT(nstate != IEEE80211_S_INIT, | ||||
("INIT state change failed")); | ("INIT state change failed")); | ||||
IEEE80211_DPRINTF(vap, IEEE80211_MSG_STATE, | IEEE80211_DPRINTF(vap, IEEE80211_MSG_STATE, | ||||
"%s: %s returned error %d\n", __func__, | "%s: %s returned error %d\n", __func__, | ||||
ieee80211_state_name[nstate], rc); | ieee80211_state_name[nstate], rc); | ||||
goto done; | goto done; | ||||
} | |||||
/* | |||||
* Handle the case of a RUN->RUN transition occuring when STA + AP | |||||
* VAPs occur on the same radio. | |||||
* | |||||
* The mark and wakeup waiting routines call iv_newstate() directly, | |||||
* but they do not end up deferring state changes here. | |||||
* Thus, although the VAP newstate method sees a transition | |||||
* of RUN->INIT->RUN, the deferred path here only sees a RUN->RUN | |||||
* transition. If OACTIVE is set then it is never cleared. | |||||
* | |||||
* So, if we're here and the state is RUN, just clear OACTIVE. | |||||
* At some point if the markwaiting/wakeupwaiting paths end up | |||||
* also invoking the deferred state updates then this will | |||||
* be no-op code - and also if OACTIVE is finally retired, it'll | |||||
* also be no-op code. | |||||
*/ | |||||
if (nstate == IEEE80211_S_RUN) { | |||||
/* | |||||
* Unblock the VAP queue; a RUN->RUN state can happen | |||||
* on a STA+AP setup on the AP vap. See wakeupwaiting(). | |||||
*/ | |||||
bz: Why don't you move half of the work from below up here but duplicate it?
And then ta single… | |||||
vap->iv_ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; | |||||
} | } | ||||
/* No actual transition, skip post processing */ | /* No actual transition, skip post processing */ | ||||
if (ostate == nstate) | if (ostate == nstate) | ||||
goto done; | goto done; | ||||
if (nstate == IEEE80211_S_RUN) { | if (nstate == IEEE80211_S_RUN) { | ||||
/* | /* | ||||
▲ Show 20 Lines • Show All 231 Lines • Show Last 20 Lines |
Why don't you move half of the work from below up here but duplicate it?
And then ta single sentence is probably enough to be added that a RUN->RUN transition can also happen on STA + AP VAPs. The remainder of the information is in the proposed commit message already or should probably be there with the remainder of the call-chain. I feel splitting the information over three places will only make it harder to understand later what was going on or why the change was made.