diff options
author | Brad Smith <brad@cvs.openbsd.org> | 2006-11-17 02:03:33 +0000 |
---|---|---|
committer | Brad Smith <brad@cvs.openbsd.org> | 2006-11-17 02:03:33 +0000 |
commit | b8fd4744ee687f54750b27a6fb7bfcffa914fa05 (patch) | |
tree | 2aa2106d2c078bc58e978e7d03f66f9b7a9a0bb5 | |
parent | 9293300a9d8484e6beab3d73474bca6290238e70 (diff) |
Add a lower TX threshold value and use this when checking the number of
available TX descriptors in the case that em_encap() has tried to reclaim
descriptors.
From Jack Vogel@Intel
Tested by brad@, mk@, Gabriel Kihlman <gk at stacken dot kth dot se>,
Johan Mson Lindman <tybollt at solace dot mh dot se>
Tested on amd64/i386/sparc64
-rw-r--r-- | sys/dev/pci/if_em.c | 13 | ||||
-rw-r--r-- | sys/dev/pci/if_em.h | 5 |
2 files changed, 12 insertions, 6 deletions
diff --git a/sys/dev/pci/if_em.c b/sys/dev/pci/if_em.c index 1919d47b40c..4b5b7bb2619 100644 --- a/sys/dev/pci/if_em.c +++ b/sys/dev/pci/if_em.c @@ -31,7 +31,7 @@ POSSIBILITY OF SUCH DAMAGE. ***************************************************************************/ -/* $OpenBSD: if_em.c,v 1.156 2006/11/14 03:59:00 brad Exp $ */ +/* $OpenBSD: if_em.c,v 1.157 2006/11/17 02:03:32 brad Exp $ */ /* $FreeBSD: if_em.c,v 1.46 2004/09/29 18:28:28 mlaier Exp $ */ #include <dev/pci/if_em.h> @@ -935,7 +935,8 @@ em_encap(struct em_softc *sc, struct mbuf *m_head) */ if (sc->num_tx_desc_avail <= EM_TX_CLEANUP_THRESHOLD) { em_txeof(sc); - if (sc->num_tx_desc_avail <= EM_TX_CLEANUP_THRESHOLD) { + /* Now do we at least have a minimal? */ + if (sc->num_tx_desc_avail <= EM_TX_OP_THRESHOLD) { sc->no_tx_desc_avail1++; return (ENOBUFS); } @@ -2102,8 +2103,10 @@ em_txeof(struct em_softc *sc) eop_desc = &sc->tx_desc_base[last]; /* - * Now calculate the terminating index - * for the cleanup loop below. + * What this does is get the index of the + * first descriptor AFTER the EOP of the + * first packet, that way we can do the + * simple comparison on the inner while loop. */ if (++last == sc->num_tx_desc) last = 0; @@ -2164,8 +2167,10 @@ em_txeof(struct em_softc *sc) */ if (num_avail > EM_TX_CLEANUP_THRESHOLD) { ifp->if_flags &= ~IFF_OACTIVE; + /* All clean, turn off the timer */ if (num_avail == sc->num_tx_desc) ifp->if_timer = 0; + /* Some cleaned, reset the timer */ else if (num_avail != sc->num_tx_desc_avail) ifp->if_timer = EM_TX_TIMEOUT; } diff --git a/sys/dev/pci/if_em.h b/sys/dev/pci/if_em.h index fbc3897f5bf..282532e61c4 100644 --- a/sys/dev/pci/if_em.h +++ b/sys/dev/pci/if_em.h @@ -32,7 +32,7 @@ POSSIBILITY OF SUCH DAMAGE. ***************************************************************************/ /* $FreeBSD: if_em.h,v 1.26 2004/09/01 23:22:41 pdeuskar Exp $ */ -/* $OpenBSD: if_em.h,v 1.32 2006/11/14 03:59:00 brad Exp $ */ +/* $OpenBSD: if_em.h,v 1.33 2006/11/17 02:03:32 brad Exp $ */ #ifndef _EM_H_DEFINED_ #define _EM_H_DEFINED_ @@ -180,10 +180,11 @@ POSSIBILITY OF SUCH DAMAGE. #define EM_TX_TIMEOUT 5 /* set to 5 seconds */ /* - * This parameter controls when the driver calls the routine to reclaim + * These parameter controls when the driver calls the routine to reclaim * transmit descriptors. */ #define EM_TX_CLEANUP_THRESHOLD (sc->num_tx_desc / 8) +#define EM_TX_OP_THRESHOLD (sc->num_tx_desc / 32) /* * This parameter controls whether or not autonegotation is enabled. |