From nobody Thu Dec 05 07:30:14 2024 X-Original-To: dev-commits-src-main@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 4Y3mJ62GBpz5g3vB; Thu, 05 Dec 2024 07:30:14 +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 4Y3mJ61kZqz4KjW; Thu, 5 Dec 2024 07:30:14 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1733383814; 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=F1BM2MSaTqw+2QnTFEhM1LcVnJ6DtHNlqOuFzAsC8IA=; b=UazBXRh0OmW9m+Wf1ipy00loypqApInbeJkJ6FDNsL69axhe+S/jOC3tSY+iZpDJflQUrL Zo/S0qFkkT72p5QM+FKToRmEEIV4QU3IbMaUXs4BYkokIcf8FYYJ4Hm3Qb/Ayr5yt8C9/T Q0SK2qxSj9rhcj1XvXKB1X6nZApmib820WgD4nrqBC1Y2fv2xDM3pUpKzH3D/gZz0zDzuz LNGmknPxiKzXgDspwVFGZQtb0iA4GToqP2wGy3fx8LqbjHT8Yhlfo8tUaAD2n5kpbrdGMl GYx/lwlXNNtOdWP0tWz0Q9copG0L/mYDl73cNDLkHJadiA/Iu/kNwLwGspG0fA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1733383814; 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=F1BM2MSaTqw+2QnTFEhM1LcVnJ6DtHNlqOuFzAsC8IA=; b=NsQxEopfOHwFQMbGi5BLGPY07cMVC+M12EeGdt6vHJBH0WkAe4KAvuL2JczpZogEN7+yUd SRi1bBej+49DBc6LkR0zLipbv2ZrD6JEgz1DbFGnd04XKhgVA1qBDiEQG5mNwq6g0EHHP0 R1zmxPE+ZRymfSYjfv3V4QR/xXAygPqAzEOuG+WwfkEKWIdlbpn0cUaPFOZ7D1irTuoGW4 QSWej36WRZ/i3Nc2KwGa3I1xFwNvcp2Tgc12Fs2sjA7r69KTigNy4vJfnFOb9KdgP0se50 rlQ9036bNGvw6cZcRkUP8/dgX9zwlqtvTHo0/99NZQ2NtBpC0Yt8XjgPhW0+kA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1733383814; a=rsa-sha256; cv=none; b=UPr7Bo4I8QTZFCzCaWKob/AUk0DAdDAUG4qtSqLfDxmvaZ0diaKER7Ajv9YpZT3/9rtLEN nVbW9gKtSYVgytWStP5Yi49NCXv9jB7Iyhw7udoEP17uKwTG0ijKPOedhLUXH9Vi2PWiWb 8+PnomFvGaWpk5lVMZRTKYvkK+J7jZPKzzo/45QXbKgQ4HlHJp1ZFlUsXbCAOuGLGTAj9U HW7sRwpeIVLf0rWQwRHVEHC+lSNPfl8tJfGRljjwDUg3EynBLuYF2G+Jj9Hm8Lo4hutKfY 81L4NRF5Eg3fcqE+UZLfZOvzL12aJBBgIuuRb28zb+QKDiApIoCVawl6M93v+Q== 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 4Y3mJ61DQ9zjTD; Thu, 5 Dec 2024 07:30:14 +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 4B57UEKe021327; Thu, 5 Dec 2024 07:30:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4B57UEdU021318; Thu, 5 Dec 2024 07:30:14 GMT (envelope-from git) Date: Thu, 5 Dec 2024 07:30:14 GMT Message-Id: <202412050730.4B57UEdU021318@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: 4fa68495f04f - main - rtwn: fix rtl8812/rtl8821 vht definitions, add VHT calibration/rate control List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@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: 4fa68495f04ff3906c6d93d7c296fea5bc0311d3 Auto-Submitted: auto-generated The branch main has been updated by adrian: URL: https://cgit.FreeBSD.org/src/commit/?id=4fa68495f04ff3906c6d93d7c296fea5bc0311d3 commit 4fa68495f04ff3906c6d93d7c296fea5bc0311d3 Author: Adrian Chadd AuthorDate: 2024-11-26 23:55:26 +0000 Commit: Adrian Chadd CommitDate: 2024-12-05 07:26:49 +0000 rtwn: fix rtl8812/rtl8821 vht definitions, add VHT calibration/rate control * Add support for 80MHz channels during IQ calibration * Correct the RAID flags for 1 and 2 stream VHT - the later ones are for 2GHz VHT and then 3/4 stream VHT * Add VHT to the RAID calculation for when we eventually transmit VHT rates. Obtained from: Linux rtw88 (https://github.com/lwfinger/rtw88) Differential Revision: https://reviews.freebsd.org/D47774 --- sys/dev/rtwn/rtl8812a/r12a_fw.c | 6 ++++-- sys/dev/rtwn/rtl8812a/r12a_reg.h | 4 ++-- sys/dev/rtwn/rtl8812a/r12a_tx.c | 10 +++++++++- sys/dev/rtwn/rtl8812a/r12a_tx_desc.h | 6 ++---- 4 files changed, 17 insertions(+), 9 deletions(-) diff --git a/sys/dev/rtwn/rtl8812a/r12a_fw.c b/sys/dev/rtwn/rtl8812a/r12a_fw.c index 6d383fe2f5ad..c2c12c2a2ee2 100644 --- a/sys/dev/rtwn/rtl8812a/r12a_fw.c +++ b/sys/dev/rtwn/rtl8812a/r12a_fw.c @@ -171,8 +171,10 @@ r12a_iq_calib_fw(struct rtwn_softc *sc) else cmd.band_bw = RTWN_CMD_IQ_BAND_2GHZ; - /* TODO: 80/160 MHz. */ - if (IEEE80211_IS_CHAN_HT40(c)) + /* TODO: 160MHz */ + if (IEEE80211_IS_CHAN_VHT80(c)) + cmd.band_bw |= RTWN_CMD_IQ_CHAN_WIDTH_80; + else if (IEEE80211_IS_CHAN_HT40(c) || IEEE80211_IS_CHAN_VHT40(c)) cmd.band_bw |= RTWN_CMD_IQ_CHAN_WIDTH_40; else cmd.band_bw |= RTWN_CMD_IQ_CHAN_WIDTH_20; diff --git a/sys/dev/rtwn/rtl8812a/r12a_reg.h b/sys/dev/rtwn/rtl8812a/r12a_reg.h index f9acc2047490..4e9892ce2592 100644 --- a/sys/dev/rtwn/rtl8812a/r12a_reg.h +++ b/sys/dev/rtwn/rtl8812a/r12a_reg.h @@ -75,8 +75,8 @@ #define R12A_DATA_SEC_PRIM_DOWN_20 0x02 #define R12A_DATA_SEC_PRIM_UPPER_20 0x03 #define R12A_DATA_SEC_PRIM_LOWER_20 0x04 -#define R12A_DATA_SEC_PRIM_UP_40 0x90 -#define R12A_DATA_SEC_PRIM_DOWN_40 0xa0 +#define R12A_DATA_SEC_PRIM_UP_40 0x09 +#define R12A_DATA_SEC_PRIM_DOWN_40 0x0a /* Bits for R12A_HT_SINGLE_AMPDU. */ #define R12A_HT_SINGLE_AMPDU_PKT_ENA 0x80 diff --git a/sys/dev/rtwn/rtl8812a/r12a_tx.c b/sys/dev/rtwn/rtl8812a/r12a_tx.c index 6102a0567e74..e6b5111063f7 100644 --- a/sys/dev/rtwn/rtl8812a/r12a_tx.c +++ b/sys/dev/rtwn/rtl8812a/r12a_tx.c @@ -147,6 +147,9 @@ r12a_tx_raid(struct rtwn_softc *sc, struct r12a_tx_desc *txd, case IEEE80211_MODE_11NG: mode = IEEE80211_MODE_11G; break; + case IEEE80211_MODE_VHT_5GHZ: + mode = IEEE80211_MODE_VHT_5GHZ; + break; default: device_printf(sc->sc_dev, "unknown mode(1) %d!\n", ic->ic_curmode); @@ -186,8 +189,13 @@ r12a_tx_raid(struct rtwn_softc *sc, struct r12a_tx_desc *txd, raid = R12A_RAID_11BGN_2; } break; + case IEEE80211_MODE_VHT_5GHZ: + if (sc->ntxchains == 1) + raid = R12A_RAID_11AC_1; + else + raid = R12A_RAID_11AC_2; + break; default: - /* TODO: 80 MHz / 11ac */ device_printf(sc->sc_dev, "unknown mode(2) %d!\n", mode); return; } diff --git a/sys/dev/rtwn/rtl8812a/r12a_tx_desc.h b/sys/dev/rtwn/rtl8812a/r12a_tx_desc.h index 93cc9b867401..7d0793a0fe10 100644 --- a/sys/dev/rtwn/rtl8812a/r12a_tx_desc.h +++ b/sys/dev/rtwn/rtl8812a/r12a_tx_desc.h @@ -138,9 +138,7 @@ struct r12a_tx_desc { #define R12A_RAID_11BG 6 #define R12A_RAID_11G 7 /* "pure" 11g */ #define R12A_RAID_11B 8 -#define R12A_RAID_11AC_2_80 9 -#define R12A_RAID_11AC_1_80 10 -#define R12A_RAID_11AC_1 11 -#define R12A_RAID_11AC_2 12 +#define R12A_RAID_11AC_2 9 +#define R12A_RAID_11AC_1 10 #endif /* R12A_TX_DESC_H */