From 4590e6a960b6b223e83aeb72e2778eeff0ac07d0 Mon Sep 17 00:00:00 2001 From: peter Date: Thu, 11 Sep 1997 15:27:35 +0000 Subject: malloc() the rx and tx descriptors seperately rather than as part of the large (over 4KB) softc struct. The descriptor array is accessed by busmaster dma and must be physically contiguous in memory. malloc() of a block greater than a page is only virtually contiguous, and not necessarily physically contigious. contigmalloc() could do this, but that is a bit on the overkill side. I'm not sure of the origins of the problem report and diagnosis, I learned of the problem via mail forwarded from Jim Shankland . Jim said that Matt Thomas's workaround was to reduce the number of transmit descriptors from 128 to 32, but I was concerned that it might cost performance. Anyway, this change is my fault, not Jim's. :-) Reviewed by: davidg --- sys/dev/de/if_de.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'sys/dev/de/if_de.c') diff --git a/sys/dev/de/if_de.c b/sys/dev/de/if_de.c index 460c74a..4169e30 100644 --- a/sys/dev/de/if_de.c +++ b/sys/dev/de/if_de.c @@ -21,7 +21,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: if_de.c,v 1.66 1997/08/03 13:00:42 peter Exp $ + * $Id: if_de.c,v 1.67 1997/09/02 20:06:26 bde Exp $ * */ @@ -5052,6 +5052,16 @@ tulip_pci_attach( if (sc == NULL) return; bzero(sc, sizeof(*sc)); /* Zero out the softc*/ + sc->tulip_rxdescs = (tulip_desc_t *) malloc(sizeof(tulip_desc_t) * TULIP_RXDESCS, M_DEVBUF, M_NOWAIT); + sc->tulip_txdescs = (tulip_desc_t *) malloc(sizeof(tulip_desc_t) * TULIP_TXDESCS, M_DEVBUF, M_NOWAIT); + if (sc->tulip_rxdescs == NULL || sc->tulip_txdescs == NULL) { + if (sc->tulip_rxdescs) + free((caddr_t) sc->tulip_rxdescs, M_DEVBUF); + if (sc->tulip_rxdescs) + free((caddr_t) sc->tulip_rxdescs, M_DEVBUF); + free((caddr_t) sc, M_DEVBUF); + return; + } #endif PCI_GETBUSDEVINFO(sc); -- cgit v1.1