RE: Link up detection bug in tg3

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is just an update to my previous message.  Being proactive, I was
looking at the tg3.c source to see if I could help trace down the problem.
I added a printk to the following code snippet from tg3_timer() in tg3.c
from 2.4.21-pre7:

} else if (tp->tg3_flags & TG3_FLAG_POLL_SERDES) {
	u32 mac_stat = tr32(MAC_STATUS);
	int need_setup = 0;

	printk(KERN_DEBUG "%s: mac_stat = 0x%08X netif_carrier_ok = %d\n",
	       __FILE__,
	       mac_stat,
	       netif_carrier_ok(tp->dev));
	if (netif_carrier_ok(tp->dev) &&
	    (mac_stat & MAC_STATUS_LNKSTATE_CHANGED)) {
		need_setup = 1;
	}
	if (! netif_carrier_ok(tp->dev) &&
	    (mac_stat & MAC_STATUS_PCS_SYNCED)) {
		need_setup = 1;
	}
	if (need_setup) {
		tw32(MAC_MODE,
		     (tp->mac_mode &
		      ~MAC_MODE_PORT_MODE_MASK));
		tr32(MAC_MODE);
		udelay(40);
		tw32(MAC_MODE, tp->mac_mode);
		tr32(MAC_MODE);
		udelay(40);
		tg3_setup_phy(tp);
	}
}

With this added printk, I repeated the test:

(cable plugged in)
ifconfig eth0 up

tg3: eth0: Link is up at 1000 Mbps, full duplex.
tg3: eth0: Flow control is on for TX and on for RX.
tg3.c: mac_stat = 0x00C00403 netif_carrier_ok = 1
and the last message repeats every second...

(cable unplugged)
tg3.c: mac_stat = 0x04C01413 netif_carrier_ok = 1
tg3: eth0: Link is down.
tg3.c: mac_stat = 0x04C0141A netif_carrier_ok = 0
and the last message repeats every second...

(cable plugged back in)
tg3.c: mac_stat = 0x04C0141F netif_carrier_ok = 0
tg3: eth0: Link is up at 1000 Mbps, full duplex.
tg3: eth0: Flow control is on for TX and on for RX.
tg3.c: mac_stat = 0x04C00403 netif_carrier_ok = 1
and the last message repeats every second...

ifconfig eth0 down
(cable unplugged)
ifconfig eth0 up

tg3: eth0: Link is down.
tg3.c: mac_stat = 0x00C00400 netif_carrier_ok = 0
and the last message repeats every second...

(cable plugged in)
tg3.c: mac_stat = 0x00C00400 netif_carrier_ok = 0
and the last message repeats every second...

So, the problem seems to be that the value of mac_stat doesn't change when
the cable is plugged in if the interface was brought up with the cable
unplugged.  Also notice that the value of mac_stat is 0x04C0141A if the
interface was brought up with the cable plugged in but subsequently
unplugged, but 0x00C00400 if the interface was brought up with the cable
unplugged.  I hope this helps.

Anthony J. Battersby
Cybernetics

-
: send the line "unsubscribe linux-net" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux 802.1Q VLAN]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Git]     [Bugtraq]     [Yosemite News and Information]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux PCI]     [Linux Admin]     [Samba]

  Powered by Linux