From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 33146340412 for ; Thu, 2 Jul 2026 18:06:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783015583; cv=none; b=MfjAMy4XE//Urr7zdrD9hqEuvbGTmd01RDtf0/7S9hea/bZ7z9ZljZscAgKfUBsb5RvivDo27djqrGMkt9tPE8UFPzoPD92nIHtRBvx09ljrhaudMffh0WzbFfSarsy2o4Cd6h9Q9mlqZcNX3izrzPHUZvABl+nauBJynzeZoks= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783015583; c=relaxed/simple; bh=zWJEmjyvqcMyeuzV8tn7G0eL/VomiTr+4CoSU0Dx8KU=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=hhqze3+M7h5SRWKO8t9v3SaWPPpytujgw6jwQk3TbSy6GnJzeOuQo2+EmlLlsrSX34p0stjxIM0mjA0lm8bxlOGUq8j/Vlp10wmUpvWGBu5BHNjg88vZDwEfZ7hx+o7NE2Tx4Q/4uWJza7OI8jda0XN++NMGpOVVBDlPJO+Cisk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=DSxXa9j4; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=HcXisEQC; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="DSxXa9j4"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="HcXisEQC" Received: from pps.filterd (m0279863.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 662E3Mpb671629 for ; Thu, 2 Jul 2026 18:06:21 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= NiePhak0dMAegnCxGrFfwKb+IHV27vZ4JEKE5uV61kc=; b=DSxXa9j4COb6M8/T D2IiS5GmOs2+NrEqSXVaY8OrF88Dt2YszNIZBc2b4df91iB5OoUXSELXdgwDYf8U x3F86PCpcYi1YWqyGNMJbMWdDzBITL/uvdfNDRn0p+nusu1EiJ2hR2c79QQVcYLg 78eaUQpW5nB/DxVrCMRKiEz/LIlksWXiJcsfU+3y2qjzMfkzGTClCDChhKiuqJOj w8P4L6dXJ3wNoQWJT474AOsA63egDwvMBi3NJHo3UIU3hQicBx8/vmcEnYu16lKn iTm6+j0f7NtyZ8YQXtCXd6xVRVJUM6PnzgtSjJ97Yne6YntgDQJmz+6BvsM5ZBVM y6kGDw== Received: from mail-pg1-f199.google.com (mail-pg1-f199.google.com [209.85.215.199]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4f5h7nb90w-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Thu, 02 Jul 2026 18:06:21 +0000 (GMT) Received: by mail-pg1-f199.google.com with SMTP id 41be03b00d2f7-c889d1eebafso3973130a12.0 for ; Thu, 02 Jul 2026 11:06:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1783015581; x=1783620381; darn=vger.kernel.org; h=content-transfer-encoding:content-type:in-reply-to:content-language :from:references:cc:to:subject:user-agent:mime-version:date :message-id:from:to:cc:subject:date:message-id:reply-to:content-type; bh=NiePhak0dMAegnCxGrFfwKb+IHV27vZ4JEKE5uV61kc=; b=HcXisEQCN2Nl5C7UWQ/g0i4PAfJ1Rc+7IJX+rlXayGidFpBtbQutg3DCR3USPlFgZ4 r3nw0zDHetFIEvPpdF0fUvQ1PxUG+fYnlTcBj8DbItpe01KncwO/TwydzeFYoarQb/ZP ABHFUsIybYt4nIaU/BsawmvUsxRlsneI8AoRRJinxlN9jqRRMuJwYfrD9QpODjerqKYY 3Qui0YkRRbCBp/2kFQmGhszYV/bkfFg2MHxSsGy4+njRmgizG6YNYeprsMuZQ+2AYw8r HrmphaM6evbWiP+cs6WZKV4vtuy+/FgNv2pRhQGoKTvnmimD2rNKDHpfPsYZ1I1fn/KO nhWA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783015581; x=1783620381; h=content-transfer-encoding:content-type:in-reply-to:content-language :from:references:cc:to:subject:user-agent:mime-version:date :message-id:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=NiePhak0dMAegnCxGrFfwKb+IHV27vZ4JEKE5uV61kc=; b=ddR1hbpK7uS0SwF/Wfrf3G7odorq0iWOUVyXWflRcmqkFG2YQ1f8v9UncSTpI9oTK6 Yn24l/PxWZ2zzFp8as2iHaycIYfHGQrQc4t1SepCEdhbDTuKQitE/6J3ZnxxwByGisPL 6e6KRAsqYl+/+aTzUJzKyJ30YedZu1HxwG5F+k+EFM7/X1z0q7LTtr0TFdd0GgzdD5XG pTld2Lnc69G1sTgwkx5Y5GSJvtOveKomTZlwaweamSWG8C+P3nbR/40VzDWF06SAi/d7 DEbxQTrF/RyUP62/i9ZX2+xIwvbFA4vlXcey+Vp9VPdyNpA5gB4fYlcyUY6Oxk/pQNso dMxw== X-Forwarded-Encrypted: i=1; AFNElJ+tFwTGm5FXNLtmHtUIU9y98UDAWb2LNdGxJVJLjkEDDIiyGXOZ4+4eEtTEhCzm+OFG4VjAoI0p/pzCtsM=@vger.kernel.org X-Gm-Message-State: AOJu0Yyuir9oRfCRz3SLWzt55qi0mbhOl4yQEOK+N/M4RBpyjvfHT5Nq OU7+QDnQlm54yl0tDUsSTtak6Y+lhro/WeI316t3zeOU3qqk7F2q5bJKVPwjqPWsdthXlgcUjn4 Susn5zlw6i+mmN0ZGRp/BDuy7xwodMDDXesXGDk1JgSVzA9dLTiLOzvqxl/NmIBfYe88= X-Gm-Gg: AfdE7ckJDsjaTtWBllBQV7oUgwqLV9LPV3b6//gjHQxzZ2ftmqIlw65tE5MHzn6pGaz YFp7ucl+7ewLSN4oHQadr8u3kcKKby8eM3ligGykZJBmuM1ynKe7h7UkUK0ZhiZnaA6Zwmu7cmS PzhBKZfdoSjFk0ii41rW8d0gR1eyGVcr3orI36WKdbM5pzZQMzAkYttFi5CruOza0eLJMTQwyMx XGZjyyn9/cqtkwNx0lo/+QWZ/c3RMUX3g6l+6weRXn1r78upJv52TG7DE7IftDXLl/1Qql/qsMt enpteIaGVL3intv/69uHXD2UpzeOa/6no1lf8hZ3GOLdH87GlAusXS+TVVKz10OfusWtZ0GzgQq PHGhP6ioMIxnmdFoOh1zGTkTPhYYRkQEmC8IopeC/uf/ekbwbhb3UI5c= X-Received: by 2002:a05:6a20:4c8:b0:3b4:8f57:3205 with SMTP id adf61e73a8af0-3bff4235bd5mr7540985637.36.1783015580529; Thu, 02 Jul 2026 11:06:20 -0700 (PDT) X-Received: by 2002:a05:6a20:4c8:b0:3b4:8f57:3205 with SMTP id adf61e73a8af0-3bff4235bd5mr7540930637.36.1783015580062; Thu, 02 Jul 2026 11:06:20 -0700 (PDT) Received: from [192.168.11.104] ([124.123.80.135]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-30f0bc3ea61sm12164081eec.30.2026.07.02.11.06.15 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 02 Jul 2026 11:06:19 -0700 (PDT) Message-ID: <8dd4aceb-48e8-45cb-abe8-af7ece2285ae@oss.qualcomm.com> Date: Thu, 2 Jul 2026 23:36:13 +0530 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2] wifi: ath12k: fix survey indexing across bands To: Matthew Leach , Jeff Johnson , Vasanthakumar Thiagarajan , Baochen Qiang Cc: Kalle Valo , Pradeep Kumar Chitrapu , linux-wireless@vger.kernel.org, ath12k@lists.infradead.org, linux-kernel@vger.kernel.org, kernel@collabora.com, Rameshkumar Sundaram , Jeff Johnson References: <20260702-ath12-survey-band-fix-v2-1-75b5bdf72a08@collabora.com> From: Rameshkumar Sundaram Content-Language: en-US In-Reply-To: <20260702-ath12-survey-band-fix-v2-1-75b5bdf72a08@collabora.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNzAyMDE4OSBTYWx0ZWRfX55L72q0RlSvL KbV2kveDULanSyL3T5j4T/z/5zjKxlgQfhKUNzrwaQ2ugte6ijZ7EHTnrDKFzU+KdCrOP/NGUjJ DGgVBTWBkD9UtmH2cqUn3E70yI1D5skSuSyHYQbJgLO8ljeY5KiphjGw4krKXatnsahOTc2veAy lYRmY+etmY4wGXfusmcy1TA2OurkuVqx+pW6BzWtdPEcuMFuLFSBuhZRqHeeAztmJizut0x3l9O T50S8561ef28a3zV0AoahW/GSdOQTpO8lQ6JA5XLvFeb8wAnMHCul0Nm4OessBt79BJmqT0wXCH Iz+SEDZ4vJjbCF3dsHVfmNaniJoRaRixW+22V2c+LkHXhHOP/3fHlq0hpAiLnb9syKWqXdybrbJ bzzQVzpPIrfmZgJd/K/NYCKhBCfEZ7VFH2ez5971YJnVcRzQ6MoVE5KdktyeuMkt3yD7m6PShhq cP1Ku9LYQs3wD/qOYgA== X-Proofpoint-ORIG-GUID: LiunVyM2fK4E-gyQIbfjmPQfouOBp86O X-Proofpoint-Spam-Info: AW1haW4tMjYwNzAyMDE4OSBTYWx0ZWRfX6HMpQL3GWuBX IVD2EazIXoFbIdab2JfzMLG47NSPKLYDtcfFBVxBp6o9Uk8ky6Zoi1hpF8oVmWkb3cSQVSrE1fd A1n2iE1HyN+6DOzTuGJgOKiJQC3NJYA= X-Proofpoint-GUID: LiunVyM2fK4E-gyQIbfjmPQfouOBp86O X-Authority-Analysis: v=2.4 cv=WMBPmHsR c=1 sm=1 tr=0 ts=6a46a89d cx=c_pps a=Oh5Dbbf/trHjhBongsHeRQ==:117 a=kllYWVK2JqQtNyhMtAlpJw==:17 a=IkcTkHD0fZMA:10 a=RAioF0-LDSMA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=yOCtJkima9RkubShWh1s:22 a=bC-a23v3AAAA:8 a=QX4gbG5DAAAA:8 a=VwQbUJbxAAAA:8 a=COk6AnOGAAAA:8 a=EUspDBNiAAAA:8 a=JfrnYn6hAAAA:8 a=Z1bz1sYHDrk7OavG6BEA:9 a=QEXdDO2ut3YA:10 a=_Vgx9l1VpLgwpw_dHYaR:22 a=FO4_E8m0qiDe52t0p3_H:22 a=AbAUZ8qAyYyZVLSsDulk:22 a=TjNXssC_j7lpFel5tvFf:22 a=1CNFftbPRP8L7MoqJWF3:22 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.125,FMLib:17.12.100.49 definitions=2026-07-02_02,2026-06-26_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 phishscore=0 suspectscore=0 lowpriorityscore=0 bulkscore=0 spamscore=0 priorityscore=1501 adultscore=0 impostorscore=0 malwarescore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2607020189 On 7/2/2026 4:20 PM, Matthew Leach wrote: > When running 'iw dev wlan0 survey dump' the values for the channel busy > time have the same sequence across bands. This is caused by indexing > into the ath12k survey array using a band-local index rather than the > global index passed by mac80211. This results in surveys for 5 GHz and 6 > GHz channels returning values from 2.4 GHz slots, making the survey > unusable on those bands. Further, there are redundant survey slots for > multi-radio/single-phy instances. > > Fix by moving the survey data into ath12k_hw so multiple radios under a > single wiphy share one table, and index into it using the global > mac80211 index. A new spinlock in ath12k_hw serialises access to the > survey array, which is now shared across all radios under a single hw. > > Band busy-times Before this fix: > > 2.4 GHz: 9, 2, 2, 2, 4, 2, 10, 16, 4, 12, 5 > 5 GHz: 9, 2, 2, 2, 4, 2, 10, 16, 4, 12, 5 > 6 GHz: 9, 2, 2, 2, 4, 2, 10, 16, 4, 12, 5 > > After this fix, times are independent: > > 2.4 GHz: 23, 5, 5, 12, 2, 12, 26, 5, 3, 1, 27 > 5 GHz: 30, 40, 29, 27, 118, 118, 112, 120, 11, 11, 11 > 6 GHz: 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 > > Tested-on: wcn7850 hw2.0 PCI WLAN.IOE_HMT.1.1-00018-QCAHMTSWPL_V1.0_V2.0_SILICONZ-1 > > Fixes: 4f242b1d6996 ("wifi: ath12k: support get_survey mac op for single wiphy") > Signed-off-by: Matthew Leach > --- > Changes in v2: > - Move survey[] from ath12k to ath12k_hw so multi-radio single-wiphy > setups share one global table (suggested by Rameshkumar Sundaram). > - Drop the ar->mac.sbands[] filter in freq_to_idx() so the WMI event > handlers use the same global index > - Add ah->survey_lock to serialise access to the shared survey table > - Update Fixes: tag to the correct commit > - Link to v1: https://patch.msgid.link/20260617-ath12-survey-band-fix-v1-1-e7d9555bb478@collabora.com > > To: Jeff Johnson > To: Sriram R > To: Kalle Valo > To: Rameshkumar Sundaram > Cc: Jeff Johnson > Cc: linux-wireless@vger.kernel.org > Cc: ath12k@lists.infradead.org > Cc: linux-kernel@vger.kernel.org > --- > drivers/net/wireless/ath/ath12k/core.h | 6 ++++- > drivers/net/wireless/ath/ath12k/mac.c | 33 ++++++++++++++------------- > drivers/net/wireless/ath/ath12k/wmi.c | 41 ++++++++++++++++++---------------- > 3 files changed, 45 insertions(+), 35 deletions(-) > > diff --git a/drivers/net/wireless/ath/ath12k/core.h b/drivers/net/wireless/ath/ath12k/core.h > index 8be435535a4e..6ce2f7b3fa50 100644 > --- a/drivers/net/wireless/ath/ath12k/core.h > +++ b/drivers/net/wireless/ath/ath12k/core.h > @@ -712,7 +712,6 @@ struct ath12k { > * avoid reporting garbage data. > */ > bool ch_info_can_report_survey; > - struct survey_info survey[ATH12K_NUM_CHANS]; > struct completion bss_survey_done; > > struct work_struct regd_update_work; > @@ -774,6 +773,11 @@ struct ath12k_hw { > */ > struct mutex hw_mutex; > enum ath12k_hw_state state; > + > + /* protects survey[] shared across radios of this hw. */ > + spinlock_t survey_lock; > + struct survey_info survey[ATH12K_NUM_CHANS]; > + > bool regd_updated; > bool use_6ghz_regd; > > diff --git a/drivers/net/wireless/ath/ath12k/mac.c b/drivers/net/wireless/ath/ath12k/mac.c > index 2cff9485c95a..daf9bc8722df 100644 > --- a/drivers/net/wireless/ath/ath12k/mac.c > +++ b/drivers/net/wireless/ath/ath12k/mac.c > @@ -13348,52 +13348,54 @@ ath12k_mac_update_bss_chan_survey(struct ath12k *ar, > int ath12k_mac_op_get_survey(struct ieee80211_hw *hw, int idx, > struct survey_info *survey) > { > + struct ath12k_hw *ah = hw->priv; > struct ath12k *ar; > struct ieee80211_supported_band *sband; > - struct survey_info *ar_survey; > + struct survey_info *ah_survey; > + int sband_idx = idx; > > lockdep_assert_wiphy(hw->wiphy); > > - if (idx >= ATH12K_NUM_CHANS) > + if (sband_idx >= ATH12K_NUM_CHANS) > return -ENOENT; > > sband = hw->wiphy->bands[NL80211_BAND_2GHZ]; > - if (sband && idx >= sband->n_channels) { > - idx -= sband->n_channels; > + if (sband && sband_idx >= sband->n_channels) { > + sband_idx -= sband->n_channels; > sband = NULL; > } > > if (!sband) > sband = hw->wiphy->bands[NL80211_BAND_5GHZ]; > - if (sband && idx >= sband->n_channels) { > - idx -= sband->n_channels; > + if (sband && sband_idx >= sband->n_channels) { > + sband_idx -= sband->n_channels; > sband = NULL; > } > > if (!sband) > sband = hw->wiphy->bands[NL80211_BAND_6GHZ]; > > - if (!sband || idx >= sband->n_channels) > + if (!sband || sband_idx >= sband->n_channels) > return -ENOENT; > > - ar = ath12k_mac_get_ar_by_chan(hw, &sband->channels[idx]); > + ar = ath12k_mac_get_ar_by_chan(hw, &sband->channels[sband_idx]); > if (!ar) { > - if (sband->channels[idx].flags & IEEE80211_CHAN_DISABLED) { > + if (sband->channels[sband_idx].flags & IEEE80211_CHAN_DISABLED) { > memset(survey, 0, sizeof(*survey)); > return 0; > } > return -ENOENT; > } > > - ar_survey = &ar->survey[idx]; > + ah_survey = &ah->survey[idx]; > > - ath12k_mac_update_bss_chan_survey(ar, &sband->channels[idx]); > + ath12k_mac_update_bss_chan_survey(ar, &sband->channels[sband_idx]); > > - spin_lock_bh(&ar->data_lock); > - memcpy(survey, ar_survey, sizeof(*survey)); > - spin_unlock_bh(&ar->data_lock); > + scoped_guard(spinlock_bh, &ah->survey_lock) { > + memcpy(survey, ah_survey, sizeof(*survey)); > + } > > - survey->channel = &sband->channels[idx]; > + survey->channel = &sband->channels[sband_idx]; > > if (ar->rx_channel == survey->channel) > survey->filled |= SURVEY_INFO_IN_USE; > @@ -15055,6 +15057,7 @@ static struct ath12k_hw *ath12k_mac_hw_allocate(struct ath12k_hw_group *ag, > > mutex_init(&ah->hw_mutex); > > + spin_lock_init(&ah->survey_lock); > spin_lock_init(&ah->dp_hw.peer_lock); > INIT_LIST_HEAD(&ah->dp_hw.dp_peers_list); > > diff --git a/drivers/net/wireless/ath/ath12k/wmi.c b/drivers/net/wireless/ath/ath12k/wmi.c > index b5e904a55aea..aa70d2a61d38 100644 > --- a/drivers/net/wireless/ath/ath12k/wmi.c > +++ b/drivers/net/wireless/ath/ath12k/wmi.c > @@ -6617,16 +6617,12 @@ static int ath12k_pull_roam_ev(struct ath12k_base *ab, struct sk_buff *skb, > return 0; > } > > -static int freq_to_idx(struct ath12k *ar, int freq) > +static int freq_to_idx(struct ieee80211_hw *hw, int freq) > { > struct ieee80211_supported_band *sband; > - struct ieee80211_hw *hw = ath12k_ar_to_hw(ar); > int band, ch, idx = 0; > > for (band = NL80211_BAND_2GHZ; band < NUM_NL80211_BANDS; band++) { > - if (!ar->mac.sbands[band].channels) > - continue; > - > sband = hw->wiphy->bands[band]; > if (!sband) > continue; > @@ -7507,6 +7503,7 @@ static void ath12k_chan_info_event(struct ath12k_base *ab, struct sk_buff *skb) > { > struct wmi_chan_info_event ch_info_ev = {}; > struct ath12k *ar; > + struct ath12k_hw *ah; > struct survey_info *survey; > int idx; > /* HW channel counters frequency value in hertz */ > @@ -7538,6 +7535,7 @@ static void ath12k_chan_info_event(struct ath12k_base *ab, struct sk_buff *skb) > return; > } > spin_lock_bh(&ar->data_lock); > + ah = ath12k_ar_to_ah(ar); > > switch (ar->scan.state) { > case ATH12K_SCAN_IDLE: > @@ -7549,8 +7547,8 @@ static void ath12k_chan_info_event(struct ath12k_base *ab, struct sk_buff *skb) > break; > } > > - idx = freq_to_idx(ar, le32_to_cpu(ch_info_ev.freq)); > - if (idx >= ARRAY_SIZE(ar->survey)) { > + idx = freq_to_idx(ath12k_ar_to_hw(ar), le32_to_cpu(ch_info_ev.freq)); > + if (idx >= ARRAY_SIZE(ah->survey)) { > ath12k_warn(ab, "chan info: invalid frequency %d (idx %d out of bounds)\n", > ch_info_ev.freq, idx); > goto exit; > @@ -7563,14 +7561,16 @@ static void ath12k_chan_info_event(struct ath12k_base *ab, struct sk_buff *skb) > cc_freq_hz = (le32_to_cpu(ch_info_ev.mac_clk_mhz) * 1000); > > if (ch_info_ev.cmd_flags == WMI_CHAN_INFO_START_RESP) { > - survey = &ar->survey[idx]; > - memset(survey, 0, sizeof(*survey)); > - survey->noise = le32_to_cpu(ch_info_ev.noise_floor); > - survey->filled = SURVEY_INFO_NOISE_DBM | SURVEY_INFO_TIME | > + scoped_guard(spinlock_bh, &ah->survey_lock) { > + survey = &ah->survey[idx]; > + memset(survey, 0, sizeof(*survey)); > + survey->noise = le32_to_cpu(ch_info_ev.noise_floor); > + survey->filled = SURVEY_INFO_NOISE_DBM | SURVEY_INFO_TIME | > SURVEY_INFO_TIME_BUSY; > - survey->time = div_u64(le32_to_cpu(ch_info_ev.cycle_count), cc_freq_hz); > - survey->time_busy = div_u64(le32_to_cpu(ch_info_ev.rx_clear_count), > - cc_freq_hz); > + survey->time = div_u64(le32_to_cpu(ch_info_ev.cycle_count), cc_freq_hz); > + survey->time_busy = div_u64(le32_to_cpu(ch_info_ev.rx_clear_count), > + cc_freq_hz); > + } > } > exit: > spin_unlock_bh(&ar->data_lock); > @@ -7583,6 +7583,7 @@ ath12k_pdev_bss_chan_info_event(struct ath12k_base *ab, struct sk_buff *skb) > struct wmi_pdev_bss_chan_info_event bss_ch_info_ev = {}; > struct survey_info *survey; > struct ath12k *ar; > + struct ath12k_hw *ah; > u32 cc_freq_hz = ab->cc_freq_hz; > u64 busy, total, tx, rx, rx_bss; > int idx; > @@ -7623,15 +7624,18 @@ ath12k_pdev_bss_chan_info_event(struct ath12k_base *ab, struct sk_buff *skb) > return; > } > > - spin_lock_bh(&ar->data_lock); > - idx = freq_to_idx(ar, le32_to_cpu(bss_ch_info_ev.freq)); > - if (idx >= ARRAY_SIZE(ar->survey)) { > + ah = ath12k_ar_to_ah(ar); > + > + guard(spinlock_bh)(&ah->survey_lock); > + > + idx = freq_to_idx(ath12k_ar_to_hw(ar), le32_to_cpu(bss_ch_info_ev.freq)); > + if (idx >= ARRAY_SIZE(ah->survey)) { > ath12k_warn(ab, "bss chan info: invalid frequency %d (idx %d out of bounds)\n", > bss_ch_info_ev.freq, idx); > goto exit; > } > the scope of survey_lock should start here and .. > - survey = &ar->survey[idx]; > + survey = &ah->survey[idx]; > > survey->noise = le32_to_cpu(bss_ch_info_ev.noise_floor); > survey->time = div_u64(total, cc_freq_hz); > @@ -7644,7 +7648,6 @@ ath12k_pdev_bss_chan_info_event(struct ath12k_base *ab, struct sk_buff *skb) > SURVEY_INFO_TIME_RX | > SURVEY_INFO_TIME_TX); > exit: > - spin_unlock_bh(&ar->data_lock); end here, may be a scoped guard here as well ? > complete(&ar->bss_survey_done); > > rcu_read_unlock(); > > --- > base-commit: 8cd9520d35a6c38db6567e97dd93b1f11f185dc6 > change-id: 20260617-ath12-survey-band-fix-4b5e78579379 > > Best regards, > -- > Matt > Rest of the changes looks fine to me.