diff options
author | peter <peter@FreeBSD.org> | 1997-09-11 15:27:35 +0000 |
---|---|---|
committer | peter <peter@FreeBSD.org> | 1997-09-11 15:27:35 +0000 |
commit | 4590e6a960b6b223e83aeb72e2778eeff0ac07d0 (patch) | |
tree | ad05d2cdfc4b272147180347fbf205373de3c9e4 /sys/dev/de/if_de.c | |
parent | ce64e4e169ac61e130e0a35de394b94f77b2ac62 (diff) | |
download | FreeBSD-src-4590e6a960b6b223e83aeb72e2778eeff0ac07d0.zip FreeBSD-src-4590e6a960b6b223e83aeb72e2778eeff0ac07d0.tar.gz |
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 <jas@flyingfox.com>.
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
Diffstat (limited to 'sys/dev/de/if_de.c')
-rw-r--r-- | sys/dev/de/if_de.c | 12 |
1 files changed, 11 insertions, 1 deletions
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); |