summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorbrad <brad@openbsd.org>2006-02-22 06:02:09 +0000
committerbrad <brad@openbsd.org>2006-02-22 06:02:09 +0000
commit2413423aa754b62787d5c20784b9e7b042a06921 (patch)
treed6e77381b0316825c40b799af62c997ca9b35cd6 /sys
parentregen (diff)
downloadwireguard-openbsd-2413423aa754b62787d5c20784b9e7b042a06921.tar.xz
wireguard-openbsd-2413423aa754b62787d5c20784b9e7b042a06921.zip
For 82544 and newer chips increase the number of TX descriptors to 512.
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/pci/if_em.c15
-rw-r--r--sys/dev/pci/if_em.h9
2 files changed, 16 insertions, 8 deletions
diff --git a/sys/dev/pci/if_em.c b/sys/dev/pci/if_em.c
index a109dcffc58..9be12980011 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.107 2006/02/17 04:01:05 brad Exp $ */
+/* $OpenBSD: if_em.c,v 1.108 2006/02/22 06:02:09 brad Exp $ */
/* $FreeBSD: if_em.c,v 1.46 2004/09/29 18:28:28 mlaier Exp $ */
#include <dev/pci/if_em.h>
@@ -269,8 +269,12 @@ em_attach(struct device *parent, struct device *self, void *aux)
/* Initialize eeprom parameters */
em_init_eeprom_params(&sc->hw);
- tsize = EM_ROUNDUP(sc->num_tx_desc * sizeof(struct em_tx_desc),
- EM_MAX_TXD * sizeof(struct em_tx_desc));
+ if (sc->hw.mac_type >= em_82544)
+ tsize = EM_ROUNDUP(sc->num_tx_desc * sizeof(struct em_tx_desc),
+ EM_MAX_TXD_82544 * sizeof(struct em_tx_desc));
+ else
+ tsize = EM_ROUNDUP(sc->num_tx_desc * sizeof(struct em_tx_desc),
+ EM_MAX_TXD * sizeof(struct em_tx_desc));
tsize = EM_ROUNDUP(tsize, PAGE_SIZE);
/* Allocate Transmit Descriptor ring */
@@ -581,7 +585,10 @@ em_init(void *arg)
em_stop(sc);
if (ifp->if_flags & IFF_UP) {
- sc->num_tx_desc = EM_MAX_TXD;
+ if (sc->hw.mac_type >= em_82544)
+ sc->num_tx_desc = EM_MAX_TXD_82544;
+ else
+ sc->num_tx_desc = EM_MAX_TXD;
sc->num_rx_desc = EM_MAX_RXD;
} else {
sc->num_tx_desc = EM_MIN_TXD;
diff --git a/sys/dev/pci/if_em.h b/sys/dev/pci/if_em.h
index d31e6320fbf..e31194691e4 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.21 2005/12/10 18:41:50 brad Exp $ */
+/* $OpenBSD: if_em.h,v 1.22 2006/02/22 06:02:09 brad Exp $ */
#ifndef _EM_H_DEFINED_
#define _EM_H_DEFINED_
@@ -83,7 +83,7 @@ POSSIBILITY OF SUCH DAMAGE.
/* Tunables */
/*
- * EM_MAX_TXD: Maximum number of Transmit Descriptors
+ * EM_(MIN/MAX)_TXD: Maximum number of Transmit Descriptors
* Valid Range: 80-256 for 82542 and 82543-based adapters
* 80-4096 for others
* Default Value: 256
@@ -93,9 +93,10 @@ POSSIBILITY OF SUCH DAMAGE.
*/
#define EM_MIN_TXD 12
#define EM_MAX_TXD 256
+#define EM_MAX_TXD_82544 512
/*
- * EM_MAX_RXD - Maximum number of receive Descriptors
+ * EM_(MIN/MAX)_RXD - Maximum number of receive Descriptors
* Valid Range: 80-256 for 82542 and 82543-based adapters
* 80-4096 for others
* Default Value: 256
@@ -176,7 +177,7 @@ POSSIBILITY OF SUCH DAMAGE.
* This parameter controls when the driver calls the routine to reclaim
* transmit descriptors.
*/
-#define EM_TX_CLEANUP_THRESHOLD EM_MAX_TXD / 8
+#define EM_TX_CLEANUP_THRESHOLD (sc->num_tx_desc / 8)
/*
* This parameter controls whether or not autonegotation is enabled.