Received: by 2002:a89:48b:0:b0:1f5:f2ab:c469 with SMTP id a11csp893454lqd; Wed, 24 Apr 2024 22:58:17 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWkyE6qbQld8RcOmdlkf9y4zIKKFpq0Cj/1PR8q/MX/yg/l4DeiAtO2QVhpNoXrOtbCYeQQ9Rw/JamRgUSb0GV6n2DAFO20HzjLhdJE/g== X-Google-Smtp-Source: AGHT+IHbK4qtIvAGxJsUxpUXIs0zZq/BE7xaeereUe60HJOykUOmnFePKaihPZ3odj253qxOUjrF X-Received: by 2002:a05:6870:2050:b0:239:7008:b755 with SMTP id l16-20020a056870205000b002397008b755mr5490899oad.28.1714024697360; Wed, 24 Apr 2024 22:58:17 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714024697; cv=pass; d=google.com; s=arc-20160816; b=ZRj09rxpOxl9YerF3oAN9WuyK6w4J+TBqbtxx9O+arUc/rIkvf4KsQiI4L1LAc5HqS DYi0WrqxvIMexccjYvTlLmeLQWCS3ErBoirk98WW1FGN+LMT3sTvuFiuXeqHnaK8Rk3i 32rnOn1lIZAH/x9P3R7vTs/zfLKC3tNtnanZLJG+CnFNuAFF1MhMkfzCoNSAfGtxCCg4 eiJTn4ppT+atsZKkSzwutXP1TDV7GWL1sVZj/j9zyTdt4/IWZRJ6ZwXfOPBZF7y2eAOV v4sKCM2mjNz86guDfcbmwIjwA+e1Hg7rUlnxd2syP3fb0Hz6l//e975+xeeUe3YyoF1K +MnQ== 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=mWzuNCck3sLo/I39f3dOEObVGU3Ar/55UCY7JchOws0=; fh=wnySVr9+WO9j7lO1L6CVbSw/CjEiK6R10EUaKUiDPbE=; b=CtrA5SvV8ctwEZpb24fpWroAVvbFFNCU8eoZDhxLv8X5PO8hg2VxhT74qm4KEjB2Io ngujhEINaSoJ4fnoGZCWvwn4Iy19ZoNRSqtdBz7BRuKN0tKIKZTgUHOmeEFG7jazD2zj h+gOcmOAHhJP/mT8cdNh0LnMsIYKKQqTd0LMJt/237BXcPc7gie2S1LevVIKstxPYAuS 6RNsFg9uJlhribNPPxI9A4RIMAo9Trv1ESmxXd28A2y9eDDZJfTUurZTXGefHrDKOVRb VRGvxNRqPpGB4/Sw0H4CtdzfXgP+BKNRyRYpJ9are64aktpyQ5DSRQKUvwHlmGy45TwH bj/w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=CeVAEh38; 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-6806-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-wireless+bounces-6806-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 t71-20020a63814a000000b006009435e6ccsi6392317pgd.256.2024.04.24.22.58.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Apr 2024 22:58:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless+bounces-6806-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=CeVAEh38; 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-6806-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-wireless+bounces-6806-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 A8877281BE5 for ; Thu, 25 Apr 2024 05:58:16 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 32A953C099; Thu, 25 Apr 2024 05:58:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="CeVAEh38" 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 665173A1AC for ; Thu, 25 Apr 2024 05:58: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=1714024694; cv=none; b=tVMGqtJ1k+JD5dn7cQxYqI1er9HmCV7eOCd7KleeFLhf/DA7xCS2DZyr4StecpdksbzPuzJAa0Gm78qTxQjISAY/MMXw4891bcJi+nYQnNv54jVX/t9/z/Rvh8dzjCpVMbWrxD8PuScaVj3aQEdNaFr3/KvyCfnDIj2/f1qYmiY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714024694; c=relaxed/simple; bh=E19azsfgGU2wAsdE+Z66/mbR0pxT9DXSyqNEpjpvcyE=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Fj9eNSvEmSnW6kzBVKqvQwZ5yFf74CoD/711u9swKvHMsF7aYBBPIRhFSgfim7/2jycgTvQIl//wUY5b+YyHHT0JU36j0NvRpkBRFJA58tQVqQGR3n51XO6pXYSonWvEEjmt71ZLAaDQs2nFeFQ9VguVchIv2M1rRBMZ4dddYoY= 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=CeVAEh38; 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 (m0279866.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 43P5eAKN022086; Thu, 25 Apr 2024 05:58:08 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=mWzuNCc k3sLo/I39f3dOEObVGU3Ar/55UCY7JchOws0=; b=CeVAEh38gtA+M8FuZ5SPb8I EdGQvIIqvap0XL9y6aozByZ4ffpEoMS4uXGilC/hCCiUD9obaog2vPWE3X9BA/YT f/S9kyIFEP/vOfbJxCFJTjiReU+4ngfiFb3gu56Pkrp+VxPCsuoYnaB46+dZE6kP m2t0fUyuLGhsrXi4QK2phDM+AgorHPXxoPG0F0SxzK2aD0W/+XBLtE7zgQusGfIl fxXmPDPd3E1K6DLC/Lv74nYdfbmS2SpEMYQoKwMeeaCN3lJY29TYSpWNKqcqiiyp LndttpM26l3jMKEe6UefBDqyPZBOYmj1waYTT1n0N8tMS2PIgEvg8+1V2R7wM6A= = 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 3xqenhgcc9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 25 Apr 2024 05:58:07 +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 43P5w4jU031201; Thu, 25 Apr 2024 05:58:04 GMT Received: from pps.reinject (localhost [127.0.0.1]) by APBLRPPMTA01.qualcomm.com (PPS) with ESMTPS id 3xm6smbfmp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 25 Apr 2024 05:58:04 +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 43P5w4av031130; Thu, 25 Apr 2024 05:58:04 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 43P5w4c1031089 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 25 Apr 2024 05:58:04 +0000 Received: by hu-devc-blr-u22-a.qualcomm.com (Postfix, from userid 4146166) id 563164114F; Thu, 25 Apr 2024 11:28:03 +0530 (+0530) From: Harshitha Prem To: ath12k@lists.infradead.org Cc: linux-wireless@vger.kernel.org, Karthikeyan Periyasamy , Harshitha Prem Subject: [PATCH v2 1/8] wifi: ath12k: Refactor core start api Date: Thu, 25 Apr 2024 11:27:52 +0530 Message-Id: <20240425055759.1181165-2-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: 2nBgV1yw8717HWqJvF1-FnTwhHCwnPeo X-Proofpoint-GUID: 2nBgV1yw8717HWqJvF1-FnTwhHCwnPeo 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 mlxscore=0 clxscore=1015 phishscore=0 spamscore=0 adultscore=0 mlxlogscore=999 priorityscore=1501 suspectscore=0 impostorscore=0 malwarescore=0 lowpriorityscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2404010003 definitions=main-2404250040 From: Karthikeyan Periyasamy Hardware device group abstraction would be introduced, in future, where radios across different devices can be grouped together to support multi-link operation and register as a device group to mac80211. Currently, ath12k_mac_allocate() and ath12k_mac_register() APIs are part of ath12k_core_start() and ath12k_core_pdev_create() respectively and are based on per device (ath12k_base). These APIs can be decoupled and moved out to ath12k_core_qmi_firmware_ready() itself. This refactor would be helpful for device group abstraction when mac80211 allocate and register will be changed from per device (ath12k_base) to per device group (ath12k_hw_group). Add changes to move allocate and register APIs from existing one and modify corresponding deinit sequence. 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 | 64 +++++++++++++------------- 1 file changed, 31 insertions(+), 33 deletions(-) diff --git a/drivers/net/wireless/ath/ath12k/core.c b/drivers/net/wireless/ath/ath12k/core.c index e9aabdb9341c..63f0ba7bb57d 100644 --- a/drivers/net/wireless/ath/ath12k/core.c +++ b/drivers/net/wireless/ath/ath12k/core.c @@ -563,14 +563,15 @@ u32 ath12k_core_get_max_num_tids(struct ath12k_base *ab) static void ath12k_core_stop(struct ath12k_base *ab) { - if (!test_bit(ATH12K_FLAG_CRASH_FLUSH, &ab->dev_flags)) - ath12k_qmi_firmware_stop(ab); - ath12k_acpi_stop(ab); + ath12k_dp_rx_pdev_reo_cleanup(ab); ath12k_hif_stop(ab); ath12k_wmi_detach(ab); - ath12k_dp_rx_pdev_reo_cleanup(ab); + ath12k_dp_free(ab); + + if (!test_bit(ATH12K_FLAG_CRASH_FLUSH, &ab->dev_flags)) + ath12k_qmi_firmware_stop(ab); /* De-Init of components as needed */ } @@ -672,7 +673,7 @@ static int ath12k_core_soc_create(struct ath12k_base *ab) static void ath12k_core_soc_destroy(struct ath12k_base *ab) { - ath12k_dp_free(ab); + ath12k_hif_power_down(ab, false); ath12k_reg_free(ab); ath12k_debugfs_soc_destroy(ab); ath12k_qmi_deinit_service(ab); @@ -682,30 +683,17 @@ static int ath12k_core_pdev_create(struct ath12k_base *ab) { int ret; - ret = ath12k_mac_register(ab); - if (ret) { - ath12k_err(ab, "failed register the radio with mac80211: %d\n", ret); - return ret; - } - ret = ath12k_dp_pdev_alloc(ab); if (ret) { ath12k_err(ab, "failed to attach DP pdev: %d\n", ret); - goto err_mac_unregister; + return ret; } return 0; - -err_mac_unregister: - ath12k_mac_unregister(ab); - - return ret; } static void ath12k_core_pdev_destroy(struct ath12k_base *ab) { - ath12k_mac_unregister(ab); - ath12k_hif_irq_disable(ab); ath12k_dp_pdev_free(ab); } @@ -763,19 +751,12 @@ static int ath12k_core_start(struct ath12k_base *ab, goto err_hif_stop; } - ret = ath12k_mac_allocate(ab); - if (ret) { - ath12k_err(ab, "failed to create new hw device with mac80211 :%d\n", - ret); - goto err_hif_stop; - } - ath12k_dp_cc_config(ab); ret = ath12k_dp_rx_pdev_reo_setup(ab); if (ret) { ath12k_err(ab, "failed to initialize reo destination rings: %d\n", ret); - goto err_mac_destroy; + goto err_hif_stop; } ath12k_dp_hal_rx_desc_init(ab); @@ -818,8 +799,6 @@ static int ath12k_core_start(struct ath12k_base *ab, err_reo_cleanup: ath12k_dp_rx_pdev_reo_cleanup(ab); -err_mac_destroy: - ath12k_mac_destroy(ab); err_hif_stop: ath12k_hif_stop(ab); err_wmi_detach: @@ -873,11 +852,25 @@ int ath12k_core_qmi_firmware_ready(struct ath12k_base *ab) goto err_dp_free; } + ret = ath12k_mac_allocate(ab); + if (ret) { + ath12k_err(ab, "failed to create new hw device with mac80211 :%d\n", + ret); + goto err_core_stop; + } + + ret = ath12k_mac_register(ab); + if (ret) { + ath12k_err(ab, "failed register the radio with mac80211: %d\n", ret); + goto err_mac_destroy; + } + ret = ath12k_core_pdev_create(ab); if (ret) { ath12k_err(ab, "failed to create pdev core: %d\n", ret); - goto err_core_stop; + goto err_mac_unregister; } + ath12k_hif_irq_enable(ab); ret = ath12k_core_rfkill_config(ab); @@ -891,10 +884,14 @@ int ath12k_core_qmi_firmware_ready(struct ath12k_base *ab) return 0; err_core_pdev_destroy: + ath12k_hif_irq_disable(ab); ath12k_core_pdev_destroy(ab); +err_mac_unregister: + ath12k_mac_unregister(ab); +err_mac_destroy: + ath12k_mac_destroy(ab); err_core_stop: ath12k_core_stop(ab); - ath12k_mac_destroy(ab); err_dp_free: ath12k_dp_free(ab); mutex_unlock(&ab->core_lock); @@ -1208,13 +1205,14 @@ void ath12k_core_deinit(struct ath12k_base *ab) { mutex_lock(&ab->core_lock); + ath12k_hif_irq_disable(ab); ath12k_core_pdev_destroy(ab); + ath12k_mac_unregister(ab); + ath12k_mac_destroy(ab); ath12k_core_stop(ab); mutex_unlock(&ab->core_lock); - ath12k_hif_power_down(ab, false); - ath12k_mac_destroy(ab); ath12k_core_soc_destroy(ab); ath12k_fw_unmap(ab); } -- 2.34.1