From nobody Fri Apr 18 14:37:11 2025 X-Original-To: dev-commits-src-branches@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 4ZfHQw0Pbfz5stYN; Fri, 18 Apr 2025 14:37:12 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4ZfHQv3blVz3KZQ; Fri, 18 Apr 2025 14:37:11 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1744987031; 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=X8bAcCDBDAEv1nmYrSf0qd7SZr8wyNlhdeGCiykknMg=; b=EAH1YkcLUSL4wd5SgpG3aqpPF/qDEI11GSHTWJYut/sWcOf3LOrT2V9S4TyxYJlAeQcV2D quFK9ty+U1DbaRe3PntqXebxPqiUXo3AG7whyZ8BqfaLAShxz3uQEpCxNf/xizNnl7NkAo Yi0BgMZl+0o+mPgZgMo69rcFbRC7iBKLzMVjKWI5ZarX//qx5WdKJHSBeJmPq58GKOIaci SJDHLxYx046fJ5j4aG9gIScEt4ExzzgM3efrOde7kU/GZMr+qfClUmvWT0wYRkSLXz6h/b U5/0wjRCQjQBBHLBJ35z3GaxOp01en1WI71XWT4XGwpliikt8DboaWd6/TOpyQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1744987031; a=rsa-sha256; cv=none; b=cQ+qqKVuFTqg9NOQj2q4k8oMIe0dtDuvVQyZvUaqZuvHEXmCRki4Du+xgVW7M7YyjbJgHf rUyqXTOD2CRKLMGYZ80fdBBvr4sLCCWn3PFpPeJVH3kk9zgO+y4crPNJ8zB1O2nwYEAFjk gH7BRrrNURlSYRf2oSx4WgpYNaJmHXJDbhcAHAvh7coGD7wUaip1nPF+/ApaX6p/Vx7Ped qFsLGEQM8hpXkAFNf5c/FOGhKxMUI3mnu46uzC3QoUL/uVBF1p5fk0wvabJaXLlNZQTizy cyhKTDriDA1iQ6BCENlOxKD1IANx1G0U8QEkDAeKaFfg6BDz1pQHwMiqBwc25A== 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=1744987031; 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=X8bAcCDBDAEv1nmYrSf0qd7SZr8wyNlhdeGCiykknMg=; b=LQcRhKNWmrARk6nwhe7mcJ9+ExlLSUWiNbaXsY50o5LR1xtHt9gPLDjWhfB9X9BoUffsQU ELWv1NTHt42oMfV4u7JjHXtFLktRV/Z+Wm65Cmq5Zv/26ZebvJcQPyQYame3PBnXkbvkeq 5c+sndkHAZXL7UHnVExupJQzrf/fFAN9/oRoOhbNQAkWc75Q6d8vX6hWa5OU9fjkv2v23A +hZl1MobWw9IScGtFfLyjlz8uebV4zXHH+piWQseRs5GbirqO0Q5v3C0PFm1xVsDFO+8lt xxcVULV2l4kFGivZGdRdo2ICEWZTx9VFnEKrghKrCygy+f3RxaBMfYcWqzlQnw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4ZfHQv38wGzdtC; Fri, 18 Apr 2025 14:37:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 53IEbB4k091767; Fri, 18 Apr 2025 14:37:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 53IEbBHj091764; Fri, 18 Apr 2025 14:37:11 GMT (envelope-from git) Date: Fri, 18 Apr 2025 14:37:11 GMT Message-Id: <202504181437.53IEbBHj091764@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: 57764d222865 - stable/14 - LinuxKPI: 802.11: reduce code duplication introducing lkpi_remove_chanctx() List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@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/14 X-Git-Reftype: branch X-Git-Commit: 57764d222865c1182dd9bab55fda4e4c012ba56b Auto-Submitted: auto-generated The branch stable/14 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=57764d222865c1182dd9bab55fda4e4c012ba56b commit 57764d222865c1182dd9bab55fda4e4c012ba56b Author: Bjoern A. Zeeb AuthorDate: 2025-04-05 23:59:00 +0000 Commit: Bjoern A. Zeeb CommitDate: 2025-04-18 14:36:00 +0000 LinuxKPI: 802.11: reduce code duplication introducing lkpi_remove_chanctx() We have the same code three times, so factor it out into its own function to make it easier to maintain. Sponsored by: The FreeBSD Foundation PR: 280546 Tested by: Oleksandr Kryvulia (shuriku shurik.kiev.ua) Tested by: Oleg Nauman (oleg.nauman gmail.com) [rtw88] Differential Revision: https://reviews.freebsd.org/D49734 (cherry picked from commit 50d826be664ef35065e8c4c4966252f2dfde9cb9) --- sys/compat/linuxkpi/common/include/net/mac80211.h | 2 +- sys/compat/linuxkpi/common/src/linux_80211.c | 80 ++++++++--------------- 2 files changed, 30 insertions(+), 52 deletions(-) diff --git a/sys/compat/linuxkpi/common/include/net/mac80211.h b/sys/compat/linuxkpi/common/include/net/mac80211.h index 5c155a4c1cc8..95991dd2ac42 100644 --- a/sys/compat/linuxkpi/common/include/net/mac80211.h +++ b/sys/compat/linuxkpi/common/include/net/mac80211.h @@ -839,7 +839,7 @@ struct ieee80211_vif { bool probe_req_reg; uint8_t addr[ETH_ALEN]; struct ieee80211_vif_cfg cfg; - struct ieee80211_chanctx_conf *chanctx_conf; + struct ieee80211_chanctx_conf *chanctx_conf; /* XXX-BZ no longer used anywhere but in linuxkpi 802.11 internally; now in bss_conf per-link? */ struct ieee80211_txq *txq; struct ieee80211_bss_conf bss_conf; struct ieee80211_bss_conf *link_conf[IEEE80211_MLD_MAX_NUM_LINKS]; /* rcu? */ diff --git a/sys/compat/linuxkpi/common/src/linux_80211.c b/sys/compat/linuxkpi/common/src/linux_80211.c index 3d60404537e2..63a6328ebc74 100644 --- a/sys/compat/linuxkpi/common/src/linux_80211.c +++ b/sys/compat/linuxkpi/common/src/linux_80211.c @@ -1731,6 +1731,31 @@ lkpi_80211_flush_tx(struct lkpi_hw *lhw, struct lkpi_sta *lsta) } } + +static void +lkpi_remove_chanctx(struct ieee80211_hw *hw, struct ieee80211_vif *vif) +{ + /* Take the chan ctx down. */ + if (vif->chanctx_conf != NULL) { + struct lkpi_chanctx *lchanctx; + struct ieee80211_chanctx_conf *chanctx_conf; + + chanctx_conf = vif->chanctx_conf; + /* Remove vif context. */ + lkpi_80211_mo_unassign_vif_chanctx(hw, vif, &vif->bss_conf, &vif->chanctx_conf); + /* NB: vif->chanctx_conf is NULL now. */ + + lkpi_hw_conf_idle(hw, true); + + /* Remove chan ctx. */ + lkpi_80211_mo_remove_chanctx(hw, chanctx_conf); + vif->bss_conf.chanctx_conf = NULL; + lchanctx = CHANCTX_CONF_TO_LCHANCTX(chanctx_conf); + free(lchanctx, M_LKPI80211); + } +} + + /* -------------------------------------------------------------------------- */ static int @@ -1924,6 +1949,7 @@ lkpi_sta_scan_to_auth(struct ieee80211vap *vap, enum ieee80211_state nstate, int ic_printf(vap->iv_ic, "%s:%d: mo_assign_vif_chanctx " "failed: %d\n", __func__, __LINE__, error); lkpi_80211_mo_remove_chanctx(hw, chanctx_conf); + vif->bss_conf.chanctx_conf = NULL; lchanctx = CHANCTX_CONF_TO_LCHANCTX(chanctx_conf); free(lchanctx, M_LKPI80211); goto out; @@ -2157,23 +2183,7 @@ lkpi_sta_auth_to_scan(struct ieee80211vap *vap, enum ieee80211_state nstate, int /* conf_tx */ - /* Take the chan ctx down. */ - if (vif->chanctx_conf != NULL) { - struct lkpi_chanctx *lchanctx; - struct ieee80211_chanctx_conf *chanctx_conf; - - chanctx_conf = vif->chanctx_conf; - /* Remove vif context. */ - lkpi_80211_mo_unassign_vif_chanctx(hw, vif, &vif->bss_conf, &vif->chanctx_conf); - /* NB: vif->chanctx_conf is NULL now. */ - - lkpi_hw_conf_idle(hw, true); - - /* Remove chan ctx. */ - lkpi_80211_mo_remove_chanctx(hw, chanctx_conf); - lchanctx = CHANCTX_CONF_TO_LCHANCTX(chanctx_conf); - free(lchanctx, M_LKPI80211); - } + lkpi_remove_chanctx(hw, vif); out: LKPI_80211_LHW_UNLOCK(lhw); @@ -2501,23 +2511,7 @@ _lkpi_sta_assoc_to_down(struct ieee80211vap *vap, enum ieee80211_state nstate, i /* conf_tx */ - /* Take the chan ctx down. */ - if (vif->chanctx_conf != NULL) { - struct lkpi_chanctx *lchanctx; - struct ieee80211_chanctx_conf *chanctx_conf; - - chanctx_conf = vif->chanctx_conf; - /* Remove vif context. */ - lkpi_80211_mo_unassign_vif_chanctx(hw, vif, &vif->bss_conf, &vif->chanctx_conf); - /* NB: vif->chanctx_conf is NULL now. */ - - lkpi_hw_conf_idle(hw, true); - - /* Remove chan ctx. */ - lkpi_80211_mo_remove_chanctx(hw, chanctx_conf); - lchanctx = CHANCTX_CONF_TO_LCHANCTX(chanctx_conf); - free(lchanctx, M_LKPI80211); - } + lkpi_remove_chanctx(hw, vif); error = EALREADY; out: @@ -3117,23 +3111,7 @@ lkpi_sta_run_to_init(struct ieee80211vap *vap, enum ieee80211_state nstate, int /* conf_tx */ - /* Take the chan ctx down. */ - if (vif->chanctx_conf != NULL) { - struct lkpi_chanctx *lchanctx; - struct ieee80211_chanctx_conf *chanctx_conf; - - chanctx_conf = vif->chanctx_conf; - /* Remove vif context. */ - lkpi_80211_mo_unassign_vif_chanctx(hw, vif, &vif->bss_conf, &vif->chanctx_conf); - /* NB: vif->chanctx_conf is NULL now. */ - - lkpi_hw_conf_idle(hw, true); - - /* Remove chan ctx. */ - lkpi_80211_mo_remove_chanctx(hw, chanctx_conf); - lchanctx = CHANCTX_CONF_TO_LCHANCTX(chanctx_conf); - free(lchanctx, M_LKPI80211); - } + lkpi_remove_chanctx(hw, vif); error = EALREADY; out: