git: 4fa68495f04f - main - rtwn: fix rtl8812/rtl8821 vht definitions, add VHT calibration/rate control
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 05 Dec 2024 07:30:14 UTC
The branch main has been updated by adrian: URL: https://cgit.FreeBSD.org/src/commit/?id=4fa68495f04ff3906c6d93d7c296fea5bc0311d3 commit 4fa68495f04ff3906c6d93d7c296fea5bc0311d3 Author: Adrian Chadd <adrian@FreeBSD.org> AuthorDate: 2024-11-26 23:55:26 +0000 Commit: Adrian Chadd <adrian@FreeBSD.org> 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 */