From nobody Sat Dec 07 07:14:56 2024 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Y4zsY0nZCz5gfNy; Sat, 07 Dec 2024 07:14:57 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Y4zsX5J2fz49M2; Sat, 7 Dec 2024 07:14:56 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1733555696; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=lpUSUYrRZSPH4M7sNdc9hJsdVA/hLTaOpGV4gGBAyig=; b=xYaigXHKu/d0oA24vdr9Px5b1q944dRBcepDmQpsadrmBaSaexe3Xp3fGjj2TUgkpo+4C1 LpYbMl/5V0+U8NqD2TUitq6fbBmxK219Zthq/C8pjIuTGXy3D3iEDtJboo/p5esbY65cPg QJT1dXqmYqCCF6WEFSKpyFgXkZcGuA0hbBpA76RUsYLQRj4ZkEA+DejPTtglo2yRXdb3Yx hpOF3jPskKSm+65xaDsR/CnL898phiTbK9WNU3rVz7GbkKbbDuG0lGOxdtrk3cOxfLciiB C/xPeAmomEreEVHRDZ+mMAUZh3f9N88c/c8XpdI+qoi7UYLV/H8DhYi2KTwVgA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1733555696; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=lpUSUYrRZSPH4M7sNdc9hJsdVA/hLTaOpGV4gGBAyig=; b=Ew9utnju+MsQcUvP0EucI4WOWrrOc6rBiyn9awBAEjK92yIyISXgAVfu4ROxo03208BH6Y 5qg6zu+LU1v++e6vmgFZqMbNj7DjAlVOb7SS7frNEkmUXFy2VhmyozwDQNIdmgFzOovgkn 15lEnQcOPVWmmtUsnanwpyJLnA3bx3xlZ4gUwY85QXSZUmIzPQixdvPmIvbhbpN/QIjGr6 m2VLTyOmXYJ2abFq3V9+phWr68stNiDUzQ5KBJ8TO6wWRoLxQ4DwNQbmQ4Gpbs1Z0WisdL 5f+qeQ7EFPPNPVUVqosYh1XTqwI7xFUVBGL3++xBMU95wew9q5QjtKBF39LHKA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1733555696; a=rsa-sha256; cv=none; b=Kzr5JxjpqzGs3pEQons6ywP19iIUAAd4D9HIfWLLIO+XTsiwslEO2Fal+Ug1wbzm3dEUF5 W4mgu3fEC80DNEXxIiJOSYTq4fDD6zYIGlpDHCVjs3+M5MSs3nVjHGDc34GWpUPwzkIi35 fpQrecNDm2opttE+7yDLmB0daQucMLzPnUg519lhBz2fkPMYlKopw3w1rQIvNye7G/c+9A zAb5TMQLkRYYksdgsIKYDu19RP428p1mY+s4cl6JS66qBb5mPM0lJ9oQxGQMvZK2V7l+eY Esgm+sJTX5WKe668q6mgFYqdhJqmEC+JO+4BGm9vG46rbyKx850KHfwE6Eo27g== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Y4zsX4vdMz1CXp; Sat, 7 Dec 2024 07:14:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 4B77Eus7058457; Sat, 7 Dec 2024 07:14:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4B77EucM058454; Sat, 7 Dec 2024 07:14:56 GMT (envelope-from git) Date: Sat, 7 Dec 2024 07:14:56 GMT Message-Id: <202412070714.4B77EucM058454@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Adrian Chadd Subject: git: b4980d8a48e5 - main - rtwn: calculate the transmit power for VHT rates List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: adrian X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b4980d8a48e50367f2f8b60ee08c0a0604ecfc79 Auto-Submitted: auto-generated The branch main has been updated by adrian: URL: https://cgit.FreeBSD.org/src/commit/?id=b4980d8a48e50367f2f8b60ee08c0a0604ecfc79 commit b4980d8a48e50367f2f8b60ee08c0a0604ecfc79 Author: Adrian Chadd AuthorDate: 2024-12-04 05:21:44 +0000 Commit: Adrian Chadd CommitDate: 2024-12-07 07:14:07 +0000 rtwn: calculate the transmit power for VHT rates The VHT rate power array wasn't populated, and it needs to be in order to use VHT rates. The vendor driver reuses the HT40 values for VHT rates. Differential Revision: https://reviews.freebsd.org/D47898 --- sys/dev/rtwn/rtl8812a/r12a_chan.c | 36 ++++++++++++++++++++++++++---------- 1 file changed, 26 insertions(+), 10 deletions(-) diff --git a/sys/dev/rtwn/rtl8812a/r12a_chan.c b/sys/dev/rtwn/rtl8812a/r12a_chan.c index 517d96bb06cf..518b02d765cf 100644 --- a/sys/dev/rtwn/rtl8812a/r12a_chan.c +++ b/sys/dev/rtwn/rtl8812a/r12a_chan.c @@ -187,7 +187,7 @@ r12a_get_txpower(struct rtwn_softc *sc, int chain, struct ieee80211_channel *c, uint8_t power[RTWN_RIDX_COUNT]) { struct r12a_softc *rs = sc->sc_priv; - int i, ridx, group, max_mcs; + int i, ridx, group, max_mcs, max_vht_mcs; /* Determine channel group. */ group = r12a_get_power_group(sc, c); @@ -196,8 +196,8 @@ r12a_get_txpower(struct rtwn_softc *sc, int chain, return; } - /* TODO: VHT rates. */ max_mcs = RTWN_RIDX_HT_MCS(sc->ntxchains * 8 - 1); + max_vht_mcs = RTWN_RIDX_VHT_MCS(sc->ntxchains, 9) - 1; /* XXX regulatory */ /* XXX net80211 regulatory */ @@ -215,13 +215,11 @@ r12a_get_txpower(struct rtwn_softc *sc, int chain, uint8_t min_mcs; uint8_t pwr_diff; -#ifdef notyet - if (IEEE80211_IS_CHAN_HT80(c)) { + if (IEEE80211_IS_CHAN_VHT80(c)) { /* Vendor driver uses HT40 values here. */ pwr_diff = rs->bw40_tx_pwr_diff_2g[chain][i]; } else -#endif - if (IEEE80211_IS_CHAN_HT40(c)) + if (IEEE80211_IS_CHAN_HT40(c) || IEEE80211_IS_CHAN_VHT40(c)) pwr_diff = rs->bw40_tx_pwr_diff_2g[chain][i]; else pwr_diff = rs->bw20_tx_pwr_diff_2g[chain][i]; @@ -231,9 +229,14 @@ r12a_get_txpower(struct rtwn_softc *sc, int chain, power[ridx] += pwr_diff; } } else { /* 5GHz */ + /* OFDM + HT */ for (ridx = RTWN_RIDX_OFDM6; ridx <= max_mcs; ridx++) power[ridx] = rs->ht40_tx_pwr_5g[chain][group]; + /* VHT */ + for (ridx = RTWN_RIDX_VHT_MCS_SHIFT; ridx <= max_vht_mcs; ridx++) + power[ridx] = rs->ht40_tx_pwr_5g[chain][group]; + /* Add power for OFDM rates */ for (ridx = RTWN_RIDX_OFDM6; ridx <= RTWN_RIDX_OFDM54; ridx++) power[ridx] += rs->ofdm_tx_pwr_diff_5g[chain][0]; @@ -241,20 +244,26 @@ r12a_get_txpower(struct rtwn_softc *sc, int chain, uint8_t min_mcs; uint8_t pwr_diff; -#ifdef notyet - if (IEEE80211_IS_CHAN_HT80(c)) { + if (IEEE80211_IS_CHAN_VHT80(c)) { /* TODO: calculate base value. */ pwr_diff = rs->bw80_tx_pwr_diff_5g[chain][i]; } else -#endif - if (IEEE80211_IS_CHAN_HT40(c)) + if (IEEE80211_IS_CHAN_HT40(c) || IEEE80211_IS_CHAN_VHT40(c)) pwr_diff = rs->bw40_tx_pwr_diff_5g[chain][i]; else pwr_diff = rs->bw20_tx_pwr_diff_5g[chain][i]; + /* Adjust HT rates */ min_mcs = RTWN_RIDX_HT_MCS(i * 8); for (ridx = min_mcs; ridx <= max_mcs; ridx++) power[ridx] += pwr_diff; + + /* Adjust VHT rates */ + for (ridx = RTWN_RIDX_VHT_MCS(i, 0); + ridx <= RTWN_RIDX_VHT_MCS(i, 9); + ridx++) + power[ridx] += pwr_diff; + } } @@ -263,6 +272,12 @@ r12a_get_txpower(struct rtwn_softc *sc, int chain, if (power[ridx] > R92C_MAX_TX_PWR) power[ridx] = R92C_MAX_TX_PWR; } + for (ridx = RTWN_RIDX_VHT_MCS(0, 0); + ridx <= RTWN_RIDX_VHT_MCS(3, 9); + ridx++) { + if (power[ridx] > R92C_MAX_TX_PWR) + power[ridx] = R92C_MAX_TX_PWR; + } #ifdef RTWN_DEBUG if (sc->sc_debug & RTWN_DEBUG_TXPWR) { @@ -270,6 +285,7 @@ r12a_get_txpower(struct rtwn_softc *sc, int chain, printf("Tx power for chain %d:\n", chain); for (ridx = RTWN_RIDX_CCK1; ridx <= max_mcs; ridx++) printf("Rate %d = %u\n", ridx, power[ridx]); + /* TODO: dump VHT 0..9 for each spatial stream */ } #endif }