From owner-svn-src-head@freebsd.org Sat May 16 01:56:06 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D75C72DFFD5; Sat, 16 May 2020 01:56:06 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49P7fZ54VHz3FlW; Sat, 16 May 2020 01:56:06 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A50B062C9; Sat, 16 May 2020 01:56:06 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 04G1u6jt074864; Sat, 16 May 2020 01:56:06 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 04G1u6DB074863; Sat, 16 May 2020 01:56:06 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <202005160156.04G1u6DB074863@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Sat, 16 May 2020 01:56:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r361098 - head/sys/dev/ath/ath_rate/sample X-SVN-Group: head X-SVN-Commit-Author: adrian X-SVN-Commit-Paths: head/sys/dev/ath/ath_rate/sample X-SVN-Commit-Revision: 361098 X-SVN-Commit-Repository: base 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.33 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, 16 May 2020 01:56:06 -0000 Author: adrian Date: Sat May 16 01:56:06 2020 New Revision: 361098 URL: https://svnweb.freebsd.org/changeset/base/361098 Log: [ath_rate_sample] Fix logic for determining whether to bump up an MCS rate. * Fix formatting, cause reasons; * Put back the "and the chosen rate is within 90% of the current rate" logic; * Ensure the best rate and the current rate aren't the same; this ... * ... fixes the packets_since_switch[] tracking to actually conut how many frames since the rate switched, so now I know how stable stuff is; and * Ensure that MCS can go up to a higher MCS at this or any other spatial stream. My previous quick hack attempt was doing > rather than >= so you had to go to both a higher root MCS rate (0..7) and spatial stream. Eg, you couldn't go from MCS0 (1ss) to MCS8 (2ss) this way. The best rate and switching rate logic still have a bunch more work to do because they're still quite touchy when it comes to average tx time but at least now it's choosing higher rates correctly when it wants to try a higher rate. Tested: * AR9380, STA mode Modified: head/sys/dev/ath/ath_rate/sample/sample.c Modified: head/sys/dev/ath/ath_rate/sample/sample.c ============================================================================== --- head/sys/dev/ath/ath_rate/sample/sample.c Sat May 16 01:50:28 2020 (r361097) +++ head/sys/dev/ath/ath_rate/sample/sample.c Sat May 16 01:56:06 2020 (r361098) @@ -712,10 +712,13 @@ ath_rate_findrate(struct ath_softc *sc, struct ath_nod * Limit the time measuring the performance of other tx * rates to sample_rate% of the total transmission time. */ - if (sn->sample_tt[size_bin] < average_tx_time * (sn->packets_since_sample[size_bin]*ssc->sample_rate/100)) { + if (sn->sample_tt[size_bin] < + average_tx_time * + (sn->packets_since_sample[size_bin]*ssc->sample_rate/100)) { rix = pick_sample_rate(ssc, an, rt, size_bin); IEEE80211_NOTE(an->an_node.ni_vap, IEEE80211_MSG_RATECTL, - &an->an_node, "att %d sample_tt %d size %u sample rate %d %s current rate %d %s", + &an->an_node, "att %d sample_tt %d size %u " + "sample rate %d %s current rate %d %s", average_tx_time, sn->sample_tt[size_bin], bin_to_size(size_bin), @@ -776,12 +779,9 @@ ath_rate_findrate(struct ath_softc *sc, struct ath_nod printf("cur rix/att %x/%d, best rix/att %x/%d\n", MCS(cur_rix), cur_att, MCS(best_rix), average_tx_time); #endif -#if 0 - if (((MCS(best_rix) & 0x7) > (MCS(cur_rix) & 0x7)) && - (average_tx_time * 10) <= (cur_att * 10)) { -#else - if ((average_tx_time * 10) <= (cur_att * 10)) { -#endif + if ((best_rix != cur_rix) && + ((MCS(best_rix) & 0x7) >= (MCS(cur_rix) & 0x7)) && + (average_tx_time * 9) <= (cur_att * 10)) { IEEE80211_NOTE(an->an_node.ni_vap, IEEE80211_MSG_RATECTL, &an->an_node, "%s: HT: size %d best_rix 0x%x > " @@ -823,7 +823,9 @@ ath_rate_findrate(struct ath_softc *sc, struct ath_nod /* * Set the visible txrate for this node. */ - an->an_node.ni_txrate = (rt->info[best_rix].phy == IEEE80211_T_HT) ? MCS(best_rix) : DOT11RATE(best_rix); + an->an_node.ni_txrate = + (rt->info[best_rix].phy == IEEE80211_T_HT) ? + MCS(best_rix) : DOT11RATE(best_rix); } rix = sn->current_rix[size_bin]; sn->packets_since_switch[size_bin]++;