Subject: kern/36454: msk(4) (Marvell Yukon-2 FE) watchdog timeout (with fix)
To: None <kern-bug-people@netbsd.org, gnats-admin@netbsd.org,>
From: Loic Hoguin <essen@dev-extend.eu>
List: netbsd-bugs
Date: 06/07/2007 10:15:00
>Number:         36454
>Category:       kern
>Synopsis:       msk(4) (Marvell Yukon-2 FE) watchdog timeout (with fix)
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Jun 07 10:15:00 +0000 2007
>Originator:     Loic Hoguin
>Release:        NetBSD 4.0_BETA2 i386
>Organization:
Dev:Extend 
>Environment:


System: NetBSD 4.0_BETA2 (BLACKROSE_GENERIC) #5: Thu Jun  7 11:46:49 CEST 2007
	root@blackrose.dev-extend.eu:/usr/obj/sys/arch/i386/compile/BLACKROSE_GENERIC



>Description:


My network driver for my laptop had a problem:
- it would not send data at more than 100kb/s
- it would stop functionning if I sent big data files, while printing this:
- msk0: watchdog timeout

However it would work without problem downloading, browsing the web, or using ssh (if it didn't send files). The problem was happening from time to time (like every two weeks) but it was usable.

I searched a bit and found someone who had the same problem, with a fix for it. I applied and tested the fix, and it works. Now my files are sent at 10 mb/s and it doesn't stop functioning.

Here is his post:
- http://www.security-express.com/archives/openbsd/2007-05/1003.html

I went to OpenBSD source too and noticed their algorithm was different for this calculation. I haven't tested their, but I can if required.

Also I noticed something strange in the source of our msk. The following line, just after the timeout is detected:
- /* XXX Resets both ports; we shouldn't do that. */
At least I can say it doesn't help with the watchdog timeout since I had to manually ifconfig msk0 down && ifconfig msk0 up to get it working again.


>How-To-Repeat:


Try sending big files via msk(4).
It is possible it timeout only on my card (Marvell Yukon-2 FE).


>Fix:


Apply the following patch:

--- if_msk.c.patch begins here ---
Index: if_msk.c
===================================================================
RCS file: /cvsroot/src/sys/dev/pci/if_msk.c,v
retrieving revision 1.3
diff -r1.3 if_msk.c
944c944
< 	chunk = sc->sk_ramsize  - (sc->sk_ramsize + 2) / 3;
---
> 	chunk = sc->sk_ramsize  - (sc->sk_ramsize >> 1);
--- if_msk.c.patch ends here ---