Received: by 2002:a89:48b:0:b0:1f5:f2ab:c469 with SMTP id a11csp893739lqd; Wed, 24 Apr 2024 22:59:27 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXScDs4ZOrWWFT3BUnRELRuvEgh3VmgMin+m+IovNA6UkjXtjs3/j4ji0RpSiWa111izSUF5xLe55a1/Ee65N3YWjAr0AvFLFHW5Wq9ww== X-Google-Smtp-Source: AGHT+IHGRu6yl1ATGI0ItlcZzMMBS239TGTluynYgxzeigBLqmk30CgN1ILA+JXvpGLTVHWnHydY X-Received: by 2002:a05:6a00:2346:b0:6ed:de86:be57 with SMTP id j6-20020a056a00234600b006edde86be57mr7041970pfj.25.1714024767564; Wed, 24 Apr 2024 22:59:27 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714024767; cv=pass; d=google.com; s=arc-20160816; b=NIn3ourMwwEkAwOuy98W8M1nJjDtGzj9nJ8tAyqz1CVGbO7xbE7cdv5+t+cFZ2GSVx /S19J3cwNWOd+hI80mi9QQFKY16RgpG41EGCuCg2m32u/B2rQ4Q4nn8raHf/NQYAV/eb v14jw/6RT+IyK7QJ4SjwXLaDjj52vBSL24p5z0jc8VPQAFYT+VOXJfLXrE8uNYTozVCc GmrOfWREugosLcTJtp2toYOf2RegfpYKCujpL/bG3udD8mrZG76Rnziv33LgE/4QDcit 7xYnWFLm+Bfs7PeXFD89CldN4rgLAMbORTgbGHvO53xrbFmUEAxleML5RtDj79OLDQ4Y g5bQ== 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=/35D89WjUuLWzl4B2QvT8lRlv8WuIaB4oeHVFXLe4bY=; fh=wnySVr9+WO9j7lO1L6CVbSw/CjEiK6R10EUaKUiDPbE=; b=CA5HIWEKMtl6aVCei5NYpjPBfYwEaR1fd/Dc2Paa7NlR4FTiW3IY4t8OnlnO+rUSTw slOVawZdk1Wo0BaBt7GSopowbb9WkQyoHG4K75fneiyPQQ8CSOpvumVUr7mvtKhSuuCn FKakaZfv5F+R18K2FC8/5IuY5YAnsNwg+UrbJgoE02iYQ8Sjwwrr3cO22sd1CiD9e9BX yxCb5L4C0MGpVvI7ZsecKblC4qosq/LAHU3VZgrBHr2xz+Bh0WYschjxHnTC5tBxczRo WDwI8TSm4K2DOD7dBOcVaXjDKMgFrOFNVkmCS27/FAnP2Ad8emEQ6gT7ugsn5NUBHVKo erMw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=Pt2nwi4T; 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-6807-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-wireless+bounces-6807-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id fr10-20020a056a00810a00b006ecee76286bsi12226720pfb.233.2024.04.24.22.59.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Apr 2024 22:59:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless+bounces-6807-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=Pt2nwi4T; 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-6807-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-wireless+bounces-6807-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 93709B246F3 for ; Thu, 25 Apr 2024 05:58:19 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 52A783C467; Thu, 25 Apr 2024 05:58:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="Pt2nwi4T" 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 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 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 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: 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 --- 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; -- 2.34.1