From 5c07516451e9563ce52fcb76a682312deb44334e Mon Sep 17 00:00:00 2001 From: Theo de Raadt Date: Wed, 14 Jul 2004 01:25:32 +0000 Subject: allocate the full ring set, even if we are currently running with a reduced set --- sys/dev/pci/if_em.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'sys/dev/pci') diff --git a/sys/dev/pci/if_em.c b/sys/dev/pci/if_em.c index 33806a83f1d..f51b6fee891 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.23 2004/06/18 20:42:34 mcbride Exp $ */ +/* $OpenBSD: if_em.c,v 1.24 2004/07/14 01:25:31 deraadt Exp $ */ #include "bpfilter.h" #include "vlan.h" @@ -567,8 +567,9 @@ 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), 4096); + 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 */ if (em_dma_malloc(sc, tsize, &sc->txdma, BUS_DMA_NOWAIT)) { @@ -579,8 +580,9 @@ em_attach(struct device *parent, struct device *self, void *aux) } sc->tx_desc_base = (struct em_tx_desc *)sc->txdma.dma_vaddr; - rsize = EM_ROUNDUP(sc->num_rx_desc * - sizeof(struct em_rx_desc), 4096); + rsize = EM_ROUNDUP(sc->num_rx_desc * sizeof(struct em_rx_desc), + EM_MAX_RXD * sizeof(struct em_tx_desc)); + rsize = EM_ROUNDUP(rsize, PAGE_SIZE); /* Allocate Receive Descriptor ring */ if (em_dma_malloc(sc, rsize, &sc->rxdma, BUS_DMA_NOWAIT)) { -- cgit v1.2.3