git: 3f62f8ef5e40 - main - iwn: 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 05:32:36 UTC
The branch main has been updated by adrian:

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

commit 3f62f8ef5e4001ba7a2a9324e10a508eea15b68c
Author:     Adrian Chadd <adrian@FreeBSD.org>
AuthorDate: 2024-11-25 23:13:32 +0000
Commit:     Adrian Chadd <adrian@FreeBSD.org>
CommitDate: 2024-12-03 05:31:39 +0000

    iwn: use ieee80211_ht_check_tx_shortgi_20() and ieee80211_ht_check_tx_shortgi_40()
    
    Use the new net80211 routines to check the node width and the
    local / node flags.
    
    This should be "more" correct than the previous code.
    
    Differential Revision: https://reviews.freebsd.org/D47750
    
    Reviewed by:    bz
---
 sys/dev/iwn/if_iwn.c | 15 +++++----------
 1 file changed, 5 insertions(+), 10 deletions(-)

diff --git a/sys/dev/iwn/if_iwn.c b/sys/dev/iwn/if_iwn.c
index 50d50fdc473c..db3eb37ced9e 100644
--- a/sys/dev/iwn/if_iwn.c
+++ b/sys/dev/iwn/if_iwn.c
@@ -2812,23 +2812,18 @@ iwn_rate_to_plcp(struct iwn_softc *sc, struct ieee80211_node *ni,
 		 */
 		plcp = IEEE80211_RV(rate) | IWN_RFLAG_MCS;
 
-		/*
-		 * XXX the following should only occur if both
-		 * the local configuration _and_ the remote node
-		 * advertise these capabilities.  Thus this code
-		 * may need fixing!
-		 */
-
 		/*
 		 * Set the channel width and guard interval.
+		 *
+		 * Take into account the local configuration and
+		 * the node/peer advertised abilities.
 		 */
 		if (IEEE80211_IS_CHAN_HT40(ni->ni_chan)) {
 			plcp |= IWN_RFLAG_HT40;
-			if (ni->ni_htcap & IEEE80211_HTCAP_SHORTGI40)
+			if (ieee80211_ht_check_tx_shortgi_40(ni))
 				plcp |= IWN_RFLAG_SGI;
-		} else if (ni->ni_htcap & IEEE80211_HTCAP_SHORTGI20) {
+		} else if (ieee80211_ht_check_tx_shortgi_20(ni))
 			plcp |= IWN_RFLAG_SGI;
-		}
 
 		/*
 		 * Ensure the selected rate matches the link quality