From owner-freebsd-bugs@FreeBSD.ORG Mon Oct 18 11:40:22 2004 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id B4F5C16A4CE for ; Mon, 18 Oct 2004 11:40:22 +0000 (GMT) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 9EEB643D31 for ; Mon, 18 Oct 2004 11:40:22 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.11/8.12.11) with ESMTP id i9IBeMtM056659 for ; Mon, 18 Oct 2004 11:40:22 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.11/8.12.11/Submit) id i9IBeMiP056658; Mon, 18 Oct 2004 11:40:22 GMT (envelope-from gnats) Date: Mon, 18 Oct 2004 11:40:22 GMT Message-Id: <200410181140.i9IBeMiP056658@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org From: Andrew Belashov Subject: Re: kern/61448: [patch] RealTek driver rl(4) fails to adjust TXthreshold on TX underrun X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: Andrew Belashov List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Oct 2004 11:40:22 -0000 The following reply was made to PR kern/61448; it has been noted by GNATS. From: Andrew Belashov To: freebsd-gnats-submit@FreeBSD.org, tim@eudaemon.net, wpaul@FreeBSD.org Cc: Subject: Re: kern/61448: [patch] RealTek driver rl(4) fails to adjust TX threshold on TX underrun Date: Mon, 18 Oct 2004 15:37:07 +0400 This is a multi-part message in MIME format. --------------000302050404030206090101 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit I have same problem with cardbus PCMCIA card. Hardware: Fujitsu FMV-BIBLIO NU13 notebook (Pentium I, 133MHz); TRENDnet TE100-PCBUSR Cardbus Ethernet card based on RealTek 8139 chip. Network card is locked by transfer files through ftp or scp. Strange messages on console: ---[dmesg]--- rl0: discard oversize frame (ether type 6269 flags 3 len 25696 > max 1514) rl0: discard oversize frame (ether type 3423 flags 3 len 12589 > max 1514) rl0: discard oversize frame (ether type 2f62 flags 3 len 25387 > max 1514) ---[dmesg]--- I have added some debug code (thanks ktr(4)) into if_rl.c. For example see: . This patch also resolve my problem. I offer adapted patch for -CURRENT. See attachment. With attached patch I do not have any error or problem on my slow notebook. Now FTP transfer rate from 1,6 MByte/s to 2,7 MByte/s in any direction. Note: I do not known how to test patched driver for error recovery from RL_TXSTAT_TXABRT or RL_TXSTAT_OUTOFWIN error state. -- Best regards, Andrew Belashov. --------------000302050404030206090101 Content-Type: text/plain; name="current.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="current.patch" --- sys/pci/if_rl.c.orig Thu Sep 9 14:39:52 2004 +++ sys/pci/if_rl.c Sun Oct 17 21:49:44 2004 @@ -1226,31 +1226,33 @@ rl_txeof(struct rl_softc *sc) RL_TXSTAT_TX_UNDERRUN|RL_TXSTAT_TXABRT))) break; - ifp->if_collisions += (txstat & RL_TXSTAT_COLLCNT) >> 24; - bus_dmamap_unload(sc->rl_tag, RL_LAST_DMAMAP(sc)); bus_dmamap_destroy(sc->rl_tag, RL_LAST_DMAMAP(sc)); m_freem(RL_LAST_TXMBUF(sc)); RL_LAST_TXMBUF(sc) = NULL; - if (txstat & RL_TXSTAT_TX_OK) - ifp->if_opackets++; - else { - int oldthresh; + if (txstat & (RL_TXSTAT_OUTOFWIN | RL_TXSTAT_TXABRT)) { ifp->if_oerrors++; - if ((txstat & RL_TXSTAT_TXABRT) || - (txstat & RL_TXSTAT_OUTOFWIN)) - CSR_WRITE_4(sc, RL_TXCFG, RL_TXCFG_CONFIG); - oldthresh = sc->rl_txthresh; - /* error recovery */ - rl_reset(sc); - rl_init_locked(sc); + + /* If abort-condition, clear the abort */ + if (txstat & RL_TXSTAT_TXABRT) { + CSR_WRITE_4(sc, RL_TXCFG, RL_TXCFG_CLRABRT); + } + } else { + ifp->if_opackets++; + /* - * If there was a transmit underrun, - * bump the TX threshold. + * Update the RX threshold if underrun is reported. + * Datasheet says threshold must be between 000001 and + * 111111 inclusive. We start at 000011 (96). */ - if (txstat & RL_TXSTAT_TX_UNDERRUN) - sc->rl_txthresh = oldthresh + 32; - return; + if ((txstat & RL_TXSTAT_TX_UNDERRUN) && + (sc->rl_txthresh < 2016)) { + sc->rl_txthresh += 64; + } + + /* Update collision count, if any */ + ifp->if_collisions += + (txstat & RL_TXSTAT_COLLCNT) >> 24; } RL_INC(sc->rl_cdata.last_tx); ifp->if_flags &= ~IFF_OACTIVE; --------------000302050404030206090101--