git: e1eff81ea99c - main - rtwn: use ieee80211_ht_check_tx_shortgi_20() and ieee80211_ht_check_tx_shortgi_40()

From: Adrian Chadd <adrian_at_FreeBSD.org>
Date: Tue, 03 Dec 2024 22:11:28 UTC
The branch main has been updated by adrian:

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

commit e1eff81ea99c1000ad74436a54c54ec9e777282a
Author:     Adrian Chadd <adrian@FreeBSD.org>
AuthorDate: 2024-11-25 23:20:42 +0000
Commit:     Adrian Chadd <adrian@FreeBSD.org>
CommitDate: 2024-12-03 22:10:49 +0000

    rtwn: use ieee80211_ht_check_tx_shortgi_20() and ieee80211_ht_check_tx_shortgi_40()
    
    Use the new net80211 routines rather than rolling our own.
    
    Differential Revision: https://reviews.freebsd.org/D47751
    
    Reviewed by: bz
---
 sys/dev/rtwn/rtl8192c/r92c_tx.c | 11 ++++-------
 sys/dev/rtwn/rtl8812a/r12a_tx.c | 13 ++++++-------
 2 files changed, 10 insertions(+), 14 deletions(-)

diff --git a/sys/dev/rtwn/rtl8192c/r92c_tx.c b/sys/dev/rtwn/rtl8192c/r92c_tx.c
index 15beca776b61..5c8b2e114727 100644
--- a/sys/dev/rtwn/rtl8192c/r92c_tx.c
+++ b/sys/dev/rtwn/rtl8192c/r92c_tx.c
@@ -171,15 +171,12 @@ static void
 r92c_tx_set_sgi(struct rtwn_softc *sc, void *buf, struct ieee80211_node *ni)
 {
 	struct r92c_tx_desc *txd = (struct r92c_tx_desc *)buf;
-	struct ieee80211vap *vap = ni->ni_vap;
 
-	if ((vap->iv_flags_ht & IEEE80211_FHT_SHORTGI20) &&	/* HT20 */
-	    (ni->ni_htcap & IEEE80211_HTCAP_SHORTGI20))
+	if (IEEE80211_IS_CHAN_HT40(ni->ni_chan)
+	    && ieee80211_ht_check_tx_shortgi_40(ni))
 		txd->txdw5 |= htole32(R92C_TXDW5_SGI);
-	else if (ni->ni_chan != IEEE80211_CHAN_ANYC &&		/* HT40 */
-	    IEEE80211_IS_CHAN_HT40(ni->ni_chan) &&
-	    (ni->ni_htcap & IEEE80211_HTCAP_SHORTGI40) &&
-	    (vap->iv_flags_ht & IEEE80211_FHT_SHORTGI40))
+	else if (IEEE80211_IS_CHAN_HT20(ni->ni_chan)
+	    && ieee80211_ht_check_tx_shortgi_20(ni))
 		txd->txdw5 |= htole32(R92C_TXDW5_SGI);
 }
 
diff --git a/sys/dev/rtwn/rtl8812a/r12a_tx.c b/sys/dev/rtwn/rtl8812a/r12a_tx.c
index 9e0d8e85c0cf..7a8a7d3679b1 100644
--- a/sys/dev/rtwn/rtl8812a/r12a_tx.c
+++ b/sys/dev/rtwn/rtl8812a/r12a_tx.c
@@ -199,15 +199,14 @@ static void
 r12a_tx_set_sgi(struct rtwn_softc *sc, void *buf, struct ieee80211_node *ni)
 {
 	struct r12a_tx_desc *txd = (struct r12a_tx_desc *)buf;
-	struct ieee80211vap *vap = ni->ni_vap;
 
-	if ((vap->iv_flags_ht & IEEE80211_FHT_SHORTGI20) &&	/* HT20 */
-	    (ni->ni_htcap & IEEE80211_HTCAP_SHORTGI20))
+	/* TODO: VHT 20/40/80 checks */
+
+	if (IEEE80211_IS_CHAN_HT40(ni->ni_chan)
+	    && ieee80211_ht_check_tx_shortgi_40(ni))
 		txd->txdw5 |= htole32(R12A_TXDW5_DATA_SHORT);
-	else if (ni->ni_chan != IEEE80211_CHAN_ANYC &&		/* HT40 */
-	    IEEE80211_IS_CHAN_HT40(ni->ni_chan) &&
-	    (ni->ni_htcap & IEEE80211_HTCAP_SHORTGI40) &&
-	    (vap->iv_flags_ht & IEEE80211_FHT_SHORTGI40))
+	else if (IEEE80211_IS_CHAN_HT20(ni->ni_chan)
+	    && ieee80211_ht_check_tx_shortgi_20(ni))
 		txd->txdw5 |= htole32(R12A_TXDW5_DATA_SHORT);
 }