Received: by 2002:a89:d88:0:b0:1fa:5c73:8e2d with SMTP id eb8csp2458265lqb; Mon, 27 May 2024 23:36:27 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXcn/RdZJubAwcrNqZG8bRGMEISUCn38mo5uxM+d4LAbK8YRiBdRGSXMmxphxyaAFwn8L8ZNhR8ktPcLu9oJDoWjWOXZ0znBwCuXYcjqw== X-Google-Smtp-Source: AGHT+IHn1smtGYZ/xUCbf6TnU0xYmqzlNVkkq9yWE0ve1UXk+5XQqpb+cXXH9I7fZ66z+mO1hH62 X-Received: by 2002:a05:6a00:35c7:b0:6f3:ee81:13b5 with SMTP id d2e1a72fcca58-6f8f34aad7amr18909927b3a.17.1716878186831; Mon, 27 May 2024 23:36:26 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716878186; cv=pass; d=google.com; s=arc-20160816; b=pO5FCabWO3NRozfTnO0WVKlMmSzzztjvhGC5+ZocsUdBdeIzXRirJb6eTiUhTSk5un Vh4ldPH86DqabihzH0alzp4XgspTO9Z6u+7/pdKAL5IGUREv4BzImDAADPkKEtNfjN20 KPoqfohawpMDRQyZ8wzr5TgzAvhaODdvXS+T4GEFnSmnAO1ahl9bSzovgskxR9OfNg2W W1OHLvCyNPl+yUyafYgvu8q4lfcGaORQD+d2AgCzj354viavmAmYG8NCemsMLj/SW5fA JsB+oQ4PcnKhDF4w2RicaRv1AzP95qeTq3X0d2vzlwY9ARt9uSXMF4XF+rsbT0Ou9+QO H+lg== 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=q9ZloH1bI1zct1SU4341ZzcGwjDZqsBFVqUcnb6amg4=; fh=gjyKuI8lXSKwquXF/tvFPrzHVVLmD81gAC9iylGd+k0=; b=yOmxl+l2mM48UavQe+I+5wejnN6TgEuhIbDXq9Tdiq587Ul5agx12aDpU5VQ+8QMJy aHIBPsQt0ECe+khUT6PD/VjSojCWGll5yduuKYkJp8tbkv1PHekIVMlS8XWNjL5QIBPE yKuC8PCt6KzOuNVHgobNvy4fqqE63R5vaCSG0k/bAA8iEUuh3oe/CbNFh78cABSbPU/G 1lthp+U3ZUsXgYwIWGQmQ2Mx2xfCidf9wCMgXPVYCknamYAUV3q/bMW/vEDgZ/BZHvVZ xY2GCKBlcIuKk4uYhOMdDddY73EGDKgUv8dSAd5p9UbD9/NKBuyxg469s4QGfE4lc/Bf xtVw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=Pay+PrcW; 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-8161-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-wireless+bounces-8161-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. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id d2e1a72fcca58-6f8fc36e635si7309939b3a.114.2024.05.27.23.36.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 May 2024 23:36:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless+bounces-8161-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=Pay+PrcW; 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-8161-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-wireless+bounces-8161-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 3136F283C13 for ; Tue, 28 May 2024 06:36:26 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id EA7BB6D1A8; Tue, 28 May 2024 06:36:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="Pay+PrcW" 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 454CB61FC5 for ; Tue, 28 May 2024 06:36:12 +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=1716878174; cv=none; b=j7a4J3bW87q/gtAZuSxQtGzEfYmJ1tVFuziTEtuy9qCI/j7TwhsO9c1hY2wmvYDTmneuzJSylJRwZyglKPFJbi2Tt2J6NIKAa6kXGA3fcl6eVstx0qI8sqj+269LDQ6+nvySJXRNJj/3YgHfrphL3S1IGJA/itPbpuC7M9bpaIY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716878174; c=relaxed/simple; bh=g4xoRO9xj6dOiD3VqciB/zfkT2esrbTTCOXNPr9Zz2o=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Pnt2QbxaClNN+UUFkVRx6ZePBMEmBXoofwQ36+cj+b8zr5vic4OH+2dSvQUGlhuYIYSGvUc1l0uaOxLSTPxZKRCgrd9yBR0v1n2hsub9+NyzdIGpaA+a2cyXzlet4vNhMKrTUtsNSdtDlT11EGlU3HGoXICRpafG6YSRQFV4jLY= 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=Pay+PrcW; 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 (m0279872.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 44RNVkaf001099; Tue, 28 May 2024 06:36:07 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= cc:content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=qcppdkim1; bh=q9ZloH1bI1z ct1SU4341ZzcGwjDZqsBFVqUcnb6amg4=; b=Pay+PrcW9MrPQ8U6/1j95axVw3e tQjqFiNaJZpu82mFZZKBYRLhePBkEwLO+WJ8zNd2EanBiwq6wa+q58szwJCUfaBZ QPR3ZnZkM50NZiI4g467CzuIDGTQSGQE3AbDyrdcTEr88xZsPdYgjZH/cS26hmYq bY4k6Y2gt1XxGyCni9WmLyBWERu2vvPLRZCw0/F3COvcv2yImKBKY+Y0PM36DcWE CyeX9Gk8zmYB8MPpB+/GtjsFlb/hQaJzam45bpdKoS0rWJk/mxB0P9H4v6fgXYOW yKIDO7STo83g6tjcb6IogoYs+VrUv+rkVhH+kvklOcZwDK91PCbdGZUW3PQ== 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 3yb9yj5b80-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 28 May 2024 06:36:07 +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 44S6a0EK012700; Tue, 28 May 2024 06:36:04 GMT Received: from pps.reinject (localhost [127.0.0.1]) by APBLRPPMTA02.qualcomm.com (PPS) with ESMTPS id 3yb92kd5xr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 28 May 2024 06:36:04 +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 44S6a4fH012771; Tue, 28 May 2024 06:36:04 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 44S6a3i9012768 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 28 May 2024 06:36:04 +0000 Received: by hu-devc-blr-u22-a.qualcomm.com (Postfix, from userid 4146166) id 1A2C44114D; Tue, 28 May 2024 12:06:03 +0530 (+0530) From: Harshitha Prem To: ath12k@lists.infradead.org Cc: linux-wireless@vger.kernel.org, Karthikeyan Periyasamy , Harshitha Prem , Jeff Johnson Subject: [PATCH v7 3/8] wifi: ath12k: Add ath12k_get_num_hw api Date: Tue, 28 May 2024 12:05:42 +0530 Message-Id: <20240528063547.1400700-4-quic_hprem@quicinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240528063547.1400700-1-quic_hprem@quicinc.com> References: <20240528063547.1400700-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: 6yFmhyH_6X-_AiCONRh4ENHmRSpMXCIE X-Proofpoint-ORIG-GUID: 6yFmhyH_6X-_AiCONRh4ENHmRSpMXCIE X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.650,FMLib:17.12.28.16 definitions=2024-05-28_03,2024-05-27_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 adultscore=0 mlxscore=0 phishscore=0 mlxlogscore=854 spamscore=0 clxscore=1015 impostorscore=0 bulkscore=0 suspectscore=0 malwarescore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2405170001 definitions=main-2405280047 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 3925bb70d479..7ad65ace7123 100644 --- a/drivers/net/wireless/ath/ath12k/core.c +++ b/drivers/net/wireless/ath/ath12k/core.c @@ -946,7 +946,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; @@ -998,7 +998,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; @@ -1037,7 +1037,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 3f5c9fa9d04c..a22f3561deb0 100644 --- a/drivers/net/wireless/ath/ath12k/core.h +++ b/drivers/net/wireless/ath/ath12k/core.h @@ -1062,4 +1062,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 f8e8320b8598..66587c5ea8fd 100644 --- a/drivers/net/wireless/ath/ath12k/mac.c +++ b/drivers/net/wireless/ath/ath12k/mac.c @@ -9157,7 +9157,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); @@ -9184,7 +9184,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; @@ -9254,7 +9254,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; @@ -9277,7 +9277,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