Bug 156509

Summary: xircom_cb: carrier detect does not work.
Product: [openSUSE] SUSE Linux 10.1 Reporter: Forgotten User ZhJd0F0L3x <forgotten_ZhJd0F0L3x>
Component: KernelAssignee: E-mail List <gnome-bugs>
Status: RESOLVED FIXED QA Contact: E-mail List <qa-bugs>
Severity: Normal    
Priority: P5 - None    
Version: Beta 7   
Target Milestone: ---   
Hardware: Other   
OS: Other   
Whiteboard:
Found By: Component Test Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---
Bug Depends on:    
Bug Blocks: 140732    

Description Forgotten User ZhJd0F0L3x 2006-03-09 15:32:11 UTC
While wondering why networkManager does not work with my xircom cardbus card, i came across the following:
linux:~ # ifplugstatus -v eth0
eth0:
    SIOCETHTOOL failed (Operation not supported)
    SIOCGMIIPHY failed (Operation not supported)
    Wireless failed.
    IFF_RUNNING: unplugged
    SIOCDEVPRIVATE failed (Operation not supported)
linux:~ # cat /sys/bus/pci/devices/0000\:01\:00.0/net\:eth0/carrier
cat: /sys/bus/pci/devices/0000:01:00.0/net:eth0/carrier: Invalid argument

the card itself is working:
linux:~ # dhcpcd eth0
linux:~ # ifconfig
eth0      Link encap:Ethernet  HWaddr 00:10:A4:A5:C3:22
          inet addr:10.10.103.125  Bcast:10.10.255.255  Mask:255.255.0.0
          inet6 addr: 2001:780:101:a00:210:a4ff:fea5:c322/64 Scope:Global
          inet6 addr: fe80::210:a4ff:fea5:c322/64 Scope:Link
          UP BROADCAST NOTRAILERS RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:164 errors:0 dropped:0 overruns:0 frame:0
          TX packets:23 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:11843 (11.5 Kb)  TX bytes:2113 (2.0 Kb)
          Interrupt:11 Base address:0x1000

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:85 errors:0 dropped:0 overruns:0 frame:0
          TX packets:85 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:6608 (6.4 Kb)  TX bytes:6608 (6.4 Kb)

linux:~ #

It is also working when using xircom_tulip_cb driver (which is deprecated IIUC).
Comment 1 Forgotten User ZhJd0F0L3x 2006-03-09 15:33:09 UTC
Robert, Timo: this might pop up as "NetworkManager bug".
Comment 2 Forgotten User ZhJd0F0L3x 2006-03-09 15:40:39 UTC
the card does notice when the cable gets unplugged:
Mar  9 16:43:14 linux kernel: xircom_cb: Link status has changed
Mar  9 16:43:14 linux kernel: xircom_cb: Link is 0 mbit
Mar  9 16:43:17 linux kernel: xircom_cb: Link status has changed
Mar  9 16:43:17 linux kernel: xircom_cb: Link is 100 mbit
Comment 3 Forgotten User ZhJd0F0L3x 2006-03-09 16:29:37 UTC
after reading the kernel code, i think it is actually a networkmanager bug.

The function is:
static ssize_t show_carrier(struct class_device *dev, char *buf)
{
	struct net_device *netdev = to_net_dev(dev);
	if (netif_running(netdev)) {
		return sprintf(buf, fmt_dec, !!netif_carrier_ok(netdev));
	}
	return -EINVAL;
}

so if the interface is not up (!netif_running...) we get EINVAL instead of a carrier.

it works fine with ifplugd, since ifplugd up's the interface before trying to sense carrier.

Also, "ifplugstatus -a eth0" (which also does an implicit ifconfig eth0 up) works fine:

linux:~ # ifplugstatus -a eth0
eth0: link beat detected

So i'll let you argue if this is a NM or a kernel bug ;-)
Comment 4 Olaf Kirch 2006-03-13 13:48:28 UTC
I think I mentioned this previously to the network manager people.

Yes, most (all?) cards are unable to detect the link carrier unless
they're running. And there's no way around this.
Comment 5 Robert Love 2006-03-15 18:37:12 UTC
I've always said we don't down devices, but I just found a bug where we do down them on suspend.  So any problems from the NM side should be fixed in the next package.

If you think the kernel driver is correct, feel free to close this.
Comment 6 JP Rosevear 2006-03-19 18:29:52 UTC
Closing as per comments.