git: b4688ce7454f - stable/14 - LinuxKPI: 802.11: stop using hw_value on a channel

From: Bjoern A. Zeeb <bz_at_FreeBSD.org>
Date: Fri, 16 Jan 2026 19:40:37 UTC
The branch stable/14 has been updated by bz:

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

commit b4688ce7454fd5324c2cd7e3743b21261592e18f
Author:     Bjoern A. Zeeb <bz@FreeBSD.org>
AuthorDate: 2025-06-22 07:33:04 +0000
Commit:     Bjoern A. Zeeb <bz@FreeBSD.org>
CommitDate: 2026-01-16 19:37:44 +0000

    LinuxKPI: 802.11: stop using hw_value on a channel
    
    During initial LinuxKPI 802.11 bringup looking at the usage in one
    driver I started using hw_value as an equivalent for ic_ieee.
    That is not correct.   Remove all usage but logging of hw_value
    from LinuxKPI 802.11 code and leave the field to the drivers.
    
    We have to go through some hoops to get the needed ic_ieee value
    but so be it.  At some point we may want to clear this up in
    net80211 (especially given we'll have to handle more per-band data
    in the future).
    
    Sponsored by:   The FreeBSD Foundation
    
    (cherry picked from commit aa2989738ab1f1dae55702e2bf1d853f6fdcfdd0)
---
 sys/compat/linuxkpi/common/src/linux_80211.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/sys/compat/linuxkpi/common/src/linux_80211.c b/sys/compat/linuxkpi/common/src/linux_80211.c
index 21c53e15bfb4..7461b5db940a 100644
--- a/sys/compat/linuxkpi/common/src/linux_80211.c
+++ b/sys/compat/linuxkpi/common/src/linux_80211.c
@@ -1179,7 +1179,7 @@ lkpi_find_lkpi80211_chan(struct lkpi_hw *lhw,
 
 	channels = hw->wiphy->bands[band]->channels;
 	for (i = 0; i < nchans; i++) {
-		if (channels[i].hw_value == c->ic_ieee)
+		if (channels[i].center_freq == c->ic_freq)
 			return (&channels[i]);
 	}
 
@@ -4371,7 +4371,6 @@ sw_scan:
 			struct ieee80211_channel *c;
 
 			c = ss->ss_chans[ss->ss_next + i];
-			lc->hw_value = c->ic_ieee;
 			lc->center_freq = c->ic_freq;	/* XXX */
 			/* lc->flags */
 			lc->band = lkpi_net80211_chan_to_nl80211_band(c);
@@ -4400,7 +4399,6 @@ sw_scan:
 			}
 		}
 #endif
-
 		hw_req->req.n_ssids = ssid_count;
 		if (hw_req->req.n_ssids > 0) {
 			ssids = (struct cfg80211_ssid *)lc;
@@ -5839,8 +5837,9 @@ lkpi_ic_getradiocaps(struct ieee80211com *ic, int maxchan,
 				cflags &= ~NET80211_CBW_FLAG_HT40;
 
 			error = ieee80211_add_channel_cbw(c, maxchan, n,
-			    channels[i].hw_value, channels[i].center_freq,
-			    channels[i].max_power,
+			    ieee80211_mhz2ieee(channels[i].center_freq,
+				lkpi_nl80211_band_to_net80211_band(channels[i].band)),
+			    channels[i].center_freq, channels[i].max_power,
 			    nflags, bands, cflags);
 			/* net80211::ENOBUFS: *n >= maxchans */
 			if (error != 0 && error != ENOBUFS)
@@ -5911,8 +5910,9 @@ lkpi_ic_getradiocaps(struct ieee80211com *ic, int maxchan,
 				cflags &= ~NET80211_CBW_FLAG_HT40;
 
 			error = ieee80211_add_channel_cbw(c, maxchan, n,
-			    channels[i].hw_value, channels[i].center_freq,
-			    channels[i].max_power,
+			    ieee80211_mhz2ieee(channels[i].center_freq,
+				lkpi_nl80211_band_to_net80211_band(channels[i].band)),
+			    channels[i].center_freq, channels[i].max_power,
 			    nflags, bands, cflags);
 			/* net80211::ENOBUFS: *n >= maxchans */
 			if (error != 0 && error != ENOBUFS)