From nobody@FreeBSD.org  Tue Nov  6 10:13:08 2001
Return-Path: <nobody@FreeBSD.org>
Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21])
	by hub.freebsd.org (Postfix) with ESMTP id 0CC9037B416
	for <freebsd-gnats-submit@FreeBSD.org>; Tue,  6 Nov 2001 10:13:08 -0800 (PST)
Received: (from nobody@localhost)
	by freefall.freebsd.org (8.11.4/8.11.4) id fA6ID8d68618;
	Tue, 6 Nov 2001 10:13:08 -0800 (PST)
	(envelope-from nobody)
Message-Id: <200111061813.fA6ID8d68618@freefall.freebsd.org>
Date: Tue, 6 Nov 2001 10:13:08 -0800 (PST)
From: Daniel Rudy <dcrudy@pacbell.net>
To: freebsd-gnats-submit@FreeBSD.org
Subject: Clearing PME mode kills network performance on NatSemi DP83815 using sis driver
X-Send-Pr-Version: www-1.0

>Number:         31804
>Category:       kern
>Synopsis:       Clearing PME mode kills network performance on NatSemi DP83815 using sis driver
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Nov 06 10:20:01 PST 2001
>Closed-Date:    Sat Dec 21 07:41:33 PST 2002
>Last-Modified:  Sat Dec 21 07:41:33 PST 2002
>Originator:     Daniel Rudy
>Release:        4.4-STABLE
>Organization:
None
>Environment:
FreeBSD wildfire.pacbell.net 4.4-STABLE FreeBSD 4.4-STABLE #2: Tue Nov  6 01:37:52 PST 2001
root@strata.pacbell.net:/usr/src/sys/compile/WILDFIRE  i386
>Description:
Refer to PR-31737.  Network performance under full-duplex is greatly
reduced.  Symptoms of this failure is with NFS or FTP where file sizes
are greater than about 60K.  The network slows down to a crawl and
then quits.  The same problem is experienced with MS Windows machines
when communicating to FreeBSD machines.  MS Windows based machines do
not exhibit the same problem when communicating to other MS Windows
based machines.  Network cards involved are Netgear FA-312 series.  All
machines involved have the same network card.  100BaseTX Full Duplex
mode has been verified on all machines, both FreeBSD and Windows, and
the switch registers full duplex link as well.  The hub that is used
is a NDC Communications NSH510 10/100 Autosensing 5-port switch.  The
problem does not show up under half duplex mode.  And furthermore, it
is not a hardware interaction problem between the switch and the network
interface card because this DID work in 4.2 and the only thing that has
changed on my end is the FreeBSD load on the machines.  By the actions
that I have taken, it appears that clearing the PME mode in the chip
init code kills network performance when it comes to large file
transfers.

>How-To-Repeat:
Netgear FA-312 NICs to full duplex mode using any mainboard.  I'm using
a FIC, DFI, and DTK boards in my computers.

>Fix:
static void sis_reset(sc)
        struct sis_softc        *sc;
{
        register int            i;

        SIS_SETBIT(sc, SIS_CSR, SIS_CSR_RESET);

        for (i = 0; i < SIS_TIMEOUT; i++) {
                if (!(CSR_READ_4(sc, SIS_CSR) & SIS_CSR_RESET))
                        break;
        }

        if (i == SIS_TIMEOUT)
                printf("sis%d: reset never completed\n", sc->sis_unit);

        /* Wait a little while for the chip to get its brains in order.
*/
        DELAY(1000);

        /*
         * If this is a NetSemi chip, make sure to clear
         * PME mode.
         */
/*      if (sc->sis_type == SIS_TYPE_83815) {
                CSR_WRITE_4(sc, NS_CLKRUN, NS_CLKRUN_PMESTS);
                CSR_WRITE_4(sc, NS_CLKRUN, 0);
        }

commented out for testing pourposes */

        return;
}

Commenting out the section of code dealing with Power Manegement Event
mode fixes the problem, at least for me and my hardware.

>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->feedback 
State-Changed-By: iedowse 
State-Changed-When: Sun Dec 1 12:24:00 PST 2002 
State-Changed-Why:  

Is this bug still present in more recent releases? 

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

From: Daniel Rudy <dcrudy@pacbell.net>
To: freebsd-gnats-submit@FreeBSD.org, dcrudy@pacbell.net
Cc:  
Subject: Re: kern/31804: Clearing PME mode kills network performance on NatSemi
 DP83815 using sis driver
Date: Mon, 02 Dec 2002 01:21:30 -0800

 I have found and had been setting the hw.sis_quick sysctl variable to 0
 to also correct performance, but now on the later versions, this sysctl
 variable no longer exists.  I have not tested any large file transfers
 as of late, but I will report back to this PR my results in testing.
 
 -- 
 Daniel Rudy
 

From: Daniel Rudy <dcrudy@pacbell.net>
To: freebsd-gnats-submit@FreeBSD.org, dcrudy@pacbell.net
Cc:  
Subject: Re: kern/31804: Clearing PME mode kills network performance on NatSemi
 DP83815 using sis driver
Date: Mon, 02 Dec 2002 01:41:22 -0800

 Further testing indicates the following results:
 
 I built a file called testarchive which is 311,787,520 bytes.
 Transmission from FreeBSD 4.7 to a WinXP Pro is 30.46 seconds with a
 network throughput of 10234.96KB/s.  Transmission in the opposite
 direction between the two same computers yeilded 26.84 seconds at
 11617.39KB/s.  Not bad.  I guess the problem has been fixed.
 
 -- 
 Daniel Rudy
 
State-Changed-From-To: feedback->closed 
State-Changed-By: dwmalone 
State-Changed-When: Sat Dec 21 07:40:55 PST 2002 
State-Changed-Why:  
Submitter reckons problem is fixed. 

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