lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230105180408.2998-1-hau@realtek.com>
Date:   Fri, 6 Jan 2023 02:04:08 +0800
From:   Chunhao Lin <hau@...ltek.com>
To:     <hkallweit1@...il.com>
CC:     <netdev@...r.kernel.org>, <nic_swsd@...ltek.com>,
        Chunhao Lin <hau@...ltek.com>
Subject: [PATCH net] r8169: fix rtl8168h wol fail

rtl8168h has an application that it will connect to rtl8211fs through mdi
interface. And rtl8211fs will connect to fiber through serdes interface.
In this application, rtl8168h revision id will be set to 0x2a.

Because rtl8211fs's firmware will set link capability to 100M and GIGA
when link is from off to on. So when system suspend and wol is enabled,
rtl8168h will speed down to 100M (because rtl8211fs advertise 100M and GIGA
to rtl8168h). If the link speed between rtl81211fs and fiber is GIGA.
The link speed between rtl8168h and fiber will mismatch. That will cause
wol fail.

In this patch, if rtl8168h is in this kind of application, driver will not
speed down phy when wol is enabled.

Signed-off-by: Chunhao Lin <hau@...ltek.com>
---
 drivers/net/ethernet/realtek/r8169_main.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/realtek/r8169_main.c b/drivers/net/ethernet/realtek/r8169_main.c
index 24592d972523..83d017369ae7 100644
--- a/drivers/net/ethernet/realtek/r8169_main.c
+++ b/drivers/net/ethernet/realtek/r8169_main.c
@@ -1199,6 +1199,12 @@ static enum rtl_dash_type rtl_check_dash(struct rtl8169_private *tp)
 	}
 }
 
+static bool rtl_mdi_connect_to_phy(struct rtl8169_private *tp)
+{
+	return tp->mac_version == RTL_GIGA_MAC_VER_46 &&
+		tp->pci_dev->revision == 0x2a;
+}
+
 static void rtl_set_d3_pll_down(struct rtl8169_private *tp, bool enable)
 {
 	switch (tp->mac_version) {
@@ -2453,7 +2459,8 @@ static void rtl_prepare_power_down(struct rtl8169_private *tp)
 		rtl_ephy_write(tp, 0x19, 0xff64);
 
 	if (device_may_wakeup(tp_to_dev(tp))) {
-		phy_speed_down(tp->phydev, false);
+		if (!rtl_mdi_connect_to_phy(tp))
+			phy_speed_down(tp->phydev, false);
 		rtl_wol_enable_rx(tp);
 	}
 }
-- 
2.39.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