Date: Wed, 22 Apr 2026 21:08:47 +0000 From: Bjoern A. Zeeb <bz@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: git: 222fee361c66 - stable/15 - LinuxKPI: 802.11: add chandef tracing Message-ID: <69e938df.2767c.84dba55@gitrepo.freebsd.org>
index | next in thread | raw e-mail
The branch stable/15 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=222fee361c66b140e0a2d09a8e43eabd05389b29 commit 222fee361c66b140e0a2d09a8e43eabd05389b29 Author: Bjoern A. Zeeb <bz@FreeBSD.org> AuthorDate: 2026-04-03 19:59:02 +0000 Commit: Bjoern A. Zeeb <bz@FreeBSD.org> CommitDate: 2026-04-22 20:57:06 +0000 LinuxKPI: 802.11: add chandef tracing Add chandef tracing so we can follow what is set and unset in the chanctx emulation for drivers still needing this. Sponsored by: The FreeBSD Foundation (cherry picked from commit 72b9dda511b6944068fb18c2f2e059bca48d9edd) --- sys/compat/linuxkpi/common/src/linux_80211.c | 79 ++++++++++++++++++++++++++-- sys/compat/linuxkpi/common/src/linux_80211.h | 1 + 2 files changed, 77 insertions(+), 3 deletions(-) diff --git a/sys/compat/linuxkpi/common/src/linux_80211.c b/sys/compat/linuxkpi/common/src/linux_80211.c index c2f2adfc7053..e1a3daf98cb2 100644 --- a/sys/compat/linuxkpi/common/src/linux_80211.c +++ b/sys/compat/linuxkpi/common/src/linux_80211.c @@ -2219,7 +2219,8 @@ lkpi_80211_flush_tx(struct lkpi_hw *lhw, struct lkpi_sta *lsta) } static void -lkpi_init_chandef(struct cfg80211_chan_def *chandef, +lkpi_init_chandef(struct ieee80211com *ic __unused, + struct cfg80211_chan_def *chandef, struct linuxkpi_ieee80211_channel *chan, struct ieee80211_channel *c, bool can_ht) { @@ -2248,6 +2249,17 @@ lkpi_init_chandef(struct cfg80211_chan_def *chandef, chandef->width = NL80211_CHAN_WIDTH_80; } #endif + +#ifdef LINUXKPI_DEBUG_80211 + if ((linuxkpi_debug_80211 & D80211_CHANDEF) != 0) + ic_printf(ic, "%s:%d: chandef %p { chan %p { %u }, " + "width %d cfreq1 %u cfreq2 %u punctured %u }\n", + __func__, __LINE__, chandef, + chandef->chan, chandef->chan->center_freq, + chandef->width, + chandef->center_freq1, chandef->center_freq2, + chandef->punctured); +#endif } static uint32_t @@ -2587,11 +2599,18 @@ lkpi_sta_scan_to_auth(struct ieee80211vap *vap, enum ieee80211_state nstate, int #else can_ht = false; #endif - lkpi_init_chandef(&chandef, chan, ni->ni_chan, can_ht); + lkpi_init_chandef(vap->iv_ic, &chandef, chan, ni->ni_chan, can_ht); hw->conf.radar_enabled = ((chan->flags & IEEE80211_CHAN_RADAR) != 0) ? true : false; hw->conf.chandef = chandef; vif->bss_conf.chanreq.oper = hw->conf.chandef; +#ifdef LINUXKPI_DEBUG_80211 + if ((linuxkpi_debug_80211 & D80211_CHANDEF) != 0) + ic_printf(vap->iv_ic, "%s:%d: hw->conf.chandef %p = chandef %p = " + "vif->bss_conf.chanreq.oper %p\n", __func__, __LINE__, + &hw->conf.chandef, &chandef, &vif->bss_conf.chanreq.oper); +#endif + changed = lkpi_init_chanctx_conf(hw, &chandef, chanctx_conf); /* Responder ... */ @@ -5205,6 +5224,11 @@ lkpi_ic_set_channel(struct ieee80211com *ic) /* We always set the chandef to no-HT for scanning. */ cfg80211_chandef_create(&lhw->scan_chandef, chan, NL80211_CHAN_NO_HT); +#ifdef LINUXKPI_DEBUG_80211 + if ((linuxkpi_debug_80211 & D80211_CHANDEF) != 0) + ic_printf(ic, "%s:%d: initialized lhw->scan_chandef\n", + __func__, __LINE__); +#endif /* * This works for as long as we do not do BGSCANs; otherwise @@ -5232,7 +5256,7 @@ lkpi_ic_set_channel(struct ieee80211com *ic) }; struct cfg80211_chan_def chandef; - lkpi_init_chandef(&chandef, chan, c, false); + lkpi_init_chandef(ic, &chandef, chan, c, false); ieee80211_iter_chan_contexts_mtx(hw, lkpi_ic_set_channel_chanctx_iterf, &chanctx_iter_arg); @@ -5252,6 +5276,11 @@ lkpi_ic_set_channel(struct ieee80211com *ic) lvif = VAP_TO_LVIF(vap); vif = LVIF_TO_VIF(lvif); +#ifdef LINUXKPI_DEBUG_80211 + if ((linuxkpi_debug_80211 & D80211_CHANDEF) != 0) + ic_printf(ic, "%s:%d: using on stack chandef\n", + __func__, __LINE__); +#endif chanctx_conf = lkpi_get_chanctx_conf(hw, vif); changed = lkpi_init_chanctx_conf(hw, &chandef, chanctx_conf); IMPROVE("update HT, VHT, bw, ..."); @@ -5264,6 +5293,12 @@ lkpi_ic_set_channel(struct ieee80211com *ic) */ IMPROVE("update HT, VHT, bw, ..."); +#ifdef LINUXKPI_DEBUG_80211 + if ((linuxkpi_debug_80211 & D80211_CHANDEF) != 0) + ic_printf(ic, "%s:%d: using on stack chandef\n", + __func__, __LINE__); +#endif + chanctx_conf = chanctx_iter_arg.chanctx_conf; changed = lkpi_init_chanctx_conf(hw, &chandef, chanctx_conf); lkpi_80211_mo_change_chanctx(hw, chanctx_conf, changed); @@ -7073,6 +7108,12 @@ linuxkpi_ieee80211_ifattach(struct ieee80211_hw *hw) #endif NL80211_CHAN_NO_HT); lhw->dflt_chandef = hw->conf.chandef; +#ifdef LINUXKPI_DEBUG_80211 + if ((linuxkpi_debug_80211 & D80211_CHANDEF) != 0) + ic_printf(ic, "%s:%d: initialized " + "hw->conf.chandef and dflt_chandef to %p\n", + __func__, __LINE__, &lhw->dflt_chandef); +#endif break; } } @@ -9334,11 +9375,26 @@ lkpi_80211_update_chandef(struct ieee80211_hw *hw, * scan_chandef should have a channel set. */ if (lhw->scan_chandef.chan != NULL) { +#ifdef LINUXKPI_DEBUG_80211 + if ((linuxkpi_debug_80211 & D80211_CHANDEF) != 0) + ic_printf(lhw->ic, "%s:%d: using scan_chandef %p\n", + __func__, __LINE__, &lhw->scan_chandef); +#endif cd = &lhw->scan_chandef; } else { +#ifdef LINUXKPI_DEBUG_80211 + if ((linuxkpi_debug_80211 & D80211_CHANDEF) != 0) + ic_printf(lhw->ic, "%s:%d: using dflt_chandef %p\n", + __func__, __LINE__, &lhw->dflt_chandef); +#endif cd = &lhw->dflt_chandef; } } else { +#ifdef LINUXKPI_DEBUG_80211 + if ((linuxkpi_debug_80211 & D80211_CHANDEF) != 0) + ic_printf(lhw->ic, "%s:%d: using chanctx %p chandef %p\n", + __func__, __LINE__, new, &new->def); +#endif cd = &new->def; } @@ -9351,6 +9407,23 @@ lkpi_80211_update_chandef(struct ieee80211_hw *hw, } IMPROVE("IEEE80211_CONF_CHANGE_PS, IEEE80211_CONF_CHANGE_POWER"); +#ifdef LINUXKPI_DEBUG_80211 + if ((linuxkpi_debug_80211 & D80211_CHANDEF) != 0) + ic_printf(lhw->ic, "%s:%d: chanctx %p { %u } cd %p { %u } " + "hw->conf.chandef %p { %u %d %u %u %u }, " + "changed %#04x same %d\n", + __func__, __LINE__, + new, (new != NULL && new->def.chan != NULL) ? + new->def.chan->center_freq : 0, + cd, cd->chan->center_freq, + &hw->conf.chandef, hw->conf.chandef.chan->center_freq, + hw->conf.chandef.width, + hw->conf.chandef.center_freq1, + hw->conf.chandef.center_freq2, + hw->conf.chandef.punctured, + changed, same); +#endif + if (changed == 0) return (0); diff --git a/sys/compat/linuxkpi/common/src/linux_80211.h b/sys/compat/linuxkpi/common/src/linux_80211.h index 235597ea7a94..569c4f12f6d6 100644 --- a/sys/compat/linuxkpi/common/src/linux_80211.h +++ b/sys/compat/linuxkpi/common/src/linux_80211.h @@ -57,6 +57,7 @@ #define D80211_IMPROVE 0x00000002 #endif #define D80211_IMPROVE_TXQ 0x00000004 +#define D80211_CHANDEF 0x00000008 #define D80211_TRACE 0x00000010 #define D80211_TRACEOK 0x00000020 #define D80211_SCAN 0x00000040home | help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?69e938df.2767c.84dba55>
