From owner-freebsd-wireless@FreeBSD.ORG Sat Apr 12 07:31:29 2014 Return-Path: Delivered-To: freebsd-wireless@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 327E6C53 for ; Sat, 12 Apr 2014 07:31:29 +0000 (UTC) Received: from mail-vc0-x22a.google.com (mail-vc0-x22a.google.com [IPv6:2607:f8b0:400c:c03::22a]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E852616DC for ; Sat, 12 Apr 2014 07:31:28 +0000 (UTC) Received: by mail-vc0-f170.google.com with SMTP id hu19so5834596vcb.1 for ; Sat, 12 Apr 2014 00:31:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:date:message-id:subject:from:to:content-type; bh=WkltvnockFfUvhpm9h0bX9w04+49BJx8vgTfkbtY/I8=; b=rMC7FzJ9ZF43qXEvC0iRjW83oPVpEsCfTXkiSFDmrxDNEKwNNBeC7nO1umNQizk0Wi 10QZwxruTbyor8M4Z0nYcCDRBHIBCIz2eT8qs+dPevaTXicgN2gXmKIAsghfy5k+JOhQ doRPPlOXb9z4CdA4jA2mZlEDg3UvKgltzPerKoHGaUroYi2KCO1jcRkITiH+9hj5vHMn HnhwtAMMRSCcBJk5gk6tAUmyAuypgjjahasfbqxp3SHa0hG9khkmVssueHKIbVcow57y vpvBEsxlE+iLqZP59eSNUhehuo+YOvLaQElttKyCeobnFmvRg5GqMrH3QP2sZ3mbjBVi HyvA== MIME-Version: 1.0 X-Received: by 10.58.23.6 with SMTP id i6mr23684377vef.12.1397287888042; Sat, 12 Apr 2014 00:31:28 -0700 (PDT) Sender: adrian.chadd@gmail.com Received: by 10.220.113.199 with HTTP; Sat, 12 Apr 2014 00:31:27 -0700 (PDT) Date: Sat, 12 Apr 2014 00:31:27 -0700 X-Google-Sender-Auth: mw-eifYdsgI_4hdTQGxjTZ1DQsk Message-ID: Subject: [rfc] net80211/ath station side sleep support From: Adrian Chadd To: "freebsd-wireless@freebsd.org" Content-Type: text/plain; charset=ISO-8859-1 X-BeenThere: freebsd-wireless@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: "Discussions of 802.11 stack, tools device driver development." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 Apr 2014 07:31:29 -0000 Hi, Here's a WIP for chip power saving support for net80211 and ath: http://people.freebsd.org/~adrian/ath/20140411-net80211-ath-sleep-3.diff (ignore the stuff for non-net80211 and non-ath drivers.) This implements: * basic chip power management for ath(4), allowing the NIC to go into network sleep in STA mode * .. and all the fiddly places where I have to actually force wake the thing up before I can access it! * implements IEEE80211_S_SLEEP for ath(4), so net80211 can drive when the VAP goes into sleep mode * very basic (and I do mean _very_) sleep state support in net80211 - it's just a timer that monitors for idle periods of greater than a second and puts the VAP into IEEE80211_S_SLEEP state. I should be triggering it off of beacon intervals and such. * .. and hook into the beacon receive path to check for the TIM and whether the VAP needs to wake up for active receive. What it doesn't implement: * ath(4) should only put the NIC into network sleep if all the VAPs are capable of it and all the VAPs are currently asleep. Very notably, STA+AP mode (ie, WDS) shouldn't put the NIC into network sleep. * i haven't verified at all that the net80211 code is correctly marking management frames with PWR=1 (ie, telling the peer that although a frame is being transmitted, it should be considered "asleep") if the sending VAP is asleep * mesh or adhoc sleep state handling - mostly because the TIM stuff needs checking _and_ we need to figure out how to handle ATIM stuff. * We don't yet have support to send out PS-POLL frames to ask the AP for individual data frames. I plan on yanking this out of madwifi at some point as it'll make it much, much easier to stay asleep for longer periods of time and thus get much better power savings. * .. and yes, we still don't support uAPSD. I have no plans to implement that at the moment. To test: * Apply to -HEAD and rebuild * .. make sure you have ATH_DEBUG, AH_DEBUG, ATH_DIAGAPI, IEEE80211_DEBUG in your kernel config files! * ifconfig wlan0 create wlandev ath0 powersave * wlandebug +power +state +debug to see the NIC go in and out of sleep state It's working for me so far on the AR5416 test device I have. I'm sure it'll work on the AR91xx and AR92xx series. The AR93xx stuff will need some further digging into as I haven't verified yet whether I'm waking the NIC up correctly before I do the FIFO descriptor programming. But yes, there's a noticable (2W) drop when the NIC is actually in and staying in power save state. -a