Received: by 2002:a89:288:0:b0:1f7:eeee:6653 with SMTP id j8csp300253lqh; Mon, 6 May 2024 22:02:35 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUZho21Cg2dSD52TBKSwWCPu9vqra1VSoNc1v07vzMUe7Y2qzjmNQk5TiI5hHvIg5GWZeOfZwios3xabwL3istzPInvAxa8FrnTw00WGA== X-Google-Smtp-Source: AGHT+IHTWmYQG44+Mw4btvA725S1fdb815egbqHCX7Yvc6BnrC10csnXeSb0+diFtWWa+7XYHC7+ X-Received: by 2002:a05:6a00:1907:b0:6f3:eaa2:539f with SMTP id y7-20020a056a00190700b006f3eaa2539fmr14026603pfi.16.1715058155019; Mon, 06 May 2024 22:02:35 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715058155; cv=pass; d=google.com; s=arc-20160816; b=xqZom2WozuOwNuDAYs8sEGhC989eUun2PzwkEcQ4geuoxP2fKwEb3F4Zmp3NsRsprM SJCFtuu8gfU3CXysFMWkDEcya3eBRwTaBK1iyUxb/motbNrZGZe2ANH6vaKnW/NGzgsI rgjpfRjRYy1czKjekhTYcEF21MqvMLzzmBfS2uMHT6bVMQBOtqPctxbXFGL+VeKgJcvL FNJ1j6HilDzdB58x3b0K+FGt5Q8M73DF3R0zgh/V5P6eVGrvc9vFaUgm9yCizQz6qPaL 7vWnEiDqeke5TKJyHeWzLYlUDkKn5Qgi/AhqX+gdx0H6Ui6jmAGEjDV7vmSVJ4D7lCRf NEaw== 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=3isgEBffzYEQsvvgH5j932Ob5avBkeu1B6MNSFtYUbU=; fh=wnySVr9+WO9j7lO1L6CVbSw/CjEiK6R10EUaKUiDPbE=; b=etuE1Yh5HoR1I/DKrkqXNqDmIX0B+J0wLgQbQF/XKqBQ/8grg6o8Crkais2KW++nqV Xl/6QdbBHuSHIZd73JR6aQToTjXL12IpnOM+ppvtTHjDet7mKrfZKHi4gPTcDZjjJA0G /eodTgp9jH5kNx2FT5XtV6RnOvZMrOHuBMyANT1fz0TZR7NmtrW+yuEbsc7QFhWsqrkp GkLD5mU83yBEhSO3naenmy4uQh9nkUBFikmANNpZzxJMKGNMma6jAwNrEt2SxChJ1NK5 evhvSKzzYFhVegVzFqFdKaB1+CkTrIndVxa3Vh0rXyyD95dnTJVHFVBkIk8vMBM8p41Z 6tAw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=jdnu0Vpl; 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-7262-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-wireless+bounces-7262-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 s70-20020a637749000000b0061aad72bec1si9621667pgc.467.2024.05.06.22.02.34 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 May 2024 22:02:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless+bounces-7262-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=jdnu0Vpl; 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-7262-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-wireless+bounces-7262-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 6F466B25174 for ; Tue, 7 May 2024 04:58:20 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id F2D566F086; Tue, 7 May 2024 04:57:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="jdnu0Vpl" 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 D59056CDB1 for ; Tue, 7 May 2024 04:57:35 +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=1715057857; cv=none; b=WMr3Koi+OQZ0tIbGrNDJPX5QTpwds6QCAzWsu1fztc7DH1jZ4BbZ1aWUVkWOrgEU3bkhRVabOrd14rgT5T1GvzJ4oRa923lN5M/oQCWM0LHyevmgftx/XL6V0hx3V+JGKlmrKPSXHkun8Q+JlHjvA5RTXzJ1Jo7sgIOrXtjepuI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715057857; c=relaxed/simple; bh=fZ2okmahIYtvxUdGAqWO04/TrlfhOsKclQydgNlQuDA=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=L4vEe6uOdxfBWNpzwP7JIp6qEGM7bMweNfkbNFyK2OTtHtrpvHit6MiV8XaUe7SOHbaJMfeEZ9voN77ServoP0aHUjmlRaSacKtMG52bfGRh9U88uaYu+wAq4ePaFA3/Ldpat+E9mcjPyQbTp4x9JpEhDdtHg4zTXW9mLwwmlPI= 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=jdnu0Vpl; 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=qualcomm.com Received: from pps.filterd (m0279868.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 4473KeuL019034; Tue, 7 May 2024 04:57:32 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=3isgEBf fzYEQsvvgH5j932Ob5avBkeu1B6MNSFtYUbU=; b=jdnu0VplnF3dtvFil5d3gkP riqkb0aQZ3ScZDeXdLUEhAHgL1x0osQeHZBhwKjQ+TdrxTwi4XRPEW10LvkqUucN f+xpu+9qK57BrPrTaWSXFzo7WrlVRMBSAZSLj7XFJ8B/o1bVOiEgrhp5teip/Fau 0deh8fuELhZ6IGant7YJEaZ++ncBe2MtBJ2xdjyq8HNoJni1wkZYst9o5J3qOSTR zl9KfPMV8VuLm614/avqY9fqmCP27fII2pUJbMURv5E2zWZP6Y7OpjzdMoZveY3i CgUqNvO0/Pr3wWc5TO/dOGKnCVfDlEl83BnTRrhJiXLGYMOFBDnO3yvLSKCd5Lw= = 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 3xxxj1hr7b-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 07 May 2024 04:57:32 +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 4474vSbK003660; Tue, 7 May 2024 04:57:28 GMT Received: from pps.reinject (localhost [127.0.0.1]) by APBLRPPMTA01.qualcomm.com (PPS) with ESMTPS id 3xwe3kn50q-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 07 May 2024 04:57:28 +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 4474vSNm003652; Tue, 7 May 2024 04:57:28 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 4474vSkA003646 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 07 May 2024 04:57:28 +0000 Received: by hu-devc-blr-u22-a.qualcomm.com (Postfix, from userid 4146166) id 499994114D; Tue, 7 May 2024 10:27:27 +0530 (+0530) From: Harshitha Prem To: ath12k@lists.infradead.org Cc: linux-wireless@vger.kernel.org, Karthikeyan Periyasamy , Harshitha Prem Subject: [PATCH v4 3/8] wifi: ath12k: Add ath12k_get_num_hw api Date: Tue, 7 May 2024 10:26:57 +0530 Message-Id: <20240507045702.2858954-4-quic_hprem@quicinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240507045702.2858954-1-quic_hprem@quicinc.com> References: <20240507045702.2858954-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: Dupxga4V3ugzwO-C4CK8WfjJbLKQmKm3 X-Proofpoint-ORIG-GUID: Dupxga4V3ugzwO-C4CK8WfjJbLKQmKm3 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-07_02,2024-05-06_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 phishscore=0 malwarescore=0 clxscore=1015 adultscore=0 mlxlogscore=796 impostorscore=0 mlxscore=0 lowpriorityscore=0 suspectscore=0 spamscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2404010003 definitions=main-2405070033 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.34.1