From f3a173844485c5683c2a96c54625122f554805fa Mon Sep 17 00:00:00 2001 From: adrian Date: Sun, 21 Dec 2014 04:48:54 +0000 Subject: [PATCH] Break out the unicast/multicast TIM bit setting into "set something that indicates we have traffic" bit and a "do something if we have traffic bit." I'm going to be fleshing out this stuff more over time and it'll make more sense to have it broken out into two pieces here. --- sys/net80211/ieee80211_sta.c | 33 ++++++++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 5 deletions(-) diff --git a/sys/net80211/ieee80211_sta.c b/sys/net80211/ieee80211_sta.c index 89ed85627d60..c3c2bc92b59e 100644 --- a/sys/net80211/ieee80211_sta.c +++ b/sys/net80211/ieee80211_sta.c @@ -1405,6 +1405,7 @@ sta_recv_mgmt(struct ieee80211_node *ni, struct mbuf *m0, int ix = aid / NBBY; int min = tim->tim_bitctl &~ 1; int max = tim->tim_len + min - 4; + int tim_ucast = 0, tim_mcast = 0; /* * Only do this for unicast traffic in the TIM @@ -1414,20 +1415,42 @@ sta_recv_mgmt(struct ieee80211_node *ni, struct mbuf *m0, */ if (min <= ix && ix <= max && isset(tim->tim_bitmap - min, aid)) { - ieee80211_sta_tim_notify(vap, 1); - ic->ic_lastdata = ticks; + tim_ucast = 1; } /* - * XXX TODO: do a separate notification + * Do a separate notification * for the multicast bit being set. */ -#if 0 if (tim->tim_bitctl & 1) { + tim_mcast = 1; + } + + /* + * If the TIM indicates there's traffic for + * us then get us out of STA mode powersave. + */ + if (tim_ucast == 1) { + + /* + * Wake us out of SLEEP state if we're + * in it; and if we're doing bgscan + * then wake us out of STA powersave. + */ ieee80211_sta_tim_notify(vap, 1); + + /* + * This is preventing us from + * continuing a bgscan; because it + * tricks the contbgscan() + * routine to think there's always + * traffic for us. + * + * I think we need both an RX and + * TX ic_lastdata field. + */ ic->ic_lastdata = ticks; } -#endif ni->ni_dtim_count = tim->tim_count; ni->ni_dtim_period = tim->tim_period;