Received: by 2002:ab2:6203:0:b0:1f5:f2ab:c469 with SMTP id o3csp1125808lqt; Sat, 20 Apr 2024 01:38:26 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXeZErzPVdJccTFFsIg8ZVzzYvPsWAY73h0Oh6Vrox9VzMIVXfCRm7r219/8jzBknFujwA+lUJIY4DSPzJb4JnJxEge74bmxFkbtvKvsg== X-Google-Smtp-Source: AGHT+IG1KK9+XHHbX79lkuXeq49YgcL4/t16inslwVttwqiYPGaIuLwOUlbnyHMRg35pHVKmIwZP X-Received: by 2002:a17:906:615:b0:a52:3623:f498 with SMTP id s21-20020a170906061500b00a523623f498mr3482233ejb.31.1713602306380; Sat, 20 Apr 2024 01:38:26 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713602306; cv=pass; d=google.com; s=arc-20160816; b=b4ebmyRMCSZPY3Bqle9xOLPc4yEv8iUTTJvlBr5mZh1z30IjOE4Buk/E9hHYtO/vxl 8VNixXL2CA72AisN5W8achCHrOeBZAecZ/2M5PRyOzqeDAdLXMwzTegJVoNPWrMPL3JY h/ipn95N874bgqk8w03XrmGE8vuc+qSzVf8UJFHRFua+4I3oznZy5/ABOLxDwJNyjgd8 KSE3NsReep8MN5GTTYJGMXxGZYpuhh0ToQyFUjW3hUmDOJhCkcHlylbo2mTpJJJ7Ka39 SGkHZtGtplGnpfjngJvjeoNqz4ubZ8yJNOXCXlxxQDenGOctJUckxzqtB/tWoLaqeLlB jBgQ== 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=rbq7uXMCN+jqexr4sjvGDjlEMUQjzrI8dmX/HycYcyA=; fh=wnySVr9+WO9j7lO1L6CVbSw/CjEiK6R10EUaKUiDPbE=; b=i+XzJxFRxK+z/ZNfNqxPSx1levBkT+eCtlKlcSRNP2t+N2fFQp0dJLISY8q2mZG7W3 v+wyFja2LpxrK7fBITE+N8yLkcqc1GDcWwrDgZOmlV7uZdn4ibCoARp+mXXqUZuugg7U KQLPDqOJacUTDUGYCMHHDUgl9Yim2XQFNaK2ndNJ09l0l6014JxR2EcY0buazmFtiXjj pRQAt/fG+GljCim7pcSvYoC/8ALyMyNDDlhRXFQkmktEOIWcxT/BeF7LLV9YmRYJhI4T D2cLlmDqFNaGe+yubfnimVio7Y/62idLfADv887/NOjIO0yets+7OvvNCqUp1DQCfkXb O3mw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=DvFNC9Eb; 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-6595-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-wireless+bounces-6595-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id gg6-20020a170906e28600b00a526457fce9si3233725ejb.879.2024.04.20.01.38.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 20 Apr 2024 01:38:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless+bounces-6595-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=DvFNC9Eb; 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-6595-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-wireless+bounces-6595-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 am.mirrors.kernel.org (Postfix) with ESMTPS id EB05C1F2233C for ; Sat, 20 Apr 2024 08:38:25 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4925D14003; Sat, 20 Apr 2024 08:38:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="DvFNC9Eb" 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 B8FCF15E8B for ; Sat, 20 Apr 2024 08:38: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=1713602294; cv=none; b=M/+KIRbgjb66FT9bD4XP1W+EGY0bJwiylaaARV35SIqu2oz/Tj1efmk5Q3B/bCkYR1BR+82SxQnnRHYkIJDA6GManWgATd9YVhiiy6BDGa5d8ClnzOPKBkwZ6Ll/ZouKcB2tXMdV9XQ8m/7SkljLnFGdhY+6DqStcAtixHZX4gQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713602294; c=relaxed/simple; bh=QmUQpZBEmzJkAAPV4wrD+O6fukqZEQ4X3ueGzg6Z/xw=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=ctwH5gM0RQKbRbf6RwdTmKf7LnhqlK7ePtOWb0aSW6gfTp1lrjMDGiukUBsTg43O5YxiSoL5h/uA3KTT3Apj1rXkNzSN4tnV+lU9OB0zBdggOHHlaeQKZleBlGjgDipxDclCjclg05SMqvafoIUuMOcf2f5r/Fc1/Pi2/l3gD28= 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=DvFNC9Eb; 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 (m0279862.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 43K80Amp003058; Sat, 20 Apr 2024 08:38: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=rbq7uXM CN+jqexr4sjvGDjlEMUQjzrI8dmX/HycYcyA=; b=DvFNC9EbTPoAIawIUI6wg1j 27SeZURwriKbuh3Hdw1TewIeAebz8/BzwLz+9pTH5manEqTJ27f/wGVtzpwp4nIu AWTKXXn3r3QEpHyFMTI4SZ9vilCaiBSztGdGtuRlyaWUg918n15CGubAyWqw/Ofx ilG0WuNAAvPQfpzAxybNyZc0sR8AOSz4V/bRXtHUyaYyf8oJvP4aKsajcQ/bHdZ9 BymLe6OamlcqHAwaIl4hEF+hC4BWFgrl/sVJTHYoHj921YyaAH5YQS0JQqXD9kjd G8mP0vcUwfYiNakYpuwd3jHgYd9Bk4KpwagKYDGHvS8BE3wx/0W/Wx5SB40WVVQ= = 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 3xm6fkgbxp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sat, 20 Apr 2024 08:38:10 +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 43K8Zqf5028242; Sat, 20 Apr 2024 08:38:06 GMT Received: from pps.reinject (localhost [127.0.0.1]) by APBLRPPMTA01.qualcomm.com (PPS) with ESMTPS id 3xm6sk95k7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sat, 20 Apr 2024 08:38: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 43K8ZpaZ028222; Sat, 20 Apr 2024 08:38: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 43K8c6xR030893 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sat, 20 Apr 2024 08:38:06 +0000 Received: by hu-devc-blr-u22-a.qualcomm.com (Postfix, from userid 4146166) id B945E41171; Sat, 20 Apr 2024 14:08:05 +0530 (+0530) From: Harshitha Prem To: ath12k@lists.infradead.org Cc: linux-wireless@vger.kernel.org, Karthikeyan Periyasamy , Harshitha Prem Subject: [PATCH 3/8] wifi: ath12k: Add ath12k_get_num_hw api Date: Sat, 20 Apr 2024 14:07:45 +0530 Message-Id: <20240420083750.1545670-4-quic_hprem@quicinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240420083750.1545670-1-quic_hprem@quicinc.com> References: <20240420083750.1545670-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: dz-B5nU8tdFtNQ5C33ZbeWU2URqr2UTl X-Proofpoint-ORIG-GUID: dz-B5nU8tdFtNQ5C33ZbeWU2URqr2UTl X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-04-20_07,2024-04-19_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 adultscore=0 impostorscore=0 spamscore=0 suspectscore=0 lowpriorityscore=0 malwarescore=0 clxscore=1015 phishscore=0 bulkscore=0 mlxlogscore=798 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2404010003 definitions=main-2404200062 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 07b795784cbd..0d03648f4e10 100644 --- a/drivers/net/wireless/ath/ath12k/core.c +++ b/drivers/net/wireless/ath/ath12k/core.c @@ -920,7 +920,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; @@ -972,7 +972,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; @@ -1011,7 +1011,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 9ce8e01af133..c06bbb083ab3 100644 --- a/drivers/net/wireless/ath/ath12k/core.h +++ b/drivers/net/wireless/ath/ath12k/core.h @@ -1038,4 +1038,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 af820df77866..8516a0168f7b 100644 --- a/drivers/net/wireless/ath/ath12k/mac.c +++ b/drivers/net/wireless/ath/ath12k/mac.c @@ -8786,7 +8786,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); @@ -8813,7 +8813,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; @@ -8883,7 +8883,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; @@ -8906,7 +8906,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