Received: by 2002:a05:7412:bbc7:b0:fc:a2b0:25d7 with SMTP id kh7csp2916450rdb; Tue, 6 Feb 2024 01:22:52 -0800 (PST) X-Google-Smtp-Source: AGHT+IE85aBJ4eoBjazlYxrXK5HEt/XuVCU/mwuxSMgl+RUcuQEtilqHH6LwIu1x9TabmoE2OP3R X-Received: by 2002:a05:622a:28e:b0:42b:ff8d:3719 with SMTP id z14-20020a05622a028e00b0042bff8d3719mr2121603qtw.67.1707211371803; Tue, 06 Feb 2024 01:22:51 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707211371; cv=pass; d=google.com; s=arc-20160816; b=WJsypvwYqX+2aV4ifrEjNevwUC/YZKJUe8RzJiZH5M2qAbkB3VTiDuXlarDbjyGr0k WinGmJM7sGujXS+DOunxbQXjSzFrAhqkTZJYezqs9tlCUtSBFkwK3cRLxbs9w3AU+4yi rzgMnhSdK1MMeneK7YGwB8S3EzmnWF/aJN08YGzkxU74+8257jPYc472fkSonOZ86d4n VRqtmG0wpWb9Gvnfb0kqNL5u/dY5bDjSYScRGtWWnkSnZlkmDh0kdRisvby+cUo1Gt+J NQyYPMB/cv56v5Uk1FXoAbUt77+G/6G9CxCuSQfeBEHgvRu0b3c29+1NtvPCzGEl+2c2 mfow== 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=qF0awN3hZfn5EQwPHsOHaB3bJPsbMCBruR4Rgyx7Bck=; fh=UGvv+WwqOj2Nhh+ppHmYw4HfmsZjaRbh3NZ0QWC9xrI=; b=ieGA4JQRdcPNUUpqgM6CP4G5SERHkONFWwARW2bG3Rve831fkK588U9zHfeD9V7ULP TEMV1gyeELrE76ZrGklyZATPS9eRZXDAz/6tbeE2a25ClmlhNjw3VrFXz2sVeFl8AxJC 0pnzFWMn0rqSJ3/30H6pp0PRQturnyNn2PBW1RXs9BcZOCBO5+Cqet67vzgYm1MWQsYM 6BtVjUSPQ9o7QxacH4DL0Lctice9XuWObD6VCeHImMfwVVShEY0zW1ACyemHnrKeQIV3 Tecd3dsOGkuopZMGyW2vt+l0EiFGq7mhScUk+6L9y6kLesI5yotIhWrd+wmU07exCUV0 dxcg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=UMyMjM7s; 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-3200-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-wireless+bounces-3200-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; AJvYcCVz2Z9kekd9Y7UPimS1aaqGf+F4gtQBq9mPa01Rzd3CcD8ZH8HMsAB9EGPxr1Jz8VT0S/USWl3MNi90Chkw1NUKoLDnv9Jt1U0rYA9JKA== Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id k18-20020ac85fd2000000b0042c32e8db9bsi1561544qta.374.2024.02.06.01.22.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Feb 2024 01:22:51 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless+bounces-3200-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=UMyMjM7s; 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-3200-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-wireless+bounces-3200-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 81C9A1C228C9 for ; Tue, 6 Feb 2024 09:22:51 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C086512E1D9; Tue, 6 Feb 2024 09:21:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="UMyMjM7s" 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 DBDAF12E1C8 for ; Tue, 6 Feb 2024 09:21:53 +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=1707211315; cv=none; b=V0JEYGjZnIgS/T+oFmx26+57YcDFcuznMn9+QwacTeEsrFr9O0aIHx6ib3FT0/sYH49UQTDiSaLPYXe7nYk3tWr5thOuclEe5BntTX4OUkFTbj2JPrgZ271Uay1cQM0g5nxJI56cDXLrbMMAQjGfEi/6E12kA2VYi/M2QEz/xHs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707211315; c=relaxed/simple; bh=oIBP4hyN7WJd/SDpV4eg0L5MpLmwcodkJZnS5jkhVnk=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=FO8OCfanHTTYeoxpXP9fM/DJ+n+xPnjFYL2igROKKjiW/bUR6UF2XdsU1IA1kc4w/lig8JxFI9pGAuiVd0aYDQ+8SNr0v/2kEux6csYHee1UuSopzXCxeDtiU+a8qA3NRqMbyK+b93M7BBCT6D5+yoLLVbx92Bkd86QcecVD7pE= 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=UMyMjM7s; 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 (m0279873.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 4167Q83m016271; Tue, 6 Feb 2024 09:21:41 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=qF0awN3hZfn5EQwPHsOHaB3bJPsbMCBruR4Rgyx7Bck=; b=UM yMjM7s7sswo7M9mJDWWlr0ctoDUiiHb2IG8CQVgk65avzo0T/VZlGIDbigxgcjtz 5KOi8HAk0nE+1pk7j0P3n44FGcOZFTQlwv8+jH1CrLM06RMKNWFAQo/9BmItNBgp v1OIDMpzzVdfZA4aUDMK05muQ6OShZdpZw4sG0RKk7yy89paCHXRkh1qRJjPHG2E 9zrJLarRAfBFI1UpqwV8hdM0AnOKyEZaxK6wGV8XMBE2XFm1cRaECxNvKCLnStmu Azmoc+eL79hCxXkrvDvBu47Z6MqxBaTTcpknxd2ohtoF+nQn9tRHEyMiKW5C8ol9 5jjCbAcJr4zIidTQmOzw== Received: from nalasppmta04.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3w31wnt5aa-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 06 Feb 2024 09:21:41 +0000 (GMT) Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA04.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 4169Leth006396 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 6 Feb 2024 09:21:40 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:38 -0800 From: Rameshkumar Sundaram To: CC: , Sriram R , Rameshkumar Sundaram Subject: [PATCH v2 02/12] wifi: ath12k: Modify add and remove chanctx ops for single wiphy support Date: Tue, 6 Feb 2024 14:49:44 +0530 Message-ID: <20240206091954.4144454-3-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: HO0cUDWqqMs9xPgozNlYLoKzyrkwXTqt X-Proofpoint-GUID: HO0cUDWqqMs9xPgozNlYLoKzyrkwXTqt 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 priorityscore=1501 adultscore=0 phishscore=0 mlxlogscore=663 spamscore=0 lowpriorityscore=0 impostorscore=0 bulkscore=0 clxscore=1015 malwarescore=0 suspectscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2401310000 definitions=main-2402060065 From: Sriram R 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 Signed-off-by: Rameshkumar Sundaram --- drivers/net/wireless/ath/ath12k/core.h | 3 ++ drivers/net/wireless/ath/ath12k/mac.c | 51 +++++++++++++++++++++++--- 2 files changed, 48 insertions(+), 6 deletions(-) diff --git a/drivers/net/wireless/ath/ath12k/core.h b/drivers/net/wireless/ath/ath12k/core.h index 002d4af64335..18269aa0264b 100644 --- a/drivers/net/wireless/ath/ath12k/core.h +++ b/drivers/net/wireless/ath/ath12k/core.h @@ -596,6 +596,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 69d60e57d660..c58f753d4a10 100644 --- a/drivers/net/wireless/ath/ath12k/mac.c +++ b/drivers/net/wireless/ath/ath12k/mac.c @@ -613,6 +613,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; @@ -6031,11 +6061,13 @@ static int ath12k_mac_op_ampdu_action(struct ieee80211_hw *hw, static int ath12k_mac_op_add_chanctx(struct ieee80211_hw *hw, struct ieee80211_chanctx_conf *ctx) { - struct ath12k_hw *ah = ath12k_hw_to_ah(hw); struct ath12k *ar; struct ath12k_base *ab; - ar = ath12k_ah_to_ar(ah, 0); + ar = ath12k_get_ar_by_ctx(hw, ctx); + if (!ar) + return -EINVAL; + ab = ar->ab; ath12k_dbg(ab, ATH12K_DBG_MAC, @@ -6059,11 +6091,13 @@ static int ath12k_mac_op_add_chanctx(struct ieee80211_hw *hw, static void ath12k_mac_op_remove_chanctx(struct ieee80211_hw *hw, struct ieee80211_chanctx_conf *ctx) { - struct ath12k_hw *ah = ath12k_hw_to_ah(hw); struct ath12k *ar; struct ath12k_base *ab; - ar = ath12k_ah_to_ar(ah, 0); + ar = ath12k_get_ar_by_ctx(hw, ctx); + if (!ar) + return; + ab = ar->ab; ath12k_dbg(ab, ATH12K_DBG_MAC, @@ -6477,11 +6511,13 @@ static void ath12k_mac_op_change_chanctx(struct ieee80211_hw *hw, struct ieee80211_chanctx_conf *ctx, u32 changed) { - struct ath12k_hw *ah = ath12k_hw_to_ah(hw); struct ath12k *ar; struct ath12k_base *ab; - ar = ath12k_ah_to_ar(ah, 0); + ar = ath12k_get_ar_by_ctx(hw, ctx); + if (!ar) + return; + ab = ar->ab; mutex_lock(&ar->conf_mutex); @@ -7373,6 +7409,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.25.1