The branch main has been updated by bz:

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

commit 90d8e307ff610f20dccffe038353affbad0c374e
Author:     Bjoern A. Zeeb <b...@freebsd.org>
AuthorDate: 2025-02-24 01:42:31 +0000
Commit:     Bjoern A. Zeeb <b...@freebsd.org>
CommitDate: 2025-02-24 01:42:31 +0000

    LinuxKPI: 802.11: cleanup chanctx freq/width settings
    
    Cleanup chanctx freq1/2 and width settings using the channel from the
    net80211 node and the net80211 functions to return the center
    frequencies (already doing the math for us or using pre-computed values).
    
    Set the min_def (minimum channel definition) to def (channel definition)
    for the moment as it seems to be unused by anything but
    iwl_mvm_chanctx_def() to avoid complications.
    
    Sponsored by:   The FreeBSD Foundation
    MFC after:      3 days
---
 sys/compat/linuxkpi/common/src/linux_80211.c | 43 +++++++++++++---------------
 1 file changed, 20 insertions(+), 23 deletions(-)

diff --git a/sys/compat/linuxkpi/common/src/linux_80211.c 
b/sys/compat/linuxkpi/common/src/linux_80211.c
index b53d8eaa7925..6d6d14e06a57 100644
--- a/sys/compat/linuxkpi/common/src/linux_80211.c
+++ b/sys/compat/linuxkpi/common/src/linux_80211.c
@@ -1732,39 +1732,45 @@ lkpi_sta_scan_to_auth(struct ieee80211vap *vap, enum 
ieee80211_state nstate, int
            (chan->flags & IEEE80211_CHAN_RADAR) ? true : false;
        chanctx_conf->def.chan = chan;
        chanctx_conf->def.width = NL80211_CHAN_WIDTH_20_NOHT;
-       chanctx_conf->def.center_freq1 = chan->center_freq;
-       chanctx_conf->def.center_freq2 = 0;
+       chanctx_conf->def.center_freq1 = 
ieee80211_get_channel_center_freq1(ni->ni_chan);
+       chanctx_conf->def.center_freq2 = 
ieee80211_get_channel_center_freq2(ni->ni_chan);
        IMPROVE("Check vht_cap from band not just chan?");
        KASSERT(ni->ni_chan != NULL && ni->ni_chan != IEEE80211_CHAN_ANYC,
           ("%s:%d: ni %p ni_chan %p\n", __func__, __LINE__, ni, ni->ni_chan));
 #ifdef LKPI_80211_HT
        if (IEEE80211_IS_CHAN_HT(ni->ni_chan)) {
-               if (IEEE80211_IS_CHAN_HT40(ni->ni_chan)) {
+               if (IEEE80211_IS_CHAN_HT40(ni->ni_chan))
                        chanctx_conf->def.width = NL80211_CHAN_WIDTH_40;
-               } else
+               else
                        chanctx_conf->def.width = NL80211_CHAN_WIDTH_20;
        }
 #endif
 #ifdef LKPI_80211_VHT
        if (IEEE80211_IS_CHAN_VHT(ni->ni_chan)) {
 #ifdef __notyet__
-               if (IEEE80211_IS_CHAN_VHT80P80(ni->ni_chan)) {
+               if (IEEE80211_IS_CHAN_VHT80P80(ni->ni_chan))
                        chanctx_conf->def.width = NL80211_CHAN_WIDTH_80P80;
-                       chanctx_conf->def.center_freq2 = 0;     /* XXX */
-               } else
-#endif
-               if (IEEE80211_IS_CHAN_VHT160(ni->ni_chan))
+               else if (IEEE80211_IS_CHAN_VHT160(ni->ni_chan))
                        chanctx_conf->def.width = NL80211_CHAN_WIDTH_160;
-               else if (IEEE80211_IS_CHAN_VHT80(ni->ni_chan))
+               else
+#endif
+               if (IEEE80211_IS_CHAN_VHT80(ni->ni_chan))
                        chanctx_conf->def.width = NL80211_CHAN_WIDTH_80;
        }
 #endif
        /* Responder ... */
-       chanctx_conf->min_def.chan = chan;
+#if 0
+       chanctx_conf->min_def.chan = chanctx_conf->def.chan;
        chanctx_conf->min_def.width = NL80211_CHAN_WIDTH_20_NOHT;
-       chanctx_conf->min_def.center_freq1 = chan->center_freq;
-       chanctx_conf->min_def.center_freq2 = 0;
-       IMPROVE("currently 20_NOHT min_def only");
+#ifdef LKPI_80211_HT
+       if (IEEE80211_IS_CHAN_HT(ni->ni_chan) || 
IEEE80211_IS_CHAN_VHT(ni->ni_chan))
+               chanctx_conf->min_def.width = NL80211_CHAN_WIDTH_20;
+#endif
+       chanctx_conf->min_def.center_freq1 = chanctx_conf->def.center_freq1;
+       chanctx_conf->min_def.center_freq2 = chanctx_conf->def.center_freq2;
+#else
+       chanctx_conf->min_def = chanctx_conf->def;
+#endif
 
        /* Set bss info (bss_info_changed). */
        bss_changed = 0;
@@ -1797,15 +1803,6 @@ lkpi_sta_scan_to_auth(struct ieee80211vap *vap, enum 
ieee80211_state nstate, int
                        vif->bss_conf.chanreq.oper.width = 
chanctx_conf->def.width;
                        vif->bss_conf.chanreq.oper.center_freq1 =
                            chanctx_conf->def.center_freq1;
-#ifdef LKPI_80211_HT
-                       if (vif->bss_conf.chanreq.oper.width == 
NL80211_CHAN_WIDTH_40) {
-                               /* Note: it is 10 not 20. */
-                               if (IEEE80211_IS_CHAN_HT40U(ni->ni_chan))
-                                       vif->bss_conf.chanreq.oper.center_freq1 
+= 10;
-                               else if (IEEE80211_IS_CHAN_HT40D(ni->ni_chan))
-                                       vif->bss_conf.chanreq.oper.center_freq1 
-= 10;
-                       }
-#endif
                        vif->bss_conf.chanreq.oper.center_freq2 =
                            chanctx_conf->def.center_freq2;
                } else {

Reply via email to