git: aa2989738ab1 - main - LinuxKPI: 802.11: stop using hw_value on a channel

From: Bjoern A. Zeeb <bz_at_FreeBSD.org>
Date: Mon, 25 Aug 2025 09:54:09 UTC
The branch main has been updated by bz:

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

commit aa2989738ab1f1dae55702e2bf1d853f6fdcfdd0
Author:     Bjoern A. Zeeb <bz@FreeBSD.org>
AuthorDate: 2025-06-22 07:33:04 +0000
Commit:     Bjoern A. Zeeb <bz@FreeBSD.org>
CommitDate: 2025-08-25 09:54:03 +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
    MFC after:      3 days
---
 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 500c1c1d52eb..903061117fc3 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)