]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/commitdiff
r8169: check that Realtek PHY driver module is loaded
authorHeiner Kallweit <hkallweit1@gmail.com>
Fri, 13 Dec 2019 15:53:37 +0000 (16:53 +0100)
committerPaolo Pisati <paolo.pisati@canonical.com>
Mon, 24 Feb 2020 15:19:44 +0000 (16:19 +0100)
BugLink: https://bugs.launchpad.net/bugs/1864488
[ Upstream commit f325937735498afb054a0195291bbf68d0b60be5 ]

Some users complained about problems with r8169 and it turned out that
the generic PHY driver was used instead instead of the dedicated one.
In all cases reason was that r8169.ko was in initramfs, but realtek.ko
not. Manually adding realtek.ko to initramfs fixed the issues.
Root cause seems to be that tools like dracut and genkernel don't
consider softdeps. Add a check for loaded Realtek PHY driver module
and provide the user with a hint if it's not loaded.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
drivers/net/ethernet/realtek/r8169_main.c

index 5ae0b5663d540528c1719b2f1e31f7b4fe3f3e4e..a2cef6a004e730a46f430e5ab75b127bba53d6dd 100644 (file)
@@ -7064,6 +7064,15 @@ static int rtl_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
        int chipset, region;
        int jumbo_max, rc;
 
+       /* Some tools for creating an initramfs don't consider softdeps, then
+        * r8169.ko may be in initramfs, but realtek.ko not. Then the generic
+        * PHY driver is used that doesn't work with most chip versions.
+        */
+       if (!driver_find("RTL8201CP Ethernet", &mdio_bus_type)) {
+               dev_err(&pdev->dev, "realtek.ko not loaded, maybe it needs to be added to initramfs?\n");
+               return -ENOENT;
+       }
+
        dev = devm_alloc_etherdev(&pdev->dev, sizeof (*tp));
        if (!dev)
                return -ENOMEM;