Received: by 2002:ab2:7855:0:b0:1f9:5764:f03e with SMTP id m21csp231871lqp; Wed, 22 May 2024 02:55:28 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWPATHKZ0Qjy81cmFA25VbWNhT5FfOkxcGF/TJ4/VCgqzQfc8Dc7wTAz83cnxoG8DH66gK21O7Qq+S1joiT1HGgNzLlW20hCtSrC3kaeg== X-Google-Smtp-Source: AGHT+IF8lepL+pYC+Xmgaw7xGIjULlt6fImbi93DaMB14XgfAfP5GekrbDljsK1fCyKaauqcg6BV X-Received: by 2002:a05:6a21:2d04:b0:1aa:5ca9:c564 with SMTP id adf61e73a8af0-1b1f873b403mr1531488637.5.1716371728545; Wed, 22 May 2024 02:55:28 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716371728; cv=pass; d=google.com; s=arc-20160816; b=pnOZjyhkv7HcGztaRWkXAvMD0W61fpHPeyQvqDGlEr7RAqyOKqfeBGgxEyKUXW3DmG CFaTPbjVIUjmJKJ2chGBmoBA2773RdZSpECN399kD9oRvH/fDiKRIdzbDk5MsxnKybC8 N2CtZCOsCgQG/oEbPnmP6SL7qepisrjz4CTwOhFZh61cQQOFhqSufsJxqVylLbJHh3df Lrkbklao8IJPtqxmQqEp1LzrHSGggjSNcCXRac+/+TM0bL0nDMR85eKy0803L22w9d7g nrIDQrrCVJfRpGsA2N1ruDFsg2gRXxJAy0DBo11ng08VZDcIxnb+M4Cp4TMAg2RKtW4u ETDg== 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=q9ZloH1bI1zct1SU4341ZzcGwjDZqsBFVqUcnb6amg4=; fh=gjyKuI8lXSKwquXF/tvFPrzHVVLmD81gAC9iylGd+k0=; b=hoNzGhGawYTh9fuTEXDDYc44gy+Du5oCLlvQ7/kwkr/nh36y9mwUToJGNmPzi5D8Je cewKvn+UnoRD2i3OH6vEz5+Oi41Fg0iOeuPsoziVX4GYdV5AfIYxBcHLVk/UBIT8aivP ybNTbihWoxGqWIdS0uPvG1f17aYFDUodtJbGLFAtdl8EXH2Fdxff25ItAylyQi7flUr+ Ot+cLbRTdZPqcTMn4xofu/M5JkvHkoMPZS0+6XxMGAsTnR8vAb4IFOAVSIIzCnk/OxLA RvT1twZ8K4u9cy7e/sdIfDFAB3mzrt/1SFjepZYbPQ9TNOrFpjSVoHZXZvMWzv9nDjNT RoPA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=Pi53iQXH; arc=pass (i=1 spf=pass spfdomain=qualcomm.com dkim=pass dkdomain=quicinc.com dmarc=pass fromdomain=quicinc.com); spf=pass (google.com: domain of linux-wireless+bounces-7948-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-wireless+bounces-7948-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. [139.178.88.99]) by mx.google.com with ESMTPS id 98e67ed59e1d1-2b670f57185si25924591a91.63.2024.05.22.02.55.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 May 2024 02:55:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless+bounces-7948-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=Pi53iQXH; arc=pass (i=1 spf=pass spfdomain=qualcomm.com dkim=pass dkdomain=quicinc.com dmarc=pass fromdomain=quicinc.com); spf=pass (google.com: domain of linux-wireless+bounces-7948-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-wireless+bounces-7948-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 248422811EA for ; Wed, 22 May 2024 09:55:28 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4454681AB4; Wed, 22 May 2024 09:55:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="Pi53iQXH" X-Original-To: linux-wireless@vger.kernel.org Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.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 B997A81729 for ; Wed, 22 May 2024 09:55:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716371723; cv=none; b=O0UGSfqn2JUDLd/z6exqkaxIuWdEyE/aKzPU5GM5mldOGHeWwCMzpCxs04sqGIvlFURLD5iPmn7o8tB8xCXFn4jyuVgkzE6ChSj43n/7zh7y3XyyA75Fr/++eoyT+Xtm14qOPuTDOFq7l0IOdJe8Mvjgs1vPDsP5nUAxtkf58Vw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716371723; c=relaxed/simple; bh=g4xoRO9xj6dOiD3VqciB/zfkT2esrbTTCOXNPr9Zz2o=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=tPi8y4+B1RF4z3scVPVv1frXqaNTjr+V2YtuxjSR88v3HA6TnUz8H9rD/SUWkC+Yk5DdXWNDZTdh2IJ5dbYpDkIMxp56W/BOr0HDXlQ127ZipN4zHdUoTQCNDp+04uIWmFw30Updslrpq//bb+irESUe/Nx4NrjyhVYXiSUaC5k= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=qualcomm.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=Pi53iQXH; arc=none smtp.client-ip=205.220.168.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=qualcomm.com Received: from pps.filterd (m0279864.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 44M8Vini008286; Wed, 22 May 2024 09:55:20 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; s=qcppdkim1; bh=q9ZloH1 bI1zct1SU4341ZzcGwjDZqsBFVqUcnb6amg4=; b=Pi53iQXH6Ym0qwPgCcO7vb7 lh/k1y5TR7nQ1yb7xmcvZW+UOPzsnYsr6L+Tprh7AbsDMLl7lR/75aAn4Wce64b3 heJK7OXcJToP6kiv8+d73S4qMI7vwOYKlzJCRdMSErPZV0eYTxA5oIokUXOCD8iu VsD8mFn6hmgDpOkg/olZrjAFrqGEDjIJGlhj1/t+m7hqkUBuHIk+6cJ4tBZDVBin ymjht4MVYslMkImEMVVPXS5NNbak1b42a0qHcKmEWQqvAtzjNRq3+UhCmoq85w+h p9JIbOT6cIIopCC/3QUIKiZjtaUvdv5W7XihEb445lb75cXU4ySnNKYUa2phkcA= = Received: from apblrppmta02.qualcomm.com (blr-bdr-fw-01_GlobalNAT_AllZones-Outside.qualcomm.com [103.229.18.19]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3y6pqardkv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 22 May 2024 09:55:19 +0000 (GMT) Received: from pps.filterd (APBLRPPMTA02.qualcomm.com [127.0.0.1]) by APBLRPPMTA02.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTP id 44M9tFb4024963; Wed, 22 May 2024 09:55:15 GMT Received: from pps.reinject (localhost [127.0.0.1]) by APBLRPPMTA02.qualcomm.com (PPS) with ESMTPS id 3y6ndkfpvc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 22 May 2024 09:55:15 +0000 Received: from APBLRPPMTA02.qualcomm.com (APBLRPPMTA02.qualcomm.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 44M9tFMc024958; Wed, 22 May 2024 09:55:15 GMT Received: from hu-devc-blr-u22-a.qualcomm.com (hu-hprem-blr.qualcomm.com [10.190.108.75]) by APBLRPPMTA02.qualcomm.com (PPS) with ESMTPS id 44M9tFYw024957 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 22 May 2024 09:55:15 +0000 Received: by hu-devc-blr-u22-a.qualcomm.com (Postfix, from userid 4146166) id 3737541148; Wed, 22 May 2024 15:25:14 +0530 (+0530) From: Harshitha Prem To: ath12k@lists.infradead.org Cc: linux-wireless@vger.kernel.org, Karthikeyan Periyasamy , Harshitha Prem , Jeff Johnson Subject: [PATCH v5 3/8] wifi: ath12k: Add ath12k_get_num_hw api Date: Wed, 22 May 2024 15:24:34 +0530 Message-Id: <20240522095439.2596989-4-quic_hprem@quicinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240522095439.2596989-1-quic_hprem@quicinc.com> References: <20240522095439.2596989-1-quic_hprem@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 X-QCInternal: smtphost X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: dArmUokaoJKDT8sFoLWzspKxaLAbc2Oq X-Proofpoint-ORIG-GUID: dArmUokaoJKDT8sFoLWzspKxaLAbc2Oq X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.650,FMLib:17.12.28.16 definitions=2024-05-22_05,2024-05-21_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 impostorscore=0 suspectscore=0 bulkscore=0 mlxscore=0 adultscore=0 spamscore=0 malwarescore=0 mlxlogscore=856 clxscore=1015 priorityscore=1501 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2405010000 definitions=main-2405220070 From: Karthikeyan Periyasamy Currently, one or more ath12k_hw is part of device (ath12k_base) but in future, ath12k_hw would be part of device group (ath12k_hw_group). Hence, num_hw under device would be moved to device group. To facilitate above transition, add helper ath12k_get_num_hw() api to get the number of radios per device. In future, this helper would be able to get the number of radios in a device group. Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.0.1-00029-QCAHKSWPL_SILICONZ-1 Signed-off-by: Karthikeyan Periyasamy Signed-off-by: Harshitha Prem Acked-by: Jeff Johnson --- drivers/net/wireless/ath/ath12k/core.c | 6 +++--- drivers/net/wireless/ath/ath12k/core.h | 5 +++++ drivers/net/wireless/ath/ath12k/mac.c | 8 ++++---- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/drivers/net/wireless/ath/ath12k/core.c b/drivers/net/wireless/ath/ath12k/core.c index 3925bb70d479..7ad65ace7123 100644 --- a/drivers/net/wireless/ath/ath12k/core.c +++ b/drivers/net/wireless/ath/ath12k/core.c @@ -946,7 +946,7 @@ static void ath12k_rfkill_work(struct work_struct *work) rfkill_radio_on = ab->rfkill_radio_on; spin_unlock_bh(&ab->base_lock); - for (i = 0; i < ab->num_hw; i++) { + for (i = 0; i < ath12k_get_num_hw(ab); i++) { ah = ath12k_ab_to_ah(ab, i); if (!ah) continue; @@ -998,7 +998,7 @@ static void ath12k_core_pre_reconfigure_recovery(struct ath12k_base *ab) if (ab->is_reset) set_bit(ATH12K_FLAG_CRASH_FLUSH, &ab->dev_flags); - for (i = 0; i < ab->num_hw; i++) { + for (i = 0; i < ath12k_get_num_hw(ab); i++) { ah = ath12k_ab_to_ah(ab, i); if (!ah || ah->state == ATH12K_HW_STATE_OFF) continue; @@ -1037,7 +1037,7 @@ static void ath12k_core_post_reconfigure_recovery(struct ath12k_base *ab) struct ath12k *ar; int i, j; - for (i = 0; i < ab->num_hw; i++) { + for (i = 0; i < ath12k_get_num_hw(ab); i++) { ah = ath12k_ab_to_ah(ab, i); if (!ah || ah->state == ATH12K_HW_STATE_OFF) continue; diff --git a/drivers/net/wireless/ath/ath12k/core.h b/drivers/net/wireless/ath/ath12k/core.h index 3f5c9fa9d04c..a22f3561deb0 100644 --- a/drivers/net/wireless/ath/ath12k/core.h +++ b/drivers/net/wireless/ath/ath12k/core.h @@ -1062,4 +1062,9 @@ static inline void ath12k_ab_set_ah(struct ath12k_base *ab, int idx, { ab->ah[idx] = ah; } + +static inline int ath12k_get_num_hw(struct ath12k_base *ab) +{ + return ab->num_hw; +} #endif /* _CORE_H_ */ diff --git a/drivers/net/wireless/ath/ath12k/mac.c b/drivers/net/wireless/ath/ath12k/mac.c index f8e8320b8598..66587c5ea8fd 100644 --- a/drivers/net/wireless/ath/ath12k/mac.c +++ b/drivers/net/wireless/ath/ath12k/mac.c @@ -9157,7 +9157,7 @@ int ath12k_mac_register(struct ath12k_base *ab) ab->cc_freq_hz = 320000; ab->free_vdev_map = (1LL << (ab->num_radios * TARGET_NUM_VDEVS)) - 1; - for (i = 0; i < ab->num_hw; i++) { + for (i = 0; i < ath12k_get_num_hw(ab); i++) { ah = ath12k_ab_to_ah(ab, i); ret = ath12k_mac_hw_register(ah); @@ -9184,7 +9184,7 @@ void ath12k_mac_unregister(struct ath12k_base *ab) struct ath12k_hw *ah; int i; - for (i = ab->num_hw - 1; i >= 0; i--) { + for (i = ath12k_get_num_hw(ab) - 1; i >= 0; i--) { ah = ath12k_ab_to_ah(ab, i); if (!ah) continue; @@ -9254,7 +9254,7 @@ void ath12k_mac_destroy(struct ath12k_base *ab) pdev->ar = NULL; } - for (i = 0; i < ab->num_hw; i++) { + for (i = 0; i < ath12k_get_num_hw(ab); i++) { ah = ath12k_ab_to_ah(ab, i); if (!ah) continue; @@ -9277,7 +9277,7 @@ int ath12k_mac_allocate(struct ath12k_base *ab) ab->num_hw = ab->num_radios; radio_per_hw = 1; - for (i = 0; i < ab->num_hw; i++) { + for (i = 0; i < ath12k_get_num_hw(ab); i++) { for (j = 0; j < radio_per_hw; j++) { pdev_map[j].ab = ab; pdev_map[j].pdev_idx = (i * radio_per_hw) + j; -- 2.34.1