mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Simon Arlott <simon@fire.lp0.eu>
To: David Miller <davem@davemloft.net>
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	romieu@fr.zoreil.com
Subject: Re: [PATCH] r8169: add phy_reset parameter
Date: Mon, 22 Jun 2009 18:13:18 +0100	[thread overview]
Message-ID: <4A3FBBAE.6010005@simon.arlott.org.uk> (raw)
In-Reply-To: <20090621.142930.251405926.davem@davemloft.net>

On 21/06/09 22:29, David Miller wrote:
> From: Simon Arlott <simon@fire.lp0.eu>
> Date: Sun, 21 Jun 2009 19:45:25 +0100
> 
>> When booting over the network the physical link will already be up
>> and configured appropriately, so there is no need to reset it and
>> cause auto-negotiation to occur again. Adding an option to disable
>> this makes it possible to avoid a 2 second delay while booting.
>> 
>> Signed-off-by: Simon Arlott <simon@fire.lp0.eu>
> 
> This is getting out of control.

I'll look into getting ipconfig to detect link up notifications so its
sleep()s can then just be removed...

> We're not going to add a hundred different obscure module options to
> eliminate delays and device resets.

What about detecting link up before calling rtl8169_phy_reset instead?

I've tried not resetting the PHY but still setting the speed to auto
1000-FD, however this still resets the link.

The downside is that the speed won't be reset if the link is up while
booting. This may actually be desirable but it's not the current
behaviour. It could be possible to check if the speed is already set
to auto 1000-FD, although as the comment setting it indicates, the
8101 is a special case.

On my system the PHY/link speed is also getting reset by the boot ROM,
so I can't check that any change would be persisted.

This works ok for me:
[    0.469009] r8169 Gigabit Ethernet driver 2.3LK-NAPI loaded
[    0.469134]   alloc irq_desc for 18 on node -1
[    0.469143]   alloc kstat_irqs on node -1
[    0.469164] r8169 0000:00:09.0: PCI INT A -> GSI 18 (level, low) -> IRQ 18
[    0.469315] r8169 0000:00:09.0: no PCI Express capability
[    0.470354] eth0: RTL8169sc/8110sc at 0xbf700000, 00:30:18:b0:25:c2, XID 18000000 IRQ 18
[    0.470498] r8169: eth0: PHY reset skipped (link up)
[    0.470606] r8169 Gigabit Ethernet driver 2.3LK-NAPI loaded
[    0.470719]   alloc irq_desc for 19 on node -1
[    0.470728]   alloc kstat_irqs on node -1
[    0.470742] r8169 0000:00:0b.0: PCI INT A -> GSI 19 (level, low) -> IRQ 19
[    0.470875] r8169 0000:00:0b.0: no PCI Express capability
[    0.471870] eth1: RTL8169sc/8110sc at 0xbf704000, 00:30:18:b0:25:c3, XID 18000000 IRQ 19
(eth1 has no link)

diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c
index 4e22462..ae3e174 100644
--- a/drivers/net/r8169.c
+++ b/drivers/net/r8169.c
@@ -1798,13 +1798,18 @@ static void rtl8169_init_phy(struct net_device *dev, struct rtl8169_private *tp)
 		mdio_write(ioaddr, 0x0b, 0x0000); //w 0x0b 15 0 0
 	}
 
-	rtl8169_phy_reset(dev, tp);
+	/* Reset PHY/speed only if the link is not already up. */
+	if (tp->link_ok(ioaddr)) {
+		printk(KERN_INFO PFX "%s: PHY reset skipped (link up)\n", dev->name);
+	} else {
+		rtl8169_phy_reset(dev, tp);
 
-	/*
-	 * rtl8169_set_speed_xmii takes good care of the Fast Ethernet
-	 * only 8101. Don't panic.
-	 */
-	rtl8169_set_speed(dev, AUTONEG_ENABLE, SPEED_1000, DUPLEX_FULL);
+		/*
+		 * rtl8169_set_speed_xmii takes good care of the Fast Ethernet
+		 * only 8101. Don't panic.
+		 */
+		rtl8169_set_speed(dev, AUTONEG_ENABLE, SPEED_1000, DUPLEX_FULL);
+	}
 
 	if ((RTL_R8(PHYstatus) & TBI_Enable) && netif_msg_link(tp))
 		printk(KERN_INFO PFX "%s: TBI auto-negotiating\n", dev->name);

-- 
Simon Arlott

      reply	other threads:[~2009-06-22 17:13 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-21 18:45 Simon Arlott
2009-06-21 21:29 ` David Miller
2009-06-22 17:13   ` Simon Arlott [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4A3FBBAE.6010005@simon.arlott.org.uk \
    --to=simon@fire.lp0.eu \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=romieu@fr.zoreil.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®