summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2004-04-26 07:27:53 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2004-04-26 07:27:53 +0000
commitcd8147213a6ac10c8913b5f0ca0cd2be792603f3 (patch)
tree8225bf13614c13b62f96a56e2c4186b0badfd93b /sys
parent50d7ddf906efcdad549794f593a82c1c795a2100 (diff)
this driver had 256 clusters for receive buffers. move to 512, to increase
performance, if the interface is up. at boot time, allocate only 12 though ... though we note that em_stop() frees them all. perhaps some are used to talk to other parts of the engine though at runtime... tested by mcbride and beck
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/pci/if_em.c18
-rw-r--r--sys/dev/pci/if_em.h8
2 files changed, 18 insertions, 8 deletions
diff --git a/sys/dev/pci/if_em.c b/sys/dev/pci/if_em.c
index e0fcaf25d41..43c94480101 100644
--- a/sys/dev/pci/if_em.c
+++ b/sys/dev/pci/if_em.c
@@ -32,7 +32,7 @@ POSSIBILITY OF SUCH DAMAGE.
***************************************************************************/
/*$FreeBSD: if_em.c,v 1.38 2004/03/17 17:50:31 njl Exp $*/
-/* $OpenBSD: if_em.c,v 1.19 2004/04/18 04:15:00 henric Exp $ */
+/* $OpenBSD: if_em.c,v 1.20 2004/04/26 07:27:52 deraadt Exp $ */
#include "bpfilter.h"
#include "vlan.h"
@@ -513,8 +513,8 @@ em_attach(struct device *parent, struct device *self, void *aux)
#endif /* __FreeBSD__ */
/* Parameters (to be read from user) */
- sc->num_tx_desc = EM_MAX_TXD;
- sc->num_rx_desc = EM_MAX_RXD;
+ sc->num_tx_desc = EM_MIN_TXD;
+ sc->num_rx_desc = EM_MIN_RXD;
sc->hw.autoneg = DO_AUTO_NEG;
sc->hw.wait_autoneg_complete = WAIT_FOR_AUTO_NEG_DEFAULT;
sc->hw.autoneg_advertised = AUTONEG_ADV_DEFAULT;
@@ -1003,7 +1003,7 @@ em_watchdog(struct ifnet *ifp)
void
em_init_locked(struct em_softc *sc)
{
- struct ifnet *ifp;
+ struct ifnet *ifp = &sc->interface_data.ac_if;
INIT_DEBUGOUT("em_init: begin");
@@ -1011,6 +1011,15 @@ em_init_locked(struct em_softc *sc)
em_stop(sc);
+ if (ifp->if_flags & IFF_UP) {
+ sc->num_tx_desc = EM_MAX_TXD;
+ sc->num_rx_desc = EM_MAX_RXD;
+ } else {
+ sc->num_tx_desc = EM_MIN_TXD;
+ sc->num_rx_desc = EM_MIN_RXD;
+ }
+
+
#ifdef __FreeBSD__
/* Get the latest mac address, User can use a LAA */
bcopy(sc->interface_data.ac_enaddr, sc->hw.mac_addr,
@@ -1050,7 +1059,6 @@ em_init_locked(struct em_softc *sc)
/* Don't loose promiscuous settings */
em_set_promisc(sc);
- ifp = &sc->interface_data.ac_if;
ifp->if_flags |= IFF_RUNNING;
ifp->if_flags &= ~IFF_OACTIVE;
diff --git a/sys/dev/pci/if_em.h b/sys/dev/pci/if_em.h
index 25dfb5cf50c..74def91ca6a 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.24 2003/11/14 18:02:24 pdeuskar Exp $*/
-/* $OpenBSD: if_em.h,v 1.3 2004/04/18 04:15:00 henric Exp $ */
+/* $OpenBSD: if_em.h,v 1.4 2004/04/26 07:27:52 deraadt Exp $ */
#ifndef _EM_H_DEFINED_
#define _EM_H_DEFINED_
@@ -50,7 +50,8 @@ POSSIBILITY OF SUCH DAMAGE.
* Increasing this value allows the driver to queue more transmits. Each
* descriptor is 16 bytes.
*/
-#define EM_MAX_TXD 256
+#define EM_MIN_TXD 12
+#define EM_MAX_TXD 512
/*
* EM_MAX_RXD - Maximum number of receive Descriptors
@@ -63,7 +64,8 @@ POSSIBILITY OF SUCH DAMAGE.
* descriptor. The maximum MTU size is 16110.
*
*/
-#define EM_MAX_RXD 256
+#define EM_MIN_RXD 12
+#define EM_MAX_RXD 512
/*
* EM_TIDV - Transmit Interrupt Delay Value