Bug 11926

Summary: [PATCH]sis190 doesn't detect ethernet cable removal (Realtek PHY)
Product: Drivers Reporter: Herton Ronaldo Krzesinski (herton)
Component: NetworkAssignee: drivers_network (drivers_network)
Status: CLOSED CODE_FIX    
Severity: normal CC: alan, fry.kun, hadamax, jgarzik, jsantos
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: 2.6.30.1 Tree: Mainline
Regression: No
Attachments: poll for link status
Herton's patch, updated for 2.6.33+

Description Herton Ronaldo Krzesinski 2008-10-31 14:37:39 UTC
Latest working kernel version: unknown
Earliest failing kernel version: tested with 2.6.27.2 (vanilla), it fails, also other version tested was now old 2.6.24, same issue
Distribution: Mandriva
Hardware Environment: Clevo M540SS
Software Environment:

Problem Description:
For the sis190 I have here it doesn't report link change inside interrupt handler after removing ethernet cable. This makes ethernet cable detection to not work correctly. Network works fine, if you don't remove ethernet cable after first connection, keep it removed for some time, and reconnect.

Steps to reproduce:
- Remove ethernet cable (after booting with it plugged, or after plugging it after boot). Driver doesn't detect link change.

This is shown on kernel log after sis190 module is loaded with cable connected:
sis190 Gigabit Ethernet driver 1.2 loaded.
sis190 0000:00:04.0: PCI INT A -> GSI 19 (level, low) -> IRQ 19
sis190 0000:00:04.0: setting latency timer to 64
0000:00:04.0: Read MAC address from EEPROM
0000:00:04.0: Realtek PHY RTL8201 transceiver at address 1.
0000:00:04.0: Using transceiver at address 1 as default.
0000:00:04.0: SiS 191 PCI Gigabit Ethernet adapter at f8c14000 (IRQ: 19), 00:90:f5:69:e8:8b
eth0: GMII mode.
eth0: Enabling Auto-negotiation.
ADDRCONF(NETDEV_UP): eth0: link is not ready
eth0: mii ext = 0000.
eth0: mii lpa = 40a1 adv = 01e1.
eth0: link on 100 Mbps Half Duplex mode.
ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
eth0: no IPv6 routers present
Comment 1 Herton Ronaldo Krzesinski 2008-10-31 14:40:37 UTC
Created attachment 18559 [details]
poll for link status

This patch I made fixed the problem for me. Not sure why in sis190 device here LinkChange isn't reported.
Comment 2 Nick Hadaway 2009-06-07 20:49:09 UTC
I can confirm this problem still exists... SiS191... x86_64  2.6.29+       I am also affected by 4G memory problems which I can get around by limiting the kernel to access only 3G... but link detection is broken for me still... upon cable disconnect there are no notifications...
Comment 3 Herton Ronaldo Krzesinski 2009-06-08 14:16:47 UTC
(In reply to comment #2)
> I can confirm this problem still exists... SiS191... x86_64  2.6.29+       I
> am
> also affected by 4G memory problems which I can get around by limiting the
> kernel to access only 3G... but link detection is broken for me still... upon
> cable disconnect there are no notifications...

Can you check the patch I attached in the ticket here? It should fix the issue, or you can say workaround as it's weird LinkChange isn't reported (it should be).
Comment 4 José Santos 2009-07-17 10:42:37 UTC
I can confirm the problem persists in vanilla kernel 2.6.30.1, I then applied the patch to the same kernel and the driver started working as expected. It now detects correctly when the cable is plugged and when is unplugged.
I'm using Debian Lenny with vanila kernell 2.6.30.1 on a Clevo/kapok computer device 0802 Laptop.
Comment 5 Jeff Garzik 2010-03-01 20:36:54 UTC
Created attachment 25296 [details]
Herton's patch, updated for 2.6.33+


Updated Herton's patch to apply to the current kernel as of March 1, 2010.

A re-test to confirm this fixes the issue would be appreciated.
Comment 6 Jeff Garzik 2010-03-01 20:47:45 UTC
Posted to netdev:
http://marc.info/?l=linux-netdev&m=126747601613756&w=2
Comment 7 Konstantin Svist 2010-06-29 08:16:38 UTC
Confirm working with Atheros PHY.
Without this patch, link changes are not detected