diff mbox series

[V3,SRU,I] UBUNTU: SAUCE: r8169: Use PHY_POLL when RTL8106E enable ASPM

Message ID 20211207035723.1197965-1-koba.ko@canonical.com
State New
Headers show
Series [V3,SRU,I] UBUNTU: SAUCE: r8169: Use PHY_POLL when RTL8106E enable ASPM | expand

Commit Message

Koba Ko Dec. 7, 2021, 3:57 a.m. UTC
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 <koba.ko@canonical.com>

V3: SRU for Impish
---
 drivers/net/ethernet/realtek/r8169_main.c | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

Comments

Kai-Heng Feng Dec. 7, 2021, 4:05 a.m. UTC | #1
On Tue, Dec 7, 2021 at 11:58 AM Koba Ko <koba.ko@canonical.com> wrote:
>
> 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 <koba.ko@canonical.com>

Isn't this fixed by 9c40186488145b57f800de120f0872168772adfe ("r8169:
change the L0/L1 entrance latencies for RTL8106e")?

Kai-Heng

>
> V3: SRU for Impish
> ---
>  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 c3775901a798..206e21f8033c 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)
> @@ -5088,7 +5101,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-%x",
>                  pci_domain_nr(pdev->bus), pci_dev_id(pdev));
>
> --
> 2.32.0
>
>
> --
> kernel-team mailing list
> kernel-team@lists.ubuntu.com
> https://lists.ubuntu.com/mailman/listinfo/kernel-team
Koba Ko Dec. 13, 2021, 10:30 a.m. UTC | #2
On Tue, Dec 7, 2021 at 12:05 PM Kai-Heng Feng
<kai.heng.feng@canonical.com> wrote:
>
> On Tue, Dec 7, 2021 at 11:58 AM Koba Ko <koba.ko@canonical.com> wrote:
> >
> > 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 <koba.ko@canonical.com>
>
> Isn't this fixed by 9c40186488145b57f800de120f0872168772adfe ("r8169:
> change the L0/L1 entrance latencies for RTL8106e")?
>
> Kai-Heng
yes, you're right.
thanks

koba
> >
> > V3: SRU for Impish
> > ---
> >  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 c3775901a798..206e21f8033c 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)
> > @@ -5088,7 +5101,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-%x",
> >                  pci_domain_nr(pdev->bus), pci_dev_id(pdev));
> >
> > --
> > 2.32.0
> >
> >
> > --
> > kernel-team mailing list
> > kernel-team@lists.ubuntu.com
> > https://lists.ubuntu.com/mailman/listinfo/kernel-team
Koba Ko Dec. 13, 2021, 10:33 a.m. UTC | #3
Will reSRU the fixed patch.

9c40186488145b57f800de120f0872168772adfe ("r8169: change the L0/L1
entrance latencies for RTL8106e")

On Mon, Dec 13, 2021 at 6:30 PM Koba Ko <koba.ko@canonical.com> wrote:
>
> On Tue, Dec 7, 2021 at 12:05 PM Kai-Heng Feng
> <kai.heng.feng@canonical.com> wrote:
> >
> > On Tue, Dec 7, 2021 at 11:58 AM Koba Ko <koba.ko@canonical.com> wrote:
> > >
> > > 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 <koba.ko@canonical.com>
> >
> > Isn't this fixed by 9c40186488145b57f800de120f0872168772adfe ("r8169:
> > change the L0/L1 entrance latencies for RTL8106e")?
> >
> > Kai-Heng
> yes, you're right.
> thanks
>
> koba
> > >
> > > V3: SRU for Impish
> > > ---
> > >  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 c3775901a798..206e21f8033c 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)
> > > @@ -5088,7 +5101,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-%x",
> > >                  pci_domain_nr(pdev->bus), pci_dev_id(pdev));
> > >
> > > --
> > > 2.32.0
> > >
> > >
> > > --
> > > kernel-team mailing list
> > > kernel-team@lists.ubuntu.com
> > > https://lists.ubuntu.com/mailman/listinfo/kernel-team
diff mbox series

Patch

diff --git a/drivers/net/ethernet/realtek/r8169_main.c b/drivers/net/ethernet/realtek/r8169_main.c
index c3775901a798..206e21f8033c 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)
@@ -5088,7 +5101,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-%x",
 		 pci_domain_nr(pdev->bus), pci_dev_id(pdev));