From nobody@FreeBSD.org  Tue Apr 19 09:24:50 2011
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id AA12E106564A
	for <freebsd-gnats-submit@FreeBSD.org>; Tue, 19 Apr 2011 09:24:50 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from red.freebsd.org (red.freebsd.org [IPv6:2001:4f8:fff6::22])
	by mx1.freebsd.org (Postfix) with ESMTP id 98F758FC1C
	for <freebsd-gnats-submit@FreeBSD.org>; Tue, 19 Apr 2011 09:24:50 +0000 (UTC)
Received: from red.freebsd.org (localhost [127.0.0.1])
	by red.freebsd.org (8.14.4/8.14.4) with ESMTP id p3J9Oop2081400
	for <freebsd-gnats-submit@FreeBSD.org>; Tue, 19 Apr 2011 09:24:50 GMT
	(envelope-from nobody@red.freebsd.org)
Received: (from nobody@localhost)
	by red.freebsd.org (8.14.4/8.14.4/Submit) id p3J9OojC081399;
	Tue, 19 Apr 2011 09:24:50 GMT
	(envelope-from nobody)
Message-Id: <201104190924.p3J9OojC081399@red.freebsd.org>
Date: Tue, 19 Apr 2011 09:24:50 GMT
From: Sergey <cy6erGn0m@gmail.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: Marvell Yukon 2 device works only few seconds
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         156493
>Category:       kern
>Synopsis:       [msk] Marvell Yukon 2 device works only few seconds
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    yongari
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Apr 19 09:30:09 UTC 2011
>Closed-Date:    Fri Jun 24 00:57:10 UTC 2011
>Last-Modified:  Fri Jun 24 00:57:10 UTC 2011
>Originator:     Sergey
>Release:        FreeBSD 8.2
>Organization:
>Environment:
FreeBSD 8.2  amd64 
>Description:
I've installed FreeBSD 8.2 to my laptop with Marvell Yukon 2 network
adapter. This device is handled by module if_msk. Unfortunately device
works only few seconds and then data can't be received.

I tried to debug driver and found the following: when interrupt happens
the event's ring checked but it does not contains event about RX so it
looks like device thinks that it has no space to read any more or
something somewhere disabled but I can't find where.


>How-To-Repeat:
Just use network interface about a second. For example, connect with
DHCP and try to ping for a few seconds
>Fix:


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->freebsd-net 
Responsible-Changed-By: linimon 
Responsible-Changed-When: Wed Apr 20 22:28:37 UTC 2011 
Responsible-Changed-Why:  
Over to maintainer(s). 

http://www.freebsd.org/cgi/query-pr.cgi?pr=156493 

From: David Xu <davidxu@freebsd.org>
To: bug-followup@freebsd.org, cy6erGn0m@gmail.com
Cc:  
Subject: Re: kern/156493: [msk] Marvell Yukon 2 device works only few seconds
Date: Fri, 13 May 2011 16:08:57 +0800

 On CURRENT, I have same problem, dmesg shows my machine has following
 hardware configuration:
 
 mskc0: <Marvell Yukon 88E8057 Gigabit Ethernet> port 0xe800-0xe8ff mem
 0xfebfc000-0xfebfffff irq 17 at device 0.0 on pci3
 msk0: <Marvell Technology Group Ltd. Yukon Ultra 2 Id 0xba Rev 0x00> on
 mskc0
 msk0: Ethernet address: 90:fb:a6:9b:bd:c5
 miibus0: <MII bus> on msk0
 e1000phy0: <Marvell 88E1149 Gigabit PHY> PHY 0 on miibus0
 e1000phy0:  none, 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX,
 1000baseT, 1000baseT-master, 1000baseT-FDX, 1000baseT-FDX-master, auto,
 auto-flow
 
 
 I have to disable workaround in if_msk.c to make it work:
 
 Index: dev/msk/if_msk.c
 ===================================================================
 --- dev/msk/if_msk.c	(revision 221829)
 +++ dev/msk/if_msk.c	(working copy)
 @@ -1228,7 +1228,7 @@
  		case CHIP_ID_YUKON_EC_U:
  		case CHIP_ID_YUKON_EX:
  		case CHIP_ID_YUKON_FE_P:
 -		case CHIP_ID_YUKON_UL_2:
 +//		case CHIP_ID_YUKON_UL_2:
  		case CHIP_ID_YUKON_OPT:
  			CSR_WRITE_2(sc, B0_CTST, Y2_HW_WOL_OFF);
 
 
