NetBSD Problem Report #36454

From essen@dev-extend.eu  Thu Jun  7 10:11:57 2007
Return-Path: <essen@dev-extend.eu>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
	by narn.NetBSD.org (Postfix) with ESMTP id 86B4A63B8FF
	for <gnats-bugs@gnats.netbsd.org>; Thu,  7 Jun 2007 10:11:57 +0000 (UTC)
Message-Id: <1181211072.7419@blackrose.dev-extend.eu>
Date: Thu, 7 Jun 2007 12:11:12 +0200
From: "Loic Hoguin" <essen@dev-extend.eu>
To: "gnats bugs" <gnats-bugs@NetBSD.org>
Subject: msk(4) (Marvell Yukon-2 FE) watchdog timeout (with fix)
X-Send-Pr-Version: gtk-send-pr 0.4.8 
X-GNATS-Notify:

>Number:         36454
>Category:       kern
>Synopsis:       msk(4) (Marvell Yukon-2 FE) watchdog timeout (with fix)
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    jdolecek
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Jun 07 10:15:00 +0000 2007
>Closed-Date:    Mon Jun 25 19:31:54 +0000 2018
>Last-Modified:  Mon Jun 25 19:31:54 +0000 2018
>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 ---



>Release-Note:

>Audit-Trail:

Responsible-Changed-From-To: kern-bug-people->jdolecek
Responsible-Changed-By: jdolecek@NetBSD.org
Responsible-Changed-When: Mon, 11 Jun 2018 19:17:29 +0000
Responsible-Changed-Why:
I've committed a fix.


State-Changed-From-To: open->feedback
State-Changed-By: jdolecek@NetBSD.org
State-Changed-When: Mon, 11 Jun 2018 19:17:29 +0000
State-Changed-Why:
Adopted the size computation from OpenBSD, the problem was that our
former code set the hw registers to 8x the expected value, it's supposed
to be in octets.
Can you confirm if the fix in rev. 1.57 of dev/pci/if_msk.c works for you?


From: "Jaromir Dolecek" <jdolecek@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/36454 CVS commit: src/sys/dev/pci
Date: Mon, 11 Jun 2018 19:13:38 +0000

 Module Name:	src
 Committed By:	jdolecek
 Date:		Mon Jun 11 19:13:38 UTC 2018

 Modified Files:
 	src/sys/dev/pci: if_msk.c if_mskvar.h

 Log Message:
 adopt tx/rx buffer size computation from OpenBSD rev. 1.51 to fix
 "random" msk failures

 the crucial fix is that the start/end adresses are computed and
 written to hw registers in number of octets (i.e. size /
 sizeof(u_int64_t)), as that is actually what the hardware expects

 fixes PR kern/36454 (which had fix which highlighted the trouble),
 and seems likely to also fix kern/35711 and port-i386/42514


 To generate a diff of this commit:
 cvs rdiff -u -r1.56 -r1.57 src/sys/dev/pci/if_msk.c
 cvs rdiff -u -r1.12 -r1.13 src/sys/dev/pci/if_mskvar.h

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: feedback->closed
State-Changed-By: jdolecek@NetBSD.org
State-Changed-When: Mon, 25 Jun 2018 19:31:54 +0000
State-Changed-Why:
Address bounces, unable to confirm.


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.43 2018/01/16 07:36:43 maya Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2017 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.