The branch main has been updated by adrian:

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

commit 6749f059a586ff62f2909134c4f4599c82fabc5e
Author:     Adrian Chadd <[email protected]>
AuthorDate: 2024-11-25 23:20:42 +0000
Commit:     Adrian Chadd <[email protected]>
CommitDate: 2024-12-03 22:46:46 +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.
    
    (The first version of this diff landed a previous version of what was
    reviewed, so this brings it up to what was finally accepted in the
    review.)
    
    Differential Revision: https://reviews.freebsd.org/D47751
    
    Reviewed by:    bz
---
 sys/dev/rtwn/rtl8192c/r92c_tx.c | 20 ++++++++++++++------
 sys/dev/rtwn/rtl8812a/r12a_tx.c | 20 ++++++++++++++------
 2 files changed, 28 insertions(+), 12 deletions(-)

diff --git a/sys/dev/rtwn/rtl8192c/r92c_tx.c b/sys/dev/rtwn/rtl8192c/r92c_tx.c
index 5c8b2e114727..b8c26d861a14 100644
--- a/sys/dev/rtwn/rtl8192c/r92c_tx.c
+++ b/sys/dev/rtwn/rtl8192c/r92c_tx.c
@@ -172,12 +172,20 @@ r92c_tx_set_sgi(struct rtwn_softc *sc, void *buf, struct 
ieee80211_node *ni)
 {
        struct r92c_tx_desc *txd = (struct r92c_tx_desc *)buf;
 
-       if (IEEE80211_IS_CHAN_HT40(ni->ni_chan)
-           && ieee80211_ht_check_tx_shortgi_40(ni))
-               txd->txdw5 |= htole32(R92C_TXDW5_SGI);
-       else if (IEEE80211_IS_CHAN_HT20(ni->ni_chan)
-           && ieee80211_ht_check_tx_shortgi_20(ni))
-               txd->txdw5 |= htole32(R92C_TXDW5_SGI);
+       /*
+        * Only enable short-GI if we're transmitting in that
+        * width to that node.
+        *
+        * Specifically, do not enable shortgi for 20MHz if
+        * we're attempting to transmit at 40MHz.
+        */
+       if (ieee80211_ht_check_tx_ht40(ni)) {
+               if (ieee80211_ht_check_tx_shortgi_40(ni))
+                       txd->txdw5 |= htole32(R92C_TXDW5_SGI);
+       } else if (ieee80211_ht_check_tx_ht(ni)) {
+               if (ieee80211_ht_check_tx_shortgi_20(ni))
+                       txd->txdw5 |= htole32(R92C_TXDW5_SGI);
+       }
 }
 
 void
diff --git a/sys/dev/rtwn/rtl8812a/r12a_tx.c b/sys/dev/rtwn/rtl8812a/r12a_tx.c
index 7a8a7d3679b1..8cee2a16fbd5 100644
--- a/sys/dev/rtwn/rtl8812a/r12a_tx.c
+++ b/sys/dev/rtwn/rtl8812a/r12a_tx.c
@@ -202,12 +202,20 @@ r12a_tx_set_sgi(struct rtwn_softc *sc, void *buf, struct 
ieee80211_node *ni)
 
        /* 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 (IEEE80211_IS_CHAN_HT20(ni->ni_chan)
-           && ieee80211_ht_check_tx_shortgi_20(ni))
-               txd->txdw5 |= htole32(R12A_TXDW5_DATA_SHORT);
+       /*
+        * Only enable short-GI if we're transmitting in that
+        * width to that node.
+        *
+        * Specifically, do not enable shortgi for 20MHz if
+        * we're attempting to transmit at 40MHz.
+        */
+       if (ieee80211_ht_check_tx_ht40(ni)) {
+               if (ieee80211_ht_check_tx_shortgi_40(ni))
+                       txd->txdw5 |= htole32(R12A_TXDW5_DATA_SHORT);
+       } else if (ieee80211_ht_check_tx_ht(ni)) {
+               if (ieee80211_ht_check_tx_shortgi_20(ni))
+                       txd->txdw5 |= htole32(R12A_TXDW5_DATA_SHORT);
+       }
 }
 
 static void

Reply via email to