State-Changed-From-To: open->feedback 
State-Changed-By: yongari 
State-Changed-When: Mon May 23 22:49:55 UTC 2011 
State-Changed-Why:  
Could you try latest msk(4) on your box? Recently I fixed a couple 
stability issues of msk(4). I think you can install 8.2-RELEASE and 
use msk(4) in HEAD. 

- Download if_msk.c/if_mskreg.h from HEAD. 
- Manually change all instances of pci_find_cap to pci_find_extcap()  
in if_msk.c would make it build on 8.2-RELEASE.  
- Install new kernel and shutdown the box 
- Make sure to cold-start(i.e. unplug your system's power cord and 
replug it after waiting 30 seconds) before rebooting  

Let me know whether that makes any difference. 


Responsible-Changed-From-To: freebsd-net->yongari 
Responsible-Changed-By: yongari 
Responsible-Changed-When: Mon May 23 22:49:55 UTC 2011 
Responsible-Changed-Why:  
Grab. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=156493 

From: YongHyeon PYUN <pyunyh@gmail.com>
To: cyberGn0m <cy6ergn0m@gmail.com>
Cc: David Xu <davidxu@freebsd.org>, "K. Macy" <kmacy@freebsd.org>,
	bug-followup@FreeBSD.org
Subject: Re: kern/156493: [msk] Marvell Yukon 2 device works only few seconds
Date: Sun, 29 May 2011 16:39:32 -0700

 On Fri, May 13, 2011 at 02:54:44PM +0400, cyberGn0m wrote:
 > I also found that this bug is applicable to latest Linux kernels but not to
 > older kernel versions. So if something was ported from Linux.. perhaps it
 > affected FreeBSD too.
 > 
 > 2011/5/13 David Xu <davidxu@freebsd.org>
 > 
 > > The following reply was made to PR kern/156493; it has been noted by GNATS.
 > >
 > > From: David Xu <davidxu@freebsd.org>
 > > To: bug-followup@freebsd.org, cy6erGn0m@gmail.com
 > > Cc:
 > > Subject: Re: kern/156493: [msk] Marvell Yukon 2 device works only few
 > > seconds
 > > Date: Fri, 13 May 2011 16:08:57 +0800
 > >
 > >  On CURRENT, I have same problem, dmesg shows my machine has following
 > >  hardware configuration:
 > >
 > >  mskc0: <Marvell Yukon 88E8057 Gigabit Ethernet> port 0xe800-0xe8ff mem
 > >  0xfebfc000-0xfebfffff irq 17 at device 0.0 on pci3
 > >  msk0: <Marvell Technology Group Ltd. Yukon Ultra 2 Id 0xba Rev 0x00> on
 > >  mskc0
 > >  msk0: Ethernet address: 90:fb:a6:9b:bd:c5
 > >  miibus0: <MII bus> on msk0
 > >  e1000phy0: <Marvell 88E1149 Gigabit PHY> PHY 0 on miibus0
 > >  e1000phy0:  none, 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX,
 > >  1000baseT, 1000baseT-master, 1000baseT-FDX, 1000baseT-FDX-master, auto,
 > >  auto-flow
 > >
 > >
 > >  I have to disable workaround in if_msk.c to make it work:
 > >
 > >  Index: dev/msk/if_msk.c
 > >  ===================================================================
 > >  --- dev/msk/if_msk.c   (revision 221829)
 > >  +++ dev/msk/if_msk.c   (working copy)
 > >  @@ -1228,7 +1228,7 @@
 > >                case CHIP_ID_YUKON_EC_U:
 > >                case CHIP_ID_YUKON_EX:
 > >                case CHIP_ID_YUKON_FE_P:
 > >  -              case CHIP_ID_YUKON_UL_2:
 > >  +//            case CHIP_ID_YUKON_UL_2:
 > >                case CHIP_ID_YUKON_OPT:
 > >                        CSR_WRITE_2(sc, B0_CTST, Y2_HW_WOL_OFF);
 > >
 
 I received positive reports from msk(4) users who are suffering
 from msk(4) instability and I think this issue also might be fixed
 in latest msk(4) in HEAD.
 For your easy testing, I've back-ported msk(4) of HEAD to
 8.2-RELEASE. Please download the two files at the following URL and
 rebuild kernel. Make sure to you cold-start your box before
 rebooting to new kernel(i.e. unplug power cable and wait 10-20
 seconds and boot).
 http://people.freebsd.org/~yongari/msk/8.2R/if_msk.c
 http://people.freebsd.org/~yongari/msk/8.2R/if_mskreg.h

