Received: by 2002:a05:7412:e794:b0:fa:551:50a7 with SMTP id o20csp1421843rdd; Wed, 10 Jan 2024 20:51:46 -0800 (PST) X-Google-Smtp-Source: AGHT+IGrGH4YX0o6dKe5RLRIQzyqPtElQ+ArSf5rdO4VPwd/Ao0xGdLxFzW8Cvt8xAYaKe8TyDKJ X-Received: by 2002:a05:6870:418d:b0:206:86cf:1c23 with SMTP id y13-20020a056870418d00b0020686cf1c23mr745349oac.21.1704948706109; Wed, 10 Jan 2024 20:51:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704948706; cv=none; d=google.com; s=arc-20160816; b=QtJpEt/U0/LrqMajhCofce9iAemlgHitwk6E5DouzbX+PHuWlDzEgS1kYPB90Kqrwp 2Y2qBAATCboBIlJEcf4TDEeh07O0DPH3lryjo5DEXyH76WGDfgOne46BI9VGxta0/AAp hPXyQ8uH9Q1os0YgIJSDD+dNz+ZUvmNVd+PomIOzEpNMGN3gQJYNZnpUvw9q0iPHSfNF xE96WpBUoKHdzmqZnjxt4huNe+C81pdgmmSgjct1PN/EXoZq+0ydSkX/mENOvWdEVLhg yQUlW5FanmWcBPslZAlndVYGD7z70duKBzsqNA0DDiopv36RK6zslmJVYsmunsHfBXKO 9Rzg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=BjhHzsRfTXvm+YoUsGulZQ7nxpfLgxexRKdhGKGT1dY=; fh=AbPIYUmLJBwTg11YE+PxpxKzNq+ErB2KX7qIU43oOA8=; b=O1Mn8pPvfwLPnikODey8lqkxL6DWqkTGk3IAC7PmS9PW6Jv3dUiY29XvrxXWREJ7Hd g4LDPeCILOFHI5bSCuhR79DY3I9+//XnRFozzSzzBkQS9aYG34BlRcQDFszWad0nKxew U3fTE7V7kAis0Bh7YX2dntJBXIi+uwfmS0VzF1zjjiPTgljF8eausY7Ijp7oxVAApXlx GxLNhMK/xjulX7zuaX+umyy0ELhRFkADEbVoZBmlz6yzqHfmHMNr1miw+B7cO6aTS0Md Y8U/q+vBwCGJTAaeaiDEzNPOZUC/kcs0FvXzrlgH/V33hM8BAzklUw7KKsFmma4h0A6E FKDg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=Oqbc+Mn9; spf=pass (google.com: domain of linux-wireless+bounces-1689-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-wireless+bounces-1689-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id j192-20020a638bc9000000b005cdf3787c1fsi314134pge.67.2024.01.10.20.51.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Jan 2024 20:51:46 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless+bounces-1689-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=Oqbc+Mn9; spf=pass (google.com: domain of linux-wireless+bounces-1689-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-wireless+bounces-1689-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 956E92887F6 for ; Thu, 11 Jan 2024 04:51:45 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id EC4B72583; Thu, 11 Jan 2024 04:51:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="Oqbc+Mn9" 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 48CAC1FD2 for ; Thu, 11 Jan 2024 04:51:30 +0000 (UTC) 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 (m0279873.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 40B2oqqE013582; Thu, 11 Jan 2024 04:51:25 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-type; s=qcppdkim1; bh=BjhHzsRfTXvm+YoUsGul ZQ7nxpfLgxexRKdhGKGT1dY=; b=Oqbc+Mn9xth3V1NBnQdyovG4LKvYhfbnQTGw o4Z3d3LNUiDur+DP6/A+92voCN6rz2IcolSQnJhncI5GOvIIkc+wY2F8+0q+XA9U 5jgpMoO4U2OscHplPBUiX3Rp3i+ucj507LcliNgfrn4DZecZpzNOpWkc2i3RIKRq zK+sxSooG4frRijOoHp2OfEK+xhQBO/iirjKWs0PKXxIrrzES8C9BQ+4U9M4xqll Gik7HwKP+Dliy/QvWeYsf/SF7TfOGJCIXywX7G3Tttg9XcUol3SaqUzEHleHae+g TS2V929k/ybPalyC8BZ/TVZHFHwgE71CfcUcCQaCU2VhYqJJzA== Received: from nalasppmta05.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3vj7w20641-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 11 Jan 2024 04:51:24 +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 40B4pNo5012173 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 11 Jan 2024 04:51:23 GMT Received: from srirrama-linux.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; Wed, 10 Jan 2024 20:51:22 -0800 From: Sriram R To: CC: , Sriram R Subject: [PATCH 02/12] wifi: ath12k: Modify add and remove chanctx ops for single wiphy support Date: Thu, 11 Jan 2024 10:20:35 +0530 Message-ID: <20240111045045.28377-3-quic_srirrama@quicinc.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240111045045.28377-1-quic_srirrama@quicinc.com> References: <20240111045045.28377-1-quic_srirrama@quicinc.com> Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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-GUID: hUks5e_30cBJuvyb0fcYzCr2XTHE5FWj X-Proofpoint-ORIG-GUID: hUks5e_30cBJuvyb0fcYzCr2XTHE5FWj X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.997,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-12-09_02,2023-12-07_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 suspectscore=0 priorityscore=1501 spamscore=0 malwarescore=0 impostorscore=0 clxscore=1015 mlxlogscore=614 adultscore=0 lowpriorityscore=0 phishscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2311290000 definitions=main-2401110035 Modify add and remove chanctx mac80211 ops to fetch the correct radio(ar) based on channel context. This change also introduces new helper function to fetch the radio/ar based on channel context and ieee80211_chan which internally uses the radio's low/high freq range. 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 --- drivers/net/wireless/ath/ath12k/core.h | 3 ++ drivers/net/wireless/ath/ath12k/mac.c | 54 ++++++++++++++++++++++++-- 2 files changed, 54 insertions(+), 3 deletions(-) diff --git a/drivers/net/wireless/ath/ath12k/core.h b/drivers/net/wireless/ath/ath12k/core.h index 5bce55799d98..69c926ba0e73 100644 --- a/drivers/net/wireless/ath/ath12k/core.h +++ b/drivers/net/wireless/ath/ath12k/core.h @@ -595,6 +595,9 @@ struct ath12k { bool monitor_vdev_created; bool monitor_started; int monitor_vdev_id; + + u32 freq_low; + u32 freq_high; }; struct ath12k_hw { diff --git a/drivers/net/wireless/ath/ath12k/mac.c b/drivers/net/wireless/ath/ath12k/mac.c index fbb2d195d778..2a70b7a486e3 100644 --- a/drivers/net/wireless/ath/ath12k/mac.c +++ b/drivers/net/wireless/ath/ath12k/mac.c @@ -612,6 +612,36 @@ struct ath12k *ath12k_mac_get_ar_by_pdev_id(struct ath12k_base *ab, u32 pdev_id) return NULL; } +static struct ath12k *ath12k_mac_get_ar_by_chan(struct ieee80211_hw *hw, + struct ieee80211_channel *channel) +{ + struct ath12k_hw *ah = hw->priv; + struct ath12k *ar; + int i; + + ar = ah->radio; + + if (ah->num_radio == 1) + return ar; + + for (i = 0; i < ah->num_radio; i++) { + if (channel->center_freq >= ar->freq_low && + channel->center_freq <= ar->freq_high) + return ar; + ar++; + } + return NULL; +} + +static struct ath12k *ath12k_get_ar_by_ctx(struct ieee80211_hw *hw, + struct ieee80211_chanctx_conf *ctx) +{ + if (!ctx) + return NULL; + + return ath12k_mac_get_ar_by_chan(hw, ctx->def.chan); +} + static void ath12k_pdev_caps_update(struct ath12k *ar) { struct ath12k_base *ab = ar->ab; @@ -6084,7 +6114,12 @@ static int ath12k_mac_op_add_chanctx(struct ieee80211_hw *hw, mutex_lock(&ah->conf_mutex); - ar = ath12k_ah_to_ar(ah, 0); + ar = ath12k_get_ar_by_ctx(hw, ctx); + if (!ar) { + mutex_unlock(&ah->conf_mutex); + return -EINVAL; + } + ab = ar->ab; ath12k_dbg(ab, ATH12K_DBG_MAC, @@ -6116,7 +6151,12 @@ static void ath12k_mac_op_remove_chanctx(struct ieee80211_hw *hw, mutex_lock(&ah->conf_mutex); - ar = ath12k_ah_to_ar(ah, 0); + ar = ath12k_get_ar_by_ctx(hw, ctx); + if (!ar) { + mutex_unlock(&ah->conf_mutex); + return; + } + ab = ar->ab; ath12k_dbg(ab, ATH12K_DBG_MAC, @@ -6533,7 +6573,12 @@ static void ath12k_mac_op_change_chanctx(struct ieee80211_hw *hw, mutex_lock(&ah->conf_mutex); - ar = ath12k_ah_to_ar(ah, 0); + ar = ath12k_get_ar_by_ctx(hw, ctx); + if (!ar) { + mutex_unlock(&ah->conf_mutex); + return; + } + ab = ar->ab; mutex_lock(&ar->conf_mutex); @@ -7439,6 +7484,9 @@ static void ath12k_mac_update_ch_list(struct ath12k *ar, band->channels[i].center_freq > freq_high) band->channels[i].flags |= IEEE80211_CHAN_DISABLED; } + + ar->freq_low = freq_low; + ar->freq_high = freq_high; } static u32 ath12k_get_phy_id(struct ath12k *ar, u32 band) -- 2.17.1