From nobody Fri Apr 18 14:37:17 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 4ZfHR15zkpz5stWv; Fri, 18 Apr 2025 14:37:17 +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 4ZfHR11QCRz3KVM; Fri, 18 Apr 2025 14:37:17 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1744987037; 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=RKj8y1+36Qb4g5hLVPsq3nsZQwvZdEkCIPr8fxgavJk=; b=wKC/m/7o2Dcvs9gs3Hw4Crtl5R1OCRSOq5wb65QRFVzfjx3ZHsp2gw0UEwQlMTXKTle1/j lLnvjF5t/TVJaKz1M2SwCC/IHlP2vstcjwqxWtFLagnU7/7ZHh5ird+HdaKGwkFa/Uvsfh RXCBzKC/7BKZIQFTA9+wBW10ts5mmOfm9u3S2Bi4iIf0UD4ueZTxyyc+6+xgg0aI3ZsrMd yk1/cvrgZPnf/Pq90Cx4ZVae+4NoCkKXuJUdJwLJ0qDh7BDm9cJHrsLxTEUNi2SlnLXCnF i3QxKb9l1l9gUdkp1pArOa57zd+6OhFiIHd5b6OYQ1xM2nXIhxXmTJC+A/pXWQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1744987037; a=rsa-sha256; cv=none; b=BTV/o5obzv+diwqlGzRioLsIf9OEb6a4Btin9xnuofPmigHZUHVA2a2wcIJc1vVVHr939G 4IvPk1WNjCLV5IvSEbuANFF8J1d/50up4m2jkuoKFfnLbwTF+v2Wi437vs7XnlAV/UcJ7X 6eYzDFxB6uTl4GZ9TWo5OjIAMmSgwn7tKX01jsLsmRP1gBaNXDtVx1JWpndwPvhNuWD6Rd LYOQie9BF6MnnTqQ/qTg5o9w7v79mAZpUw09zKFKmWDwj5X446FQXWje8Re6akAkzoPIdL SfwAAzyX8d+QAE8xk6I23wrZu/RXW02UJDrc0L4K5nKGJJ2R5MXcBSf+AAX7GQ== 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=1744987037; 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=RKj8y1+36Qb4g5hLVPsq3nsZQwvZdEkCIPr8fxgavJk=; b=ilTAe0yDTxh345k22EbFm+uiyT5TevwQAVqkcEWGrkwZsoXCO7qSUABZXAa/mVkFLi0Qmg YyWIGzOpU3j9Cu3+7n63jJG+CPcDRoCaTrBeYb9Xzi7mV06MTmYbGDYgmSRCgUax5bOtEv 7xRnv61goyEjBZUk0pYYqMg6kWfLqMRzTzPEmAT06/iAyvke3O7Z+hLi7XYbmvdZvU3Iyc e15/IlLR//Ums4S8XDZGgPGx7N7ia4xnneKxpP7UhIXKq1K668fKmCmnL/tEr2e5nF50DD CvG33f4LajHxcFwu7a//cYWJvtYQSAnBe1Eup2jBqxtMxlcAz5O6csUQaiB7XA== 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 4ZfHR10rLNzf3s; Fri, 18 Apr 2025 14:37:17 +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 53IEbHqC091950; Fri, 18 Apr 2025 14:37:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 53IEbHEG091947; Fri, 18 Apr 2025 14:37:17 GMT (envelope-from git) Date: Fri, 18 Apr 2025 14:37:17 GMT Message-Id: <202504181437.53IEbHEG091947@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: becb074fdefc - stable/14 - LinuxKPI: 802.11: adjust vif->bss_conf.chanctx_conf to rcu accessors 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: becb074fdefc40cff3365746a1036843e16c09d6 Auto-Submitted: auto-generated The branch stable/14 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=becb074fdefc40cff3365746a1036843e16c09d6 commit becb074fdefc40cff3365746a1036843e16c09d6 Author: Bjoern A. Zeeb AuthorDate: 2025-04-08 19:25:03 +0000 Commit: Bjoern A. Zeeb CommitDate: 2025-04-18 14:36:01 +0000 LinuxKPI: 802.11: adjust vif->bss_conf.chanctx_conf to rcu accessors Adjust the init and lkpi_sta_scan_to_auth() chanctx_conf accesses to use rcu functions as needed. linuxkpi_ieee80211_iterate_chan_contexts() which is ieee80211_iter_chan_contexts_atomic() needs further work to get rid of the vif locks by keeping all chanctx_conf on a list in lhw. This will be done in a follow-up commit. 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 560708cbb0468bf1fd1834f4894a1326e88ff10e) --- sys/compat/linuxkpi/common/src/linux_80211.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/sys/compat/linuxkpi/common/src/linux_80211.c b/sys/compat/linuxkpi/common/src/linux_80211.c index 1eff90a1d93e..bd1e60928144 100644 --- a/sys/compat/linuxkpi/common/src/linux_80211.c +++ b/sys/compat/linuxkpi/common/src/linux_80211.c @@ -1844,8 +1844,9 @@ lkpi_sta_scan_to_auth(struct ieee80211vap *vap, enum ieee80211_state nstate, int LKPI_80211_LHW_LOCK(lhw); /* Add chanctx (or if exists, change it). */ - if (vif->bss_conf.chanctx_conf != NULL) { - chanctx_conf = vif->bss_conf.chanctx_conf; + chanctx_conf = rcu_dereference_protected(vif->bss_conf.chanctx_conf, + lockdep_is_held(&hw->wiphy->mtx)); + if (chanctx_conf != NULL) { lchanctx = CHANCTX_CONF_TO_LCHANCTX(chanctx_conf); IMPROVE("diff changes for changed, working on live copy, rcu"); } else { @@ -1920,7 +1921,7 @@ lkpi_sta_scan_to_auth(struct ieee80211vap *vap, enum ieee80211_state nstate, int bss_changed |= lkpi_update_dtim_tsf(vif, ni, vap, __func__, __LINE__); error = 0; - if (vif->bss_conf.chanctx_conf != NULL) { + if (vif->bss_conf.chanctx_conf == chanctx_conf) { changed = IEEE80211_CHANCTX_CHANGE_MIN_WIDTH; changed |= IEEE80211_CHANCTX_CHANGE_RADAR; changed |= IEEE80211_CHANCTX_CHANGE_RX_CHAINS; @@ -1941,7 +1942,7 @@ lkpi_sta_scan_to_auth(struct ieee80211vap *vap, enum ieee80211_state nstate, int goto out; } - vif->bss_conf.chanctx_conf = chanctx_conf; + rcu_assign_pointer(vif->bss_conf.chanctx_conf, chanctx_conf); /* Assign vif chanctx. */ if (error == 0) @@ -1953,7 +1954,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; + rcu_assign_pointer(vif->bss_conf.chanctx_conf, NULL); lchanctx = CHANCTX_CONF_TO_LCHANCTX(chanctx_conf); free(lchanctx, M_LKPI80211); goto out; @@ -3480,7 +3481,7 @@ lkpi_ic_vap_create(struct ieee80211com *ic, const char name[IFNAMSIZ], /* XXX-BZ hardcoded for now! */ #if 1 - vif->bss_conf.chanctx_conf = NULL; + RCU_INIT_POINTER(vif->bss_conf.chanctx_conf, NULL); vif->bss_conf.vif = vif; /* vap->iv_myaddr is not set until net80211::vap_setup or vap_attach. */ IEEE80211_ADDR_COPY(vif->bss_conf.addr, mac); @@ -5981,7 +5982,7 @@ linuxkpi_ieee80211_iterate_chan_contexts(struct ieee80211_hw *hw, TAILQ_FOREACH(lvif, &lhw->lvif_head, lvif_entry) { vif = LVIF_TO_VIF(lvif); - if (vif->bss_conf.chanctx_conf == NULL) + if (vif->bss_conf.chanctx_conf == NULL) /* XXX-BZ; FIXME see IMPROVE above. */ continue; lchanctx = CHANCTX_CONF_TO_LCHANCTX(vif->bss_conf.chanctx_conf);