aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrian Chadd <adrian@FreeBSD.org>2024-11-25 23:20:42 +0000
committerAdrian Chadd <adrian@FreeBSD.org>2024-12-03 22:46:46 +0000
commit6749f059a586ff62f2909134c4f4599c82fabc5e (patch)
tree0adfd6f772c1183405715ca3bc9b4f7b1408b121
parent49a7f2b31329b7bf9d986f1ae1f8a2c5397c6563 (diff)
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
-rw-r--r--sys/dev/rtwn/rtl8192c/r92c_tx.c20
-rw-r--r--sys/dev/rtwn/rtl8812a/r12a_tx.c20
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