From c6fb4e3c5e9d4b5e696205c580386f8ea234fda1 Mon Sep 17 00:00:00 2001 From: stsp Date: Wed, 31 May 2017 09:17:39 +0000 Subject: [PATCH] The net80211 stack was providing a 'beacon miss timeout' value (in ms) which specified 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 mpi@ --- sys/dev/ic/ath.c | 12 ++++-------- sys/dev/pci/if_iwm.c | 5 ++--- sys/net80211/ieee80211.c | 4 ++-- sys/net80211/ieee80211_var.h | 4 ++-- 4 files changed, 10 insertions(+), 15 deletions(-) diff --git a/sys/dev/ic/ath.c b/sys/dev/ic/ath.c index 90f70a1a45d..164d57e310a 100644 --- a/sys/dev/ic/ath.c +++ b/sys/dev/ic/ath.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ath.c,v 1.114 2017/04/11 14:43:49 dhill Exp $ */ +/* $OpenBSD: ath.c,v 1.115 2017/05/31 09:17:39 stsp Exp $ */ /* $NetBSD: ath.c,v 1.37 2004/08/18 21:59:39 dyoung Exp $ */ /*- @@ -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) { diff --git a/sys/dev/pci/if_iwm.c b/sys/dev/pci/if_iwm.c index fc37a560391..8c81e5e1628 100644 --- a/sys/dev/pci/if_iwm.c +++ b/sys/dev/pci/if_iwm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_iwm.c,v 1.186 2017/05/31 08:33:11 stsp Exp $ */ +/* $OpenBSD: if_iwm.c,v 1.187 2017/05/31 09:17:39 stsp Exp $ */ /* * Copyright (c) 2014, 2016 genua gmbh @@ -3542,7 +3542,6 @@ iwm_rx_bmiss(struct iwm_softc *sc, struct iwm_rx_packet *pkt, 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, struct iwm_rx_packet *pkt, 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 diff --git a/sys/net80211/ieee80211.c b/sys/net80211/ieee80211.c index 4daabc68d40..e8506cd8337 100644 --- a/sys/net80211/ieee80211.c +++ b/sys/net80211/ieee80211.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ieee80211.c,v 1.60 2017/05/30 16:21:55 stsp Exp $ */ +/* $OpenBSD: ieee80211.c,v 1.61 2017/05/31 09:17:39 stsp Exp $ */ /* $NetBSD: ieee80211.c,v 1.19 2004/06/06 05:45:29 dyoung Exp $ */ /*- @@ -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); diff --git a/sys/net80211/ieee80211_var.h b/sys/net80211/ieee80211_var.h index 7d6bb1bd85e..4aae6a8355b 100644 --- a/sys/net80211/ieee80211_var.h +++ b/sys/net80211/ieee80211_var.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ieee80211_var.h,v 1.78 2017/05/30 11:00:38 stsp Exp $ */ +/* $OpenBSD: ieee80211_var.h,v 1.79 2017/05/31 09:17:40 stsp Exp $ */ /* $NetBSD: ieee80211_var.h,v 1.7 2004/05/06 03:07:10 dyoung Exp $ */ /*- @@ -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 */ -- 2.20.1