lkml.org 
[lkml]   [2020]   [Feb]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 4.19 070/191] r8169: check that Realtek PHY driver module is loaded
    Date
    From: Heiner Kallweit <hkallweit1@gmail.com>

    [ 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>
    ---
    drivers/net/ethernet/realtek/r8169.c | 9 +++++++++
    1 file changed, 9 insertions(+)

    diff --git a/drivers/net/ethernet/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c
    index 4ab87fe845427..6ea43e48d5f97 100644
    --- a/drivers/net/ethernet/realtek/r8169.c
    +++ b/drivers/net/ethernet/realtek/r8169.c
    @@ -7433,6 +7433,15 @@ static int rtl_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
    int chipset, region, i;
    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;
    --
    2.20.1


    \
     
     \ /
      Last update: 2020-02-21 09:29    [W:8.833 / U:0.160 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site