Received: by 2002:a89:48b:0:b0:1f5:f2ab:c469 with SMTP id a11csp1043284lqd; Thu, 25 Apr 2024 04:38:49 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUCnYuARHMQq/OGSa4jrMHqHD4XeBgeVp75Y1p5mew9mGqchXtj97MhIaIRDymQQSxIWnIkyiTlPo4GaZY4kPPoKCLuKDXEf6MguKCuow== X-Google-Smtp-Source: AGHT+IGZ2Gtsms59Mp9zBjN+U9qDBYQLMFsf8YPbLz2DSXXHXX5+P3K1iDj15mMHpIfKjJsBx5Or X-Received: by 2002:a05:6a00:3c88:b0:6ec:ea4b:f077 with SMTP id lm8-20020a056a003c8800b006ecea4bf077mr6265140pfb.16.1714045128825; Thu, 25 Apr 2024 04:38:48 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714045128; cv=pass; d=google.com; s=arc-20160816; b=Ri9NC31C1aNezKkIXtBVtbhNr0QkYuaM9qakPBdFWoycQXHHpbd7sF/iwBqcqP2uKe YxsQYy4bxaGAaOJM5zKHQ2FQsobCzwvddDSv3gvzF98L4Q558+VtV9hGPss5QMPEFcIw TUfzB4JtYCa/VpvhEY6xmcPOz3aivZmcyDqT0mapgVdCGbyPDzMdpE+mKT4rlcaBEC98 KSSznUiBtkIW8xaK8W7zIDgW/rwT6Vus6G+nzLOACRlUKxs/flK8WnDS2VHX1F3Dyqim QuH+TNeC8svD1KHH655GWt6hEOAfIJclCyDuhKfzhwX6Y1p8tUAxQiJGLTt8fCFGz5pW hdeA== 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; bh=5vUiMBgpR6js3F0MuCJ/VwSwfbMmE2PBgNcck1MW0wU=; fh=Q+3JKoLZIMN+muDUq31kjnNN0UgJXr8C3Bak/Yf/zn8=; b=t77aJ/ykeW+59suefnpFHqmfOwMQmvOhUKx0Qve/CVrwUL73v5kceVzqt6x/9SoOgy C1MOmf1mglGSypj8XKUn2ZARl8WrXTwFaEVFy1P8j9G/vmI/oscZJURD4lUPYd7L66XQ Hq6a/bAc97S6l/0pjoPmevrRlfTX47AbgnrG78KmbBdk80e8zJT13OE6e7/dJZKHwSiW x1vsGDuNB3kq5Xoq+4AaLaXJAVWunosfXaNKEFnMkhzrsmgEHB1C5ri208HLQyyIvADs IIZ78Ivks+uyWEx4WprA9A5GejapLMlWWvpO7d72I7BTV/nDA7nsDYAGuwkZNc6AvJxF Q2NQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=realtek.com); spf=pass (google.com: domain of linux-wireless+bounces-6835-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-wireless+bounces-6835-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id f25-20020a056a000b1900b006eabed49580si13072364pfu.305.2024.04.25.04.38.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Apr 2024 04:38:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless+bounces-6835-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=realtek.com); spf=pass (google.com: domain of linux-wireless+bounces-6835-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-wireless+bounces-6835-linux.lists.archive=gmail.com@vger.kernel.org" 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 sy.mirrors.kernel.org (Postfix) with ESMTPS id D148EB21948 for ; Thu, 25 Apr 2024 11:28:55 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6C2B912A16C; Thu, 25 Apr 2024 11:28:52 +0000 (UTC) X-Original-To: linux-wireless@vger.kernel.org Received: from rtits2.realtek.com.tw (rtits2.realtek.com [211.75.126.72]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0008983CCD for ; Thu, 25 Apr 2024 11:28:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=211.75.126.72 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714044532; cv=none; b=M3TChyyrtyM8r7v8KCRs+s9Sv9kEalUt1cPVfzXfM4ya+UsQcilvxwRlp8c4OleWOqNG3HOTjepvZz9Yzb/eTrpLZoWCgSy//ISoMHOr120Um2JgnczGIraXPTTQ8KYvqd/vMp3DjM3aO5QcSb0CL0QQAsXe5gczxWDY/2OY+MI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714044532; c=relaxed/simple; bh=WKXRFEY/FAdH6+wuPAxppGrfKMglAxG4tZ4jCJ/EY1M=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Pnv/93oZBVxyXLWjnq4F3XLs6iZk2l7mYI1FlgR5zVeO1jIi5cVwjs2XhRecvIsU6gWfc4hsmw1FpGdgbtem/DSK5R8ht6rG1x/bOaKjN0cruA/C/jtZRB+VJTCwpU58YJRnZ2m3fPoLtQszdx6EHKDCewulwSRb/sASqP0r+u8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=realtek.com; spf=pass smtp.mailfrom=realtek.com; arc=none smtp.client-ip=211.75.126.72 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=realtek.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=realtek.com X-SpamFilter-By: ArmorX SpamTrap 5.78 with qID 43PBSmGsA3482257, This message is accepted by code: ctloc85258 Received: from mail.realtek.com (rtexh36505.realtek.com.tw[172.21.6.25]) by rtits2.realtek.com.tw (8.15.2/2.95/5.92) with ESMTPS id 43PBSmGsA3482257 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 25 Apr 2024 19:28:48 +0800 Received: from RTEXMBS04.realtek.com.tw (172.21.6.97) by RTEXH36505.realtek.com.tw (172.21.6.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.35; Thu, 25 Apr 2024 19:28:48 +0800 Received: from [127.0.1.1] (172.16.16.129) by RTEXMBS04.realtek.com.tw (172.21.6.97) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.35; Thu, 25 Apr 2024 19:28:47 +0800 From: Ping-Ke Shih To: CC: , Subject: [PATCH 02/12] wifi: rtw89: wow: refine WoWLAN flows of HCI interrupts and low power mode Date: Thu, 25 Apr 2024 19:28:06 +0800 Message-ID: <20240425112816.26431-3-pkshih@realtek.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240425112816.26431-1-pkshih@realtek.com> References: <20240425112816.26431-1-pkshih@realtek.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 Content-Type: text/plain X-ClientProxiedBy: RTEXMBS02.realtek.com.tw (172.21.6.95) To RTEXMBS04.realtek.com.tw (172.21.6.97) X-KSE-ServerInfo: RTEXH36505.realtek.com.tw, 9 X-KSE-AntiSpam-Interceptor-Info: fallback X-KSE-Antivirus-Interceptor-Info: fallback X-KSE-AntiSpam-Interceptor-Info: fallback From: Chih-Kang Chang After enabling packet offload, the TX will be stuck after resume from WoWLAN mode. And the 8852c gets error messages like rtw89_8852ce 0000:04:00.0: No busy txwd pages available rtw89_8852ce 0000:04:00.0: queue 0 txwd 100 is not idle rtw89_8852ce 0000:04:00.0: queue 0 txwd 101 is not idle rtw89_8852ce 0000:04:00.0: queue 0 txwd 102 is not idle rtw89_8852ce 0000:04:00.0: queue 0 txwd 103 is not idle If suspend/resume many times that firmware will download failed and disconnection. To fix these issues, We removed the rtw89_hci_disable_intr() and rtw89_hci_enable_intr() during rtw89_wow_swap_fw() to prevent add packet offload can't receive c2h back due to interrupt disable. Only 8852C and 8922A needs to disable interrupt before downloading fw. Furthermore, we avoid using low power HCI mode on WoWLAN mode, to prevent interrupt enabled, then get interrupt and calculate RXBD mismatched due to software RXBD index already reset but hardware RXBD index not yet. Fixes: 5c12bb66b79d ("wifi: rtw89: refine packet offload flow") Signed-off-by: Chih-Kang Chang Signed-off-by: Ping-Ke Shih --- drivers/net/wireless/realtek/rtw89/ps.c | 3 ++- drivers/net/wireless/realtek/rtw89/wow.c | 12 ++++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/drivers/net/wireless/realtek/rtw89/ps.c b/drivers/net/wireless/realtek/rtw89/ps.c index 31290d8cb7f7..92074b73ebeb 100644 --- a/drivers/net/wireless/realtek/rtw89/ps.c +++ b/drivers/net/wireless/realtek/rtw89/ps.c @@ -55,7 +55,8 @@ static void rtw89_ps_power_mode_change_with_hci(struct rtw89_dev *rtwdev, static void rtw89_ps_power_mode_change(struct rtw89_dev *rtwdev, bool enter) { - if (rtwdev->chip->low_power_hci_modes & BIT(rtwdev->ps_mode)) + if (rtwdev->chip->low_power_hci_modes & BIT(rtwdev->ps_mode) && + !test_bit(RTW89_FLAG_WOWLAN, rtwdev->flags)) rtw89_ps_power_mode_change_with_hci(rtwdev, enter); else rtw89_mac_power_mode_change(rtwdev, enter); diff --git a/drivers/net/wireless/realtek/rtw89/wow.c b/drivers/net/wireless/realtek/rtw89/wow.c index f7e96fcbbaba..ea555f29442d 100644 --- a/drivers/net/wireless/realtek/rtw89/wow.c +++ b/drivers/net/wireless/realtek/rtw89/wow.c @@ -458,14 +458,17 @@ static int rtw89_wow_swap_fw(struct rtw89_dev *rtwdev, bool wow) struct rtw89_wow_param *rtw_wow = &rtwdev->wow; struct ieee80211_vif *wow_vif = rtw_wow->wow_vif; struct rtw89_vif *rtwvif = (struct rtw89_vif *)wow_vif->drv_priv; + enum rtw89_core_chip_id chip_id = rtwdev->chip->chip_id; const struct rtw89_chip_info *chip = rtwdev->chip; bool include_bb = !!chip->bbmcu_nr; + bool disable_intr_for_dlfw = false; struct ieee80211_sta *wow_sta; struct rtw89_sta *rtwsta = NULL; bool is_conn = true; int ret; - rtw89_hci_disable_intr(rtwdev); + if (chip_id == RTL8852C || chip_id == RTL8922A) + disable_intr_for_dlfw = true; wow_sta = ieee80211_find_sta(wow_vif, rtwvif->bssid); if (wow_sta) @@ -473,12 +476,18 @@ static int rtw89_wow_swap_fw(struct rtw89_dev *rtwdev, bool wow) else is_conn = false; + if (disable_intr_for_dlfw) + rtw89_hci_disable_intr(rtwdev); + ret = rtw89_fw_download(rtwdev, fw_type, include_bb); if (ret) { rtw89_warn(rtwdev, "download fw failed\n"); return ret; } + if (disable_intr_for_dlfw) + rtw89_hci_enable_intr(rtwdev); + rtw89_phy_init_rf_reg(rtwdev, true); ret = rtw89_fw_h2c_role_maintain(rtwdev, rtwvif, rtwsta, @@ -524,7 +533,6 @@ static int rtw89_wow_swap_fw(struct rtw89_dev *rtwdev, bool wow) rtw89_phy_rfk_pre_ntfy_and_wait(rtwdev, RTW89_PHY_0, 5); rtw89_mac_hw_mgnt_sec(rtwdev, wow); - rtw89_hci_enable_intr(rtwdev); return 0; } -- 2.25.1