diff options
author | Stefan Sperling <stsp@cvs.openbsd.org> | 2019-08-27 14:57:49 +0000 |
---|---|---|
committer | Stefan Sperling <stsp@cvs.openbsd.org> | 2019-08-27 14:57:49 +0000 |
commit | 6da79be75b610f6e0cf8d6e28e8dd29a1e44e289 (patch) | |
tree | 374ee1d67eb580a22b515e8196eb5654a69665a4 /sys/dev/ic | |
parent | ee34e1a523c7af15ad865f5a7490d7f910929ed4 (diff) |
Keep ieee80211_node structures cached across scans, rather than
wiping the entire cache every time a scan is triggered.
This has benefits for userland programs trying to look at scan results,
and for drivers which don't get a full view from hardware on every scan.
Nodes will still be evicted from the cache in one of several ways:
Add a new way of timing out inactive nodes which don't send a beacon
within 10 scan iterations, for client mode only. This should get rid
of stale APs if we're scanning for some time in a changing environment.
If we fail to associate a few times, the corresponding node is removed.
If net80211 transitions back to INIT state (e.g. because of a
user-initiated configuration change) all nodes are removed.
When a background scan starts all nodes will be removed. This could be
revisited later but has been intentionally left as-is for now.
Tested by myself, jmc@, benno@, procter@ on iwm(4), athn(4) and ral(4).
Diffstat (limited to 'sys/dev/ic')
-rw-r--r-- | sys/dev/ic/bwfm.c | 4 | ||||
-rw-r--r-- | sys/dev/ic/pgt.c | 30 |
2 files changed, 13 insertions, 21 deletions
diff --git a/sys/dev/ic/bwfm.c b/sys/dev/ic/bwfm.c index 461f33f2561..7d6f2c5a569 100644 --- a/sys/dev/ic/bwfm.c +++ b/sys/dev/ic/bwfm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bwfm.c,v 1.63 2019/07/05 12:35:16 patrick Exp $ */ +/* $OpenBSD: bwfm.c,v 1.64 2019/08/27 14:57:48 stsp Exp $ */ /* * Copyright (c) 2010-2016 Broadcom Corporation * Copyright (c) 2016,2017 Patrick Wildt <patrick@blueri.se> @@ -2610,7 +2610,7 @@ bwfm_newstate(struct ieee80211com *ic, enum ieee80211_state nstate, int arg) return 0; } ieee80211_set_link_state(ic, LINK_STATE_DOWN); - ieee80211_free_allnodes(ic, 1); + ieee80211_node_cleanup(ic, ic->ic_bss); ic->ic_state = nstate; splx(s); return 0; diff --git a/sys/dev/ic/pgt.c b/sys/dev/ic/pgt.c index 0eb9dc07a0a..f4426464509 100644 --- a/sys/dev/ic/pgt.c +++ b/sys/dev/ic/pgt.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pgt.c,v 1.93 2018/04/28 16:05:56 phessler Exp $ */ +/* $OpenBSD: pgt.c,v 1.94 2019/08/27 14:57:48 stsp Exp $ */ /* * Copyright (c) 2006 Claudio Jeker <claudio@openbsd.org> @@ -170,7 +170,7 @@ void node_mark_active_ap(void *, struct ieee80211_node *); void node_mark_active_adhoc(void *, struct ieee80211_node *); void pgt_watchdog(struct ifnet *); int pgt_init(struct ifnet *); -void pgt_update_hw_from_sw(struct pgt_softc *, int, int); +void pgt_update_hw_from_sw(struct pgt_softc *, int); void pgt_hostap_handle_mlme(struct pgt_softc *, uint32_t, struct pgt_obj_mlme *); void pgt_update_sw_from_hw(struct pgt_softc *, @@ -544,8 +544,7 @@ trying_again: sc->sc_flags &= ~flag; if (ic->ic_if.if_flags & IFF_RUNNING) pgt_update_hw_from_sw(sc, - ic->ic_state != IEEE80211_S_INIT, - ic->ic_opmode != IEEE80211_M_MONITOR); + ic->ic_state != IEEE80211_S_INIT); } ic->ic_if.if_flags &= ~IFF_RUNNING; @@ -2015,7 +2014,7 @@ pgt_media_change(struct ifnet *ifp) error = ieee80211_media_change(ifp); if (error == ENETRESET) { - pgt_update_hw_from_sw(sc, 0, 0); + pgt_update_hw_from_sw(sc, 0); error = 0; } @@ -2367,7 +2366,7 @@ pgt_ioctl(struct ifnet *ifp, u_long cmd, caddr_t req) } if (error == ENETRESET) { - pgt_update_hw_from_sw(sc, 0, 0); + pgt_update_hw_from_sw(sc, 0); error = 0; } splx(s); @@ -2501,8 +2500,7 @@ pgt_init(struct ifnet *ifp) if (!(sc->sc_flags & (SC_DYING | SC_UNINITIALIZED))) pgt_update_hw_from_sw(sc, - ic->ic_state != IEEE80211_S_INIT, - ic->ic_opmode != IEEE80211_M_MONITOR); + ic->ic_state != IEEE80211_S_INIT); ifp->if_flags |= IFF_RUNNING; ifq_clr_oactive(&ifp->if_snd); @@ -2522,7 +2520,7 @@ pgt_init(struct ifnet *ifp) * back to the BSS had before. */ void -pgt_update_hw_from_sw(struct pgt_softc *sc, int keepassoc, int keepnodes) +pgt_update_hw_from_sw(struct pgt_softc *sc, int keepassoc) { struct ieee80211com *ic = &sc->sc_ic; struct arpcom *ac = &ic->ic_ac; @@ -2769,8 +2767,6 @@ badopmode: splx(s); if (success) { - if (shouldbeup && keepnodes) - sc->sc_flags |= SC_NOFREE_ALLNODES; if (shouldbeup) ieee80211_new_state(ic, IEEE80211_S_SCAN, -1); else @@ -2942,11 +2938,7 @@ pgt_newstate(struct ieee80211com *ic, enum ieee80211_state nstate, int arg) case IEEE80211_S_SCAN: ic->ic_if.if_timer = 1; ic->ic_mgt_timer = 0; - if (sc->sc_flags & SC_NOFREE_ALLNODES) - sc->sc_flags &= ~SC_NOFREE_ALLNODES; - else - ieee80211_free_allnodes(ic, 1); - + ieee80211_node_cleanup(ic, ic->ic_bss); ieee80211_set_link_state(ic, LINK_STATE_DOWN); #ifndef IEEE80211_STA_ONLY /* Just use any old channel; we override it anyway. */ @@ -3262,7 +3254,7 @@ pgt_activate(struct device *self, int act) case DVACT_SUSPEND: if (ifp->if_flags & IFF_RUNNING) { pgt_stop(sc, SC_NEEDS_RESET); - pgt_update_hw_from_sw(sc, 0, 0); + pgt_update_hw_from_sw(sc, 0); } if (sc->sc_power != NULL) (*sc->sc_power)(sc, act); @@ -3283,10 +3275,10 @@ pgt_wakeup(struct pgt_softc *sc) (*sc->sc_power)(sc, DVACT_RESUME); pgt_stop(sc, SC_NEEDS_RESET); - pgt_update_hw_from_sw(sc, 0, 0); + pgt_update_hw_from_sw(sc, 0); if (ifp->if_flags & IFF_UP) { pgt_init(ifp); - pgt_update_hw_from_sw(sc, 0, 0); + pgt_update_hw_from_sw(sc, 0); } } |