From nobody Wed Apr 22 21:08:41 2026 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4g1BfK3HKLz6bKvy for ; Wed, 22 Apr 2026 21:08:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R13" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4g1BfK14q5z3lBk for ; Wed, 22 Apr 2026 21:08:41 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1776892121; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=46LgQflwtUUxpjiMuzaMvLm9UoD30FyA2Ty+OchL/+w=; b=yM374cB2qjWZCBrfO0rpmmb8cW3EcnMOInFWGquuJNPZad6iw8ydgIoFyouexgSGnJCfyN HCte2l0M74CzfReyuO83P49qNmEQ6PejM6f5qD83fZNtNbNU6bUsCK7opYuCfBz32bd6YJ uQKL7FhJeSc0iyXFajGTpy5dFOlFDCd6IFWZpCQay0vyTDdN/kA3eeKtoZF8cjIVu1bTrs ktgUp/yTm2/ILY0q2cHfF0Cz39OQmPAW83PB6GFN83pvo1NuIfMmNYm+qoLjCxkb/en93z DotgWzTkVA7PYY84CUPK+Lyp9/CAQgf0gmEevgaZx9DCIKLV6XfxNxHq4ZONlg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1776892121; a=rsa-sha256; cv=none; b=UnI64ritcUyeOtwTbmtoXbEmiW+ItKMoi7c8KZnyvk/e1b2zwk1EuU6W/bbniDMrcDJ3i4 LuIO1CklSi9Mb0uUbOEOfPEJFd1ONWXSdvg3W/OFtIERBg8tu9t1fee8y+3DgolvPacn1W cuUoz27u1wOmxXs1bkCHOTm4qrg+UQRLQKr0uVuyyr3fjH5uYhkcpmhAXVsdyC339nliQG QSVXIRLg3LPl+vFIov032Zl4WNb43ZCWryJoFuBhUxYaVH4go42jytrCzjO2qY869ZDe+t JyyWbu7FE8yOk1/iVUDDSvU1TljFo2ETgryCKXIO7v68iVf7CTSIiGNx3Simsw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1776892121; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=46LgQflwtUUxpjiMuzaMvLm9UoD30FyA2Ty+OchL/+w=; b=ugArSYBHCKnCXu0K+2tmIm0iU9rAkOeOrrFB3p7sedIP1UgONH8A34UWaMIuWkkQUHUbcc +hW+Rt7OJ27+cOwpQJW10J6iCWdrTjjfbT/liRpbm29Gde02t7Ow/lIeZsFX+roYqPmX4u x/WtDugCKgAL2vrPuhBqRCPD7YWP07gXptOW3Ebxg+erjyzHNgdPJirJkrb9kh3rOkmIKR XNO4OZTz7g2eTlqClU5vvwO9CaT/hdETWfGW3cqpAL16IFjFPYxCKupStWV8SI0DSvxxxZ RxOG+D4tMj4CzF9kj1VDxk6Za8d7hqOOovcie6dU6aFG2EVzPz9iIADJIvleCg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4g1BfK0KW9zmyZ for ; Wed, 22 Apr 2026 21:08:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 26ff9 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Wed, 22 Apr 2026 21:08:41 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Bjoern A. Zeeb Subject: git: 157f09c63784 - stable/15 - LinuxKPI: 802.11: factor out chandef/chanctx initialization List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/stable/15 X-Git-Reftype: branch X-Git-Commit: 157f09c63784628fd0ac727bd9e4645be9bcf8f1 Auto-Submitted: auto-generated Date: Wed, 22 Apr 2026 21:08:41 +0000 Message-Id: <69e938d9.26ff9.7ba36564@gitrepo.freebsd.org> The branch stable/15 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=157f09c63784628fd0ac727bd9e4645be9bcf8f1 commit 157f09c63784628fd0ac727bd9e4645be9bcf8f1 Author: Bjoern A. Zeeb AuthorDate: 2026-01-03 20:10:24 +0000 Commit: Bjoern A. Zeeb CommitDate: 2026-04-22 20:57:04 +0000 LinuxKPI: 802.11: factor out chandef/chanctx initialization Factor out chandef and chanctx initialization from lkpi_sta_scan_to_auth(). This makes the code a lot more readable and prepares for the next steps that will re-use some of this. Sponsored by: The FreeBSD Foundation (cherry picked from commit 695f0f0d037a876fa27c0cdca9890e09fd75429e) --- sys/compat/linuxkpi/common/src/linux_80211.c | 117 ++++++++++++++++++--------- 1 file changed, 78 insertions(+), 39 deletions(-) diff --git a/sys/compat/linuxkpi/common/src/linux_80211.c b/sys/compat/linuxkpi/common/src/linux_80211.c index 01347586ef63..8bb5bd4201ef 100644 --- a/sys/compat/linuxkpi/common/src/linux_80211.c +++ b/sys/compat/linuxkpi/common/src/linux_80211.c @@ -766,6 +766,7 @@ lkpi_sta_sync_from_ni(struct ieee80211_hw *hw, struct ieee80211_vif *vif, lkpi_sync_chanctx_cw_from_rx_bw(hw, vif, sta); } +#if 0 static uint8_t lkpi_get_max_rx_chains(struct ieee80211_node *ni) { @@ -792,6 +793,7 @@ lkpi_get_max_rx_chains(struct ieee80211_node *ni) return (chains); } +#endif static void lkpi_lsta_dump(struct lkpi_sta *lsta, struct ieee80211_node *ni, @@ -2214,6 +2216,70 @@ lkpi_80211_flush_tx(struct lkpi_hw *lhw, struct lkpi_sta *lsta) } } +static void +lkpi_init_chandef(struct cfg80211_chan_def *chandef, + struct linuxkpi_ieee80211_channel *chan, struct ieee80211_channel *c, + bool can_ht) +{ + + cfg80211_chandef_create(chandef, chan, + (can_ht) ? NL80211_CHAN_HT20 : NL80211_CHAN_NO_HT); + chandef->center_freq1 = ieee80211_get_channel_center_freq1(c); + chandef->center_freq2 = ieee80211_get_channel_center_freq2(c); + + IMPROVE("Check ht/vht_cap from band not just chan? See lkpi_sta_sync_from_ni..."); +#ifdef LKPI_80211_HT + if (IEEE80211_IS_CHAN_HT(c)) { + if (IEEE80211_IS_CHAN_HT40(c)) + chandef->width = NL80211_CHAN_WIDTH_40; + else + chandef->width = NL80211_CHAN_WIDTH_20; + } +#endif +#ifdef LKPI_80211_VHT + if (IEEE80211_IS_CHAN_VHT_5GHZ(c)) { + if (IEEE80211_IS_CHAN_VHT80P80(c)) + chandef->width = NL80211_CHAN_WIDTH_80P80; + else if (IEEE80211_IS_CHAN_VHT160(c)) + chandef->width = NL80211_CHAN_WIDTH_160; + else if (IEEE80211_IS_CHAN_VHT80(c)) + chandef->width = NL80211_CHAN_WIDTH_80; + } +#endif +} + +static uint32_t +lkpi_init_chanctx_conf(struct ieee80211_hw *hw, + struct cfg80211_chan_def *chandef, + struct ieee80211_chanctx_conf *chanctx_conf) +{ + uint32_t changed; + + lockdep_assert_wiphy(hw->wiphy); + + changed = 0; + + chanctx_conf->rx_chains_static = 1; + chanctx_conf->rx_chains_dynamic = 1; + changed |= IEEE80211_CHANCTX_CHANGE_RX_CHAINS; + + if (chanctx_conf->radar_enabled != hw->conf.radar_enabled) { + chanctx_conf->radar_enabled = hw->conf.radar_enabled; + changed |= IEEE80211_CHANCTX_CHANGE_RADAR; + } + + chanctx_conf->def = *chandef; + changed |= IEEE80211_CHANCTX_CHANGE_WIDTH; + + /* One day we should figure this out; is for iwlwifi-only. */ + chanctx_conf->min_def = chanctx_conf->def; + changed |= IEEE80211_CHANCTX_CHANGE_MIN_WIDTH; + + /* chanctx_conf->ap = */ + + return (changed); +} + static void lkpi_remove_chanctx(struct ieee80211_hw *hw, struct ieee80211_vif *vif) @@ -2310,6 +2376,7 @@ static int lkpi_sta_scan_to_auth(struct ieee80211vap *vap, enum ieee80211_state nstate, int arg) { struct linuxkpi_ieee80211_channel *chan; + struct cfg80211_chan_def chandef; struct lkpi_chanctx *lchanctx; struct ieee80211_chanctx_conf *chanctx_conf; struct lkpi_hw *lhw; @@ -2322,7 +2389,7 @@ lkpi_sta_scan_to_auth(struct ieee80211vap *vap, enum ieee80211_state nstate, int struct ieee80211_prep_tx_info prep_tx_info; uint32_t changed; int error; - bool synched; + bool synched, can_ht; /* * In here we use vap->iv_bss until lvif->lvif_bss is set. @@ -2391,50 +2458,22 @@ lkpi_sta_scan_to_auth(struct ieee80211vap *vap, enum ieee80211_state nstate, int chanctx_conf = &lchanctx->chanctx_conf; } - chanctx_conf->rx_chains_static = 1; - chanctx_conf->rx_chains_dynamic = 1; - chanctx_conf->radar_enabled = - (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 = 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)) - chanctx_conf->def.width = NL80211_CHAN_WIDTH_40; - else - chanctx_conf->def.width = NL80211_CHAN_WIDTH_20; - } -#endif -#ifdef LKPI_80211_VHT - if (IEEE80211_IS_CHAN_VHT_5GHZ(ni->ni_chan)) { - if (IEEE80211_IS_CHAN_VHT80P80(ni->ni_chan)) - chanctx_conf->def.width = NL80211_CHAN_WIDTH_80P80; - 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)) - chanctx_conf->def.width = NL80211_CHAN_WIDTH_80; - } -#endif - chanctx_conf->rx_chains_dynamic = lkpi_get_max_rx_chains(ni); - /* Responder ... */ -#if 0 - chanctx_conf->min_def.chan = chanctx_conf->def.chan; - chanctx_conf->min_def.width = NL80211_CHAN_WIDTH_20_NOHT; -#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; + can_ht = (vap->iv_ic->ic_flags_ht & IEEE80211_FHT_HT) != 0; #else - chanctx_conf->min_def = chanctx_conf->def; + can_ht = false; #endif + lkpi_init_chandef(&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; + changed = lkpi_init_chanctx_conf(hw, &chandef, chanctx_conf); + + /* Responder ... */ /* Set bss info (bss_info_changed). */ bss_changed = 0;