git: 848cb6b184fa - stable/15 - LinuxKPI: 802.11: add 11g check to lkpi_ic_getradiocaps()

From: Bjoern A. Zeeb <bz_at_FreeBSD.org>
Date: Mon, 29 Jun 2026 06:34:37 UTC
The branch stable/15 has been updated by bz:

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

commit 848cb6b184fab91315710ec755f31455684f3ecf
Author:     Bjoern A. Zeeb <bz@FreeBSD.org>
AuthorDate: 2026-06-22 00:10:22 +0000
Commit:     Bjoern A. Zeeb <bz@FreeBSD.org>
CommitDate: 2026-06-29 03:54:33 +0000

    LinuxKPI: 802.11: add 11g check to lkpi_ic_getradiocaps()
    
    Replace an early comment with code and add a (simplified) 11g check.
    We make use of the annotated bitrate flags we added (see
    lkpi_wiphy_band_annotate()) and check if on the 2GHz band there are
    any bitrates which are 11g.  Upon the first one found we do set the
    IEEE80211_MODE_11G to announce to net80211 that the 2.4Ghz channels
    may operate on 11g as well.
    
    Sponsored by:   The FreeBSD Foundation
    
    (cherry picked from commit d4a529ad0d5638ad3e8d27815948b0a7c4628e3f)
---
 sys/compat/linuxkpi/common/src/linux_80211.c | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/sys/compat/linuxkpi/common/src/linux_80211.c b/sys/compat/linuxkpi/common/src/linux_80211.c
index f1ed22efb2e9..24819a970431 100644
--- a/sys/compat/linuxkpi/common/src/linux_80211.c
+++ b/sys/compat/linuxkpi/common/src/linux_80211.c
@@ -6726,18 +6726,28 @@ lkpi_ic_getradiocaps(struct ieee80211com *ic, int maxchan,
 	if (hw->wiphy->bands[NL80211_BAND_2GHZ] != NULL)
 		nchans = hw->wiphy->bands[NL80211_BAND_2GHZ]->n_channels;
 	if (nchans > 0) {
+		struct ieee80211_supported_band *supband;
+
 		memset(bands, 0, sizeof(bands));
 		chan_flags = 0;
 		setbit(bands, IEEE80211_MODE_11B);
-		/* XXX-BZ unclear how to check for 11g. */
+
+		/* Check for 11g (simplified). */
+		supband = hw->wiphy->bands[NL80211_BAND_2GHZ];
+		for (i = 0; i < supband->n_bitrates; i++) {
+			if ((supband->bitrates[i].flags &
+			    IEEE80211_RATE_MANDATORY_G) != 0) {
+				setbit(bands, IEEE80211_MODE_11G);
+				break;
+			}
+		}
 
 		IMPROVE("the bitrates may have flags?");
-		setbit(bands, IEEE80211_MODE_11G);
 
 		lkpi_ic_getradiocaps_ht(ic, hw, bands, &chan_flags,
 		    NL80211_BAND_2GHZ);
 
-		channels = hw->wiphy->bands[NL80211_BAND_2GHZ]->channels;
+		channels = supband->channels;
 		for (i = 0; i < nchans && *n < maxchan; i++) {
 			uint32_t nflags = 0;
 			int cflags = chan_flags;