> Date: Wed, 31 May 2017 10:51:43 +0200
> From: Stefan Sperling <[email protected]>
> 
> The net80211 stack currently provides a 'beacon miss timeout' value (in ms)
> which specifies how much time may elapse without beacons before drivers
> begin searching for a new AP.
> 
> Drivers convert this timeout value into the amount of beacons they're allowed
> to miss. Having the stack provide this number upfront simplifies things.
> 
> ok?

Is the beacon interval always the same for all modes/hardware?

> Index: dev/ic/ath.c
> ===================================================================
> RCS file: /cvs/src/sys/dev/ic/ath.c,v
> retrieving revision 1.114
> diff -u -p -r1.114 ath.c
> --- dev/ic/ath.c      11 Apr 2017 14:43:49 -0000      1.114
> +++ dev/ic/ath.c      31 May 2017 08:35:14 -0000
> @@ -1417,7 +1417,6 @@ ath_beacon_config(struct ath_softc *sc)
>           __func__, ni->ni_intval, nexttbtt));
>       if (ic->ic_opmode == IEEE80211_M_STA) {
>               HAL_BEACON_STATE bs;
> -             u_int32_t bmisstime;
>  
>               /* NB: no PCF support right now */
>               bzero(&bs, sizeof(bs));
> @@ -1427,13 +1426,10 @@ ath_beacon_config(struct ath_softc *sc)
>               bs.bs_nextdtim = nexttbtt;
>               /*
>                * Calculate the number of consecutive beacons to miss
> -              * before taking a BMISS interrupt.  The configuration
> -              * is specified in ms, so we need to convert that to
> -              * TU's and then calculate based on the beacon interval.
> -              * Note that we clamp the result to at most 10 beacons.
> +              * before taking a BMISS interrupt. 
> +              * Note that we clamp the result to at most 7 beacons.
>                */
> -             bmisstime = MAX(7, ic->ic_bmisstimeout);
> -             bs.bs_bmissthreshold = howmany(bmisstime, intval);
> +             bs.bs_bmissthreshold = ic->ic_bmissthres;
>               if (bs.bs_bmissthreshold > 7) {
>                       bs.bs_bmissthreshold = 7;
>               } else if (bs.bs_bmissthreshold <= 0) {
> Index: dev/pci/if_iwm.c
> ===================================================================
> RCS file: /cvs/src/sys/dev/pci/if_iwm.c,v
> retrieving revision 1.186
> diff -u -p -r1.186 if_iwm.c
> --- dev/pci/if_iwm.c  31 May 2017 08:33:11 -0000      1.186
> +++ dev/pci/if_iwm.c  31 May 2017 08:50:13 -0000
> @@ -3542,7 +3542,6 @@ iwm_rx_bmiss(struct iwm_softc *sc, struc
>      struct iwm_rx_data *data)
>  {
>       struct ieee80211com *ic = &sc->sc_ic;
> -     int bmiss_threshold = ic->ic_bmisstimeout / ic->ic_lintval;
>       struct iwm_missed_beacons_notif *mbn = (void *)pkt->data;
>  
>       if ((ic->ic_opmode != IEEE80211_M_STA) ||
> @@ -3552,7 +3551,7 @@ iwm_rx_bmiss(struct iwm_softc *sc, struc
>       bus_dmamap_sync(sc->sc_dmat, data->map, sizeof(*pkt),
>           sizeof(*mbn), BUS_DMASYNC_POSTREAD);
>  
> -     if (mbn->consec_missed_beacons_since_last_rx > bmiss_threshold) {
> +     if (mbn->consec_missed_beacons_since_last_rx > ic->ic_bmissthres) {
>               /*
>                * Rather than go directly to scan state, try to send a
>                * directed probe request first. If that fails then the
> Index: net80211/ieee80211.c
> ===================================================================
> RCS file: /cvs/src/sys/net80211/ieee80211.c,v
> retrieving revision 1.60
> diff -u -p -r1.60 ieee80211.c
> --- net80211/ieee80211.c      30 May 2017 16:21:55 -0000      1.60
> +++ net80211/ieee80211.c      31 May 2017 08:35:05 -0000
> @@ -147,7 +147,7 @@ ieee80211_ifattach(struct ifnet *ifp)
>  
>       if (ic->ic_lintval == 0)
>               ic->ic_lintval = 100;           /* default sleep */
> -     ic->ic_bmisstimeout = 7*ic->ic_lintval; /* default 7 beacons */
> +     ic->ic_bmissthres = 7;  /* default 7 beacons */
>       ic->ic_dtim_period = 1; /* all TIMs are DTIMs */
>  
>       LIST_INSERT_HEAD(&ieee80211com_head, ic, ic_list);
> Index: net80211/ieee80211_var.h
> ===================================================================
> RCS file: /cvs/src/sys/net80211/ieee80211_var.h,v
> retrieving revision 1.78
> diff -u -p -r1.78 ieee80211_var.h
> --- net80211/ieee80211_var.h  30 May 2017 11:00:38 -0000      1.78
> +++ net80211/ieee80211_var.h  31 May 2017 08:34:47 -0000
> @@ -262,7 +262,7 @@ struct ieee80211com {
>       int                     ic_max_nnodes;  /* max length of ic_nnodes */
>       u_int16_t               ic_lintval;     /* listen interval */
>       int16_t                 ic_txpower;     /* tx power setting (dBm) */
> -     u_int16_t               ic_bmisstimeout;/* beacon miss threshold (ms) */
> +     int                     ic_bmissthres;  /* beacon miss threshold */
>       int                     ic_mgt_timer;   /* mgmt timeout */
>  #ifndef IEEE80211_STA_ONLY
>       struct timeout          ic_inact_timeout; /* node inactivity timeout */
> 
> 

Reply via email to