linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: <yhchuang@realtek.com>
To: <kvalo@codeaurora.org>
Cc: <linux-wireless@vger.kernel.org>, <briannorris@chromium.org>,
	<g.schlmm@googlemail.com>
Subject: [PATCH 3/6] rtw88: use a module parameter to control LPS enter
Date: Fri, 25 Oct 2019 17:33:42 +0800	[thread overview]
Message-ID: <20191025093345.22643-4-yhchuang@realtek.com> (raw)
In-Reply-To: <20191025093345.22643-1-yhchuang@realtek.com>

From: Yan-Hsuan Chuang <yhchuang@realtek.com>

If the number of packets is less than the LPS threshold, driver
can then enter LPS mode.
And driver used to take RTW_LPS_THRESHOLD as the threshold. As
the macro can not be changed after compiled, use a parameter
instead.

The larger of the threshold, the more traffic required to leave
power save mode, responsive time could be longer, but also the
power consumption could be lower.

Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
---
 drivers/net/wireless/realtek/rtw88/main.c | 7 +++++--
 drivers/net/wireless/realtek/rtw88/ps.h   | 2 --
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/net/wireless/realtek/rtw88/main.c b/drivers/net/wireless/realtek/rtw88/main.c
index 7c1b89c4fb6c..bff8a0b129d9 100644
--- a/drivers/net/wireless/realtek/rtw88/main.c
+++ b/drivers/net/wireless/realtek/rtw88/main.c
@@ -16,16 +16,19 @@
 #include "debug.h"
 #include "bf.h"
 
+unsigned int rtw_lps_threshold = 2;
 unsigned int rtw_fw_lps_deep_mode;
 EXPORT_SYMBOL(rtw_fw_lps_deep_mode);
 bool rtw_bf_support = true;
 unsigned int rtw_debug_mask;
 EXPORT_SYMBOL(rtw_debug_mask);
 
+module_param_named(lps_threshold, rtw_lps_threshold, uint, 0644);
 module_param_named(lps_deep_mode, rtw_fw_lps_deep_mode, uint, 0644);
 module_param_named(support_bf, rtw_bf_support, bool, 0644);
 module_param_named(debug_mask, rtw_debug_mask, uint, 0644);
 
+MODULE_PARM_DESC(lps_threshold, "Threshold of number of packets in every 2 seconds");
 MODULE_PARM_DESC(lps_deep_mode, "Deeper PS mode. If 0, deep PS is disabled");
 MODULE_PARM_DESC(support_bf, "Set Y to enable beamformee support");
 MODULE_PARM_DESC(debug_mask, "Debugging mask");
@@ -199,8 +202,8 @@ static void rtw_watch_dog_work(struct work_struct *work)
 	if (busy_traffic != test_bit(RTW_FLAG_BUSY_TRAFFIC, rtwdev->flags))
 		rtw_coex_wl_status_change_notify(rtwdev);
 
-	if (stats->tx_cnt > RTW_LPS_THRESHOLD ||
-	    stats->rx_cnt > RTW_LPS_THRESHOLD)
+	if (stats->tx_cnt > rtw_lps_threshold ||
+	    stats->rx_cnt > rtw_lps_threshold)
 		ps_active = true;
 	else
 		ps_active = false;
diff --git a/drivers/net/wireless/realtek/rtw88/ps.h b/drivers/net/wireless/realtek/rtw88/ps.h
index 25925eedbad4..fe43f8d96d04 100644
--- a/drivers/net/wireless/realtek/rtw88/ps.h
+++ b/drivers/net/wireless/realtek/rtw88/ps.h
@@ -5,8 +5,6 @@
 #ifndef __RTW_PS_H_
 #define __RTW_PS_H_
 
-#define RTW_LPS_THRESHOLD	2
-
 #define POWER_MODE_ACK		BIT(6)
 #define POWER_MODE_PG		BIT(4)
 #define POWER_MODE_LCLK		BIT(0)
-- 
2.17.1


  parent reply	other threads:[~2019-10-25  9:33 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-25  9:33 [PATCH 0/6] rtw88: minor driver updates yhchuang
2019-10-25  9:33 ` [PATCH 1/6] rtw88: 8822b: add RFE type 3 support yhchuang
2019-10-31  8:04   ` Kalle Valo
2019-10-25  9:33 ` [PATCH 2/6] rtw88: use rtw_phy_pg_cfg_pair struct, not arrays yhchuang
2019-10-25  9:33 ` yhchuang [this message]
2019-10-25 10:51   ` [PATCH 3/6] rtw88: use a module parameter to control LPS enter Chris Chiu
2019-10-28  3:12     ` Tony Chuang
2019-10-29  4:01       ` Chris Chiu
2019-10-31  7:59   ` Kalle Valo
     [not found]   ` <20191031075911.3CCB86079C@smtp.codeaurora.org>
2019-10-31  8:17     ` Tony Chuang
2019-10-31 20:01       ` Brian Norris
2019-11-01  3:13         ` Tony Chuang
2019-11-01  8:35           ` Kalle Valo
2019-11-01  8:30       ` Kalle Valo
2019-10-25  9:33 ` [PATCH 4/6] rtw88: rearrange if..else statements for rx rate indexes yhchuang
2019-10-25  9:33 ` [PATCH 5/6] rtw88: fix potential read outside array boundary yhchuang
2019-10-25  9:33 ` [PATCH 6/6] rtw88: avoid FW info flood yhchuang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191025093345.22643-4-yhchuang@realtek.com \
    --to=yhchuang@realtek.com \
    --cc=briannorris@chromium.org \
    --cc=g.schlmm@googlemail.com \
    --cc=kvalo@codeaurora.org \
    --cc=linux-wireless@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).