Received: by 2002:ab2:710b:0:b0:1ef:a325:1205 with SMTP id z11csp1079927lql; Tue, 12 Mar 2024 06:58:16 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWNtTyzLYzlHln79Sws54TI4zhcYqQF4l94MzIuZdKJe3ry8OfvXKVp016zyUw4PQVxhL60lbRioPoqum/uW3f1UhvdMgEB4HH5Rc/hpA== X-Google-Smtp-Source: AGHT+IFVSs9wd0MSwT2Lj408/nCLntRJbQ0xDzYmima/KXdcIEmeW+2Z9EeSUEppeu7ghJoFZss3 X-Received: by 2002:a05:6a00:348a:b0:6e6:7abd:b870 with SMTP id cp10-20020a056a00348a00b006e67abdb870mr9996587pfb.12.1710251895747; Tue, 12 Mar 2024 06:58:15 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710251895; cv=pass; d=google.com; s=arc-20160816; b=Tlw3cGiGsX1MqMjOe5CG00TkIS/nciSEK/8T9ilWdZEEuyixHjlJcAWky1aAz4xgCN 4JA4w90qKvDs7ygmAPwHVhb/qFBRXTP0nIJ30NlMZsAlMzgixcm6DJ/YbFD1mylB2wxB /tpN2on5ghsUnNSvZLQAZI5Q65is2fyyFli4P+2y7w9ex5Feh+15AlcPXoI7wwgE/MVV Z506c1CsMCyqS/lUdMaYTLKOlrvH6U15sjgf2Jx76hUVRQoEmHS8fiGncnRhx+wt7QIE fSslxLU0fKhIi1uFSuoFpViXcmcr1Bv13mJ9LMpSj/KCmyvMkSWizJBzlo78cGwNcvZb Kt3w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=tUM/Ju9aK4iSOwpxhxl3AvnD03TmbsIcqpCil7BxX/8=; fh=woZAKccQQLpsH+ifgAFl/ubgLBC7CdNtwbjjrWqWXi0=; b=eAUs+gymLFCYuMEGBpmd/A+kavBChJOqdNfKLFkuAjI3d0wvUYzo/wttJH+j0GpAkW HyBedTZ2bnxmmfWJgP5YV0TkQkEpBcTxoh9hqxXpy6a3XdwM810EMSmjTMbpNyf3m7Uz 1LM301HbPOXjMAq76D9lIDqPiiD9PnOm/zj9Rvry7qbbjXY1+/Np3fb61/Uzak1+nKfp wcyQQJxuGPW0PPnEBtkTHMoPThsOeGwpCVdXDPrQDmdzpspP8DulF9U9lfYsEUnbyGz+ c6/VhpFTbysWd+UStg2Ov5G4EVAvEG5sG++TwvXib4kwWNwJqMbJIaD5Ratm/Bz/kg66 JXEQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=mRZfoDHw; arc=pass (i=1 spf=pass spfdomain=quicinc.com dkim=pass dkdomain=quicinc.com dmarc=pass fromdomain=quicinc.com); spf=pass (google.com: domain of linux-wireless+bounces-4623-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-wireless+bounces-4623-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id e5-20020a635445000000b005dc90546100si6729326pgm.295.2024.03.12.06.58.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Mar 2024 06:58:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless+bounces-4623-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=mRZfoDHw; arc=pass (i=1 spf=pass spfdomain=quicinc.com dkim=pass dkdomain=quicinc.com dmarc=pass fromdomain=quicinc.com); spf=pass (google.com: domain of linux-wireless+bounces-4623-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-wireless+bounces-4623-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 9C4D4B23830 for ; Tue, 12 Mar 2024 13:57:24 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C9DCD7A15A; Tue, 12 Mar 2024 13:56:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="mRZfoDHw" X-Original-To: linux-wireless@vger.kernel.org Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.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 418A37AE4D for ; Tue, 12 Mar 2024 13:56:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710251805; cv=none; b=KJKl6bnmP/uC37qxDkV/cLmOc3S4Lh9Mc5oWYJ3iu67Diki4sTx7KdeuDBjuxJlwGOgQ+j+CydkfVbGdnhDf5niW/VfxmBPMQ4NaFi62zsUBcgRsgE8dG0tYWvpAwCnZcsTn/RJbLszkiFKPhra7QEFcotlJMQXCdfQkRPz2/0M= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710251805; c=relaxed/simple; bh=e0vTb5RlaKGdPg9yCz7yqzplicqoEPtpMpQNSwSvs5k=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=TPZjuaEuTSnIUzMO92pkR27bekU3cyjbs8WEMTcfJJ7n+Tvvoy/yZG6wIvEpVyBXLNuirn3QU2Y+rJ1dKSnIE3V1fMa1hIdnG5wpTdeITqg3HWMrLsc/J/svfjXp3R2tQedwHZNA6EgxV6SmbMGG2V1RJSa7q7wxUbHqohD5I0M= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=quicinc.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=mRZfoDHw; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=quicinc.com Received: from pps.filterd (m0279868.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 42CDm9t7016740; Tue, 12 Mar 2024 13:56:40 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding:content-type; s= qcppdkim1; bh=tUM/Ju9aK4iSOwpxhxl3AvnD03TmbsIcqpCil7BxX/8=; b=mR ZfoDHwFn1/NoSM0zCUz6H2jjx28I5uc2YxvVB/Yoqy0iUBzieQc0WIk3SaHc7uYZ GYavzUCLFz5kNrrLySz0OvaY+xjxu3yyh3svh8z7PfGJPtpZ5ZI21OF/Y0RrPl4w vJAVXsaK2sGLFo6ax1DXU4A5VvOs+Di1KFbOyB3vSc1Ndrbe8jYzkJhIO/E7Dv12 KeMVS5uQmhGHOs1E4gztOgzxQs/+bLnn0dNUZU5cPbNOE/w6Ms23hiJhXoF0Pluw 3oXQcymIjDjE7xAuvwHwyQsluMmb7nXJkn7j/wZdihOcysiJpKJ6sG8EyTWqVs4f KvQ2GJ9x4V9JnaXQIKkA== Received: from nalasppmta05.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3wtfwn12gn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 12 Mar 2024 13:56:40 +0000 (GMT) Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA05.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 42CDudFJ011095 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 12 Mar 2024 13:56:39 GMT Received: from hu-ramess-blr.qualcomm.com (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.40; Tue, 12 Mar 2024 06:56:37 -0700 From: Rameshkumar Sundaram To: CC: , Sriram R , Rameshkumar Sundaram Subject: [PATCH v4 12/12] wifi: ath12k: support get_survey mac op for single wiphy Date: Tue, 12 Mar 2024 19:25:57 +0530 Message-ID: <20240312135557.1778379-13-quic_ramess@quicinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240312135557.1778379-1-quic_ramess@quicinc.com> References: <20240312135557.1778379-1-quic_ramess@quicinc.com> Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nalasex01a.na.qualcomm.com (10.47.209.196) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-ORIG-GUID: svSFhvSChdX_VNRHTfDmquzFNVJ4mtAb X-Proofpoint-GUID: svSFhvSChdX_VNRHTfDmquzFNVJ4mtAb X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-03-12_08,2024-03-12_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 spamscore=0 bulkscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 priorityscore=1501 suspectscore=0 impostorscore=0 malwarescore=0 mlxlogscore=813 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2402120000 definitions=main-2403120107 From: Sriram R The radio for which the survey info needs to be collected depends on the channel idx which could be based on the band. Use the idx to identify the appropriate sband since multiple bands could be combined for single wiphy case. Also use the channel idx and sband to identify the corresponding radio on which the survey results needs to be populated. Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.0.1-00029-QCAHKSWPL_SILICONZ-1 Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0.c5-00481-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3 Signed-off-by: Sriram R Signed-off-by: Rameshkumar Sundaram --- drivers/net/wireless/ath/ath12k/mac.c | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/drivers/net/wireless/ath/ath12k/mac.c b/drivers/net/wireless/ath/ath12k/mac.c index 6123d7db2edc..a31003f8325d 100644 --- a/drivers/net/wireless/ath/ath12k/mac.c +++ b/drivers/net/wireless/ath/ath12k/mac.c @@ -7821,7 +7821,6 @@ ath12k_mac_update_bss_chan_survey(struct ath12k *ar, static int ath12k_mac_op_get_survey(struct ieee80211_hw *hw, int idx, struct survey_info *survey) { - struct ath12k_hw *ah = ath12k_hw_to_ah(hw); struct ath12k *ar; struct ieee80211_supported_band *sband; struct survey_info *ar_survey; @@ -7830,12 +7829,6 @@ static int ath12k_mac_op_get_survey(struct ieee80211_hw *hw, int idx, if (idx >= ATH12K_NUM_CHANS) return -ENOENT; - ar = ath12k_ah_to_ar(ah, 0); - - ar_survey = &ar->survey[idx]; - - mutex_lock(&ar->conf_mutex); - sband = hw->wiphy->bands[NL80211_BAND_2GHZ]; if (sband && idx >= sband->n_channels) { idx -= sband->n_channels; @@ -7850,6 +7843,21 @@ static int ath12k_mac_op_get_survey(struct ieee80211_hw *hw, int idx, goto exit; } + ar = ath12k_mac_get_ar_by_chan(hw, &sband->channels[idx]); + if (!ar) { + if (sband->channels[idx].flags & IEEE80211_CHAN_DISABLED) { + ret = 0; + memset(survey, 0, sizeof(*survey)); + goto exit; + } + ret = -ENOENT; + goto exit; + } + + ar_survey = &ar->survey[idx]; + + mutex_lock(&ar->conf_mutex); + ath12k_mac_update_bss_chan_survey(ar, &sband->channels[idx]); spin_lock_bh(&ar->data_lock); @@ -7861,9 +7869,8 @@ static int ath12k_mac_op_get_survey(struct ieee80211_hw *hw, int idx, if (ar->rx_channel == survey->channel) survey->filled |= SURVEY_INFO_IN_USE; -exit: mutex_unlock(&ar->conf_mutex); - +exit: return ret; } -- 2.25.1