Received: by 2002:a89:d88:0:b0:1fa:5c73:8e2d with SMTP id eb8csp2458243lqb; Mon, 27 May 2024 23:36:22 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVoIqQ208PlmkcQZKYEYbtYiNy1Vnn1XRin6hfZ31+C4+YFzymhVN8cRuUiV0s0QovBvuwvTbb6aoDtBpHkn+PqIeTTA0nCTN0oN84d8w== X-Google-Smtp-Source: AGHT+IF4xT5VyQAUo3TDQqf56nEuw4pHYFuvFJrcUTQx0vyPYXhU+NC8kl943SEI5lLEp9u/w702 X-Received: by 2002:a17:903:2347:b0:1f2:fca9:731c with SMTP id d9443c01a7336-1f4486d51a5mr120418835ad.8.1716878181738; Mon, 27 May 2024 23:36:21 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716878181; cv=pass; d=google.com; s=arc-20160816; b=e2UJrITo97t4bHLd71IIz0daetdk6J15IIt3uHRTJGL0v3sf/uSAY3tkdVy+8Ea7Gi F5W/DuRCg9UuTpcVTgYnWVrJ6XQueHVisIYqudTlz61YkkGJdQo0heT98LzMC4PXxHtg 9dUBRASoS/egNlKdwhldMmL3AjWMjRQdWs/+5737stQFXePjn+kaesgn7j4oFR4Pf1Jc HNdirhjPW0PhL508vmRe7GRs0ZQX0F/bp1upWynYnbG9HmtkH4+fhHNKFI6rOAxyZY6d KpgEby7M08lpSOvkphTlqOyooLVgMVLm1GCb+Vh/wKWQuoO31Gf9sdtd9utCW1QPpJq+ NOTg== 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=v8T3sAjhzPrqu0X2wF9xd6B4jRKAemg+UKlmHd79xqc=; fh=gjyKuI8lXSKwquXF/tvFPrzHVVLmD81gAC9iylGd+k0=; b=YvvPPiEFmbfCiA8601+sqNFS+fbR3bfEoimVKNzviRfHGWeaEyieOGJsCkug/124SB oonZCM+hKMVKhyd3qWCE3fL7QSsdhnHEXJbU38bWq/WmQZUoiI2lu9ccK2VVfPy0m0g8 mtnaW7aqNBnJjPTX6NoHS46N77qEaXsBosEXsINW6z52M+kBlj/jMlUohI+jR6dipZ1W VBuRJHdU5/QLGFgpCnB/JHFcLcfMyiTsmEodCr9aVlNIyO24tHsuScvpCxMhkl+nddgz Ed/6YbBNCsvijT6rjGxciQHxUnn41TlqQE+2+BdY6TT5CVbxkRMk6a73Ld4HikC5yL16 jsYg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=o7j30Q9C; 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-8158-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-wireless+bounces-8158-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 d9443c01a7336-1f44c78a32csi72853905ad.108.2024.05.27.23.36.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 May 2024 23:36:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless+bounces-8158-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=o7j30Q9C; 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-8158-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-wireless+bounces-8158-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 739E0283C21 for ; Tue, 28 May 2024 06:36:20 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 55C1F61FFC; 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="o7j30Q9C" 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 DF92153368 for ; Tue, 28 May 2024 06:36:11 +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=WdfIK2tX16n0KCDeifT+bD/Bi/VvGFBjVyxcqswlJAvVOScjGtHByFOwLYvLmE/81hJaNhS0sAH27vlX7fysqixINDq3nWlcoCvqVzvuxs0oyJC0DY5cwJCFJSz1pM7K6oIRKtUOXsNl/GPgDU/6SV66emE7Wh+XKhy+E8X1BZs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716878174; c=relaxed/simple; bh=3FB+QHAAAfpdyskcQ8tKj+CyJfEqRu5rF5PrZ8Oro9M=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=FlCZ+2WKzdfRxVhvutTDtmFvOctk5iG+lf10t9J1UOagszCJBkJWw3GtBzmDzZF/c1I/JsUNf9NKd12jFcPYu6lliRfq8SOV9QQEMK8TVTT01lw93jvDdA+WPTiUzCkP8gJWLwkI6H1R8Y4aSfCMJdPH5Xmsn4JyFJfDrnueeRE= 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=o7j30Q9C; 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 (m0279868.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 44RNg5AV011441; Tue, 28 May 2024 06:36:04 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=v8T3sAjhzPr qu0X2wF9xd6B4jRKAemg+UKlmHd79xqc=; b=o7j30Q9CukpUrP+3KdBy/V62l0h Su/zff1Ooz+XAPL3co8I7mfBHt9tSUZiFOq0hoOweqMjzDxB/oqPJXyRRCvect0B 8t6HpKINI9lmvJJ7BhnrXBpV8Vn7qtBO4MFjZ/VuwMtccm6/IyEgGLB+xwG9XqBG I2ewUnfJb8WSsl1FrtWFZlH5502cURRRKpwHRcbCnWGClgexyMcbABbQIhJUazat qxKzGuzwMlCH/5YRPdQHbA6lrg3yLEwSOBSFiJOJfokd5ssL7hCEh4pik/3ypHcQ ARPX6UUAJYKrWEiSWDeOh1sGc7wm8evig2SZEDg1KJFo8AOg/g61cDZguYQ== 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 3yba0qd8x0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 28 May 2024 06:36:03 +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 44S6a0LH012701; Tue, 28 May 2024 06:36:00 GMT Received: from pps.reinject (localhost [127.0.0.1]) by APBLRPPMTA02.qualcomm.com (PPS) with ESMTPS id 3yb92kd5wx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 28 May 2024 06:36:00 +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 44S6ZvwD012660; Tue, 28 May 2024 06:36:00 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 44S6a0Q6012695 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 28 May 2024 06:36:00 +0000 Received: by hu-devc-blr-u22-a.qualcomm.com (Postfix, from userid 4146166) id B3F9F4114D; Tue, 28 May 2024 12:05:59 +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 1/8] wifi: ath12k: Refactor core start api Date: Tue, 28 May 2024 12:05:40 +0530 Message-Id: <20240528063547.1400700-2-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: eNrG8IYTVEqQUesK06jLSVP-f5vbQZcF X-Proofpoint-ORIG-GUID: eNrG8IYTVEqQUesK06jLSVP-f5vbQZcF 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 suspectscore=0 lowpriorityscore=0 impostorscore=0 clxscore=1015 mlxscore=0 mlxlogscore=999 malwarescore=0 spamscore=0 adultscore=0 bulkscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2405170001 definitions=main-2405280047 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 Acked-by: Jeff Johnson --- drivers/net/wireless/ath/ath12k/core.c | 59 ++++++++++++-------------- drivers/net/wireless/ath/ath12k/pci.c | 1 + 2 files changed, 29 insertions(+), 31 deletions(-) diff --git a/drivers/net/wireless/ath/ath12k/core.c b/drivers/net/wireless/ath/ath12k/core.c index e7f628e935e4..342d0ab12105 100644 --- a/drivers/net/wireless/ath/ath12k/core.c +++ b/drivers/net/wireless/ath/ath12k/core.c @@ -565,9 +565,10 @@ static void ath12k_core_stop(struct ath12k_base *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); /* De-Init of components as needed */ } @@ -669,7 +670,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); @@ -679,30 +680,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); } @@ -760,19 +748,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); @@ -815,8 +796,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: @@ -870,11 +849,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); @@ -888,10 +881,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); @@ -1205,15 +1202,15 @@ 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); } void ath12k_core_free(struct ath12k_base *ab) diff --git a/drivers/net/wireless/ath/ath12k/pci.c b/drivers/net/wireless/ath/ath12k/pci.c index ac75e8e3916b..8f37f6efb8a2 100644 --- a/drivers/net/wireless/ath/ath12k/pci.c +++ b/drivers/net/wireless/ath/ath12k/pci.c @@ -1529,6 +1529,7 @@ static void ath12k_pci_remove(struct pci_dev *pdev) cancel_work_sync(&ab->reset_work); ath12k_core_deinit(ab); + ath12k_fw_unmap(ab); qmi_fail: ath12k_mhi_unregister(ab_pci); -- 2.34.1