net80211: enable software beacon miss timer in SLEEP state

Tested with WUSB54GC, STA mode (w/ power saving enabled)

Reviewed by:	adrian
Differential Revision:	https://reviews.freebsd.org/D5545
This commit is contained in:
Andriy Voskoboinyk 2016-03-21 20:52:09 +00:00
parent 44581368a4
commit d8c364fbed
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=297164
2 changed files with 24 additions and 17 deletions

View File

@ -1531,7 +1531,7 @@ beacon_miss(void *arg, int npending)
IEEE80211_LOCK(ic);
TAILQ_FOREACH(vap, &ic->ic_vaps, iv_next) {
/*
* We only pass events through for sta vap's in RUN state;
* We only pass events through for sta vap's in RUN+ state;
* may be too restrictive but for now this saves all the
* handlers duplicating these checks.
*/
@ -1550,7 +1550,7 @@ beacon_swmiss(void *arg, int npending)
struct ieee80211com *ic = vap->iv_ic;
IEEE80211_LOCK(ic);
if (vap->iv_state == IEEE80211_S_RUN) {
if (vap->iv_state >= IEEE80211_S_RUN) {
/* XXX Call multiple times if npending > zero? */
vap->iv_bmiss(vap);
}
@ -1570,8 +1570,7 @@ ieee80211_swbmiss(void *arg)
IEEE80211_LOCK_ASSERT(ic);
/* XXX sleep state? */
KASSERT(vap->iv_state == IEEE80211_S_RUN,
KASSERT(vap->iv_state >= IEEE80211_S_RUN,
("wrong state %d", vap->iv_state));
if (ic->ic_flags & IEEE80211_F_SCAN) {

View File

@ -206,6 +206,24 @@ sta_authretry(struct ieee80211vap *vap, struct ieee80211_node *ni, int reason)
}
}
static void
sta_swbmiss_start(struct ieee80211vap *vap)
{
if (vap->iv_flags_ext & IEEE80211_FEXT_SWBMISS) {
/*
* Start s/w beacon miss timer for devices w/o
* hardware support. We fudge a bit here since
* we're doing this in software.
*/
vap->iv_swbmiss_period = IEEE80211_TU_TO_TICKS(
2 * vap->iv_bmissthreshold * vap->iv_bss->ni_intval);
vap->iv_swbmiss_count = 0;
callout_reset(&vap->iv_swbmiss, vap->iv_swbmiss_period,
ieee80211_swbmiss, vap);
}
}
/*
* IEEE80211_M_STA vap state machine handler.
* This routine handles the main states in the 802.11 protocol.
@ -419,19 +437,8 @@ sta_newstate(struct ieee80211vap *vap, enum ieee80211_state nstate, int arg)
goto invalid;
}
ieee80211_sync_curchan(ic);
if (ostate != IEEE80211_S_RUN &&
(vap->iv_flags_ext & IEEE80211_FEXT_SWBMISS)) {
/*
* Start s/w beacon miss timer for devices w/o
* hardware support. We fudge a bit here since
* we're doing this in software.
*/
vap->iv_swbmiss_period = IEEE80211_TU_TO_TICKS(
2 * vap->iv_bmissthreshold * ni->ni_intval);
vap->iv_swbmiss_count = 0;
callout_reset(&vap->iv_swbmiss, vap->iv_swbmiss_period,
ieee80211_swbmiss, vap);
}
if (ostate != IEEE80211_S_RUN)
sta_swbmiss_start(vap);
/*
* When 802.1x is not in use mark the port authorized
* at this point so traffic can flow.
@ -451,6 +458,7 @@ sta_newstate(struct ieee80211vap *vap, enum ieee80211_state nstate, int arg)
goto invalid;
break;
case IEEE80211_S_SLEEP:
sta_swbmiss_start(vap);
vap->iv_sta_ps(vap, 1);
break;
default: