From patchwork Thu Apr 25 05:57:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Harshitha Prem X-Patchwork-Id: 792318 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 BF5603BBF6 for ; Thu, 25 Apr 2024 05:58:12 +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=1714024694; cv=none; b=tPyhg//AIhq+0k6TCt0n3ecK/AmQCefMxSmGK4/5NCh37anoY+g8HJiAZm0dfetBZ781wsAJlCUMMS5WJglXJEyL5s9geIwCA9YZrmo1a5pQcFTucB77j7m/Yef45VShnBfqozDiWgQ0AmG4pDrtNfXsGIyJ0aAjw9UODOds6P8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714024694; c=relaxed/simple; bh=E7DOx+O72dyatpWjDP4qUEaYwQBMdNKgD+8RwJRD+j4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Qvq/nBR4eRY8b1rPA+eu5Pnrq5CCa2cyoBc2X8G7qf2nEcmx9/69z3DgGpbES7S92TskQaSa352rEvytTySXq7UYTiZ8BWNeUIRmW6IO+abdaZX3LYloH8linNjiIFCrDXZdfc6KLIkebSOLGGrHJhElXDTlHweLj26uqtv34ls= 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=Pt2nwi4T; 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="Pt2nwi4T" Received: from pps.filterd (m0279863.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 43P5e0kW010515; Thu, 25 Apr 2024 05:58:10 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=/35D89W jUuLWzl4B2QvT8lRlv8WuIaB4oeHVFXLe4bY=; b=Pt2nwi4TJCSdEIsMbiFbsbK M8281XrgRXjW16ooIkeiJZMpV7nJZGVAoX3QQHhJD3Y6CTrcZxOihdJotiouKSe0 sluzCSFc1QBb+1IbbA0JB04r2C4tDWPsRtaCEOxnOe6TO/77jhdSakkjkP4Q+qVw XcvxwXUs70T8Nkd2ERYBp1IKs4hzwXOVNxGvUneviMc3sCRjGdLf0ud1jzZg6NOH 0z+A4BqvDDtq7EaE7CJ1DtFxCfxXcaZC1JRIl1xXlRsKIDaTrHsj82j2eGi/yF8Q NJOgLxYJ3oZ9uVt2narvwf6Y8t5yFX50a/+vbbtuAuQITfppCPv2KEF/2QGT9tw= = Received: from apblrppmta01.qualcomm.com (blr-bdr-fw-01_GlobalNAT_AllZones-Outside.qualcomm.com [103.229.18.19]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3xqenggcr2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 25 Apr 2024 05:58:09 +0000 (GMT) Received: from pps.filterd (APBLRPPMTA01.qualcomm.com [127.0.0.1]) by APBLRPPMTA01.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTP id 43P5w6dI031548; Thu, 25 Apr 2024 05:58:06 GMT Received: from pps.reinject (localhost [127.0.0.1]) by APBLRPPMTA01.qualcomm.com (PPS) with ESMTPS id 3xm6smbfnt-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 25 Apr 2024 05:58:06 +0000 Received: from APBLRPPMTA01.qualcomm.com (APBLRPPMTA01.qualcomm.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 43P5w6j8031504; Thu, 25 Apr 2024 05:58:06 GMT Received: from hu-devc-blr-u22-a.qualcomm.com (hu-hprem-blr.qualcomm.com [10.190.108.75]) by APBLRPPMTA01.qualcomm.com (PPS) with ESMTPS id 43P5w6s7031482 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 25 Apr 2024 05:58:06 +0000 Received: by hu-devc-blr-u22-a.qualcomm.com (Postfix, from userid 4146166) id 3AC1041154; Thu, 25 Apr 2024 11:28:05 +0530 (+0530) From: Harshitha Prem To: ath12k@lists.infradead.org Cc: linux-wireless@vger.kernel.org, Karthikeyan Periyasamy , Harshitha Prem Subject: [PATCH v2 3/8] wifi: ath12k: Add ath12k_get_num_hw api Date: Thu, 25 Apr 2024 11:27:54 +0530 Message-Id: <20240425055759.1181165-4-quic_hprem@quicinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240425055759.1181165-1-quic_hprem@quicinc.com> References: <20240425055759.1181165-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 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: BdUDpLMUkW0KDVJ5XLk-V4vtQeiO_pw5 X-Proofpoint-ORIG-GUID: BdUDpLMUkW0KDVJ5XLk-V4vtQeiO_pw5 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1011,Hydra:6.0.650,FMLib:17.11.176.26 definitions=2024-04-25_04,2024-04-25_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 bulkscore=0 mlxlogscore=799 phishscore=0 malwarescore=0 mlxscore=0 impostorscore=0 lowpriorityscore=0 adultscore=0 priorityscore=1501 clxscore=1015 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2404010003 definitions=main-2404250041 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 3733a6098ffc..aeb4af6842b6 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 313348e87eef..db6124c8f660 100644 --- a/drivers/net/wireless/ath/ath12k/core.h +++ b/drivers/net/wireless/ath/ath12k/core.h @@ -1068,4 +1068,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 3769a28ccff3..0ff526bfd104 100644 --- a/drivers/net/wireless/ath/ath12k/mac.c +++ b/drivers/net/wireless/ath/ath12k/mac.c @@ -8884,7 +8884,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); @@ -8911,7 +8911,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; @@ -8981,7 +8981,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; @@ -9004,7 +9004,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;