Index: if_re.c =================================================================== RCS file: /home/ncvs/src/sys/dev/re/if_re.c,v retrieving revision 1.35 diff -u -r1.35 if_re.c --- if_re.c 2004/09/28 18:22:24 1.35 +++ if_re.c 2004/10/19 08:09:16 @@ -111,6 +111,7 @@ #include #include #include +#include #include #include #include @@ -156,6 +157,9 @@ #define RE_CSUM_FEATURES (CSUM_IP | CSUM_TCP | CSUM_UDP) +static int retimerval = -1; +SYSCTL_INT(_hw, OID_AUTO, re_timer, CTLFLAG_RW, &retimerval, 0, "re tx mod timer value"); + /* * Various supported device vendors/types and their names. */ @@ -1712,11 +1716,8 @@ /* No changes made to the TX ring, so no flush needed */ - if (idx != sc->rl_ldata.rl_tx_considx) { + if (idx != sc->rl_ldata.rl_tx_considx) sc->rl_ldata.rl_tx_considx = idx; - ifp->if_flags &= ~IFF_OACTIVE; - ifp->if_timer = 0; - } /* * If not all descriptors have been released reaped yet, @@ -1726,6 +1727,12 @@ */ if (sc->rl_ldata.rl_tx_free != RL_TX_DESC_CNT) CSR_WRITE_4(sc, RL_TIMERCNT, 1); + + /* only when we are completely done clear the OACTIVE and timer */ + if (sc->rl_ldata.rl_tx_free == RL_TX_DESC_CNT) { + ifp->if_flags &= ~IFF_OACTIVE; + ifp->if_timer = 0; + } } static void @@ -2008,7 +2015,9 @@ struct rl_softc *sc; struct mbuf *m_head = NULL; int idx; + int oactive; + oactive = ifp->if_flags & IFF_OACTIVE; sc = ifp->if_softc; RL_LOCK_ASSERT(sc); @@ -2058,8 +2067,11 @@ * the value in the TIMERINT register, and then trigger an * interrupt. Each time we write to the TIMERCNT register, * the timer count is reset to 0. + * + * Only reset the timer if we are not currently sending pkts */ - CSR_WRITE_4(sc, RL_TIMERCNT, 1); + if (!oactive) + CSR_WRITE_4(sc, RL_TIMERCNT, 1); /* * Set a timeout in case the chip goes out to lunch. @@ -2216,10 +2228,17 @@ * reloaded on each transmit. This gives us TX interrupt * moderation, which dramatically improves TX frame rate. */ + if (retimerval == -1) { + if (sc->rl_type == RL_8169) + retimerval = 0x800; + else + retimerval = 0x400; + } if (sc->rl_type == RL_8169) - CSR_WRITE_4(sc, RL_TIMERINT_8169, 0x800); + CSR_WRITE_4(sc, RL_TIMERINT_8169, retimerval); else - CSR_WRITE_4(sc, RL_TIMERINT, 0x400); + CSR_WRITE_4(sc, RL_TIMERINT, retimerval); + printf("re timer set to: 0x%x\n", retimerval); /* * For 8169 gigE NICs, set the max allowed RX packet