From: David Xu <davidxu@freebsd.org>
To: pyunyh@gmail.com
Cc: cyberGn0m <cy6ergn0m@gmail.com>, "K. Macy" <kmacy@freebsd.org>,
        bug-followup@freebsd.org
Subject: Re: kern/156493: [msk] Marvell Yukon 2 device works only few seconds
Date: Mon, 30 May 2011 13:10:38 +0800

 On 2011/05/30 07:39, YongHyeon PYUN wrote:
 > On Fri, May 13, 2011 at 02:54:44PM +0400, cyberGn0m wrote:
 >> I also found that this bug is applicable to latest Linux kernels but not to
 >> older kernel versions. So if something was ported from Linux.. perhaps it
 >> affected FreeBSD too.
 >>
 >> 2011/5/13 David Xu <davidxu@freebsd.org>
 >>
 >>> The following reply was made to PR kern/156493; it has been noted by GNATS.
 >>>
 >>> From: David Xu <davidxu@freebsd.org>
 >>> To: bug-followup@freebsd.org, cy6erGn0m@gmail.com
 >>> Cc:
 >>> Subject: Re: kern/156493: [msk] Marvell Yukon 2 device works only few
 >>> seconds
 >>> Date: Fri, 13 May 2011 16:08:57 +0800
 >>>
 >>>  On CURRENT, I have same problem, dmesg shows my machine has following
 >>>  hardware configuration:
 >>>
 >>>  mskc0: <Marvell Yukon 88E8057 Gigabit Ethernet> port 0xe800-0xe8ff mem
 >>>  0xfebfc000-0xfebfffff irq 17 at device 0.0 on pci3
 >>>  msk0: <Marvell Technology Group Ltd. Yukon Ultra 2 Id 0xba Rev 0x00> on
 >>>  mskc0
 >>>  msk0: Ethernet address: 90:fb:a6:9b:bd:c5
 >>>  miibus0: <MII bus> on msk0
 >>>  e1000phy0: <Marvell 88E1149 Gigabit PHY> PHY 0 on miibus0
 >>>  e1000phy0:  none, 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX,
 >>>  1000baseT, 1000baseT-master, 1000baseT-FDX, 1000baseT-FDX-master, auto,
 >>>  auto-flow
 >>>
 >>>
 >>>  I have to disable workaround in if_msk.c to make it work:
 >>>
 >>>  Index: dev/msk/if_msk.c
 >>>  ===================================================================
 >>>  --- dev/msk/if_msk.c   (revision 221829)
 >>>  +++ dev/msk/if_msk.c   (working copy)
 >>>  @@ -1228,7 +1228,7 @@
 >>>                case CHIP_ID_YUKON_EC_U:
 >>>                case CHIP_ID_YUKON_EX:
 >>>                case CHIP_ID_YUKON_FE_P:
 >>>  -              case CHIP_ID_YUKON_UL_2:
 >>>  +//            case CHIP_ID_YUKON_UL_2:
 >>>                case CHIP_ID_YUKON_OPT:
 >>>                        CSR_WRITE_2(sc, B0_CTST, Y2_HW_WOL_OFF);
 >>>
 > 
 > I received positive reports from msk(4) users who are suffering
 > from msk(4) instability and I think this issue also might be fixed
 > in latest msk(4) in HEAD.
 > For your easy testing, I've back-ported msk(4) of HEAD to
 > 8.2-RELEASE. Please download the two files at the following URL and
 > rebuild kernel. Make sure to you cold-start your box before
 > rebooting to new kernel(i.e. unplug power cable and wait 10-20
 > seconds and boot).
 > http://people.freebsd.org/~yongari/msk/8.2R/if_msk.c
 > http://people.freebsd.org/~yongari/msk/8.2R/if_mskreg.h
 > 
 
 Yes, I have tested it, I believe the problem went away on my machine.
 Nice work, thanks!
 
State-Changed-From-To: feedback->patched 
State-Changed-By: yongari 
State-Changed-When: Thu Jun 2 16:43:43 UTC 2011 
State-Changed-Why:  
Fixed in HEAD. 
Thanks to David for testing! 

http://www.freebsd.org/cgi/query-pr.cgi?pr=156493 
State-Changed-From-To: patched->closed 
State-Changed-By: yongari 
State-Changed-When: Fri Jun 24 00:56:44 UTC 2011 
State-Changed-Why:  
Fix merged to both stable/8 and stable/7. If you encounter the 
issue again please open a new PR. 
Thanks for reporting! 

http://www.freebsd.org/cgi/query-pr.cgi?pr=156493 
>Unformatted:
