Received: by 2002:a05:7412:bbc7:b0:fc:a2b0:25d7 with SMTP id kh7csp2916685rdb; Tue, 6 Feb 2024 01:23:31 -0800 (PST) X-Google-Smtp-Source: AGHT+IEpJo74+8rp6hKTwOInffD8QcwaB6hVEaqz98q4AoRSPbCH98SJfCo5mz9pTxGgS3/gwN4f X-Received: by 2002:a17:90a:d443:b0:296:937:6144 with SMTP id cz3-20020a17090ad44300b0029609376144mr2050375pjb.45.1707211411586; Tue, 06 Feb 2024 01:23:31 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707211411; cv=pass; d=google.com; s=arc-20160816; b=ohWGCVMplXUQ8uwOfZHwrfNlRbXsnQTdefhOxMZESsSi4nqVCH+G7v4//2w5N32qdr QhsTs3Gb/87esceRBA6Jy2fGwn2fnReK+Ni4RVuj+X4y20Dp898TWMqhjYnwhhys4gnP /xdE117xqkTvXWeLvPrL6XwYHHtCmjgKUs7UlyM2F7swA5yGfzdc9mozvfRwGa78jHCb 8c73GJ8PjI6KcU1yD/40A0vMCbsm+lNZO9gCGZPOLJ2GGB/nuvxn109P+77Yb1Lsb0n4 /I8DoDdq49fHBO6ZVzjpEAiRnN+H8tqqQYpF3oprGLxVwUquuAcggWTGzrDh1QpRStYi ji2g== 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=2mIZfcyLh28SVhNb9Kcwit7KXxWjsONUsVR+djd/jHU=; fh=T5HcY9sOos/nqQGZwqwRUCsKWEqsXvg7sjykN2x5YDs=; b=a+32hhA0YZzuF06bVu591Bzx/K+sn9zpErBeEnsB2ABof6hUhxwL71hCobMEgOllBv GlpsSA3m/znAjhT9kuZ6lJqDgHF0LFFF6OrZFTFp5RrG4V1mvyECs1e8kbxe/uqEMND2 k3WaFsvYqmYG4RnQXTpo72REaLwl7c5bxRcCrl2BQjdNWGNfCyMb92k8TsYgz3ZQpIMZ dZ4hWDiOivtakTAvZ4phADvJXUBauWRbIMCOh4JRmV7vnf2ib77wqbzO55/10sxKglK0 BHcFQ9y1bCBtiAmrUdcp1MxzNaPrWENynjxrRZAYJX5nZ5Wml3XS9HP2yHrg4XgG6sLt qEXA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=T4WFjb+o; 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-3208-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-wireless+bounces-3208-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com X-Forwarded-Encrypted: i=1; AJvYcCUiG8rsQ30IRd3gmq2Q3/RWptstCZg3GSjVlk2luecoSWx8e1fxbHunR/ob1ENduXSk1nkSOZ7hf35ehmocB/afrVspjyRK1lKBERY1fQ== Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id g20-20020a170902c39400b001d9259b5713si528551plg.38.2024.02.06.01.23.31 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Feb 2024 01:23:31 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless+bounces-3208-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=T4WFjb+o; 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-3208-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-wireless+bounces-3208-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 400A8285FC4 for ; Tue, 6 Feb 2024 09:23:31 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id EF74012D144; Tue, 6 Feb 2024 09:22:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="T4WFjb+o" 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 51E1812D142 for ; Tue, 6 Feb 2024 09:22:06 +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=1707211328; cv=none; b=BE3ifbxd7yEiGml0rLs+B1DkOSKgIyzY9yb6g/TWVfVtQpQTpekF1w5sIPA1V0WiNflwQBZVmQsz3/3JgdgE0mgfvv2HY2Ilm5diZBVrnIAPW3BDFjYyN/Ouz5b+KZeolO0RmkWItSREmK54MjXCZWp03qobzurV41Fa5CLEp0I= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707211328; c=relaxed/simple; bh=JtlHpEQy2BQBpDFDSX8SYmRcPoP+h9KXyAok3yf5m1o=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=i0qKf4364aruouqcBEJRgcMkzaauGqYjeLaw9xrL+HFA22jIm4xEMpHKYINH/EfSanUS/VYHts+JxZHY9jorlMRQNn4TmxGnRcs0+zrPf9OaW4lBjmTFCiJvLxH78f/jQkRhiEft71XRaB9AWUqJrPb//h5MKKe/d0eBsklJlOQ= 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=T4WFjb+o; 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 (m0279869.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 4166Eo7g005947; Tue, 6 Feb 2024 09:22:02 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=2mIZfcyLh28SVhNb9Kcwit7KXxWjsONUsVR+djd/jHU=; b=T4 WFjb+oPGrk6v5uX6gkPEHO4tNGwDM5XNDdTAp/CL6b/SctffjGusHIkCqmiqW8/K V9UfoctGDzALIxA/c8hxSEPHOe2dum94M3fC5UE++EoJCYRxBfGpFGTPW/Noh2U0 6ApTne7gO8r8LcNClFKWAC2JZbQwKya0rrZbNilXIBA7XdoRLH6mJL/86j3jao53 jYXznEIiYSbL4uQBclj5Qzld+dLHpg4PaS9+0uhNj1ZKKWVXRoLcBWmqO3W42Q3M tkcW2rBgGKIF0kmtELcRKiQAKySDbwWDnHqwVRyY71FTUrOYXzB9qBuUtRh6TlrX bhUEn9fUuW+2McINz15A== Received: from nalasppmta01.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3w3cafrprx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 06 Feb 2024 09:22:02 +0000 (GMT) Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA01.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 4169M1rW020657 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 6 Feb 2024 09:22:01 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, 6 Feb 2024 01:21:59 -0800 From: Rameshkumar Sundaram To: CC: , Sriram R , Rameshkumar Sundaram Subject: [PATCH v2 12/12] wifi: ath12k: support get_survey mac op for single wiphy Date: Tue, 6 Feb 2024 14:49:54 +0530 Message-ID: <20240206091954.4144454-13-quic_ramess@quicinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240206091954.4144454-1-quic_ramess@quicinc.com> References: <20240206091954.4144454-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: nasanex01a.na.qualcomm.com (10.52.223.231) 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: PDi5bOJjImS0im4GPdtR1sIW3k34G7iX X-Proofpoint-GUID: PDi5bOJjImS0im4GPdtR1sIW3k34G7iX 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-02-06_02,2024-01-31_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 adultscore=0 mlxscore=0 lowpriorityscore=0 malwarescore=0 spamscore=0 clxscore=1015 bulkscore=0 impostorscore=0 priorityscore=1501 suspectscore=0 mlxlogscore=695 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2401310000 definitions=main-2402060065 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 1e1de27e5d14..8f867fb99b5f 100644 --- a/drivers/net/wireless/ath/ath12k/mac.c +++ b/drivers/net/wireless/ath/ath12k/mac.c @@ -7702,7 +7702,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; @@ -7711,12 +7710,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; @@ -7731,6 +7724,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); @@ -7742,9 +7750,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