Blame SOURCES/0027-rtw89-coex-Not-to-send-H2C-when-WL-not-ready-and-cou.patch

56e3f4
From da03f6e3ed4f6dc74b3f0be2c7f959cea5af6c55 Mon Sep 17 00:00:00 2001
56e3f4
From: =?UTF-8?q?=C3=8D=C3=B1igo=20Huguet?= <ihuguet@redhat.com>
56e3f4
Date: Fri, 21 Jan 2022 08:49:04 +0100
56e3f4
Subject: [PATCH 27/36] rtw89: coex: Not to send H2C when WL not ready and
56e3f4
 count H2C
56e3f4
MIME-Version: 1.0
56e3f4
Content-Type: text/plain; charset=UTF-8
56e3f4
Content-Transfer-Encoding: 8bit
56e3f4
56e3f4
Bugzilla: http://bugzilla.redhat.com/2033291
56e3f4
56e3f4
commit f8028a9a92f2b8653658f2ad9cc1fb849873ba5a
56e3f4
Author: Ching-Te Ku <ku920601@realtek.com>
56e3f4
Date:   Thu Dec 9 16:32:24 2021 +0800
56e3f4
56e3f4
    rtw89: coex: Not to send H2C when WL not ready and count H2C
56e3f4
56e3f4
    Prevent to send H2C request to FW when BTC is not initialized or
56e3f4
    WL is under power saving. Add counter to count the H2C success or fail.
56e3f4
56e3f4
    Signed-off-by: Ching-Te Ku <ku920601@realtek.com>
56e3f4
    Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
56e3f4
    Signed-off-by: Kalle Valo <kvalo@kernel.org>
56e3f4
    Link: https://lore.kernel.org/r/20211209083229.10815-3-pkshih@realtek.com
56e3f4
56e3f4
Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
56e3f4
---
56e3f4
 drivers/net/wireless/realtek/rtw89/coex.c | 27 +++++++++++++++++++++++++--
56e3f4
 1 file changed, 25 insertions(+), 2 deletions(-)
56e3f4
56e3f4
diff --git a/drivers/net/wireless/realtek/rtw89/coex.c b/drivers/net/wireless/realtek/rtw89/coex.c
56e3f4
index f220229a7a48..c8f912e7344d 100644
56e3f4
--- a/drivers/net/wireless/realtek/rtw89/coex.c
56e3f4
+++ b/drivers/net/wireless/realtek/rtw89/coex.c
56e3f4
@@ -540,8 +540,31 @@ static void _update_bt_scbd(struct rtw89_dev *rtwdev, bool only_update);
56e3f4
 static void _send_fw_cmd(struct rtw89_dev *rtwdev, u8 h2c_class, u8 h2c_func,
56e3f4
 			 void *param, u16 len)
56e3f4
 {
56e3f4
-	rtw89_fw_h2c_raw_with_hdr(rtwdev, h2c_class, h2c_func, param, len,
56e3f4
-				  false, true);
56e3f4
+	struct rtw89_btc *btc = &rtwdev->btc;
56e3f4
+	struct rtw89_btc_btf_fwinfo *pfwinfo = &btc->fwinfo;
56e3f4
+	struct rtw89_btc_cx *cx = &btc->cx;
56e3f4
+	struct rtw89_btc_wl_info *wl = &cx->wl;
56e3f4
+	int ret;
56e3f4
+
56e3f4
+	if (!wl->status.map.init_ok) {
56e3f4
+		rtw89_debug(rtwdev, RTW89_DBG_BTC,
56e3f4
+			    "[BTC], %s(): return by btc not init!!\n", __func__);
56e3f4
+		pfwinfo->cnt_h2c_fail++;
56e3f4
+		return;
56e3f4
+	} else if ((wl->status.map.rf_off_pre == 1 && wl->status.map.rf_off == 1) ||
56e3f4
+		   (wl->status.map.lps_pre == 1 && wl->status.map.lps == 1)) {
56e3f4
+		rtw89_debug(rtwdev, RTW89_DBG_BTC,
56e3f4
+			    "[BTC], %s(): return by wl off!!\n", __func__);
56e3f4
+		pfwinfo->cnt_h2c_fail++;
56e3f4
+		return;
56e3f4
+	}
56e3f4
+
56e3f4
+	pfwinfo->cnt_h2c++;
56e3f4
+
56e3f4
+	ret = rtw89_fw_h2c_raw_with_hdr(rtwdev, h2c_class, h2c_func, param, len,
56e3f4
+					false, true);
56e3f4
+	if (ret != 0)
56e3f4
+		pfwinfo->cnt_h2c_fail++;
56e3f4
 }
56e3f4
 
56e3f4
 static void _reset_btc_var(struct rtw89_dev *rtwdev, u8 type)
56e3f4
-- 
56e3f4
2.13.6
56e3f4