From owner-freebsd-wireless@FreeBSD.ORG Sat Apr 7 20:27:39 2012 Return-Path: Delivered-To: freebsd-wireless@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B2BE4106564A for ; Sat, 7 Apr 2012 20:27:39 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-pb0-f54.google.com (mail-pb0-f54.google.com [209.85.160.54]) by mx1.freebsd.org (Postfix) with ESMTP id 885FB8FC0A for ; Sat, 7 Apr 2012 20:27:39 +0000 (UTC) Received: by pbcwz17 with SMTP id wz17so3809950pbc.13 for ; Sat, 07 Apr 2012 13:27:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:date:x-google-sender-auth:message-id:subject :from:to:content-type; bh=e+mnAcuINwK2yS9qQgQvJvfIgdYtpz923dv1sL21w1k=; b=tKOma0TufPKHD7rYPm3+A6bLTjHT7Gmog01mF1b+XZ5MuVXc//Y9u+hwmipFzKdfZU Q02GcJ6vD2QF74/u0OUqTkU+kaM6wDkJXQpGmXav9rK+ZuS36AI2Hz9AW+1mQZAkXeYa ReTX0tsrutDvTPcKxnhjvHT6GUDwEtBYiLWIN5cYiD59PJP9SXyiaUDbM4J2LrBU43UI 0quwO4EjnoAi2XXXt8YzaJfm8hSrk54c0r1lWL7AEM6hd8EEIJrHSEtLqYM1/1MsJ+sH xDb0mmId9Q/253CXWAJK7h+9nYUpl79oZr7jwQJ0a+PnnawAdhwHNWi0SJzNbByt3ycJ JlBQ== MIME-Version: 1.0 Received: by 10.68.194.1 with SMTP id hs1mr6643620pbc.6.1333830459013; Sat, 07 Apr 2012 13:27:39 -0700 (PDT) Sender: adrian.chadd@gmail.com Received: by 10.142.134.6 with HTTP; Sat, 7 Apr 2012 13:27:39 -0700 (PDT) Date: Sat, 7 Apr 2012 13:27:39 -0700 X-Google-Sender-Auth: 0rpMj9-xNMn1dBregqeUpA5XHF8 Message-ID: From: Adrian Chadd To: freebsd-wireless@freebsd.org Content-Type: text/plain; charset=ISO-8859-1 Subject: Now that I'm "done" with TX aggregation, now we need to figure out powersave handling.. X-BeenThere: freebsd-wireless@freebsd.org X-Mailman-Version: 2.1.5 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, 07 Apr 2012 20:27:39 -0000 Hi all, Now that I've "finished" with the TX aggregation side of ath(4), I'd like to go and make power save support work (again). The problems: * the hacky logic I put into the ath(4) TX queue code is wrong and seems to cause lots of weird issues when a power save station comes along whilst some other 11n aggregation stuff is happening; * since the ath(4) driver now has a per-TID, per-node queue of frames, ps-poll and TIM updating just don't work as you'd expect. If a power save client wakes up and sends a ps-poll frame to the hostap right now, the only software queue net80211 has is the power save queue (psq) which frames are diverted to if they're queued whilst the station is in power save mode. However, this doesn't take into account frames in the software queue, nor does it try at all to deal with frames that were already in flight. In the legacy case that's "ok" as those frames would be dropped with no real state consequence (there'd be a hole in the sequence numbers, but that's ok for legacy operation.) But in 11n, we can't just drop frames in the TX queue. The other issue is that if there -are- frames in the software queue, those should be dequeued (as aggregates? I'm not sure) before frames on the net80211 psq should be dequeued. Similarly, the TIM needs to be updated with the state of the psq _and_ the per-TID, per-node software queue frames. On the other hand, the hardware gives us a few things to make this easier. If TX failures occur, the hardware (Dating back to the pre-11n NICs) will set a "destination filtered" bit somewhere; which prevents all further hardware queued frames from even being attempted. They'll immediately fail with a specific error. So for stations transitioning into power save mode, we won't waste air time trying to transmit frames when it just plain isn't working. Those frames can then be added to the beginning of the software queue and retried once the station comes out of power save mode. Right now all frames have the "clear destination mask bit" set in the TX descriptor. I can clear that bit, notice when frames fail, throw them back on the head of the software queue and retry them when the station comes back. We just tag the next frame with the "clear destination mask bit" in the TX descriptor so traffic starts again. So, in short - this is a bit of a mess to wade through. I'd appreciate some feedback/comments. My plan is to ignore this for the next couple of weeks and concentrate on bugfixing anything that leads to crashes, memory corruption and such. There's also a lot of codebase tidying up that I'd like to do, especially with the messy locking. But handling power save needs to be done.. Adrian