wifi: rtw89: fix power save function in WoWLAN mode
authorChih-Kang Chang <gary.chang@realtek.com>
Mon, 10 Apr 2023 05:34:38 +0000 (13:34 +0800)
committerKalle Valo <kvalo@kernel.org>
Mon, 17 Apr 2023 09:47:48 +0000 (12:47 +0300)
In WoWLAN Mode, it's expected that WiFi chip could enter power save mode
only after all setting is finished, but current wow_enter_lps function
break the rule and may lead to WoWLAN function fail in low probability,
so fix it.

Signed-off-by: Chih-Kang Chang <gary.chang@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230410053438.10682-2-pkshih@realtek.com
drivers/net/wireless/realtek/rtw89/core.c
drivers/net/wireless/realtek/rtw89/ps.c
drivers/net/wireless/realtek/rtw89/ps.h
drivers/net/wireless/realtek/rtw89/wow.c

index d144903..8459a7b 100644 (file)
@@ -2503,7 +2503,7 @@ static void rtw89_vif_enter_lps(struct rtw89_dev *rtwdev, struct rtw89_vif *rtwv
 
        if (rtwvif->stats.tx_tfc_lv == RTW89_TFC_IDLE &&
            rtwvif->stats.rx_tfc_lv == RTW89_TFC_IDLE)
-               rtw89_enter_lps(rtwdev, rtwvif);
+               rtw89_enter_lps(rtwdev, rtwvif, true);
 }
 
 static void rtw89_enter_lps_track(struct rtw89_dev *rtwdev)
index cf72861..fa94335 100644 (file)
@@ -114,7 +114,8 @@ void rtw89_leave_ps_mode(struct rtw89_dev *rtwdev)
        __rtw89_leave_ps_mode(rtwdev);
 }
 
-void rtw89_enter_lps(struct rtw89_dev *rtwdev, struct rtw89_vif *rtwvif)
+void rtw89_enter_lps(struct rtw89_dev *rtwdev, struct rtw89_vif *rtwvif,
+                    bool ps_mode)
 {
        lockdep_assert_held(&rtwdev->mutex);
 
@@ -122,7 +123,8 @@ void rtw89_enter_lps(struct rtw89_dev *rtwdev, struct rtw89_vif *rtwvif)
                return;
 
        __rtw89_enter_lps(rtwdev, rtwvif->mac_id);
-       __rtw89_enter_ps_mode(rtwdev, rtwvif);
+       if (ps_mode)
+               __rtw89_enter_ps_mode(rtwdev, rtwvif);
 }
 
 static void rtw89_leave_lps_vif(struct rtw89_dev *rtwdev, struct rtw89_vif *rtwvif)
index c9e29d9..73c008d 100644 (file)
@@ -5,7 +5,8 @@
 #ifndef __RTW89_PS_H_
 #define __RTW89_PS_H_
 
-void rtw89_enter_lps(struct rtw89_dev *rtwdev, struct rtw89_vif *rtwvif);
+void rtw89_enter_lps(struct rtw89_dev *rtwdev, struct rtw89_vif *rtwvif,
+                    bool ps_mode);
 void rtw89_leave_lps(struct rtw89_dev *rtwdev);
 void __rtw89_leave_ps_mode(struct rtw89_dev *rtwdev);
 void __rtw89_enter_ps_mode(struct rtw89_dev *rtwdev, struct rtw89_vif *rtwvif);
index 7cff9c1..2ca8abb 100644 (file)
@@ -30,7 +30,7 @@ static void rtw89_wow_enter_lps(struct rtw89_dev *rtwdev)
        struct ieee80211_vif *wow_vif = rtwdev->wow.wow_vif;
        struct rtw89_vif *rtwvif = (struct rtw89_vif *)wow_vif->drv_priv;
 
-       rtw89_enter_lps(rtwdev, rtwvif);
+       rtw89_enter_lps(rtwdev, rtwvif, false);
 }
 
 static void rtw89_wow_leave_lps(struct rtw89_dev *rtwdev)