All of lore.kernel.org
 help / color / mirror / Atom feed
From: "René Rebe" <rene@exactco.de>
To: netdev@vger.kernel.org
Cc: Heiner Kallweit <hkallweit1@gmail.com>, nic_swsd@realtek.com
Subject: [PATCH] r8169: fix RTL8117 Wake-on-Lan in DASH mode
Date: Mon, 01 Dec 2025 20:17:06 +0100 (CET)	[thread overview]
Message-ID: <20251201.201706.660956838646693149.rene@exactco.de> (raw)

Wake-on-Lan does currently not work in DASH mode, e.g. the ASUS Pro WS
X570-ACE with RTL8168fp/RTL8117.

Fix by not returning early in rtl_prepare_power_down when dash_enabled.
While this fixes WOL, it still kills the OOB RTL8117 remote management
BMC connection. Fix by not calling rtl8168_driver_stop if wol is enabled.

While at it, enable wake on magic packet by default, like most other
Linux drivers do.

Signed-off-by: René Rebe <rene@exactco.de>
---

There is still another issue that should be fixed: the dirver init
kills the OOB BMC connection until if up, too. We also should probaly
not even conditionalize rtl8168_driver_stop on wol_enabled as the BMC
should always be accessible. IMHO even on module unload.

---
 drivers/net/ethernet/realtek/r8169_main.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/realtek/r8169_main.c b/drivers/net/ethernet/realtek/r8169_main.c
index 853aabedb128..e2f9b9027fe2 100644
--- a/drivers/net/ethernet/realtek/r8169_main.c
+++ b/drivers/net/ethernet/realtek/r8169_main.c
@@ -2669,9 +2669,6 @@ static void rtl_wol_enable_rx(struct rtl8169_private *tp)
 
 static void rtl_prepare_power_down(struct rtl8169_private *tp)
 {
-	if (tp->dash_enabled)
-		return;
-
 	if (tp->mac_version == RTL_GIGA_MAC_VER_32 ||
 	    tp->mac_version == RTL_GIGA_MAC_VER_33)
 		rtl_ephy_write(tp, 0x19, 0xff64);
@@ -4807,7 +4804,7 @@ static void rtl8169_down(struct rtl8169_private *tp)
 	rtl_disable_exit_l1(tp);
 	rtl_prepare_power_down(tp);
 
-	if (tp->dash_type != RTL_DASH_NONE)
+	if (tp->dash_type != RTL_DASH_NONE && !tp->saved_wolopts)
 		rtl8168_driver_stop(tp);
 }
 
@@ -5406,6 +5403,7 @@ static int rtl_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
 	tp->pci_dev = pdev;
 	tp->supports_gmii = ent->driver_data == RTL_CFG_NO_GBIT ? 0 : 1;
 	tp->ocp_base = OCP_STD_PHY_BASE;
+	tp->saved_wolopts = WAKE_MAGIC;
 
 	raw_spin_lock_init(&tp->mac_ocp_lock);
 	mutex_init(&tp->led_lock);
@@ -5565,6 +5563,9 @@ static int rtl_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
 	if (rc)
 		return rc;
 
+	if (tp->saved_wolopts)
+		__rtl8169_set_wol(tp, tp->saved_wolopts);
+
 	rc = register_netdev(dev);
 	if (rc)
 		return rc;
-- 
2.46.0

-- 
René Rebe, ExactCODE GmbH, Berlin, Germany
https://exactco.dehttps://t2linux.comhttps://patreon.com/renerebe

             reply	other threads:[~2025-12-01 19:17 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-01 19:17 René Rebe [this message]
2025-12-01 20:15 ` [PATCH] r8169: fix RTL8117 Wake-on-Lan in DASH mode Heiner Kallweit
2025-12-01 20:31   ` René Rebe
2025-12-01 21:12     ` Heiner Kallweit
2025-12-01 23:26       ` René Rebe
2025-12-02  7:07         ` Heiner Kallweit
2025-12-02 13:46           ` René Rebe
2025-12-02 15:52             ` Andrew Lunn
2025-12-02 15:56               ` René Rebe
2025-12-02 17:04                 ` Heiner Kallweit
2025-12-02 17:23                   ` René Rebe
2025-12-02 15:41 ` Andrew Lunn
2025-12-02 15:47   ` René Rebe

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=20251201.201706.660956838646693149.rene@exactco.de \
    --to=rene@exactco.de \
    --cc=hkallweit1@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=nic_swsd@realtek.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.