git: b2b6c2236b9c - main - rtwn: enable HT40 for RTL8821/RTL8812 series NICs

From: Adrian Chadd <adrian_at_FreeBSD.org>
Date: Sat, 07 Dec 2024 00:23:09 UTC
The branch main has been updated by adrian:

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

commit b2b6c2236b9cdd6d7946aee0132a5b7dd14f285c
Author:     Adrian Chadd <adrian@FreeBSD.org>
AuthorDate: 2024-12-03 06:26:43 +0000
Commit:     Adrian Chadd <adrian@FreeBSD.org>
CommitDate: 2024-12-07 00:22:39 +0000

    rtwn: enable HT40 for RTL8821/RTL8812 series NICs
    
    HT40 works fine in 2GHz and 5GHz modes in both 1 and 2 stream
    scenarios, so just enable it here.
    
    Differential Revision: https://reviews.freebsd.org/D47874
---
 sys/dev/rtwn/rtl8812a/usb/r12au_attach.c | 7 +++++++
 sys/dev/rtwn/rtl8821a/usb/r21au_attach.c | 7 +++++++
 2 files changed, 14 insertions(+)

diff --git a/sys/dev/rtwn/rtl8812a/usb/r12au_attach.c b/sys/dev/rtwn/rtl8812a/usb/r12au_attach.c
index 52a8e3d7ccf5..0c04c2d24b7b 100644
--- a/sys/dev/rtwn/rtl8812a/usb/r12au_attach.c
+++ b/sys/dev/rtwn/rtl8812a/usb/r12au_attach.c
@@ -173,6 +173,11 @@ r12au_adj_devcaps(struct rtwn_softc *sc)
 				 IEEE80211_HTC_TXLDPC;
 	}
 
+	ic->ic_htcaps |=
+	    IEEE80211_HTCAP_CHWIDTH40 /* 40 MHz channel width */
+	    | IEEE80211_HTCAP_SHORTGI40 /* short GI in 40MHz */
+	;
+
 	/* TODO: STBC, VHT etc */
 }
 
@@ -291,5 +296,7 @@ r12au_attach(struct rtwn_usb_softc *uc)
 	sc->ntxchains			= 2;
 	sc->nrxchains			= 2;
 
+	sc->sc_ht40			= 1;
+
 	r12a_attach_private(sc);
 }
diff --git a/sys/dev/rtwn/rtl8821a/usb/r21au_attach.c b/sys/dev/rtwn/rtl8821a/usb/r21au_attach.c
index 480b1ae36b11..9b648c067c2f 100644
--- a/sys/dev/rtwn/rtl8821a/usb/r21au_attach.c
+++ b/sys/dev/rtwn/rtl8821a/usb/r21au_attach.c
@@ -158,6 +158,11 @@ r21au_adj_devcaps(struct rtwn_softc *sc)
 	if (rs->rs_radar != 0)
 		ic->ic_caps |= IEEE80211_C_DFS;
 
+	ic->ic_htcaps |=
+	    IEEE80211_HTCAP_CHWIDTH40 /* 40 MHz channel width */
+	    | IEEE80211_HTCAP_SHORTGI40 /* short GI in 40MHz */
+	    ;
+
 	/* TODO: VHT */
 }
 
@@ -277,5 +282,7 @@ r21au_attach(struct rtwn_usb_softc *uc)
 	sc->ntxchains			= 1;
 	sc->nrxchains			= 1;
 
+	sc->sc_ht40			= 1;
+
 	r21a_attach_private(sc);
 }