git: 351356090998 - main - rtwn: use ieee80211_ht_check_tx_ht40() to transmit HT40 frames

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

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

commit 3513560909981a349c6edfca44fa2656b7eefeb5
Author:     Adrian Chadd <adrian@FreeBSD.org>
AuthorDate: 2024-12-02 07:13:40 +0000
Commit:     Adrian Chadd <adrian@FreeBSD.org>
CommitDate: 2024-12-07 00:22:32 +0000

    rtwn: use ieee80211_ht_check_tx_ht40() to transmit HT40 frames
    
    Using ieee80211_ht_check_tx_ht40() means that not only the
    bss and node channel are checked, but the ni_chw value is also
    now correctly checked.
    
    Differential Revision:  https://reviews.freebsd.org/D47862
---
 sys/dev/rtwn/rtl8192c/r92c_tx.c | 3 +--
 sys/dev/rtwn/rtl8812a/r12a_tx.c | 7 +++----
 2 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/sys/dev/rtwn/rtl8192c/r92c_tx.c b/sys/dev/rtwn/rtl8192c/r92c_tx.c
index a3e92e1b7ebb..8a4c6581832b 100644
--- a/sys/dev/rtwn/rtl8192c/r92c_tx.c
+++ b/sys/dev/rtwn/rtl8192c/r92c_tx.c
@@ -66,8 +66,7 @@ r92c_tx_set_ht40(struct rtwn_softc *sc, void *buf, struct ieee80211_node *ni)
 {
 	struct r92c_tx_desc *txd = (struct r92c_tx_desc *)buf;
 
-	if (ni->ni_chan != IEEE80211_CHAN_ANYC &&
-	    IEEE80211_IS_CHAN_HT40(ni->ni_chan)) {
+	if (ieee80211_ht_check_tx_ht40(ni)) {
 		int extc_offset;
 
 		extc_offset = r92c_tx_get_sco(sc, ni->ni_chan);
diff --git a/sys/dev/rtwn/rtl8812a/r12a_tx.c b/sys/dev/rtwn/rtl8812a/r12a_tx.c
index e6b5111063f7..8b16be17f8eb 100644
--- a/sys/dev/rtwn/rtl8812a/r12a_tx.c
+++ b/sys/dev/rtwn/rtl8812a/r12a_tx.c
@@ -59,7 +59,7 @@
 static int
 r12a_get_primary_channel(struct rtwn_softc *sc, struct ieee80211_channel *c)
 {
-	/* XXX 80 MHz */
+	/* XXX VHT80; VHT40 */
 	if (IEEE80211_IS_CHAN_HT40U(c))
 		return (R12A_TXDW5_PRIM_CHAN_20_80_2);
 	else
@@ -71,9 +71,8 @@ r12a_tx_set_ht40(struct rtwn_softc *sc, void *buf, struct ieee80211_node *ni)
 {
 	struct r12a_tx_desc *txd = (struct r12a_tx_desc *)buf;
 
-	/* XXX 80 Mhz */
-	if (ni->ni_chan != IEEE80211_CHAN_ANYC &&
-	    IEEE80211_IS_CHAN_HT40(ni->ni_chan)) {
+	/* XXX VHT80; VHT40; VHT20 */
+	if (ieee80211_ht_check_tx_ht40(ni)) {
 		int prim_chan;
 
 		prim_chan = r12a_get_primary_channel(sc, ni->ni_chan);