Bug 5078

Summary: r8169: eth0: PHY reset until link up
Product: Drivers Reporter: Faris Xiao (atzlinux)
Component: NetworkAssignee: Francois Romieu (romieu)
Status: CLOSED PATCH_ALREADY_AVAILABLE    
Severity: low    
Priority: P2    
Hardware: i386   
OS: Linux   
Kernel Version: 2.6.12.5 Subsystem:
Regression: --- Bisected commit-id:

Description Faris Xiao 2005-08-17 02:19:08 UTC
Distribution:Debian sarge
Hardware Environment:

I has a netcard Realtek Semiconductor Co., Ltd. RTL-8169 Gigabit Ethernet (rev 10).

lspci
0000:00:00.0 Host bridge: Intel Corp. 82865G/PE/P DRAM Controller/Host-Hub
Interface (rev 02)
0000:00:01.0 PCI bridge: Intel Corp. 82865G/PE/P PCI to AGP Controller (rev 02)
0000:00:1d.0 USB Controller: Intel Corp. 82801EB/ER (ICH5/ICH5R) USB UHCI #1
(rev 02)
0000:00:1d.1 USB Controller: Intel Corp. 82801EB/ER (ICH5/ICH5R) USB UHCI #2
(rev 02)
0000:00:1d.2 USB Controller: Intel Corp. 82801EB/ER (ICH5/ICH5R) USB UHCI #3
(rev 02)
0000:00:1d.3 USB Controller: Intel Corp. 82801EB/ER (ICH5/ICH5R) USB UHCI #4
(rev 02)
0000:00:1d.7 USB Controller: Intel Corp. 82801EB/ER (ICH5/ICH5R) USB2 EHCI
Controller (rev 02)
0000:00:1e.0 PCI bridge: Intel Corp. 82801 PCI Bridge (rev c2)
0000:00:1f.0 ISA bridge: Intel Corp. 82801EB/ER (ICH5/ICH5R) LPC Bridge (rev 02)
0000:00:1f.1 IDE interface: Intel Corp. 82801EB/ER (ICH5/ICH5R) Ultra ATA 100
Storage Controller (rev 02)
0000:00:1f.3 SMBus: Intel Corp. 82801EB/ER (ICH5/ICH5R) SMBus Controller (rev 02)
0000:00:1f.5 Multimedia audio controller: Intel Corp. 82801EB/ER (ICH5/ICH5R)
AC'97 Audio Controller (rev 02)
0000:01:00.0 VGA compatible controller: nVidia Corporation NV18 [GeForce4 MX 440
AGP 8x] (rev c1)
0000:02:09.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL-8169
Gigabit Ethernet (rev 10)

Software Environment:
cat /etc/modules

r8169 media=0x08
psmouse
usbnet

Problem Description:

I get many "r8169: eth0: PHY reset until link up" output from my dmesg command.

r8169: eth0: PHY reset until link up
r8169: eth0: PHY reset until link up
r8169: eth0: PHY reset until link up
r8169: eth0: PHY reset until link up
r8169: eth0: PHY reset until link up

Is the driver r8169 has some bugs?

Steps to reproduce:
Comment 1 Francois Romieu 2005-08-17 14:57:30 UTC
- does the driver finally negotiate the link ?
- what happens if you do not specify a media option ?
- Debian Sarges uses gcc-3.3 or above, right ?

--
Ueimor
Comment 2 Faris Xiao 2005-08-17 21:17:58 UTC
- does the driver finally negotiate the link ?
O! God save me! I don't open the switch's power.Sorry!

When I turn on the power of the switch,the dmesg output is:
r8169: eth1: PHY reset until link up
r8169: eth1: PHY reset until link up
r8169: eth1: PHY reset until link up
r8169: eth1: PHY reset until link up
r8169: eth1: PHY reset until link up
r8169: eth1: link up

The following is the output of ethtool:
# ethtool eth1
Settings for eth1:
        Supported ports: [ TP ]
        Supported link modes:   10baseT/Half 10baseT/Full 
                                100baseT/Half 100baseT/Full 
                                1000baseT/Full 
        Supports auto-negotiation: Yes
        Advertised link modes:  10baseT/Half 10baseT/Full 
                                100baseT/Half 100baseT/Full 
                                1000baseT/Full 
        Advertised auto-negotiation: Yes
        Speed: 100Mb/s
        Duplex: Full
        Port: Twisted Pair
        PHYAD: 0
        Transceiver: internal
        Auto-negotiation: on
        Link detected: yes

when I turn  off the power of the switch again,there is not more dmesg output.
I don't get the any "r8169: eth1: PHY reset until link up" again.

I think,it should be not always output "r8169: eth1: PHY reset until link up" 
when the power of the switch turn off before the computer boot,isn't it?



- what happens if you do not specify a media option ?
If I am not specify the media option in /etc/modules,
The string "r8169: eth0: PHY reset until link up" still output when
I turn off the switch power before my computer boot.

- Debian Sarges uses gcc-3.3 or above, right ?

