Typically it helps to do a rmmod r8169 + modprobe r8169 to work around the BIOS 
bug.
Maybe also a PHY soft reset helps to make the PHY behave sanely again.
Can you test whether the following fixes the issue for you?

diff --git a/drivers/net/ethernet/realtek/r8169_main.c 
b/drivers/net/ethernet/realtek/r8169_main.c
index 8b665f2ec..9b1ad5d45 100644
--- a/drivers/net/ethernet/realtek/r8169_main.c
+++ b/drivers/net/ethernet/realtek/r8169_main.c
@@ -5104,6 +5104,17 @@ static int r8169_mdio_write_reg(struct mii_bus *mii_bus, 
int phyaddr,
        return 0;
 }
 
+static void rtl_phy_soft_reset(struct rtl8169_private *tp)
+{
+       int i = 30;
+
+       rtl_writephy(tp, MII_BMCR, BMCR_ANENABLE | BMCR_RESET);
+
+       do {
+               msleep(20);
+       } while (rtl_readphy(tp, MII_BMCR) & BMCR_RESET && --i);
+}
+
 static int r8169_mdio_register(struct rtl8169_private *tp)
 {
        struct pci_dev *pdev = tp->pci_dev;
@@ -5123,6 +5134,11 @@ static int r8169_mdio_register(struct rtl8169_private 
*tp)
        new_bus->read = r8169_mdio_read_reg;
        new_bus->write = r8169_mdio_write_reg;
 
+       /* A BIOS bug causes few boards to report an invalid PHY ID otherwise */
+       if (tp->mac_version == RTL_GIGA_MAC_VER_25 ||
+           tp->mac_version == RTL_GIGA_MAC_VER_26)
+               rtl_phy_soft_reset(tp);
+
        ret = devm_mdiobus_register(new_bus);
        if (ret)
                return ret;
-- 
2.26.2

-- 
You received this bug notification because you are a member of Kernel
Packages, which is subscribed to linux-signed in Ubuntu.
https://bugs.launchpad.net/bugs/1876593

Title:
  Ethernet not working/Realtek RTL8169 fails to load

Status in linux-signed package in Ubuntu:
  New

Bug description:
  With the latest kernels on Ubuntu 20.04 LTS, my onboard Ethernet has
  stopped working.

  Last known good kernel: Ubuntu 5.4.0-21.25-generic 5.4.27
  Current (bad) kernel: Ubuntu 5.4.0-28.32-generic 5.4.30

  Ethernet controller:

  03:00.0 Ethernet controller [0200]: Realtek Semiconductor Co., Ltd.
  RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller [10ec:8168]
  (rev 03)

  Select lines from dmesg with bad kernel:

  [    1.479172] r8169 0000:03:00.0: realtek.ko not loaded, maybe it needs to 
be added to initramfs?
  [    1.498143] r8169: probe of 0000:03:00.0 failed with error -49

  With good kernel:

  [    1.472510] r8169 0000:03:00.0 eth0: RTL8168d/8111d, 6c:f0:49:e7:de:a3, 
XID 283, IRQ 35
  [    1.472511] r8169 0000:03:00.0 eth0: jumbo features [frames: 9200 bytes, 
tx checksumming: ko]
  [    8.430734] r8169 0000:03:00.0 eth0: Link is Down
  [    9.241421] r8169 0000:03:00.0 eth0: Link is Up - 100Mbps/Full - flow 
control off

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/linux-signed/+bug/1876593/+subscriptions

-- 
Mailing list: https://launchpad.net/~kernel-packages
Post to     : kernel-packages@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kernel-packages
More help   : https://help.launchpad.net/ListHelp

Reply via email to