Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp4048288ybg; Fri, 25 Oct 2019 12:34:04 -0700 (PDT) X-Google-Smtp-Source: APXvYqzZ1TETPogK7WfpCVhzWu8608TAchnSgVPZH5s2TSPnFBy/PtYkv1bMTgBg1xFgyc17uycK X-Received: by 2002:a50:950a:: with SMTP id u10mr5973335eda.68.1572032044733; Fri, 25 Oct 2019 12:34:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572032044; cv=none; d=google.com; s=arc-20160816; b=CkFq2Lh8LnzG7MozspW1/9e5OsvyhjtMfgRMC0pa/TUzyFJhdhjG7wcaxO5qJgijWc TYBOl2PEM6S39k2jbXtd0s8sbhgfrXOp2f+vW3MaF5iwpgH7uusG1hsa/qGdnrVnrZxs 99U2SBTfoOHarLjlDpiJAA9i14mmxBkiFrpkGBPMQprPHshc0pmP5Y5xfM2ZXOvKv0fS iORG3ODFjXlpNWT67Jv+ZhPiJ5YAaYu5JKG5FOUVDMAPnQCt0K8rVGtvUPWGGU3eEPU1 as/kz00wTlPAkpPrqv1OOluYTg567BYVehpPvSe2yOYpU1KdMS+oSOmOFuYfH/JEHwMj D7aw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:authenticated-by; bh=FqJzn/SJUWrCswckDKHHwi3DjX+mLL5z8yJ5gbYk8Gk=; b=WiBo1sH8EmkAsTSE2WjJo+0lz+cJGYl+a1J6xJLHWKjVEKL0x1qrDrNjAyvpJnNRsn rx4DTr0efAa9hm3HKcHA0PS2zHYxh8IkCiDvUmzH7oIL8WvY980DC2jkRngoHPtNi6/y 8qDq5NhSU+LlJpVF418Mm1DDDQWOnY0YH1YI9PV2VdPO8f0AqyPI0yOysolfAa4WYOQb Zh0iSetKhAZQ5TUfbDl/DxR9u5DGfRqKUc9dMJN9aGwkI1V/f8e1PmMo5tDBXtTwNU/H g5Xq9Ma75ZUJWGlkyC59trF3iglOqUE9nMv1mz0qY9azDmrFtp5CgzBL7Ai56Rr2RuFZ 2mwg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n9si1774061ejk.158.2019.10.25.12.33.40; Fri, 25 Oct 2019 12:34:04 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730202AbfJYJd5 (ORCPT + 99 others); Fri, 25 Oct 2019 05:33:57 -0400 Received: from rtits2.realtek.com ([211.75.126.72]:50464 "EHLO rtits2.realtek.com.tw" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729612AbfJYJd4 (ORCPT ); Fri, 25 Oct 2019 05:33:56 -0400 Authenticated-By: X-SpamFilter-By: BOX Solutions SpamTrap 5.62 with qID x9P9XnOi026479, This message is accepted by code: ctloc85258 Received: from mail.realtek.com (RTITCASV01.realtek.com.tw[172.21.6.18]) by rtits2.realtek.com.tw (8.15.2/2.57/5.78) with ESMTPS id x9P9XnOi026479 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Fri, 25 Oct 2019 17:33:49 +0800 Received: from localhost.localdomain (172.21.68.126) by RTITCASV01.realtek.com.tw (172.21.6.18) with Microsoft SMTP Server id 14.3.468.0; Fri, 25 Oct 2019 17:33:49 +0800 From: To: CC: , , Subject: [PATCH 3/6] rtw88: use a module parameter to control LPS enter Date: Fri, 25 Oct 2019 17:33:42 +0800 Message-ID: <20191025093345.22643-4-yhchuang@realtek.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191025093345.22643-1-yhchuang@realtek.com> References: <20191025093345.22643-1-yhchuang@realtek.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [172.21.68.126] Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Yan-Hsuan Chuang 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 --- 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