Author: avos
Date: Mon Mar 21 20:52:09 2016
New Revision: 297164
URL: https://svnweb.freebsd.org/changeset/base/297164

Log:
  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

Modified:
  head/sys/net80211/ieee80211_proto.c
  head/sys/net80211/ieee80211_sta.c

Modified: head/sys/net80211/ieee80211_proto.c
==============================================================================
--- head/sys/net80211/ieee80211_proto.c Mon Mar 21 20:51:35 2016        
(r297163)
+++ head/sys/net80211/ieee80211_proto.c Mon Mar 21 20:52:09 2016        
(r297164)
@@ -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) {

Modified: head/sys/net80211/ieee80211_sta.c
==============================================================================
--- head/sys/net80211/ieee80211_sta.c   Mon Mar 21 20:51:35 2016        
(r297163)
+++ head/sys/net80211/ieee80211_sta.c   Mon Mar 21 20:52:09 2016        
(r297164)
@@ -206,6 +206,24 @@ sta_authretry(struct ieee80211vap *vap, 
        }
 }
 
+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, e
                        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, e
                        goto invalid;
                break;
        case IEEE80211_S_SLEEP:
+               sta_swbmiss_start(vap);
                vap->iv_sta_ps(vap, 1);
                break;
        default:
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to