From owner-svn-src-all@FreeBSD.ORG Thu Mar 24 15:27:16 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 37051106566B; Thu, 24 Mar 2011 15:27:16 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 14C758FC12; Thu, 24 Mar 2011 15:27:16 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p2OFRFsQ047167; Thu, 24 Mar 2011 15:27:15 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p2OFRF63047165; Thu, 24 Mar 2011 15:27:15 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201103241527.p2OFRF63047165@svn.freebsd.org> From: Adrian Chadd Date: Thu, 24 Mar 2011 15:27:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r219961 - head/sys/net80211 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Thu, 24 Mar 2011 15:27:16 -0000 Author: adrian Date: Thu Mar 24 15:27:15 2011 New Revision: 219961 URL: http://svn.freebsd.org/changeset/base/219961 Log: Fix a WME corner case found by the FreeBSD 802.11n testing crew. The symptom: sometimes 11n (and non-11n) throughput is great. Sometimes it isn't. Much teeth gnashing occured, and much kernel bisecting happened, until someone figured out it was the order of which things were rebooted, not the kernel versions. (Which was great news to me, it meant that I hadn't broken if_ath.) What we found was that sometimes the WME parameters for the best-effort queue had a burst window ("txop") in which the station would be allowed to TX as many packets as it could fit inside that particular burst window. This improved throughput. After initially thinking it was a bug - the WME parameters for the best-effort queue -should- have a txop of 0, Bernard and I discovered "aggressive mode" in net80211 - where the WME BE queue parameters are changed if there's not a lot of high priority traffic going on. The WME parameters announced in the association response and beacon frames just "change" based on what the current traffic levels are. So in fact yes, the STA was acutally supposed to be doing this higher throughput stuff as it's just meant to be configuring things based on the WME parameters - but it wasn't. What was eventually happening was this: * at startup, the wme qosinfo count field would be 0; * it'd be parsed in ieee80211_parse_wmeparams(); * and it would be bumped (to say 10); * .. and the WME queue parameters would be correctly parsed and set. But then, when you restarted the assocation (eg hostap goes away and comes back with the same qosinfo count field of 10, or if you destroy the sta VIF and re-create it), the WME qosinfo count field - which is associated not to the VIF, but to the main interface - wouldn't be cleared, so the queue default parameters would be used (which include no burst setting for the BE queue) and would remain that way until the hostap qosinfo count field changed, or the STA was actually rebooted. This fix simply cleares the wme capability field (which has the count field) to 0, forcing it to be reset by the next received beacon. Thanks go to Milu for finding it and helping me track down what was going on, and Bernard Schmidt for working through the net80211 and WME specific magic. Modified: head/sys/net80211/ieee80211_proto.c Modified: head/sys/net80211/ieee80211_proto.c ============================================================================== --- head/sys/net80211/ieee80211_proto.c Thu Mar 24 15:09:36 2011 (r219960) +++ head/sys/net80211/ieee80211_proto.c Thu Mar 24 15:27:15 2011 (r219961) @@ -896,6 +896,15 @@ ieee80211_wme_initparams_locked(struct i return; /* + * Clear the wme cap_info field so a qoscount from a previous + * vap doesn't confuse later code which only parses the beacon + * field and updates hardware when said field changes. + * Otherwise the hardware is programmed with defaults, not what + * the beacon actually announces. + */ + wme->wme_wmeChanParams.cap_info = 0; + + /* * Select mode; we can be called early in which case we * always use auto mode. We know we'll be called when * entering the RUN state with bsschan setup properly