From owner-svn-src-head@FreeBSD.ORG Sat Nov 9 07:30:14 2013 Return-Path: Delivered-To: svn-src-head@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 ESMTP id 599FCA3D; Sat, 9 Nov 2013 07:30:14 +0000 (UTC) (envelope-from adrian@FreeBSD.org) 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)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 2D9212EB2; Sat, 9 Nov 2013 07:30:14 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rA97UEhG063026; Sat, 9 Nov 2013 07:30:14 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id rA97UEcn063025; Sat, 9 Nov 2013 07:30:14 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201311090730.rA97UEcn063025@svn.freebsd.org> From: Adrian Chadd Date: Sat, 9 Nov 2013 07:30:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r257881 - 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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Nov 2013 07:30:14 -0000 Author: adrian Date: Sat Nov 9 07:30:13 2013 New Revision: 257881 URL: http://svnweb.freebsd.org/changeset/base/257881 Log: Fix AMRR to correctly select the initial rate. There were two bugs: * If the initial lowest rate didn't go through the loop at least once, the AMRR rate index would be the highest rate in the table (eg the rix mapping to MCS15) but rate would stay at the default value, namely 0. This meant that the initial rate selection would be MCS15 _but_ the node ni_txrate value would be MCS0. * If the node is 11n, then break out of the loop correctly. Beforehand, my initial 11n AMRR commit would immediately exit out as it would fail the 11n check, then it would always fall through to the non-11n rate which would then see if it was < 36mbit (ie, "72"), which would always match. Hence, it'd always return MCS15. Tested: * Intel Centrino 2230 STA (local changes), STA mode * Intel Wifi 5100, STA Modified: head/sys/net80211/ieee80211_amrr.c Modified: head/sys/net80211/ieee80211_amrr.c ============================================================================== --- head/sys/net80211/ieee80211_amrr.c Sat Nov 9 06:30:09 2013 (r257880) +++ head/sys/net80211/ieee80211_amrr.c Sat Nov 9 07:30:13 2013 (r257881) @@ -199,13 +199,13 @@ amrr_node_init(struct ieee80211_node *ni amn->amn_rix--) { /* legacy - anything < 36mbit, stop searching */ /* 11n - stop at MCS4 / MCS12 / MCS28 */ - if (amrr_node_is_11n(ni) && - (rs->rs_rates[amn->amn_rix] & 0x7) < 4) + if (amrr_node_is_11n(ni)) { + if ((rs->rs_rates[amn->amn_rix] & 0x7) < 4) + break; + } else if ((rs->rs_rates[amn->amn_rix] & IEEE80211_RATE_VAL) <= 72) break; - else if ((rs->rs_rates[amn->amn_rix] & IEEE80211_RATE_VAL) <= 72) - break; - rate = rs->rs_rates[amn->amn_rix] & IEEE80211_RATE_VAL; } + rate = rs->rs_rates[amn->amn_rix] & IEEE80211_RATE_VAL; /* if the rate is an 11n rate, ensure the MCS bit is set */ if (amrr_node_is_11n(ni))