kern/61448: [patch] RealTek driver rl(4) fails to adjust
TXthreshold on TX underrun
Andrew Belashov
bel at orel.ru
Mon Oct 18 04:40:22 PDT 2004
The following reply was made to PR kern/61448; it has been noted by GNATS.
From: Andrew Belashov <bel at orel.ru>
To: freebsd-gnats-submit at FreeBSD.org, tim at eudaemon.net,
wpaul at 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: <http://www.orel.ru/~bel/patches/if_rl_debug.patch>. 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--
More information about the freebsd-bugs
mailing list