git: 7b71689c9ccd - main - rtwn: update RTL8812AU/RTL8821AU receive path to include VHT info

From: Adrian Chadd <adrian_at_FreeBSD.org>
Date: Sat, 14 Dec 2024 02:17:58 UTC
The branch main has been updated by adrian:

URL: https://cgit.FreeBSD.org/src/commit/?id=7b71689c9ccd71d9683e6d55d42e090e292d13d2

commit 7b71689c9ccd71d9683e6d55d42e090e292d13d2
Author:     Adrian Chadd <adrian@FreeBSD.org>
AuthorDate: 2024-12-04 06:26:09 +0000
Commit:     Adrian Chadd <adrian@FreeBSD.org>
CommitDate: 2024-12-14 02:17:40 +0000

    rtwn: update RTL8812AU/RTL8821AU receive path to include VHT info
    
    * RX frames with short-GI can be either HT or VHT
    * Add placeholders for RX VHT rate, PHY type, etc
    
    Differential Revision:  https://reviews.freebsd.org/D47902
---
 sys/dev/rtwn/rtl8812a/r12a_rx.c | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/sys/dev/rtwn/rtl8812a/r12a_rx.c b/sys/dev/rtwn/rtl8812a/r12a_rx.c
index 482e4ee38c81..805775033fd1 100644
--- a/sys/dev/rtwn/rtl8812a/r12a_rx.c
+++ b/sys/dev/rtwn/rtl8812a/r12a_rx.c
@@ -246,7 +246,8 @@ r12a_get_rx_stats(struct rtwn_softc *sc, struct ieee80211_rx_stats *rxs,
 			rxs->c_pktflags |= IEEE80211_RX_F_AMPDU_MORE;
 	}
 
-	if ((rxdw4 & R12A_RXDW4_SPLCP) && RTWN_RATE_IS_HT(rate))
+	if ((rxdw4 & R12A_RXDW4_SPLCP) &&
+	    (RTWN_RATE_IS_HT(rate) || RTWN_RATE_IS_VHT(rate)))
 		rxs->c_pktflags |= IEEE80211_RX_F_SHORTGI;
 
 	switch (MS(rxdw4, R12A_RXDW4_BW)) {
@@ -277,11 +278,14 @@ r12a_get_rx_stats(struct rtwn_softc *sc, struct ieee80211_rx_stats *rxs,
 				rxs->c_phytype = IEEE80211_RX_FP_11A;
 			else
 				rxs->c_phytype = IEEE80211_RX_FP_11G;
-		} else {
+		} else if (RTWN_RATE_IS_HT(rate)) {
 			if (is5ghz)
 				rxs->c_phytype = IEEE80211_RX_FP_11NA;
 			else
 				rxs->c_phytype = IEEE80211_RX_FP_11NG;
+		} else if (RTWN_RATE_IS_VHT(rate)) {
+			/* TODO: there's no FP_VHT_5GHZ yet */
+			rxs->c_phytype = IEEE80211_RX_FP_11NA;
 		}
 	}
 
@@ -292,11 +296,15 @@ r12a_get_rx_stats(struct rtwn_softc *sc, struct ieee80211_rx_stats *rxs,
 			rxs->c_pktflags |= IEEE80211_RX_F_CCK;
 		else
 			rxs->c_pktflags |= IEEE80211_RX_F_OFDM;
-	} else {	/* MCS0~15. */
-		/* TODO: VHT rates */
+	} else if (RTWN_RATE_IS_HT(rate)) {	/* MCS0~15. */
 		rxs->c_rate =
 		    IEEE80211_RATE_MCS | RTWN_RIDX_TO_MCS(rate);
 		rxs->c_pktflags |= IEEE80211_RX_F_HT;
+	} else if (RTWN_RATE_IS_VHT(rate)) {
+		/* XXX: need to revisit VHT rate representation */
+		rxs->c_vhtnss = (rate - RTWN_RIDX_VHT_MCS_SHIFT) / 10;
+		rxs->c_rate = (rate - RTWN_RIDX_VHT_MCS_SHIFT) % 10;
+		rxs->c_pktflags |= IEEE80211_RX_F_VHT;
 	}
 
 	/*