From patchwork Fri Jun 18 03:44:08 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Koba Ko X-Patchwork-Id: 1494022 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4G5lCs2Q43z9s5R; Fri, 18 Jun 2021 13:44:24 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1lu5QZ-0005PZ-N6; Fri, 18 Jun 2021 03:44:19 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1lu5QX-0005PL-98 for kernel-team@lists.ubuntu.com; Fri, 18 Jun 2021 03:44:17 +0000 Received: from mail-pg1-f199.google.com ([209.85.215.199]) by youngberry.canonical.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.93) (envelope-from ) id 1lu5QX-0006VC-0s for kernel-team@lists.ubuntu.com; Fri, 18 Jun 2021 03:44:17 +0000 Received: by mail-pg1-f199.google.com with SMTP id x9-20020a6541490000b0290222fe6234d6so236872pgp.14 for ; Thu, 17 Jun 2021 20:44:16 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=VZD8ldX9Z9M+woSC5mKVJSbZZt0zaMFf9oDO+DUB0hg=; b=JbqEr/+/c0EDUAPVO0JDj/+tfBDhJ/6KdsSTscQaR/nekQe2aphYMLseWmc9FF/GUT AQxysMozhk5vH/Lm2eIPKOk1nFljaUPTifxMILRxriTOrJbLZvJ1I9w4fCHOG5XMIfNq 3EY4k6tIn8WuyPD9upL5O6cRyMi6warZjNKkLNTQNHksNP2FiSwqou2bqziv1aeVuPgx wqhH5+LDJq7S5VJrIhcAtlfRFWKRvs59uEcEr0k/GO0t+1xCIVufLtNU2Kaz2jG3z/ij BBWF/Thc59yKI8+d5cDNVpNyLPjY5Q6s7AHt8oKwWpBO4oLSM3HCQal355U1FnyUwnTI niVw== X-Gm-Message-State: AOAM5321TL/MmMAuz9XDtOJ+66ZDj4xixNe5wEvHKZ++uMPTiWZgSAR4 3gjW7tfMzR5BraW+Bl3hDY3/FlXxqWs9r3yJoWDTlRMi1pAsJUrwQo2ZEEAs1gn7qznDWxA4vFH bbW2IVMVbH1j0vnJinfmwCJ2cTFKlAoKieQD7oI+6HA== X-Received: by 2002:a17:90a:1382:: with SMTP id i2mr13064485pja.221.1623987855279; Thu, 17 Jun 2021 20:44:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyRCeFU2f/XMe9znMES5Od7K8xFYXuYYKuz31244trFgJ48oiB5TocMPjZcbqhMwBmfWewgVw== X-Received: by 2002:a17:90a:1382:: with SMTP id i2mr13064453pja.221.1623987854844; Thu, 17 Jun 2021 20:44:14 -0700 (PDT) Received: from canonical.com (61-220-137-34.HINET-IP.hinet.net. [61.220.137.34]) by smtp.gmail.com with ESMTPSA id t7sm4959468pgh.52.2021.06.17.20.44.14 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Jun 2021 20:44:14 -0700 (PDT) From: Koba Ko To: kernel-team@lists.ubuntu.com Subject: [PATCH 1/3][SRU][OEM-5.10] net: phy: rename PHY_IGNORE_INTERRUPT to PHY_MAC_INTERRUPT Date: Fri, 18 Jun 2021 11:44:08 +0800 Message-Id: <20210618034410.3060144-2-koba.ko@canonical.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210618034410.3060144-1-koba.ko@canonical.com> References: <20210618034410.3060144-1-koba.ko@canonical.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Heiner Kallweit BugLink: https://bugs.launchpad.net/bugs/1930645 Some internal PHY's have their events like link change reported by the MAC interrupt. We have PHY_IGNORE_INTERRUPT to deal with this scenario. I'm not too happy with this name. We don't ignore interrupts, typically there is no interrupt exposed at a PHY level. So let's rename it to PHY_MAC_INTERRUPT. This is in line with phy_mac_interrupt(), which is called from the MAC interrupt handler to handle PHY events. Signed-off-by: Heiner Kallweit Reviewed-by: Andrew Lunn Acked-by: Florian Fainelli Reviewed-by: Russell King Signed-off-by: David S. Miller (cherry picked from commit 93e8990c24bee30696c02e8f6aed043333491a25) Signed-off-by: Koba Ko --- Documentation/networking/phy.rst | 2 +- drivers/net/ethernet/broadcom/genet/bcmmii.c | 2 +- drivers/net/ethernet/realtek/r8169_main.c | 2 +- drivers/net/ethernet/samsung/sxgbe/sxgbe_mdio.c | 4 ++-- drivers/net/mdio/mdio-moxart.c | 4 ++-- drivers/net/phy/icplus.c | 2 +- drivers/net/phy/phy.c | 2 +- drivers/net/phy/phy_device.c | 4 ++-- include/linux/phy.h | 10 +++++----- 9 files changed, 16 insertions(+), 16 deletions(-) diff --git a/Documentation/networking/phy.rst b/Documentation/networking/phy.rst index b2f7ec794bc8b..23c70948a152a 100644 --- a/Documentation/networking/phy.rst +++ b/Documentation/networking/phy.rst @@ -216,7 +216,7 @@ put into an unsupported state. Lastly, once the controller is ready to handle network traffic, you call phy_start(phydev). This tells the PAL that you are ready, and configures the PHY to connect to the network. If the MAC interrupt of your network driver -also handles PHY status changes, just set phydev->irq to PHY_IGNORE_INTERRUPT +also handles PHY status changes, just set phydev->irq to PHY_MAC_INTERRUPT before you call phy_start and use phy_mac_interrupt() from the network driver. If you don't want to use interrupts, set phydev->irq to PHY_POLL. phy_start() enables the PHY interrupts (if applicable) and starts the diff --git a/drivers/net/ethernet/broadcom/genet/bcmmii.c b/drivers/net/ethernet/broadcom/genet/bcmmii.c index 6fb6c35562854..f05608d8eb974 100644 --- a/drivers/net/ethernet/broadcom/genet/bcmmii.c +++ b/drivers/net/ethernet/broadcom/genet/bcmmii.c @@ -359,7 +359,7 @@ int bcmgenet_mii_probe(struct net_device *dev) * those versions of GENET. */ if (priv->internal_phy && !GENET_IS_V5(priv)) - dev->phydev->irq = PHY_IGNORE_INTERRUPT; + dev->phydev->irq = PHY_MAC_INTERRUPT; return 0; } diff --git a/drivers/net/ethernet/realtek/r8169_main.c b/drivers/net/ethernet/realtek/r8169_main.c index 6d58427739d93..bcbce17f4adac 100644 --- a/drivers/net/ethernet/realtek/r8169_main.c +++ b/drivers/net/ethernet/realtek/r8169_main.c @@ -5165,7 +5165,7 @@ static int r8169_mdio_register(struct rtl8169_private *tp) new_bus->name = "r8169"; new_bus->priv = tp; new_bus->parent = &pdev->dev; - new_bus->irq[0] = PHY_IGNORE_INTERRUPT; + new_bus->irq[0] = PHY_MAC_INTERRUPT; snprintf(new_bus->id, MII_BUS_ID_SIZE, "r8169-%x", pci_dev_id(pdev)); new_bus->read = r8169_mdio_read_reg; diff --git a/drivers/net/ethernet/samsung/sxgbe/sxgbe_mdio.c b/drivers/net/ethernet/samsung/sxgbe/sxgbe_mdio.c index b1e7f7ab281c9..fceb6d6372352 100644 --- a/drivers/net/ethernet/samsung/sxgbe/sxgbe_mdio.c +++ b/drivers/net/ethernet/samsung/sxgbe/sxgbe_mdio.c @@ -203,8 +203,8 @@ int sxgbe_mdio_register(struct net_device *ndev) case PHY_POLL: irq_str = "POLL"; break; - case PHY_IGNORE_INTERRUPT: - irq_str = "IGNORE"; + case PHY_MAC_INTERRUPT: + irq_str = "MAC"; break; default: sprintf(irq_num, "%d", phy->irq); diff --git a/drivers/net/mdio/mdio-moxart.c b/drivers/net/mdio/mdio-moxart.c index b72c6d185175e..f0cff584e1767 100644 --- a/drivers/net/mdio/mdio-moxart.c +++ b/drivers/net/mdio/mdio-moxart.c @@ -125,7 +125,7 @@ static int moxart_mdio_probe(struct platform_device *pdev) snprintf(bus->id, MII_BUS_ID_SIZE, "%s-%d-mii", pdev->name, pdev->id); bus->parent = &pdev->dev; - /* Setting PHY_IGNORE_INTERRUPT here even if it has no effect, + /* Setting PHY_MAC_INTERRUPT here even if it has no effect, * of_mdiobus_register() sets these PHY_POLL. * Ideally, the interrupt from MAC controller could be used to * detect link state changes, not polling, i.e. if there was @@ -133,7 +133,7 @@ static int moxart_mdio_probe(struct platform_device *pdev) * interrupt handled in ethernet drivercode. */ for (i = 0; i < PHY_MAX_ADDR; i++) - bus->irq[i] = PHY_IGNORE_INTERRUPT; + bus->irq[i] = PHY_MAC_INTERRUPT; data = bus->priv; data->base = devm_platform_ioremap_resource(pdev, 0); diff --git a/drivers/net/phy/icplus.c b/drivers/net/phy/icplus.c index d6e8516cd146e..203cb24e35840 100644 --- a/drivers/net/phy/icplus.c +++ b/drivers/net/phy/icplus.c @@ -184,7 +184,7 @@ static int ip175c_read_status(struct phy_device *phydev) genphy_read_status(phydev); else /* Don't need to read status for switch ports */ - phydev->irq = PHY_IGNORE_INTERRUPT; + phydev->irq = PHY_MAC_INTERRUPT; return 0; } diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index 28ddaad721ed1..61ebb3d82f443 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c @@ -1189,7 +1189,7 @@ void phy_state_machine(struct work_struct *work) } /* Only re-schedule a PHY state machine change if we are polling the - * PHY, if PHY_IGNORE_INTERRUPT is set, then we will be moving + * PHY, if PHY_MAC_INTERRUPT is set, then we will be moving * between states from phy_mac_interrupt(). * * In state PHY_HALTED the PHY gets suspended, so rescheduling the diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c index 85f3cde5ffd09..f8e0c616f7989 100644 --- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c @@ -1146,8 +1146,8 @@ char *phy_attached_info_irq(struct phy_device *phydev) case PHY_POLL: irq_str = "POLL"; break; - case PHY_IGNORE_INTERRUPT: - irq_str = "IGNORE"; + case PHY_MAC_INTERRUPT: + irq_str = "MAC"; break; default: snprintf(irq_num, sizeof(irq_num), "%d", phydev->irq); diff --git a/include/linux/phy.h b/include/linux/phy.h index 08725a262f320..de0a43329d6be 100644 --- a/include/linux/phy.h +++ b/include/linux/phy.h @@ -71,11 +71,11 @@ extern const int phy_10gbit_features_array[1]; /* * Set phydev->irq to PHY_POLL if interrupts are not supported, - * or not desired for this PHY. Set to PHY_IGNORE_INTERRUPT if - * the attached driver handles the interrupt + * or not desired for this PHY. Set to PHY_MAC_INTERRUPT if + * the attached MAC driver handles the interrupt */ #define PHY_POLL -1 -#define PHY_IGNORE_INTERRUPT -2 +#define PHY_MAC_INTERRUPT -2 #define PHY_IS_INTERNAL 0x00000001 #define PHY_RST_AFTER_CLK_EN 0x00000002 @@ -1201,11 +1201,11 @@ static inline int phy_clear_bits_mmd(struct phy_device *phydev, int devad, * @phydev: the phy_device struct * * NOTE: must be kept in sync with addition/removal of PHY_POLL and - * PHY_IGNORE_INTERRUPT + * PHY_MAC_INTERRUPT */ static inline bool phy_interrupt_is_valid(struct phy_device *phydev) { - return phydev->irq != PHY_POLL && phydev->irq != PHY_IGNORE_INTERRUPT; + return phydev->irq != PHY_POLL && phydev->irq != PHY_MAC_INTERRUPT; } /** From patchwork Fri Jun 18 03:44:10 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Koba Ko X-Patchwork-Id: 1494023 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4G5lCt6Mbxz9sXN; Fri, 18 Jun 2021 13:44:26 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1lu5Qd-0005RB-N2; Fri, 18 Jun 2021 03:44:23 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1lu5Qa-0005Ps-Gz for kernel-team@lists.ubuntu.com; Fri, 18 Jun 2021 03:44:20 +0000 Received: from mail-pj1-f69.google.com ([209.85.216.69]) by youngberry.canonical.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.93) (envelope-from ) id 1lu5Qa-0006VW-9Y for kernel-team@lists.ubuntu.com; Fri, 18 Jun 2021 03:44:20 +0000 Received: by mail-pj1-f69.google.com with SMTP id 4-20020a17090a1a44b029016e8392f557so7430957pjl.5 for ; Thu, 17 Jun 2021 20:44:20 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=3boEdbWuYT/h76P/+KZJwb8cg/K3OGXecT4NJwiChag=; b=HIjZRdBx0HglUO4xXlNz8fUPhJEfFhF4ECMCH95BBFyJPqLy5gCfF/wLvwr9on+FmR FykmnCmjxhmKx3fC/YyJ4VOixLbVraCSPEPdv8UdGby1foFLB61LW8aW8uJ9I827pFlG /jStV3Lgo5jITg4Kb6keahMYUaBH3DIgzKmpU91ntQA1d6A7o4juCnGJIU+xL2lQCmex N0NHQHiB1Agf5OWzPdrWsvj7dH/EzSWk9ICmR2sffiB9te9+Up+F7KUdltLvlp7VNOnO ivEeUoPc2bFDAmOaDssJr3HzE8gETeRElRIZyfZchzObw2YoafnzIo1h57LdOTdJxRId oshA== X-Gm-Message-State: AOAM5329+JRbPaK+zNsLTXkzSwPDD6+DYMDyvTxVo64YhyRV2Q7Thv/d +iyNopyi9epmGooAn5zsEIBK5GIOXfdQOAUBhGIGpdTBeihV80QIONGLC6fGJh/QprBcStEEaov JZUXlifk2kPydrwjm1TB2IAmv8rzsooGox99YBK2Chw== X-Received: by 2002:a62:dd83:0:b029:2e8:e511:c32f with SMTP id w125-20020a62dd830000b02902e8e511c32fmr3157540pff.49.1623987858672; Thu, 17 Jun 2021 20:44:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwzA+k/jcmejV6/hAg7u7nSH1UoPbjeQn+7RyBVsd0x0X6JO12jfOcEPUg4UIqdmyWo81tzdw== X-Received: by 2002:a62:dd83:0:b029:2e8:e511:c32f with SMTP id w125-20020a62dd830000b02902e8e511c32fmr3157519pff.49.1623987858313; Thu, 17 Jun 2021 20:44:18 -0700 (PDT) Received: from canonical.com (61-220-137-34.HINET-IP.hinet.net. [61.220.137.34]) by smtp.gmail.com with ESMTPSA id gl13sm9385669pjb.5.2021.06.17.20.44.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Jun 2021 20:44:18 -0700 (PDT) From: Koba Ko To: kernel-team@lists.ubuntu.com Subject: [PATCH 2/3 V2][SRU][OEM-5.10] UBUNTU: SAUCE: r8169: Use PHY_POLL when RTL8106E enable ASPM Date: Fri, 18 Jun 2021 11:44:10 +0800 Message-Id: <20210618034410.3060144-4-koba.ko@canonical.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210618034410.3060144-1-koba.ko@canonical.com> References: <20210618034410.3060144-1-koba.ko@canonical.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" BugLink: https://bugs.launchpad.net/bugs/1930645 For RTL8106E, it's a Fast-ethernet chip. If ASPM is enabled, the link chang interrupt wouldn't be triggered immediately and must wait a very long time to get link change interrupt. Even the link change interrupt isn't triggered, the phy link is already established. Use PHY_POLL to watch the status of phy link when ASPM is enabled on RTL8106E. Signed-off-by: Koba Ko --- drivers/net/ethernet/realtek/r8169_main.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/realtek/r8169_main.c b/drivers/net/ethernet/realtek/r8169_main.c index bcbce17f4adac..ce0d1ebb18991 100644 --- a/drivers/net/ethernet/realtek/r8169_main.c +++ b/drivers/net/ethernet/realtek/r8169_main.c @@ -2212,6 +2212,19 @@ static int rtl_set_mac_address(struct net_device *dev, void *p) return 0; } +static int rtl_phy_poll_quirk(struct rtl8169_private *tp) +{ + struct pci_dev *pdev = tp->pci_dev; + + if (!pcie_aspm_enabled(pdev)) + return 0; + + if (tp->mac_version == RTL_GIGA_MAC_VER_39) + return 1; + + return 0; +} + static void rtl_wol_suspend_quirk(struct rtl8169_private *tp) { switch (tp->mac_version) { @@ -5165,7 +5178,8 @@ static int r8169_mdio_register(struct rtl8169_private *tp) new_bus->name = "r8169"; new_bus->priv = tp; new_bus->parent = &pdev->dev; - new_bus->irq[0] = PHY_MAC_INTERRUPT; + new_bus->irq[0] = + (rtl_phy_poll_quirk(tp) ? PHY_POLL : PHY_MAC_INTERRUPT); snprintf(new_bus->id, MII_BUS_ID_SIZE, "r8169-%x", pci_dev_id(pdev)); new_bus->read = r8169_mdio_read_reg; From patchwork Fri Jun 18 03:44:09 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Koba Ko X-Patchwork-Id: 1494024 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4G5lCt5cSwz9sXL; Fri, 18 Jun 2021 13:44:26 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1lu5Qd-0005Qf-7b; Fri, 18 Jun 2021 03:44:23 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1lu5QY-0005PT-Lo for kernel-team@lists.ubuntu.com; Fri, 18 Jun 2021 03:44:18 +0000 Received: from mail-pl1-f200.google.com ([209.85.214.200]) by youngberry.canonical.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.93) (envelope-from ) id 1lu5QY-0006VH-EY for kernel-team@lists.ubuntu.com; Fri, 18 Jun 2021 03:44:18 +0000 Received: by mail-pl1-f200.google.com with SMTP id a6-20020a1709027d86b02901019f88b046so2463428plm.21 for ; Thu, 17 Jun 2021 20:44:18 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=voVdWJKHA1X2JNCyRB9ZIVDsXNWSU3vV9AWSxzL0nV8=; b=nh38I411cs3TYposvSFpc6K/qPVZZ99J2wIUjY/YDqXpTtGhyi1c6j6JNHBocCC5Fw M5yYVpFMw1rlqycX+4HYVo6bW35gnRyXms2py4p8AHZ7NMsXivVWF7VtNZQJ/jmqmKts 0U/b4of5+eloXoRo+kcN4NxrOs+GSa967/gczlu3H1vT5XUEo9aNMUDUH9NZOurD5yDY Wpf3WouacVaMJ5IrBUMtGc0qnK1dOkxGfIhxZTY3HfVt4dBa/68A+3XyGMnsaXjAn003 AJA8J0I80YfwahcnA56mU9tzvXGwR5YL7c6ggRqwC1OduhACK3LzM551nquEvr9EQK7J knPg== X-Gm-Message-State: AOAM531v3mZ99zXErPGNv1E1mxspBZy6NeOBJdJp9DS5Y9yWwNUBA8S7 CgGfDmBQOtFKdakob/IZnlEsGhcAqwjtwJzhui4uqPLntCCHtor6SYH38KJN9EWeU0QTOCHOkLr 4zWsidVGYq71ts/Dy/mnKqdeXROiinUKSDoZ4FuFMvQ== X-Received: by 2002:aa7:829a:0:b029:2e9:e53:198d with SMTP id s26-20020aa7829a0000b02902e90e53198dmr2948727pfm.72.1623987856810; Thu, 17 Jun 2021 20:44:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxeWH1FYBO3dkt6hdVWK5l4pOSoZXPC+Bdg4jUzgJpPVOLrLcIlBs0Q5dTRjo3CPDxI4DvL/w== X-Received: by 2002:aa7:829a:0:b029:2e9:e53:198d with SMTP id s26-20020aa7829a0000b02902e90e53198dmr2948706pfm.72.1623987856457; Thu, 17 Jun 2021 20:44:16 -0700 (PDT) Received: from canonical.com (61-220-137-34.HINET-IP.hinet.net. [61.220.137.34]) by smtp.gmail.com with ESMTPSA id d15sm6401269pfd.35.2021.06.17.20.44.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Jun 2021 20:44:16 -0700 (PDT) From: Koba Ko To: kernel-team@lists.ubuntu.com Subject: [PATCH 3/3 V2][SRU][U] UBUNTU: SAUCE: r8169: Use PHY_POLL when RTL8106E enable ASPM Date: Fri, 18 Jun 2021 11:44:09 +0800 Message-Id: <20210618034410.3060144-3-koba.ko@canonical.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210618034410.3060144-1-koba.ko@canonical.com> References: <20210618034410.3060144-1-koba.ko@canonical.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" BugLink: https://bugs.launchpad.net/bugs/1930645 For RTL8106E, it's a Fast-ethernet chip. If ASPM is enabled, the link chang interrupt wouldn't be triggered immediately and must wait a very long time to get link change interrupt. Even the link change interrupt isn't triggered, the phy link is already established. Use PHY_POLL to watch the status of phy link when ASPM is enabled on RTL8106E. Signed-off-by: Koba Ko --- drivers/net/ethernet/realtek/r8169_main.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/realtek/r8169_main.c b/drivers/net/ethernet/realtek/r8169_main.c index 88ff10fde853..b3c88ad943b1 100644 --- a/drivers/net/ethernet/realtek/r8169_main.c +++ b/drivers/net/ethernet/realtek/r8169_main.c @@ -2246,6 +2246,19 @@ static int rtl_set_mac_address(struct net_device *dev, void *p) return 0; } +static int rtl_phy_poll_quirk(struct rtl8169_private *tp) +{ + struct pci_dev *pdev = tp->pci_dev; + + if (!pcie_aspm_enabled(pdev)) + return 0; + + if (tp->mac_version == RTL_GIGA_MAC_VER_39) + return 1; + + return 0; +} + static void rtl_wol_enable_rx(struct rtl8169_private *tp) { if (tp->mac_version >= RTL_GIGA_MAC_VER_25) @@ -5085,7 +5098,8 @@ static int r8169_mdio_register(struct rtl8169_private *tp) new_bus->name = "r8169"; new_bus->priv = tp; new_bus->parent = &pdev->dev; - new_bus->irq[0] = PHY_MAC_INTERRUPT; + new_bus->irq[0] = + (rtl_phy_poll_quirk(tp) ? PHY_POLL : PHY_MAC_INTERRUPT); snprintf(new_bus->id, MII_BUS_ID_SIZE, "r8169-%x", pci_dev_id(pdev)); new_bus->read = r8169_mdio_read_reg;