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 | |
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')
-rw-r--r-- | sys/dev/de/if_de.c | 12 | ||||
-rw-r--r-- | sys/dev/de/if_devar.h | 7 |
2 files changed, 17 insertions, 2 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); diff --git a/sys/dev/de/if_devar.h b/sys/dev/de/if_devar.h index 68fbc7b..048480a 100644 --- a/sys/dev/de/if_devar.h +++ b/sys/dev/de/if_devar.h @@ -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_devar.h,v 1.28 1997/07/03 16:55:07 thomas Exp $ + * $Id: if_devar.h,v 1.1.1.2 1997/08/03 12:17:38 peter Exp $ */ #if !defined(_DEVAR_H) @@ -655,8 +655,13 @@ struct _tulip_softc_t { u_int8_t tulip_pci_devno; /* needed for multiport boards */ u_int8_t tulip_connidx; tulip_srom_connection_t tulip_conntype; +#if defined(__FreeBSD__) + tulip_desc_t *tulip_rxdescs; + tulip_desc_t *tulip_txdescs; +#else tulip_desc_t tulip_rxdescs[TULIP_RXDESCS]; tulip_desc_t tulip_txdescs[TULIP_TXDESCS]; +#endif }; #if defined(IFM_ETHER) |