yes,Debian Sarges uses 3.3.5.
debian:~# gcc -v
Reading specs from /usr/lib/gcc-lib/i486-linux/3.3.5/specs
Configured with: ../src/configure -v
--enable-languages=c,c++,java,f77,pascal,jc,ada,treelang --prefix=/usr
--mandir=/usr/share/man
--infodir=/usr/share/inf--with-gxx-include-dir=/usr/include/c++/3.3
--enable-shared --enable-__cxa_atet --with-system-zlib --enable-nls
--without-included-gettext --enable-clocale=u --enable-debug
--enable-java-gc=boehm --enable-java-awt=xlib --enable-objc-gi486-linux
Thread model: posix
gcc version 3.3.5 (Debian 1:3.3.5-13)
Comment 3 Francois Romieu 2005-08-18 14:39:28 UTC
> When I turn on the power of the switch,the dmesg output is:
> r8169: eth1: PHY reset until link up
[...]
> r8169: eth1: PHY reset until link up
> r8169: eth1: link up
> 
> The following is the output of ethtool:
[snip]

Ok, everything works.

[...]
> when I turn  off the power of the switch again,there is not more dmesg output.
> I don't get the any "r8169: eth1: PHY reset until link up" again.
> 
> I think,it should be not always output "r8169: eth1: PHY reset until link up" 
> when the power of the switch turn off before the computer boot,isn't it?

You can control the displayed message via the "msglvl" option of ethtool, see
include/linux/netdevice.h:
[...]
enum {
        NETIF_MSG_DRV           = 0x0001,
        NETIF_MSG_PROBE         = 0x0002,
        NETIF_MSG_LINK          = 0x0004,
        NETIF_MSG_TIMER         = 0x0008,
        NETIF_MSG_IFDOWN        = 0x0010,
        NETIF_MSG_IFUP          = 0x0020,
        NETIF_MSG_RX_ERR        = 0x0040,
        NETIF_MSG_TX_ERR        = 0x0080,
        NETIF_MSG_TX_QUEUED     = 0x0100,
        NETIF_MSG_INTR          = 0x0200, 
        NETIF_MSG_TX_DONE       = 0x0400,
        NETIF_MSG_RX_STATUS     = 0x0800,
        NETIF_MSG_PKTDATA       = 0x1000,
        NETIF_MSG_HW            = 0x2000,
        NETIF_MSG_WOL           = 0x4000,
};

-> you can pass the same value via the "debug" option of the module.

> - what happens if you do not specify a media option ?
> If I am not specify the media option in /etc/modules,
> The string "r8169: eth0: PHY reset until link up" still output when
> I turn off the switch power before my computer boot.

Ok. I assume that the link ends established the same, does it not ?

[...]
> yes,Debian Sarges uses 3.3.5.

Fine. Slow but safe.

--
Ueimor
Comment 4 Faris Xiao 2005-08-20 20:55:15 UTC
Sorry,I just a normal linux user.I can't understand the  source code.

You said "You can control the displayed message via the "msglvl" option of
ethtool",I man ethtool,I know that I should use 
"ethtool -s ethX msglvl N",but I don't know which digital I should set.

When I use command:

debian:~# ethtool -s eth1 msglvl 8
Cannot set new msglvl: Operation not supported

Why Operation not supported?

-> you can pass the same value via the "debug" option of the module.
Could you tell how to do it more detail?Thank you!

I recompiled the r8169.ko use 

EXTRA_CFLAGS += -DRTL8169_DEBUG
obj-m += r8169.o

in the Makefile.

The following is the output:

r8169 Gigabit Ethernet driver 2.2LK loaded
ACPI: PCI Interrupt 0000:02:09.0[A] -> GSI 20 (level, low) -> IRQ 20
r8169: mac_version == RTL_GIGA_MAC_VER_E (0002)
r8169: phy_version == RTL_GIGA_PHY_VER_E (0000)
eth1: Identified chip type is 'RTL8169s/8110s'.
eth1: RTL8169 at 0xe09b8000, 00:0f:ea:0b:85:04, IRQ 20
r8169: mac_version == RTL_GIGA_MAC_VER_E (0002)
r8169: phy_version == RTL_GIGA_PHY_VER_E (0000)
r8169: MAC version != 0 && PHY version == 0 or 1
r8169: Do final_reg2.cfg
r8169: Set MAC Reg C+CR Offset 0x82h = 0x01h
r8169: <6>r8169: Set MAC Reg C+CR Offset 0xE0. Bit-3 and bit-14 MUST be 1
r8169: eth1: PHY reset until link up
r8169: eth1: PHY reset until link up
r8169: eth1: PHY reset until link up
r8169: eth1: PHY reset until link up
r8169: eth1: PHY reset until link up
Comment 5 Francois Romieu 2005-08-22 15:12:20 UTC
> debian:~# ethtool -s eth1 msglvl 8
> Cannot set new msglvl: Operation not supported

My bad. The msglvl feature for the r8169 has been added in the 2.6.12 -> 2.6.13
cycle. Since 2.6.12.5 includes post 2.6.12 bugfixes only, you do not have the
feature.

[...]
> I know that I should use 
> "ethtool -s ethX msglvl N", but I don't know which digital I should set.

The driver tries to follow the NETIF_MSG_XXX. Say I want to suppress the
link up messages as in:
[  899.671755] r8169: eth1: link up

-> it is controlled by netif_msg_ifup and
        NETIF_MSG_IFUP          = 0x0020,
Whence:
$ modprobe r8169
$ ethtool -s eth1 msglvl 0xffdf

The phy reset message is controlled by netif_msg_link/NETIF_MSG_LINK/0x0004.

["debug" option of the module]
> Could you tell how to do it more detail? Thank you!

You give it the expected value like any usual kernel option. You can check
the result/difference with ethtool.

--
Ueimor