Change RXFIFO, RXDMA and TXDMA configrations to values taken from

the Reaktek's driver, which are also used in FreeBSD.
Fixes RX FIFO overrun errors on my Duron 1300MHz PC.
(Note the configuration values for rtk(4) are not changed)

Also add some debug printf's in RX error case (disabled by default).
This commit is contained in:
tsutsui 2006-11-24 16:30:45 +00:00
parent 381d97cf19
commit 47af0126d5
2 changed files with 29 additions and 6 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: rtl8169.c,v 1.69 2006/11/22 14:32:28 tsutsui Exp $ */
/* $NetBSD: rtl8169.c,v 1.70 2006/11/24 16:30:45 tsutsui Exp $ */
/*
* Copyright (c) 1997, 1998-2003
@ -1212,6 +1212,23 @@ re_rxeof(struct rtk_softc *sc)
rxstat >>= 1;
if ((rxstat & RE_RDESC_STAT_RXERRSUM) != 0) {
#ifdef RE_DEBUG
aprint_error("%s: RX error (rxstat = 0x%08x)",
sc->sc_dev.dv_xname, rxstat);
if (rxstat & RE_RDESC_STAT_FRALIGN)
aprint_error(", frame alignment error");
if (rxstat & RE_RDESC_STAT_BUFOFLOW)
aprint_error(", out of buffer space");
if (rxstat & RE_RDESC_STAT_FIFOOFLOW)
aprint_error(", FIFO overrun");
if (rxstat & RE_RDESC_STAT_GIANT)
aprint_error(", giant packet");
if (rxstat & RE_RDESC_STAT_RUNT)
aprint_error(", runt packet");
if (rxstat & RE_RDESC_STAT_CRCERR)
aprint_error(", CRC error");
aprint_error("\n");
#endif
ifp->if_ierrors++;
/*
* If this is part of a multi-fragment packet,
@ -1857,16 +1874,16 @@ re_init(struct ifnet *ifp)
if (sc->re_testmode) {
if (sc->rtk_type == RTK_8169)
CSR_WRITE_4(sc, RTK_TXCFG,
RTK_TXCFG_CONFIG | RTK_LOOPTEST_ON);
RE_TXCFG_CONFIG | RTK_LOOPTEST_ON);
else
CSR_WRITE_4(sc, RTK_TXCFG,
RTK_TXCFG_CONFIG | RTK_LOOPTEST_ON_CPLUS);
RE_TXCFG_CONFIG | RTK_LOOPTEST_ON_CPLUS);
} else
CSR_WRITE_4(sc, RTK_TXCFG, RTK_TXCFG_CONFIG);
CSR_WRITE_4(sc, RTK_TXCFG, RE_TXCFG_CONFIG);
CSR_WRITE_1(sc, RTK_EARLY_TX_THRESH, 16);
CSR_WRITE_4(sc, RTK_RXCFG, RTK_RXCFG_CONFIG);
CSR_WRITE_4(sc, RTK_RXCFG, RE_RXCFG_CONFIG);
/* Set the individual bit to receive frames for this host only. */
rxcfg = CSR_READ_4(sc, RTK_RXCFG);

View File

@ -1,4 +1,4 @@
/* $NetBSD: rtl81x9reg.h,v 1.24 2006/11/18 07:22:06 tsutsui Exp $ */
/* $NetBSD: rtl81x9reg.h,v 1.25 2006/11/24 16:30:45 tsutsui Exp $ */
/*
* Copyright (c) 1997, 1998
@ -432,6 +432,12 @@
#define RTK_RXCFG_CONFIG (RTK_RX_FIFOTHRESH|RTK_RX_MAXDMA|RTK_RX_BUF_SZ)
#define RTK_TXCFG_CONFIG (RTK_TXCFG_IFG|RTK_TX_MAXDMA)
#define RE_RX_FIFOTHRESH RTK_RXFIFO_NOTHRESH
#define RE_RX_MAXDMA RTK_RXDMA_UNLIMITED
#define RE_TX_MAXDMA RTK_TXDMA_2048BYTES
#define RE_RXCFG_CONFIG (RE_RX_FIFOTHRESH|RE_RX_MAXDMA|RTK_RX_BUF_SZ)
#define RE_TXCFG_CONFIG (RTK_TXCFG_IFG|RE_TX_MAXDMA)
/*
* RX/TX descriptor definition. When large send mode is enabled, the