Received: by 2002:ab2:710b:0:b0:1ef:a325:1205 with SMTP id z11csp925608lql; Tue, 12 Mar 2024 02:05:23 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCX1nFSAhKyZcobx1BCSCyFZ2qwguuXI+owpGd1uetdvtUdW96APC2YznQHrfY9BP7WPwqdLUrLqm8Cb1VlmT0I7YRb5iJigivNDO5iNtg== X-Google-Smtp-Source: AGHT+IGlx0NIRrcvUv64CilLDOnjjUBnIbcNUGBqvnYTQkYncECSDxP8Lng3UP4NyHteknD9nI4a X-Received: by 2002:a05:622a:1343:b0:42e:f3d5:a5a3 with SMTP id w3-20020a05622a134300b0042ef3d5a5a3mr16744379qtk.28.1710234323471; Tue, 12 Mar 2024 02:05:23 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710234323; cv=pass; d=google.com; s=arc-20160816; b=AjOkZC3t0O/vraidKinLWmlgeqfM458TudTI84c9xBmAOPXyVIGYOVmoNIrsbRFBWI MK/zsLvHx3JopD9bRsFEu1UNBE0+0s0Cv/dJWn8Fle7Qxeop/XY2511IQCcthJ4wMHR4 1zkWSlnJIInoKT+6DgLbtxVqpJbmVvp1TTkWrHY4X78JKLcKEnVNoZ9mYOivNe+cPufj 8sNbaNte62E3sJkC2Cshzrq0EraqGLEwj0E5BeX7oBoJbKNUSA6F/bfytVinNM0obvje zbRtK1LWOB4AN8JELj0y39lNeVAjPQ+tkhMuoAy38IV+v+yJIDJ07WouH2g2F7OIYoDn LNIg== 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=UEEWyQPfS/z2ZZ2PTbBEE5MObLNZHiNkQZkre89czW4=; fh=woZAKccQQLpsH+ifgAFl/ubgLBC7CdNtwbjjrWqWXi0=; b=QAB0sk5soI2D6Y9Y7t2lW2BK5RYRm5sHJPQZPrNYNefsJjONP3jmL8iUqK1beHqEhe Rk0ZBh7fpIpoN5FRi0RhZyGkBTRDaFzW6n13GzP0nK7tTeiQBOFF214ejfnxwRkBdNi8 bQXkeZIcKRW3ZT1wOonccfIDb1TmZlKn7poWudkRwVSbcoR8QOOonRyfyKuGRp/el4WG jQ19XKEHsNV//40VRZmRzudy8H/ISErL4UQZnOwotA49VwUEnmyNj3Fb7z2We68I3R/P GNSdvvXMnWdpwc8CeFlpFd8NcWMWLHT/1mPVVGMgbbRQFX8X/KEfPffqWpmjl6Urh4Ns 6puA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=psWKIhDs; 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-4601-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-wireless+bounces-4601-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id b12-20020ac87fcc000000b0042f2138dc33si7101322qtk.791.2024.03.12.02.05.23 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Mar 2024 02:05:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless+bounces-4601-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=psWKIhDs; 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-4601-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-wireless+bounces-4601-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 2973F1C21819 for ; Tue, 12 Mar 2024 09:05:23 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B854B78276; Tue, 12 Mar 2024 09:04:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="psWKIhDs" 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 1D7B17866E for ; Tue, 12 Mar 2024 09:04:41 +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=1710234283; cv=none; b=Y3XstcWzQHEjaaJt6t13qSsUduoG+a/Y2stSD4H3CI/z3C4E8qKG1CyKFkLE7sKah/P+357OgrVvJ2qyU5yhJs5mOJL+H15bSgDIFN+pTBxwnk+1/qznGqClW1JllL9sgRTkvYZE12uxjSiuGv6FeUqnknL4WAW19BuBq9sUI84= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710234283; c=relaxed/simple; bh=e6Bi/XW5F309zRA8KfpZIzbioFgW+1TYUUWMwONdKoY=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=BIkTiuYCwRnMLrDUQhQxzzMF/PlYuc+gLKUSjJvaRZWq6DN1vY4LKb0XYu5R55fqwUMlcrhICAZjgiqgFNGQIaDwmZ86smEMoX/3ZL1cEo4Nk+Xe0XPtKcf2JPwiP0BDmjVtbwnC7AU7ugwQfAml2Z8tqYzZJjHYwPaq+Zigl60= 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=psWKIhDs; 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 (m0279872.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 42C6MQF4019737; Tue, 12 Mar 2024 09:04:36 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=UEEWyQPfS/z2ZZ2PTbBEE5MObLNZHiNkQZkre89czW4=; b=ps WKIhDsUMOyuTLgELFq6WpGeIMuLWvmS+s9FY/RRzmImUy9TTVjiY1oPXrBkdoptF 2caM+3LCv+vJwbv8XkbeDLRDuXOwcMLCyE+ZQp9osB7Ql+0P3wbH4gPuMLFfJoke 34EU1b1iqHl3VgN6Ig2LAaqH5QauJ8dS6hfsHAX4lXNn+x4FqLr38JJyGLDurBQd Eo5STQ7dP0aD3IiIYP9dSo92VYLzwihtC4tM7MVQUVjJ+KRodoaMQOl1hbQ5WnxL 9NhjSycZah9M3fcoRHDSxsyfHIEl2H7QF6fxxd1giBwLlXys0C7ggsqp9vA0F212 N+4m2grs2sugciJL1F7w== Received: from nalasppmta01.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3wthqfr9e3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 12 Mar 2024 09:04:35 +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 42C94OWQ005651 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 12 Mar 2024 09:04:24 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 02:04:22 -0700 From: Rameshkumar Sundaram To: CC: , Sriram R , Rameshkumar Sundaram Subject: [PATCH v3 02/12] wifi: ath12k: Modify add and remove chanctx ops for single wiphy support Date: Tue, 12 Mar 2024 14:33:41 +0530 Message-ID: <20240312090351.1620218-3-quic_ramess@quicinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240312090351.1620218-1-quic_ramess@quicinc.com> References: <20240312090351.1620218-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-GUID: fFM-0kFaIpgflsmvgDYJ9n8MgN2aTaT5 X-Proofpoint-ORIG-GUID: fFM-0kFaIpgflsmvgDYJ9n8MgN2aTaT5 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-11_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 bulkscore=0 impostorscore=0 mlxlogscore=788 spamscore=0 lowpriorityscore=0 suspectscore=0 clxscore=1015 adultscore=0 mlxscore=0 malwarescore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2402120000 definitions=main-2403120070 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 | 50 ++++++++++++++++++++++---- 2 files changed, 47 insertions(+), 6 deletions(-) diff --git a/drivers/net/wireless/ath/ath12k/core.h b/drivers/net/wireless/ath/ath12k/core.h index ff831faa4945..53bcf9416efd 100644 --- a/drivers/net/wireless/ath/ath12k/core.h +++ b/drivers/net/wireless/ath/ath12k/core.h @@ -598,6 +598,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 ba69fdfa9133..0f33f5615170 100644 --- a/drivers/net/wireless/ath/ath12k/mac.c +++ b/drivers/net/wireless/ath/ath12k/mac.c @@ -613,6 +613,35 @@ 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_each_ar(i, ah, ar) { + if (channel->center_freq >= ar->freq_low && + channel->center_freq <= ar->freq_high) + return 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; @@ -6229,11 +6258,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, @@ -6257,11 +6288,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, @@ -6637,11 +6670,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); @@ -7643,6 +7678,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