From owner-freebsd-wireless@FreeBSD.ORG Fri Sep 12 18:40:39 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 7ED196FE; Fri, 12 Sep 2014 18:40:39 +0000 (UTC) Received: from mail-qa0-x22d.google.com (mail-qa0-x22d.google.com [IPv6:2607:f8b0:400d:c00::22d]) (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 2BA7B8BB; Fri, 12 Sep 2014 18:40:39 +0000 (UTC) Received: by mail-qa0-f45.google.com with SMTP id s7so1163809qap.32 for ; Fri, 12 Sep 2014 11:40:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=tuYu5WGJpyuCdzQNR0BbqAV9qPXc+PAQ7rtfn987YWg=; b=h8ckTnnjRSND70YOVt5+gjBUHI1kS6HMgbuBW6dLs/Rg2xK9XP41VnoxoyGTbH8mFp IlHgBoWjUUEdwmOHIpyrQnjJo1OV/rkesLJN/C673nhKBESguQ9KY3BkCtLm4vMfqOHp nhfnmePweNGTO5wn2atKYHh2zxCEWjh7ZCxuB+YfX9lcNXfbnEpmg4SIkqlR+5SZW3Q1 mKt6J068PkhSSSCKfJ5TgCrsxFCzvc1aep2EL7KeWf3OXu8KzOpIPXoUL3D/cf7+ThUW 9+zO7Y3V0ov7wSqLZhkuWe1SxQU0veGVwaUDVEF+qxJU6u+6dqrzD6q7Zs4WNBgw9+If HG2w== MIME-Version: 1.0 X-Received: by 10.224.86.5 with SMTP id q5mr15195137qal.36.1410547238196; Fri, 12 Sep 2014 11:40:38 -0700 (PDT) Sender: adrian.chadd@gmail.com Received: by 10.224.39.139 with HTTP; Fri, 12 Sep 2014 11:40:38 -0700 (PDT) In-Reply-To: <541333ED.8020005@freebsd.org> References: <540C751F.6050202@freebsd.org> <540C92D6.4030106@freebsd.org> <540CC53A.90600@freebsd.org> <540E2A2D.4090301@freebsd.org> <541333ED.8020005@freebsd.org> Date: Fri, 12 Sep 2014 11:40:38 -0700 X-Google-Sender-Auth: extDF9VY8gKDhFWjTIQDryoQOv8 Message-ID: Subject: Re: Issues with urtwn From: Adrian Chadd To: Nathan Whitehorn Content-Type: text/plain; charset=UTF-8 Cc: "freebsd-wireless@freebsd.org" X-BeenThere: freebsd-wireless@freebsd.org X-Mailman-Version: 2.1.18-1 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: Fri, 12 Sep 2014 18:40:39 -0000 What the hell is calling sta power save? Can you go put in a stack trace (maybe use dtrace :) whenever the sta powersave routines get called? That's odd. So you see TIM=1 from the AP, but since powersave isn't enabled, it doesn't transition the NIC back to normal. So ieee80211_sta_pwrsave() is set in vap->iv_sta_ps. That's only called in: * the scan task for bgscan; * transitioning in/out of IEEE80211_S_SLEEP state. So, I don't know why you're seeing the above. In fact, if you hacked up urtwn to at least do powersave, the tim_notify will transition the VAP from SLEEP to RUN. In fact, hm. Can you file a bug for the above? There's the bug you're seeing, then there's the "we see a TIM flag for us, maybe we need to force transition out of sleep even if we think we're not in powersave". Thanks, -a On 12 September 2014 10:57, Nathan Whitehorn wrote: > This is what the debug output looks like when things go wrong: > wlan0: [54:78:1a:a0:91:22] sta power save mode on > wlan0: wlan0: [54:78:1a:a0:91:22] save frame with age 41, 1 now queued > [54:78:1a:a0:91:22] sta power save mode off > wlan0: [54:78:1a:a0:91:22] flush ps queue, 1 packets queued > wlan0: [54:78:1a:a0:91:22] sta power save mode on > wlan0: [54:78:1a:a0:91:22] save frame with age 41, 1 now queued > wlan0: [54:78:1a:a0:91:22] save frame with age 0, 2 now queued > wlan0: [54:78:1a:a0:91:22] save frame with age 0, 3 now queued > wlan0: [54:78:1a:a0:91:22] save frame with age 0, 4 now queued > wlan0: ieee80211_sta_tim_notify: TIM=1 > wlan0: ieee80211_sta_tim_notify: TIM=1 > wlan0: ieee80211_sta_tim_notify: TIM=1 > wlan0: ieee80211_sta_tim_notify: TIM=1 > wlan0: ieee80211_sta_tim_notify: TIM=1 > wlan0: [54:78:1a:a0:91:22] save frame with age 0, 5 now queued > wlan0: [54:78:1a:a0:91:22] save frame with age 0, 6 now queued > > Let me know if I can test anything else. > -Nathan > > > On 09/08/14 15:17, Adrian Chadd wrote: >> >> Please compile your kernel with IEEE80211_DEBUG, then enable debugging >> - wlandebug +state +power >> >> You can disable powersave with 'ifconfig wlan0 -powersave', but it >> shouldn't be enabled by default. >> >> >> >> -a >> >> >> On 8 September 2014 15:14, Nathan Whitehorn >> wrote: >>> >>> So it's definitely to do with powersave. Here's a bunch of iterations of >>> ifconfig list sta on my laptop: >>> ADDR AID CHAN RATE RSSI IDLE TXSEQ RXSEQ CAPS FLAG >>> 54:78:1a:a0:91:22 149 1 54M 37.0 0 4385 37104 EPS A >>> HTCAP >>> RSN WME >>> ADDR AID CHAN RATE RSSI IDLE TXSEQ RXSEQ CAPS FLAG >>> 54:78:1a:a0:91:22 149 1 54M 37.5 0 4412 39360 EPS A >>> HTCAP >>> RSN WME >>> ADDR AID CHAN RATE RSSI IDLE TXSEQ RXSEQ CAPS FLAG >>> 54:78:1a:a0:91:22 149 1 54M 37.5 0 4417 39360 EPS AP >>> HTCAP >>> RSN WME >>> ADDR AID CHAN RATE RSSI IDLE TXSEQ RXSEQ CAPS FLAG >>> 54:78:1a:a0:91:22 149 1 54M 37.5 0 4417 39360 EPS AP >>> HTCAP >>> RSN WME >>> ADDR AID CHAN RATE RSSI IDLE TXSEQ RXSEQ CAPS FLAG >>> 54:78:1a:a0:91:22 149 1 54M 37.5 0 4417 39360 EPS AP >>> HTCAP >>> RSN WME >>> >>> You can see the connection die on the third line, when the txseq and >>> rxseq >>> counters stop incrementing and 'P' gets added to the FLAG field. Does >>> this >>> mean the AP has turned on powersave on its end? >>> -Nathan >>> >>> >>> On 09/07/14 14:07, Adrian Chadd wrote: >>>> >>>> Hi, >>>> >>>> The way it's supposed to work in the legacy 802.11 powersave world is >>>> that you send a/any data frame with the powermgt bit in the 802.11 >>>> header set to 0 and the AP goes "oh they're awake!" and sends you your >>>> buffered frames. >>>> >>>> By default powersave isn't enabled, so we should never be _telling_ >>>> the AP that we're going to sleep and the stack always sends data >>>> frames with pwrmgt=0. >>>> >>>> You can ensure it's disabled by ifconfig wlan0 -powersave >>>> >>>> The code in -HEAD that manages that is in ieee80211_power.c. I added >>>> an explicit powersave support mode for NICs that need it done for them >>>> - and the only one it's enabled for right now is ath(4). >>>> >>>> The only reason net80211 sends pwrmgt changes outside of having >>>> net80211 power save enabled is the background scan code. >>>> >>>> I'd compile in IEEE80211_DEBUG in your kernel, then I'd use wlandebug >>>> +scan to see if somehow there's some scanning going on; and wlandebug >>>> +power to see if any power save transitions occur. >>>> >>>> Are you absolutely sure it's a receive side buffering problem, rather >>>> than a send side problem? >>>> >>>> It's also possible that the NIC stops receiving and the AP treats that >>>> as "oh ok, they've gone to sleep for a while." ath(4) now does this in >>>> hostap mode. >>>> >>>> >>>> -a >>>> >