Received: by 2002:ab2:7855:0:b0:1f9:5764:f03e with SMTP id m21csp231855lqp; Wed, 22 May 2024 02:55:27 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCW7Kz87bspjFPD24LECxh+Gn7PI1kbvt+xZiWoTSDl1Hw04VGMlnrQM76OwafzFKUhEXjf0bTFuXiva2jMWHN4TDWw5HG913AIT40qJtA== X-Google-Smtp-Source: AGHT+IEJakXXYBv37TQgZ5Qsq2hdR5HPOOXSu5oNBLpg7F258UE2GYUJvvMXw7JXaglaBYH+eMRr X-Received: by 2002:a05:6214:5887:b0:6ab:6d5f:d351 with SMTP id 6a1803df08f44-6ab809198damr12949276d6.55.1716371726902; Wed, 22 May 2024 02:55:26 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716371726; cv=pass; d=google.com; s=arc-20160816; b=uSMkuS7kuMWX/k9wJqCdJ2xMMwisjqgt1/Pxz25W8z7vRKXmSr6zk35YLyT9brkurE +chttq/hEDSwoRH8xp87jQ8RO2lO93RKE02n4BwDSG/Izzez48wJM84OKC5sAGcqOCAm SeF1QVfieoijrXgkTAuxPd4ZHVqFfP+3lSVgQUjhSRNj5KsA84HDOIrL6Pyulfhxt4+i fdaFkmsQI3L9b2YeH163l3+T+IV/knaW9r9rQVcvsBMwAnpvq7cWonWKAOWsJcJeqk9I 1ZpNvOr99VFSOWCrSlCCQGEzhz+htUEJR/PVVDKFUT2kl5+AO5HJAj/zPE3M8g4YyBkF ymEQ== 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=Ei03v/CYUBCQYP94hlE/M/Cli/p1dOmmt2/VlXFAs+k=; fh=gjyKuI8lXSKwquXF/tvFPrzHVVLmD81gAC9iylGd+k0=; b=W59rBbOuurlT+TLqwCpit/88cbjHeLTo8i4LOpAfgjewen0TQ9GoyBffyWl+r+jETl ZziamkiWrC03wHamMsPCq9UWFWi7yYtcb5M83ngq8EO5AzO8VRQj8qwY+Ru+zW2jMW0l QU1lIgUdc0jdgMNxTt7zTgJNLaZKXprYm0Yt6OB0bAN13jP55HTiJ00NvCLM9zWHCxRg SGZvzfBccS936a0qMmDOmpB50rN8VaFA1OB+qlGsFRoZ9k49RMceHcyanBDe0qc6itVE MDegsxTiHJNGfO5c9SPG0l+ORhn+DpappcMvvrQrhZ6i7ZcrwCNMeoj7ZbMfu7tAVdoz Fraw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=Uh2CIFSJ; 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-7947-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-wireless+bounces-7947-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id 6a1803df08f44-6a9f3faf0c9si74023006d6.505.2024.05.22.02.55.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 May 2024 02:55:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless+bounces-7947-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=Uh2CIFSJ; 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-7947-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-wireless+bounces-7947-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 716991C20E45 for ; Wed, 22 May 2024 09:55:25 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9523B8172A; Wed, 22 May 2024 09:55:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="Uh2CIFSJ" 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 09DD881723 for ; Wed, 22 May 2024 09:55:20 +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=1716371722; cv=none; b=eyEecl7ASX+2KGgGzkhP4nGAWmdpDSOAqEWwDLdeuzmvYD9yJHPfBTJE4/t+/0MAC1LmZ7VNMZsXa3hUqu3ZD7cueHjGYaIGSRW1gm0ODc0C2qpk2wjRkNQtooSXocU5PegMdLKB9NbspCdyVZRGSctsLtZccb1i7fRv9LYNfOs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716371722; c=relaxed/simple; bh=RASh+UJvq6ygxh2XYu62ZlDC7e4F0InRdmIeEDYJOpk=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=dwBz+XB1sHW73T98TGIsqDCm0FWOuk6PjCSljHA/VDt5cZVTReN2zvVW0twrbK1rmYy7xgzvfnOkt3Fb9SULtMaa8FLWfgi/wsAywzx4Ygxy0bTd9nBCefqFyZhCGkKHKDP36kNO79COsFE7n6cYPbGL294giZPwRi9ikZFZZss= 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=Uh2CIFSJ; 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 (m0279865.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 44M8NIqw003043; Wed, 22 May 2024 09:55:18 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=Ei03v/C YUBCQYP94hlE/M/Cli/p1dOmmt2/VlXFAs+k=; b=Uh2CIFSJz1Dmza5goceMeRL 9EgbAr6b5rNOx1qGfizA+Xv/iQzNbt308b4NMTt8/aym3oI6/HMV/nUiVQbN3U4R xa1XJprOxzjNuM5VzYDa/fQ/tKcrG/iYxn404KUcfhW7GnkDA6LRQne+gfzF17Qn uYftEH/GVYj/PHmcQx9VmuLvBnlD+IHCEloP7Y8RyeuhqkL5REPCXuKe4YnDMkIk m/6M0WYvbZmwBwB3wajpkpyxruCQ5apJWN/GQ/jcoj0NB777cNqfOI/B9hrsvLw0 X1v9YICTOpVyOay/M+9OWPDAfM4wJe55X6MLv4geM2EhOMzkQS0v7fq2DkM3FMA= = 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 3y6psngg4c-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 22 May 2024 09:55:18 +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 44M9tEQj024944; Wed, 22 May 2024 09:55:14 GMT Received: from pps.reinject (localhost [127.0.0.1]) by APBLRPPMTA02.qualcomm.com (PPS) with ESMTPS id 3y6ndkfpv6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 22 May 2024 09:55:14 +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 44M9tEuT024937; Wed, 22 May 2024 09:55:14 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 44M9tE9A024935 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 22 May 2024 09:55:14 +0000 Received: by hu-devc-blr-u22-a.qualcomm.com (Postfix, from userid 4146166) id 04944410F2; Wed, 22 May 2024 15:25:13 +0530 (+0530) From: Harshitha Prem To: ath12k@lists.infradead.org Cc: linux-wireless@vger.kernel.org, Karthikeyan Periyasamy , Harshitha Prem , Jeff Johnson Subject: [PATCH v5 2/8] wifi: ath12k: Add helpers to get or set ath12k_hw Date: Wed, 22 May 2024 15:24:33 +0530 Message-Id: <20240522095439.2596989-3-quic_hprem@quicinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240522095439.2596989-1-quic_hprem@quicinc.com> References: <20240522095439.2596989-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: efh7iI9VhmDhMCLf0iK8c9dU2qxyv-3K X-Proofpoint-ORIG-GUID: efh7iI9VhmDhMCLf0iK8c9dU2qxyv-3K 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-22_05,2024-05-21_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 malwarescore=0 bulkscore=0 phishscore=0 impostorscore=0 adultscore=0 mlxlogscore=745 clxscore=1015 priorityscore=1501 suspectscore=0 spamscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2405010000 definitions=main-2405220070 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 Acked-by: Jeff Johnson --- 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 342d0ab12105..3925bb70d479 100644 --- a/drivers/net/wireless/ath/ath12k/core.c +++ b/drivers/net/wireless/ath/ath12k/core.c @@ -947,7 +947,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; @@ -999,7 +999,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; @@ -1038,7 +1038,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 7d20b09c52e6..3f5c9fa9d04c 100644 --- a/drivers/net/wireless/ath/ath12k/core.h +++ b/drivers/net/wireless/ath/ath12k/core.h @@ -1051,4 +1051,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 784964ae03ec..f8e8320b8598 100644 --- a/drivers/net/wireless/ath/ath12k/mac.c +++ b/drivers/net/wireless/ath/ath12k/mac.c @@ -9158,7 +9158,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) @@ -9169,7 +9169,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; @@ -9185,7 +9185,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; @@ -9243,6 +9243,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++) { @@ -9254,11 +9255,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); } } @@ -9289,7 +9291,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); @@ -9298,11 +9300,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