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
This commit is contained in:
peter 1997-09-11 15:27:35 +00:00
parent ce64e4e169
commit 4590e6a960
4 changed files with 34 additions and 4 deletions

View File

@ -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);

View File

@ -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)

View File

@ -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);

View File

@ -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)