From owner-svn-src-all@FreeBSD.ORG Sun Dec 21 04:48:55 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E5CBBAF8; Sun, 21 Dec 2014 04:48:55 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B84BC1D91; Sun, 21 Dec 2014 04:48:55 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sBL4mtT5075953; Sun, 21 Dec 2014 04:48:55 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sBL4mtbt075952; Sun, 21 Dec 2014 04:48:55 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201412210448.sBL4mtbt075952@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Sun, 21 Dec 2014 04:48:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r275983 - head/sys/net80211 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Dec 2014 04:48:56 -0000 Author: adrian Date: Sun Dec 21 04:48:54 2014 New Revision: 275983 URL: https://svnweb.freebsd.org/changeset/base/275983 Log: 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. Modified: head/sys/net80211/ieee80211_sta.c Modified: head/sys/net80211/ieee80211_sta.c ============================================================================== --- head/sys/net80211/ieee80211_sta.c Sun Dec 21 03:06:11 2014 (r275982) +++ head/sys/net80211/ieee80211_sta.c Sun Dec 21 04:48:54 2014 (r275983) @@ -1405,6 +1405,7 @@ sta_recv_mgmt(struct ieee80211_node *ni, 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, */ 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;