Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp5493094imw; Wed, 20 Jul 2022 06:51:50 -0700 (PDT) X-Google-Smtp-Source: AGRyM1ticSwRHCYDmlJxd++Q0TNCRC9pE+YZyynv2joeJWLcjDnObQRvmBSov1EWZq6sVUjLTMV5 X-Received: by 2002:a17:90b:33c4:b0:1f0:3d9d:39ac with SMTP id lk4-20020a17090b33c400b001f03d9d39acmr5559529pjb.56.1658325110344; Wed, 20 Jul 2022 06:51:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658325110; cv=none; d=google.com; s=arc-20160816; b=cE4E/KWrYaBqfIKNIaqL9malal0u60vo3l7EgRkPDhORylL08nQw0e4mOJdgTsQAqV 2azkIp6TOzU+VbrWXIvxBMO5hz34hcpJV9AYnxDKKr5PCdOTx9GxD2ANwOy3Rmu3CARF rvmsSVPvnTa5idev+6j4i5HWvQI7O3moFkUwsTZAQu4aPxHCxJqBa6Hi11X2wA4lTGA7 VSDBjRpcl556DqEgCYf7TwR63RZgHr0pFSxkyn5beembf27KGwRyoVjmC8nfwMbYocKe RdzWFgJ7Ph4BvaRy+Wvpcpk22fRCj2R6Cr28CdZCwsPSP71R5xvRMjRMNNDLT1Qcm4p1 1B8A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=2AE0/WZ2gTR+28kl+oOKg8zJE34HrAqFdsnF6K/UJHY=; b=C5XfOvADimbXkxLa0/izOu17tc621ioM8g+DEOo4nLZ0NVz+EIXr5+xaf6pt3Sz7aZ WhvwTKTUWBJtTwVjTkYKTFW0g0p7NsSTOzRwg1UUMqeiWqOuh1s53wTgy9Tcn1mRtnFT Xuq3jJKH3enS8FsUSHjNTS++xamHEuVQ1S46D9DMRuS8g/hJcIlSX3dgHDxevzKcdqrb 0wgYyHziqfEEs7g1UL1zrNJ7fjfxzo2p1u9dtId07n2Gc0lR9tDp1TQOgNjo3n9Wi8xk Z4H18mUZSrFtwlWqpVHdT1cu9dxShbspZxwZx+liibImqCtNeb9UBQhB14J7tlei0Nxb q+Kg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=IjxMOeVK; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s22-20020a632c16000000b00408c2891a4fsi19755006pgs.710.2022.07.20.06.51.40; Wed, 20 Jul 2022 06:51:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=IjxMOeVK; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237257AbiGTNu1 (ORCPT + 65 others); Wed, 20 Jul 2022 09:50:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44456 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240507AbiGTNuX (ORCPT ); Wed, 20 Jul 2022 09:50:23 -0400 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A240E39BB4 for ; Wed, 20 Jul 2022 06:50:21 -0700 (PDT) Received: from pps.filterd (m0279866.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 26KCQoFr032740; Wed, 20 Jul 2022 13:50:19 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 : content-type; s=qcppdkim1; bh=2AE0/WZ2gTR+28kl+oOKg8zJE34HrAqFdsnF6K/UJHY=; b=IjxMOeVKeSmMNSIYPp60es0rDrZK5P8MDZgb3y4IENG9v8fwZXQOP+bjwGBZw+JNp6X4 4VRD7LTUgjplsxI7ze4sQiLH4nRN6wBB9eiG3hcK35xRZRwzZv6+0uE1Ing//JmD2rZg 7WR/NC9rDGaAwzj1A392fmLIP7hZzLcu3GBQjpkcTaj2U0QIa0ly3+fV1/EZ0wE0LTL3 aPOPp1Fjx4Gda+BkBzlk2pVXJEjLcElqRTUvY6lPRtiMNrtW8/pCEj9CFs11oG3KTWCp YykaVE1zuq2H0bFeo87Q/HON96BwZ9vI9Gk7LjkGbfuyzvnylh3iOJqnYisc6zz7aUEN EA== Received: from nasanppmta04.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3he90k1gmj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 20 Jul 2022 13:50:19 +0000 Received: from nasanex01c.na.qualcomm.com (nasanex01c.na.qualcomm.com [10.47.97.222]) by NASANPPMTA04.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 26KDoIR6032076 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 20 Jul 2022 13:50:18 GMT Received: from nalasex01a.na.qualcomm.com (10.47.209.196) by nasanex01c.na.qualcomm.com (10.47.97.222) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.22; Wed, 20 Jul 2022 06:50:18 -0700 Received: from mpubbise-linux.qualcomm.com (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.22; Wed, 20 Jul 2022 06:50:16 -0700 From: Manikanta Pubbisetty To: CC: , Manikanta Pubbisetty Subject: [PATCH 2/4] ath11k: Move hardware initialization logic to start() Date: Wed, 20 Jul 2022 19:19:57 +0530 Message-ID: <20220720134959.15688-3-quic_mpubbise@quicinc.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220720134959.15688-1-quic_mpubbise@quicinc.com> References: <20220720134959.15688-1-quic_mpubbise@quicinc.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nalasex01a.na.qualcomm.com (10.47.209.196) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-ORIG-GUID: kTSHXb1cWYHIctSZheyFgANjVucI0XQr X-Proofpoint-GUID: kTSHXb1cWYHIctSZheyFgANjVucI0XQr X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.883,Hydra:6.0.517,FMLib:17.11.122.1 definitions=2022-07-20_08,2022-07-20_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 mlxscore=0 impostorscore=0 phishscore=0 clxscore=1015 bulkscore=0 malwarescore=0 adultscore=0 lowpriorityscore=0 priorityscore=1501 mlxlogscore=999 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2206140000 definitions=main-2207200057 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Currently during recovery, hardware is re-initialized as part of ath11k_core_reconfigure_on_crash(). In order to enable low power mode support in the driver, it is required to move the hardware re-initialization logic to ath11k_ops.start() hook. Since ath11k_ops.start() hook is called during WiFi ON/resume and also during hardware recovery, it is better to defer the hardware initialization to ath11k_ops.start() in the case of hardware recovery. This will help ensure that there is only path for the initialization of the hardware across different scenarios. A future patch will add the support of initializing the hardware from start() hook in WiFi ON/resume cases as well. Commit 38194f3a605e ("ath11k: add synchronization operation between reconfigure of mac80211 and ath11k_base") introduced a similar change that applies just to QCA6390/WCN6855 to defer the initialization of the hardware during recovery by using wait logic. This is no more needed and therefore remove it. Tested-on: WCN6750 hw1.0 AHB WLAN.MSL.1.0.1-00887-QCAMSLSWPLZ-1 Signed-off-by: Manikanta Pubbisetty --- drivers/net/wireless/ath/ath11k/core.c | 87 +++++++++++--------------- drivers/net/wireless/ath/ath11k/core.h | 6 +- drivers/net/wireless/ath/ath11k/mac.c | 29 +++------ 3 files changed, 44 insertions(+), 78 deletions(-) diff --git a/drivers/net/wireless/ath/ath11k/core.c b/drivers/net/wireless/ath/ath11k/core.c index c8e0bc935838..f4f88a19539e 100644 --- a/drivers/net/wireless/ath/ath11k/core.c +++ b/drivers/net/wireless/ath/ath11k/core.c @@ -1498,10 +1498,8 @@ int ath11k_core_qmi_firmware_ready(struct ath11k_base *ab) return ret; } -static int ath11k_core_reconfigure_on_crash(struct ath11k_base *ab) +static void ath11k_core_reconfigure_on_crash(struct ath11k_base *ab) { - int ret; - mutex_lock(&ab->core_lock); ath11k_thermal_unregister(ab); ath11k_hif_irq_disable(ab); @@ -1513,27 +1511,8 @@ static int ath11k_core_reconfigure_on_crash(struct ath11k_base *ab) mutex_unlock(&ab->core_lock); ath11k_dp_free(ab); - ath11k_hal_srng_deinit(ab); ab->free_vdev_map = (1LL << (ab->num_radios * TARGET_NUM_VDEVS(ab))) - 1; - - ret = ath11k_hal_srng_init(ab); - if (ret) - return ret; - - clear_bit(ATH11K_FLAG_CRASH_FLUSH, &ab->dev_flags); - - ret = ath11k_core_qmi_firmware_ready(ab); - if (ret) - goto err_hal_srng_deinit; - - clear_bit(ATH11K_FLAG_RECOVERY, &ab->dev_flags); - - return 0; - -err_hal_srng_deinit: - ath11k_hal_srng_deinit(ab); - return ret; } void ath11k_core_halt(struct ath11k *ar) @@ -1694,22 +1673,10 @@ static void ath11k_core_post_reconfigure_recovery(struct ath11k_base *ab) static void ath11k_core_restart(struct work_struct *work) { struct ath11k_base *ab = container_of(work, struct ath11k_base, restart_work); - int ret; - - if (!ab->is_reset) - ath11k_core_pre_reconfigure_recovery(ab); - - ret = ath11k_core_reconfigure_on_crash(ab); - if (ret) { - ath11k_err(ab, "failed to reconfigure driver on crash recovery\n"); - return; - } - - if (ab->is_reset) - complete_all(&ab->reconfigure_complete); - if (!ab->is_reset) - ath11k_core_post_reconfigure_recovery(ab); + ath11k_core_pre_reconfigure_recovery(ab); + ath11k_core_reconfigure_on_crash(ab); + ath11k_core_post_reconfigure_recovery(ab); } static void ath11k_core_reset(struct work_struct *work) @@ -1763,18 +1730,6 @@ static void ath11k_core_reset(struct work_struct *work) ab->is_reset = true; atomic_set(&ab->recovery_count, 0); - reinit_completion(&ab->recovery_start); - atomic_set(&ab->recovery_start_count, 0); - - ath11k_core_pre_reconfigure_recovery(ab); - - reinit_completion(&ab->reconfigure_complete); - ath11k_core_post_reconfigure_recovery(ab); - - ath11k_dbg(ab, ATH11K_DBG_BOOT, "waiting recovery start...\n"); - - time_left = wait_for_completion_timeout(&ab->recovery_start, - ATH11K_RECOVER_START_TIMEOUT_HZ); ath11k_hif_power_down(ab); ath11k_hif_power_up(ab); @@ -1882,8 +1837,6 @@ struct ath11k_base *ath11k_core_alloc(struct device *dev, size_t priv_size, spin_lock_init(&ab->base_lock); mutex_init(&ab->vdev_id_11d_lock); init_completion(&ab->reset_complete); - init_completion(&ab->reconfigure_complete); - init_completion(&ab->recovery_start); INIT_LIST_HEAD(&ab->peers); init_waitqueue_head(&ab->peer_mapping_wq); @@ -1910,5 +1863,37 @@ struct ath11k_base *ath11k_core_alloc(struct device *dev, size_t priv_size, } EXPORT_SYMBOL(ath11k_core_alloc); +int ath11k_core_start_device(struct ath11k_base *ab) +{ + int ret; + + if (!test_bit(ATH11K_FLAG_RECOVERY, &ab->dev_flags)) + return 0; + + ath11k_hal_srng_deinit(ab); + + ret = ath11k_hal_srng_init(ab); + if (ret) { + ath11k_err(ab, "failed to init srng: %d\n", ret); + return ret; + } + + clear_bit(ATH11K_FLAG_CRASH_FLUSH, &ab->dev_flags); + + ret = ath11k_core_qmi_firmware_ready(ab); + if (ret) { + ath11k_err(ab, "failed to init core: %d\n", ret); + goto err_hal_srng_deinit; + } + + clear_bit(ATH11K_FLAG_RECOVERY, &ab->dev_flags); + + return 0; + +err_hal_srng_deinit: + ath11k_hal_srng_deinit(ab); + return ret; +} + MODULE_DESCRIPTION("Core module for Qualcomm Atheros 802.11ax wireless LAN cards."); MODULE_LICENSE("Dual BSD/GPL"); diff --git a/drivers/net/wireless/ath/ath11k/core.h b/drivers/net/wireless/ath/ath11k/core.h index 2bd5eb9df4d4..5ecb60a1b51d 100644 --- a/drivers/net/wireless/ath/ath11k/core.h +++ b/drivers/net/wireless/ath/ath11k/core.h @@ -60,8 +60,6 @@ extern unsigned int ath11k_frame_mode; #define ATH11K_RESET_MAX_FAIL_COUNT_FIRST 3 #define ATH11K_RESET_MAX_FAIL_COUNT_FINAL 5 #define ATH11K_RESET_FAIL_TIMEOUT_HZ (20 * HZ) -#define ATH11K_RECONFIGURE_TIMEOUT_HZ (10 * HZ) -#define ATH11K_RECOVER_START_TIMEOUT_HZ (20 * HZ) enum ath11k_supported_bw { ATH11K_BW_20 = 0, @@ -913,11 +911,8 @@ struct ath11k_base { struct work_struct reset_work; atomic_t reset_count; atomic_t recovery_count; - atomic_t recovery_start_count; bool is_reset; struct completion reset_complete; - struct completion reconfigure_complete; - struct completion recovery_start; /* continuous recovery fail count */ atomic_t fail_cont_count; unsigned long reset_fail_timeout; @@ -1144,6 +1139,7 @@ int ath11k_core_check_smbios(struct ath11k_base *ab); void ath11k_core_halt(struct ath11k *ar); int ath11k_core_resume(struct ath11k_base *ab); int ath11k_core_suspend(struct ath11k_base *ab); +int ath11k_core_start_device(struct ath11k_base *ab); const struct firmware *ath11k_core_firmware_request(struct ath11k_base *ab, const char *filename); diff --git a/drivers/net/wireless/ath/ath11k/mac.c b/drivers/net/wireless/ath/ath11k/mac.c index d83d3c944594..84f2604a16e4 100644 --- a/drivers/net/wireless/ath/ath11k/mac.c +++ b/drivers/net/wireless/ath/ath11k/mac.c @@ -5753,27 +5753,6 @@ static int ath11k_mac_config_mon_status_default(struct ath11k *ar, bool enable) return ret; } -static void ath11k_mac_wait_reconfigure(struct ath11k_base *ab) -{ - int recovery_start_count; - - if (!ab->is_reset) - return; - - recovery_start_count = atomic_inc_return(&ab->recovery_start_count); - ath11k_dbg(ab, ATH11K_DBG_MAC, "recovery start count %d\n", recovery_start_count); - - if (recovery_start_count == ab->num_radios) { - complete(&ab->recovery_start); - ath11k_dbg(ab, ATH11K_DBG_MAC, "recovery started success\n"); - } - - ath11k_dbg(ab, ATH11K_DBG_MAC, "waiting reconfigure...\n"); - - wait_for_completion_timeout(&ab->reconfigure_complete, - ATH11K_RECONFIGURE_TIMEOUT_HZ); -} - static int ath11k_mac_op_start(struct ieee80211_hw *hw) { struct ath11k *ar = hw->priv; @@ -5782,6 +5761,13 @@ static int ath11k_mac_op_start(struct ieee80211_hw *hw) int ret; ath11k_mac_drain_tx(ar); + + ret = ath11k_core_start_device(ab); + if (ret) { + ath11k_err(ab, "failed to start device : %d\n", ret); + return ret; + } + mutex_lock(&ar->conf_mutex); switch (ar->state) { @@ -5790,7 +5776,6 @@ static int ath11k_mac_op_start(struct ieee80211_hw *hw) break; case ATH11K_STATE_RESTARTING: ar->state = ATH11K_STATE_RESTARTED; - ath11k_mac_wait_reconfigure(ab); break; case ATH11K_STATE_RESTARTED: case ATH11K_STATE_WEDGED: -- 2.35.1