Subject: kern/18372: Throughput enhancement to pcmcia xi driver
To: None <gnats-bugs@gnats.netbsd.org>
From: None <murray@river-styx.org>
List: netbsd-bugs
Date: 09/21/2002 22:37:36
>Number:         18372
>Category:       kern
>Synopsis:       Throughput enhancement to pcmcia xi driver
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Sat Sep 21 22:38:00 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     Murray Armfield
>Release:        NetBSD-1.6
>Organization:
>Environment:
NetBSD tensor 1.6 NetBSD 1.6 (TENSOR) #3: Sun Sep 22 15:21:53 EST 2002     admin@tensor:/usr/src/sys/arch/i386/compile/TENSOR i386
>Description:
The receive throughtput of my xircom RE-100 is not as good as the send throughput. Demonstrated many times with ftp.
Had a look at FreeBSD code and briefy noticed a couple of things on the interrupt code of the driver. Made changes to my NetBSD-1.6 if_xi.c file and receive throughput has roughly doubled.:-)

I hope my patch below is readable.
>How-To-Repeat:
Try ftp sending and receiving big files with and without the patch. Works great for me.
>Fix:
$NetBSD$

--- if_xi.c.orig        Sun Sep 22 15:14:14 2002
+++ if_xi.c
@@ -834,13 +834,15 @@ xi_intr(arg)
        PAGE(sc, 40);
        rx_status =
            bus_space_read_1(sc->sc_bst, sc->sc_bsh, sc->sc_offset + RXST0);
+       bus_space_write_1(sc->sc_bst, sc->sc_bsh, sc->sc_offset + RXST0,
+           ~rx_status & 0xff);
        tx_status =
            bus_space_read_1(sc->sc_bst, sc->sc_bsh, sc->sc_offset + TXST0);
-
-       /*
-        * XXX Linux writes to RXST0 and TXST* here.  My CE2 works just fine
-        * without it, and I can't see an obvious reason for it.
-        */
+       tx_status |=
+           bus_space_read_1(sc->sc_bst, sc->sc_bsh, sc->sc_offset + TXST1) << 8;
+       bus_space_write_1(sc->sc_bst, sc->sc_bsh, sc->sc_offset + TXST0,0);
+       bus_space_write_1(sc->sc_bst, sc->sc_bsh, sc->sc_offset + TXST1,0);
+       /* My Xircom RE-100 works heaps better with the above writes. */

        PAGE(sc, 0);
        while (esr & FULL_PKT_RCV) {
@@ -885,6 +887,7 @@ xi_intr(arg)

        /* Check for rx overrun. */
        if (rx_status & RX_OVERRUN) {
+               ifp->if_ierrors++;
                bus_space_write_1(sc->sc_bst, sc->sc_bsh, sc->sc_offset + CR,
                    CLR_RX_OVERRUN);
                DPRINTF(XID_INTR, ("xi: overrun cleared\n"));
>Release-Note:
>Audit-Trail:
>Unformatted: