Adjust TX threshold on every TX underrun. Some supported cards (8139-based)

can retransmit on TX underrun and set TOK in addition to TUND.  Also add a
check to prevent overflow of the addressable threshold.

This fixes some reports of rl(4) slowness, believed to be related to ALTQ
before.

PR:		kern/61448
Submitted by:	Tim Draegen-Gilman <timNOeudaemonSPAMnet> (with changes)
MFC after:	1 week
This commit is contained in:
Max Laier 2005-02-11 01:05:52 +00:00
parent 57c037be1c
commit 0afa9c9e2c

View File

@ -1232,6 +1232,14 @@ rl_txeof(struct rl_softc *sc)
bus_dmamap_destroy(sc->rl_tag, RL_LAST_DMAMAP(sc));
m_freem(RL_LAST_TXMBUF(sc));
RL_LAST_TXMBUF(sc) = NULL;
/*
* If there was a transmit underrun, bump the TX threshold.
* Make sure not to overflow the 63 * 32byte we can address
* with the 6 available bit.
*/
if ((txstat & RL_TXSTAT_TX_UNDERRUN) &&
(sc->rl_txthresh < 2016))
sc->rl_txthresh += 32;
if (txstat & RL_TXSTAT_TX_OK)
ifp->if_opackets++;
else {
@ -1244,12 +1252,8 @@ rl_txeof(struct rl_softc *sc)
/* error recovery */
rl_reset(sc);
rl_init_locked(sc);
/*
* If there was a transmit underrun,
* bump the TX threshold.
*/
if (txstat & RL_TXSTAT_TX_UNDERRUN)
sc->rl_txthresh = oldthresh + 32;
/* restore original threshold */
sc->rl_txthresh = oldthresh;
return;
}
RL_INC(sc->rl_cdata.last_tx);