Re: [PATCH] r8169: Reinstate ALDPS and ASPM support

From: Kai-Heng Feng
Date: Wed Jun 06 2018 - 02:48:48 EST


at 22:11, Andrew Lunn <andrew@xxxxxxx> wrote:

On Tue, Jun 05, 2018 at 12:58:12PM +0800, Kai-Heng Feng wrote:
This patch reinstate ALDPS and ASPM support on r8169.

On some Intel platforms, ASPM support on r8169 is the key factor to let
Package C-State achieve PC8. Without ASPM support, the deepest Package
C-State can hit is PC3. PC8 can save additional ~3W in comparison with
PC3.

This patch is from Realtek.

Fixes: e0c075577965 ("r8169: enable ALDPS for power saving")
Fixes: d64ec841517a ("r8169: enable internal ASPM and clock request settings")

Cc: Ryankao <ryankao@xxxxxxxxxxx>
Signed-off-by: Kai-Heng Feng <kai.heng.feng@xxxxxxxxxxxxx>
---
drivers/net/ethernet/realtek/r8169.c | 190 +++++++++++++++++++++------
1 file changed, 151 insertions(+), 39 deletions(-)

diff --git a/drivers/net/ethernet/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c
index 75dfac0248f4..a28ef20be221 100644
--- a/drivers/net/ethernet/realtek/r8169.c
+++ b/drivers/net/ethernet/realtek/r8169.c
@@ -319,6 +319,8 @@ static const struct pci_device_id rtl8169_pci_tbl[] = {

MODULE_DEVICE_TABLE(pci, rtl8169_pci_tbl);

+static int enable_aspm = 1;
+static int enable_aldps = 1;
static int use_dac = -1;
static struct {
u32 msg_enable;
@@ -817,6 +819,10 @@ struct rtl8169_private {

MODULE_AUTHOR("Realtek and the Linux r8169 crew <netdev@xxxxxxxxxxxxxxx>");
MODULE_DESCRIPTION("RealTek RTL-8169 Gigabit Ethernet driver");
+module_param(enable_aspm, int, 0);
+MODULE_PARM_DESC(enable_aspm, "Enable ASPM");
+module_param(enable_aldps, int, 0);
+MODULE_PARM_DESC(enable_aldps, "Enable ALDPS");

Hi Kai

No module parameter please. Just turn it on by default. Assuming
testing shows works.

Hi Andrew,

Sure.

Do you think we should also strip out the enable/disable logic?

Or just remove the parameter?

Kai-Heng


Andrew