mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Crag Wang <crag0715@gmail.com>
To: Heiner Kallweit <hkallweit1@gmail.com>,
	nic_swsd@realtek.com, Andrew Lunn <andrew+netdev@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>
Cc: crag.wang@dell.com, dell.client.kernel@dell.com,
	Crag Wang <crag0715@gmail.com>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 1/1] r8169: add module parameter aspm_en_force
Date: Mon, 24 Mar 2025 20:55:19 +0800	[thread overview]
Message-ID: <20250324125543.6723-1-crag0715@gmail.com> (raw)

ASPM is disabled by default and is enabled if the chip register is
pre-configured, as explained in #c217ab7.

A module parameter is being added to the driver to allow users to
override the default setting. This allows users to opt in and forcefully
enable or disable ASPM power-saving mode.

-1: default unset
 0: ASPM disabled forcefully
 1: ASPM enabled forcefully

Signed-off-by: Crag Wang <crag0715@gmail.com>
---
 drivers/net/ethernet/realtek/r8169_main.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/drivers/net/ethernet/realtek/r8169_main.c b/drivers/net/ethernet/realtek/r8169_main.c
index 53e541ddb439..161b2f2edf52 100644
--- a/drivers/net/ethernet/realtek/r8169_main.c
+++ b/drivers/net/ethernet/realtek/r8169_main.c
@@ -35,6 +35,10 @@
 #include "r8169.h"
 #include "r8169_firmware.h"
 
+static int aspm_en_force = -1;
+module_param(aspm_en_force, int, 0444);
+MODULE_PARM_DESC(aspm_en_force, "r8169: An integer, set 1 to force enable link ASPM");
+
 #define FIRMWARE_8168D_1	"rtl_nic/rtl8168d-1.fw"
 #define FIRMWARE_8168D_2	"rtl_nic/rtl8168d-2.fw"
 #define FIRMWARE_8168E_1	"rtl_nic/rtl8168e-1.fw"
@@ -5398,6 +5402,14 @@ static void rtl_init_mac_address(struct rtl8169_private *tp)
 /* register is set if system vendor successfully tested ASPM 1.2 */
 static bool rtl_aspm_is_safe(struct rtl8169_private *tp)
 {
+	if (aspm_en_force == 0) {
+		dev_info(tp_to_dev(tp), "ASPM disabled forcefully");
+		return false;
+	} else if (aspm_en_force > 0) {
+		dev_info(tp_to_dev(tp), "ASPM enabled forcefully");
+		return true;
+	}
+
 	if (tp->mac_version >= RTL_GIGA_MAC_VER_61 &&
 	    r8168_mac_ocp_read(tp, 0xc0b2) & 0xf)
 		return true;
-- 
2.43.0


             reply	other threads:[~2025-03-24 12:56 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-24 12:55 Crag Wang [this message]
2025-03-24 13:27 ` Heiner Kallweit
2025-04-21  8:20   ` Crag Wang
     [not found]   ` <CAP-8N0jAjeY8Wthta1yS8Hs57KKt6HyFWpYM6=q1t+jxF_sY1A@mail.gmail.com>
2025-04-21  8:45     ` Heiner Kallweit

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=20250324125543.6723-1-crag0715@gmail.com \
    --to=crag0715@gmail.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=crag.wang@dell.com \
    --cc=davem@davemloft.net \
    --cc=dell.client.kernel@dell.com \
    --cc=edumazet@google.com \
    --cc=hkallweit1@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=nic_swsd@realtek.com \
    --cc=pabeni@redhat.com \
    /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

all inboxes | Powered by JetHome®