Skip to contentSkip to conversation

rtlwifi:rtl_watchdog_wq_callback: fix calling rtl_lps_enter|rtl_lps_leave in opposite condition

PATCH NAK Wang YanQing 2 participants 2 messages May 2, 2016

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 rtlwifi:rtl_watchdog_wq_callback: fix calling rtl_lps_enter|rtl_lps_leave in opposite condition

Commit a269913c52ad37952a4d9953bb6d748f7299c304
("rtlwifi: Rework rtl_lps_leave() and rtl_lps_enter() to use work queue") make a mistake, change the meaning of num_tx|rx_inperiod comparison test.

Commit fd09ff958777cf583d7541f180991c0fc50bd2f7 ("rtlwifi: Remove extra workqueue for enter/leave power state") follow previous mistake, bring us to current code.

This patch fix it.

---
I think this patch should be ported back to stable kernels, 3.10+. In my machine, I will lost wifi connection after minutes if I enable fwlps.

 drivers/net/wireless/realtek/rtlwifi/base.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/wireless/realtek/rtlwifi/base.c +2 -2
index c74eb13..264466f 100644
@@ -1660,9 +1660,9 @@ void rtl_watchdog_wq_callback(void *data)
 		if (((rtlpriv->link_info.num_rx_inperiod +
 		      rtlpriv->link_info.num_tx_inperiod) > 8) ||
 		    (rtlpriv->link_info.num_rx_inperiod > 2))
-			rtl_lps_enter(hw);
-		else
 			rtl_lps_leave(hw);
+		else
+			rtl_lps_enter(hw);
 	}
 
 	rtlpriv->link_info.num_rx_inperiod = 0;
Signature · 5 lines
1.8.5.6.2.g3d8a54e.dirty
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#1 lore raw
Quoted 26 lines · Wang YanQing

Commit a269913c52ad37952a4d9953bb6d748f7299c304
("rtlwifi: Rework rtl_lps_leave() and rtl_lps_enter() to use work queue") make a mistake, change the meaning of num_tx|rx_inperiod comparison test.

Commit fd09ff958777cf583d7541f180991c0fc50bd2f7 ("rtlwifi: Remove extra workqueue for enter/leave power state") follow previous mistake, bring us to current code.

This patch fix it.

---
I think this patch should be ported back to stable kernels, 3.10+. In my machine, I will lost wifi connection after minutes if I enable fwlps.

  drivers/net/wireless/realtek/rtlwifi/base.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/wireless/realtek/rtlwifi/base.c +0 -0
index c74eb13..264466f 100644
@@ -1660,9 +1660,9 @@ void rtl_watchdog_wq_callback(void *data)
  		if (((rtlpriv->link_info.num_rx_inperiod +

drivers/net/wireless/realtek/rtlwifi/base.c void rtl_watchdog_wq_callback(void *data) · line 1668

Quoted 10 lines
drivers/net/wireless/realtek/rtlwifi/base.c +2 -2
  		      rtlpriv->link_info.num_tx_inperiod) > 8) ||
  		    (rtlpriv->link_info.num_rx_inperiod > 2))
-			rtl_lps_enter(hw);
-		else
  			rtl_lps_leave(hw);
+		else
+			rtl_lps_enter(hw);
  	}
 
  	rtlpriv->link_info.num_rx_inperiod = 0;

NACK

This patch is correct. There is a logic error in entering/exiting power-save mode. Thus the code part is OK; however, the subject and commit message need to be improved. If I had prepared this patch, my subject would have been "rtlwifi: Fix logic error in enter/exit power-save mode". For the commit message, I would have used the following:

In commit fd09ff958777 ("rtlwifi: Remove extra workqueue for enter/leave power state"), the tests for enter/exit power-save mode were inverted. With this change applied, the wifi connection becomes much more stable.

Fixes fd09ff958777 ("rtlwifi: Remove extra workqueue for enter/leave power state")
CC Stable <[email protected]> [3.10+]

---

Thanks for finding this problem.

Larry