1 Improve the beacon miss handling. Instead of just dropping the connection,
2 send a directed probe request to the AP to see if it's still responding.
3 Schedule a software beacon miss timer in this case, which adds a timeout
4 for the APs probe response.
6 Signed-off-by: Felix Fietkau <nbd@openwrt.org>
8 --- a/net80211/ieee80211_input.c
9 +++ b/net80211/ieee80211_input.c
10 @@ -3398,12 +3398,17 @@
13 /* WDS/Repeater: re-schedule software beacon timer for
15 - if ((vap->iv_state == IEEE80211_S_RUN) &&
16 - (vap->iv_flags_ext & IEEE80211_FEXT_SWBMISS)) {
17 - mod_timer(&vap->iv_swbmiss,
18 + * STA. Reset consecutive bmiss counter as well */
19 + IEEE80211_LOCK_IRQ(ic);
20 + if (vap->iv_state == IEEE80211_S_RUN) {
21 + vap->iv_bmiss_count = 0;
22 + if (vap->iv_flags_ext & IEEE80211_FEXT_SWBMISS)
23 + mod_timer(&vap->iv_swbmiss,
24 jiffies + vap->iv_swbmiss_period);
26 + del_timer(&vap->iv_swbmiss);
28 + IEEE80211_UNLOCK_IRQ(ic);
30 /* If scanning, pass the info to the scan module.
31 * Otherwise, check if it's the right time to do
32 --- a/net80211/ieee80211_proto.c
33 +++ b/net80211/ieee80211_proto.c
37 TAILQ_FOREACH(vap, &ic->ic_vaps, iv_next) {
40 IEEE80211_DPRINTF(vap,
41 IEEE80211_MSG_STATE | IEEE80211_MSG_DEBUG,
42 "%s\n", "beacon miss");
43 @@ -1221,6 +1223,29 @@
44 if (vap->iv_opmode != IEEE80211_M_STA ||
45 vap->iv_state != IEEE80211_S_RUN)
48 + IEEE80211_LOCK_IRQ(ic);
49 + count = vap->iv_bmiss_count++;
51 + /* if the counter was already above zero, reset it
52 + * here, since we're going to do the bmiss handling
54 + vap->iv_bmiss_count = 0;
56 + /* schedule the software beacon miss timer, it will be
57 + * cancelled, if the probe request is acked */
58 + mod_timer(&vap->iv_swbmiss, jiffies + vap->iv_swbmiss_period);
60 + IEEE80211_UNLOCK_IRQ(ic);
63 + ieee80211_send_probereq(vap->iv_bss, vap->iv_myaddr,
64 + vap->iv_bss->ni_bssid, vap->iv_bss->ni_bssid,
65 + vap->iv_bss->ni_essid, vap->iv_bss->ni_esslen,
70 if (ic->ic_roaming == IEEE80211_ROAMING_AUTO) {
71 #ifdef ATH_SUPERG_DYNTURBO
73 @@ -1617,14 +1642,14 @@
76 /* WDS/Repeater: Start software beacon timer for STA */
77 + vap->iv_swbmiss.function = ieee80211_sta_swbmiss;
78 + vap->iv_swbmiss.data = (unsigned long) vap;
79 + vap->iv_swbmiss_period = IEEE80211_TU_TO_JIFFIES(
80 + vap->iv_ic->ic_bmissthreshold * ni->ni_intval);
82 if (ostate != IEEE80211_S_RUN &&
83 (vap->iv_opmode == IEEE80211_M_STA &&
84 vap->iv_flags_ext & IEEE80211_FEXT_SWBMISS)) {
85 - vap->iv_swbmiss.function = ieee80211_sta_swbmiss;
86 - vap->iv_swbmiss.data = (unsigned long) vap;
87 - vap->iv_swbmiss_period = IEEE80211_TU_TO_JIFFIES(
88 - vap->iv_ic->ic_bmissthreshold * ni->ni_intval);
90 mod_timer(&vap->iv_swbmiss, jiffies + vap->iv_swbmiss_period);
93 --- a/net80211/ieee80211_var.h
94 +++ b/net80211/ieee80211_var.h
97 struct timer_list iv_swbmiss; /* software beacon miss timer */
98 u_int16_t iv_swbmiss_period; /* software beacon miss timer period */
99 + u_int16_t iv_bmiss_count; /* consecutive beacon miss counter */
100 struct ieee80211_nsparams iv_nsparams; /* new state parameters for tasklet for stajoin1 */
101 struct IEEE80211_TQ_STRUCT iv_stajoin1tq; /* tasklet for newstate action called from stajoin1tq */
102 unsigned int iv_nsdone; /* Done with scheduled newstate tasklet */