Received: by 2002:a89:288:0:b0:1f7:eeee:6653 with SMTP id j8csp44110lqh; Mon, 6 May 2024 10:40:13 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVNzGbwLfucj/8Z9TwZry5IBvI80vQxRicsLQNwIJGHcTvR7jYWsX/DNgiP5uq9vAfdL+FtnYX4iWoTVqbf8p/fcW5JXrKv73fdL6b8lA== X-Google-Smtp-Source: AGHT+IE9YJOaI8u/dt6uTeAqz28wMTAOzuk6WOvUUZBMnL5UT3wavWIL3ClO3ZmvZkB541ALCyaR X-Received: by 2002:a17:902:c94a:b0:1e4:17e4:3a30 with SMTP id i10-20020a170902c94a00b001e417e43a30mr13261425pla.31.1715017213207; Mon, 06 May 2024 10:40:13 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715017213; cv=pass; d=google.com; s=arc-20160816; b=JScO23N9tEne/jAKBMo5brgABRLOyVv+tbJoDGw+Fi8rAqKv4L3IadXvnObBsvnRS2 8LhyVGZqwLl9Y09UzmHKJ/0DWlTLYdSLePU1/g6fP9s31eVjSkWNEE6QkMCdsKpMGOa6 UgYxgVF998Y1gA/jinYVXk9svHRTeCdzBvLNMnVKW6zJ8QIxIo2AkvA6Pl0VP7zhy285 fHHawsucIKOHhh9bDx2fmUtoGbTtdJ65feUi51Ax+uEgkNZ2rBzj5eLl0WdJg7eQJxb0 3/V3Oc+vtunf+tH6QPtiu5YiboaU8I9yL/4K2syDUPnJqYtMBDY5ZpUomxUSApK+mamz wKwA== 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=/biARq+7zVuKXUSLT6Fi2jgK2jg+2Y/XscnrGBfjy9A=; fh=wnySVr9+WO9j7lO1L6CVbSw/CjEiK6R10EUaKUiDPbE=; b=RyA0i+OlmXX8+gkOI0FIYxb3C37lymLYYUTzPprzri+MOr9LXl+vDi4KsYBaCe+bMs pZsnWDUea62zDziYg69fjqkRFOBmgJ7aiHYyVkuxszusJxbkbCbz+9udweLg9I7khcu6 DL6dDbStlH8sdv9WoyjdPmj527LZDsemiG4p3XBrCQIhvcrLbyIFQME7v1DLwHahQOMn NUMulf2oBVHZ324QzGU4aa1H0xZy6js+JBwHGwlm2SB5RzJxFRmsy+Gyr8doUHMp1Tcx ZJraoZNn+qhMOWOef0WkUgf8MyQWgkNx83he9MyabPKbxrF6g3blEMAKmq8AAu/SP17M W15g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=Pe5qsCSv; 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-7224-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-wireless+bounces-7224-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 d11-20020a170902cecb00b001e3d3ae4d74si8704471plg.28.2024.05.06.10.40.12 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 May 2024 10:40:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless+bounces-7224-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=Pe5qsCSv; 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-7224-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-wireless+bounces-7224-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 CF9BD2857E6 for ; Mon, 6 May 2024 17:40:12 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1D76015820E; Mon, 6 May 2024 17:40:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="Pe5qsCSv" 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 150D8157493 for ; Mon, 6 May 2024 17:39:57 +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=1715017200; cv=none; b=XiYHgPIMEqzpEZ4r9WK/usaJIUJ1zvX0s5tPukFtnF0pTyt4mTPca8o5mYk3KAHHodYjP1fi2K0ef/6bisHHIsVUyN/gNsi5l+BCIOGpG+WbyGPFFj/LJSMJ58mScUQwNCF2OqDSXUvrh3Wj9vmKG9llsy4rIETLW9XuoTkUXcY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715017200; c=relaxed/simple; bh=+NU4fWQFotGT7tauaIKNvIVr6V1Pn2wwPqeI/A+lI0c=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=ORjggEXTCLWNoZp2ZiP2kOr+fCXLs3D8sn2Tpkg24WIfVfxC9L5xnwuLXJNbc1u3GUW2FVU4Yyf68SfNqMtgkqF1uRwBc0qvKqGdKDETQx0dPxCmQKIgwaG16sqCF7SMgaqooYC8Wvh2RBK6R3tcB9jZ/dzqQrtPnmVAkKpwmok= 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=Pe5qsCSv; 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 (m0279867.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 4469kOpG021183; Mon, 6 May 2024 17:39:55 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=/biARq+ 7zVuKXUSLT6Fi2jgK2jg+2Y/XscnrGBfjy9A=; b=Pe5qsCSv834tTZ/TnNqbIuD wVVz3Fm55OBfGHCBbCaMUTEHFol6F1QNSzYXc8B8Rz+bhVZjHriva2zmH4hw+k4L WseqQteq5BzOr13GunJIKR18ymcO4+/Y3G+3yVL2/45/f1AsuBbsyUUwL62qZS5m /2IujDCNaYveOcmkIxrPyYUb3YKxZ/6NIaYR/B3apl78dif8lw0BL/UEP+LVq+eh q3Spv4UClZfNDmCyp6ePlGS/3fjgZ9PHW2p1wsjT5DtyIfm9UzNnwmYutdlNUkkP x5nmnrVv23qGl8MTreoTns+Jc2wobZ2LMCQ8beVIOq3Chv5r1xrwrNqICdH4g9w= = 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 3xxvv7114d-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 06 May 2024 17:39:54 +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 446Hdpld009765; Mon, 6 May 2024 17:39:51 GMT Received: from pps.reinject (localhost [127.0.0.1]) by APBLRPPMTA02.qualcomm.com (PPS) with ESMTPS id 3xwe3k9tw8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 06 May 2024 17:39:51 +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 446Hdp0E009759; Mon, 6 May 2024 17:39:51 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 446HdpIY009758 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 06 May 2024 17:39:51 +0000 Received: by hu-devc-blr-u22-a.qualcomm.com (Postfix, from userid 4146166) id 5B6994114D; Mon, 6 May 2024 23:09:50 +0530 (+0530) From: Harshitha Prem To: ath12k@lists.infradead.org Cc: linux-wireless@vger.kernel.org, Karthikeyan Periyasamy , Harshitha Prem Subject: [PATCH v3 3/8] wifi: ath12k: Add ath12k_get_num_hw api Date: Mon, 6 May 2024 23:09:38 +0530 Message-Id: <20240506173943.1747037-4-quic_hprem@quicinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240506173943.1747037-1-quic_hprem@quicinc.com> References: <20240506173943.1747037-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: 6FeRDE7v679p4QNcCy3qrCbxNbvBr7fz X-Proofpoint-ORIG-GUID: 6FeRDE7v679p4QNcCy3qrCbxNbvBr7fz X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.650,FMLib:17.11.176.26 definitions=2024-05-06_12,2024-05-06_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 malwarescore=0 lowpriorityscore=0 bulkscore=0 adultscore=0 clxscore=1015 suspectscore=0 spamscore=0 mlxscore=0 priorityscore=1501 mlxlogscore=796 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2404010003 definitions=main-2405060126 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 --- 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 217a1081fa94..23b0edec1789 100644 --- a/drivers/net/wireless/ath/ath12k/core.c +++ b/drivers/net/wireless/ath/ath12k/core.c @@ -949,7 +949,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; @@ -1001,7 +1001,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; @@ -1040,7 +1040,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 c88262276cd9..49ff408d6db1 100644 --- a/drivers/net/wireless/ath/ath12k/core.h +++ b/drivers/net/wireless/ath/ath12k/core.h @@ -1069,4 +1069,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 ff26cbc63b0a..2e0bd7cfc7bf 100644 --- a/drivers/net/wireless/ath/ath12k/mac.c +++ b/drivers/net/wireless/ath/ath12k/mac.c @@ -8885,7 +8885,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); @@ -8912,7 +8912,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; @@ -8982,7 +8982,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; @@ -9005,7 +9005,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.17.1