Received: by 2002:a89:48b:0:b0:1f5:f2ab:c469 with SMTP id a11csp893522lqd; Wed, 24 Apr 2024 22:58:32 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXlFMXgIV6ciPkmBJt4Vm5aVBPvyTmA69tdFqajdp/mdxZtuYA3Wxw8sMAGm3WdSFBv+V1ca0uBAoFDGo3x6Jy2JJzxKuJ/ZmZ5qJ8Gag== X-Google-Smtp-Source: AGHT+IGy3qRdHXILJ+6GCmTy9gB24OCKDc/c1l4NJvsZ3EYtN0VXOGLElHiutNf1uJpEtjGpgh7X X-Received: by 2002:a05:6a20:1004:b0:1a9:6cdd:6907 with SMTP id gs4-20020a056a20100400b001a96cdd6907mr4041843pzc.29.1714024712030; Wed, 24 Apr 2024 22:58:32 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714024712; cv=pass; d=google.com; s=arc-20160816; b=RlJWw34McEi5wQcFjhH2bWGo4nw/UoQOkFT6SV54fwxhiqZAE789I7m5qNgIXrgLca lkAU23KmJcS+fLBgQBpkVPOjpPBb9az4S1PNjywh+0HynM+nJZrDtYRasOpaqfbCx6i8 PXIZjwcO4wdvclzrrvzRRQCMu7D2o8PcWK4Cnr8t0XOjCIlmD7zH4rGGJrwarrTsGNL2 LSUQZfmB618ERMm+B9rM0oioSAgdGaErDcTcieSGEZaenEfD220v0KsshBNT/ufDHP6T slmcUwYt0pkilzqO+n1Qoc+3cM37PX71skcfXS1isJxE3rpqDL2obE1eCMIvP7SPGcUD DVaw== 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=5awLSP8K+pJQa9ozh3vKV10rzikL7WFHaKfXecKRnSI=; fh=wnySVr9+WO9j7lO1L6CVbSw/CjEiK6R10EUaKUiDPbE=; b=aBS2vEKSPINE4uIOUvf3NqeA4N06JodARCfBtF1hRsc0Z6TciJEDo+p8VOf3Xndu7W uk2I/k0ljEpsMXPfoxQ5cIxN3KnN0TmfdWC6z1MYkTQDlHtu9ag33mmniReZSsnymtbV rPW0kihlVOAqzDIdSJWOK5jZSuw2uARaDn0OQkeqIOeTsKdHBbRE2wYYCNGmVw9J8IOG 8PBINhob5p4cSp/H4laOsJlEN5A+18EVHBeTmEFlodu6IR/QTljXaSSFYz9Woj+wohEz fy7T/2N9J9MtTMJ1jR/hJ1UNFMvZAmoDyOTcsQE0zs+TPjR3M4PmwPkP5CDAdJvETt0r UykA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=Hx4L1Qnq; 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-6810-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-wireless+bounces-6810-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 u7-20020a17090341c700b001e5281d9639si12622945ple.520.2024.04.24.22.58.31 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Apr 2024 22:58:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless+bounces-6810-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=Hx4L1Qnq; 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-6810-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-wireless+bounces-6810-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 7A2FF281F44 for ; Thu, 25 Apr 2024 05:58:31 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9B8E53D57E; Thu, 25 Apr 2024 05:58:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="Hx4L1Qnq" 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 1F7813C097 for ; Thu, 25 Apr 2024 05:58:13 +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=1714024695; cv=none; b=sAm1sNQnqfLeSqHiKH2rxQ6y75s7msvCtwAhKLkDeTXC9kYmknWKYhj/493gzYI+K/IF6YtkzIQ8QsWTXC5lZCM3wVJklT4YDxvwYL4gCWe/L8WhBDkRHVfos7C8qt4fGJ/Ydmh52mfybz5eqcgT5mZPZ7fkeuyksFEQzvR3lpM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714024695; c=relaxed/simple; bh=tczw/eV6gXwmLzuCuFx6YrG+BnzNj7a9W4+PyyBWToA=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=HSknNSYjbw0vpjzgMGh54Mkq/T529rGZAE2aO3db8sLndgpOPP4ac2Xypqy4wB4ydCjDna9Eh40dobpDpeOgxMBZk5eD8LGXWA1U25/EWkYmJcveH1VA9K2AxVpH1vNvb3DXSzLfJVKkc01HKm4E/cHhz1LAdl2KN70p2h5lpD8= 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=Hx4L1Qnq; 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 43P3gwbR003757; Thu, 25 Apr 2024 05:58:12 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=5awLSP8 K+pJQa9ozh3vKV10rzikL7WFHaKfXecKRnSI=; b=Hx4L1QnqNt7XlCxQsr3znkq 7+DGU1DqJFW6OYbu38fkB34CDCPWEjlL0qpNLT9yGZZmuUEK1wuiHgqKln762pZd jEYcSQygrX5yuH/QjY2wQQ6PBd36zQ4/UfVC0mqoqgl0KTm68zBGOQDkI0Z80gj5 XqCoRDLrU7X9ZoioWwsGcRyzKKCK5I7qBEmBBHlDryeiI+07P9ji5Lrv1E8u5Ggc szMfeVi9As4OdqsGfgI2nziM55q0+17vTFlhwGbTZFq7DcdYJLq0FEtwEGMT+9gy io5qw90UnOwzAewavBsOAps19oN7MOA5DMk3MjBWoV28fB7MzrBqWjC+3bbphEg= = 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 3xqenm0d31-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 25 Apr 2024 05:58:11 +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 43P5w5rQ031308; Thu, 25 Apr 2024 05:58:05 GMT Received: from pps.reinject (localhost [127.0.0.1]) by APBLRPPMTA01.qualcomm.com (PPS) with ESMTPS id 3xm6smbfn7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 25 Apr 2024 05:58:05 +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 43P5w4ax031130; Thu, 25 Apr 2024 05:58:05 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 43P5w5lE031243 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 25 Apr 2024 05:58:05 +0000 Received: by hu-devc-blr-u22-a.qualcomm.com (Postfix, from userid 4146166) id 6265B4114F; Thu, 25 Apr 2024 11:28:04 +0530 (+0530) From: Harshitha Prem To: ath12k@lists.infradead.org Cc: linux-wireless@vger.kernel.org, Karthikeyan Periyasamy , Harshitha Prem Subject: [PATCH v2 2/8] wifi: ath12k: Add helpers to get or set ath12k_hw Date: Thu, 25 Apr 2024 11:27:53 +0530 Message-Id: <20240425055759.1181165-3-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-ORIG-GUID: ovkjqHfozDC1YQX7G0YaiKBWVsR9VPrN X-Proofpoint-GUID: ovkjqHfozDC1YQX7G0YaiKBWVsR9VPrN 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 lowpriorityscore=0 suspectscore=0 bulkscore=0 phishscore=0 priorityscore=1501 spamscore=0 mlxscore=0 malwarescore=0 adultscore=0 clxscore=1015 mlxlogscore=676 impostorscore=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 a device (ath12k_base) but in future, it would be part of device group abstraction (ath12k_hw_group), i.e., when multiple radios (ar) across different devices can be combined together in a device group (ath12k_hw_group). In order to facilitate the above transition, introduce helpers such as ath12k_ab_to_ah() and ath12k_ab_set_ah() to get and set values of ath12k_hw respectively. 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 | 11 +++++++++++ drivers/net/wireless/ath/ath12k/mac.c | 23 +++++++++++++---------- 3 files changed, 27 insertions(+), 13 deletions(-) diff --git a/drivers/net/wireless/ath/ath12k/core.c b/drivers/net/wireless/ath/ath12k/core.c index 63f0ba7bb57d..3733a6098ffc 100644 --- a/drivers/net/wireless/ath/ath12k/core.c +++ b/drivers/net/wireless/ath/ath12k/core.c @@ -950,7 +950,7 @@ static void ath12k_rfkill_work(struct work_struct *work) spin_unlock_bh(&ab->base_lock); for (i = 0; i < ab->num_hw; i++) { - ah = ab->ah[i]; + ah = ath12k_ab_to_ah(ab, i); if (!ah) continue; @@ -1002,7 +1002,7 @@ static void ath12k_core_pre_reconfigure_recovery(struct ath12k_base *ab) set_bit(ATH12K_FLAG_CRASH_FLUSH, &ab->dev_flags); for (i = 0; i < ab->num_hw; i++) { - ah = ab->ah[i]; + ah = ath12k_ab_to_ah(ab, i); if (!ah || ah->state == ATH12K_HW_STATE_OFF) continue; @@ -1041,7 +1041,7 @@ static void ath12k_core_post_reconfigure_recovery(struct ath12k_base *ab) int i, j; for (i = 0; i < ab->num_hw; i++) { - ah = ab->ah[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 d833361948b7..313348e87eef 100644 --- a/drivers/net/wireless/ath/ath12k/core.h +++ b/drivers/net/wireless/ath/ath12k/core.h @@ -1057,4 +1057,15 @@ static inline struct ieee80211_hw *ath12k_ar_to_hw(struct ath12k *ar) #define for_each_ar(ah, ar, index) \ for ((index) = 0; ((index) < (ah)->num_radio && \ ((ar) = &(ah)->radio[(index)])); (index)++) + +static inline struct ath12k_hw *ath12k_ab_to_ah(struct ath12k_base *ab, int idx) +{ + return ab->ah[idx]; +} + +static inline void ath12k_ab_set_ah(struct ath12k_base *ab, int idx, + struct ath12k_hw *ah) +{ + ab->ah[idx] = ah; +} #endif /* _CORE_H_ */ diff --git a/drivers/net/wireless/ath/ath12k/mac.c b/drivers/net/wireless/ath/ath12k/mac.c index 1f7e23b74632..3769a28ccff3 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->free_vdev_map = (1LL << (ab->num_radios * TARGET_NUM_VDEVS)) - 1; for (i = 0; i < ab->num_hw; i++) { - ah = ab->ah[i]; + ah = ath12k_ab_to_ah(ab, i); ret = ath12k_mac_hw_register(ah); if (ret) @@ -8896,7 +8896,7 @@ int ath12k_mac_register(struct ath12k_base *ab) err: for (i = i - 1; i >= 0; i--) { - ah = ab->ah[i]; + ah = ath12k_ab_to_ah(ab, i); if (!ah) continue; @@ -8912,7 +8912,7 @@ void ath12k_mac_unregister(struct ath12k_base *ab) int i; for (i = ab->num_hw - 1; i >= 0; i--) { - ah = ab->ah[i]; + ah = ath12k_ab_to_ah(ab, i); if (!ah) continue; @@ -8970,6 +8970,7 @@ static struct ath12k_hw *ath12k_mac_hw_allocate(struct ath12k_base *ab, void ath12k_mac_destroy(struct ath12k_base *ab) { struct ath12k_pdev *pdev; + struct ath12k_hw *ah; int i; for (i = 0; i < ab->num_radios; i++) { @@ -8981,11 +8982,12 @@ void ath12k_mac_destroy(struct ath12k_base *ab) } for (i = 0; i < ab->num_hw; i++) { - if (!ab->ah[i]) + ah = ath12k_ab_to_ah(ab, i); + if (!ah) continue; - ath12k_mac_hw_destroy(ab->ah[i]); - ab->ah[i] = NULL; + ath12k_mac_hw_destroy(ah); + ath12k_ab_set_ah(ab, i, NULL); } } @@ -9016,7 +9018,7 @@ int ath12k_mac_allocate(struct ath12k_base *ab) goto err; } - ab->ah[i] = ah; + ath12k_ab_set_ah(ab, i, ah); } ath12k_dp_pdev_pre_alloc(ab); @@ -9025,11 +9027,12 @@ int ath12k_mac_allocate(struct ath12k_base *ab) err: for (i = i - 1; i >= 0; i--) { - if (!ab->ah[i]) + ah = ath12k_ab_to_ah(ab, i); + if (!ah) continue; - ath12k_mac_hw_destroy(ab->ah[i]); - ab->ah[i] = NULL; + ath12k_mac_hw_destroy(ah); + ath12k_ab_set_ah(ab, i, NULL); } return ret; -- 2.34.1