From owner-p4-projects@FreeBSD.ORG Fri Sep 26 19:28:00 2008 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 3D9E510656AD; Fri, 26 Sep 2008 19:28:00 +0000 (UTC) Delivered-To: perforce@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0075C10656B7 for ; Fri, 26 Sep 2008 19:28:00 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id E2DFE8FC22 for ; Fri, 26 Sep 2008 19:27:59 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id m8QJRx7i066537 for ; Fri, 26 Sep 2008 19:27:59 GMT (envelope-from hselasky@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id m8QJRxmj066531 for perforce@freebsd.org; Fri, 26 Sep 2008 19:27:59 GMT (envelope-from hselasky@FreeBSD.org) Date: Fri, 26 Sep 2008 19:27:59 GMT Message-Id: <200809261927.m8QJRxmj066531@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky To: Perforce Change Reviews Cc: Subject: PERFORCE change 150524 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 26 Sep 2008 19:28:00 -0000 http://perforce.freebsd.org/chv.cgi?CH=150524 Change 150524 by hselasky@hselasky_laptop001 on 2008/09/26 19:27:31 Reduce the need for memory. This also fixes an issue where the BUS-DMA refuses to allocate the memory due to the aligment and size combination. I was not able to find the real reason for the failure, but this patch fixes the problem for now. Affected files ... .. //depot/projects/usb/src/sys/dev/usb2/core/usb2_busdma.c#8 edit .. //depot/projects/usb/src/sys/dev/usb2/core/usb2_transfer.c#29 edit Differences ... ==== //depot/projects/usb/src/sys/dev/usb2/core/usb2_busdma.c#8 (text+ko) ==== @@ -495,7 +495,7 @@ * memory, hence we sometimes to a large number of * small allocations! */ - if (size < USB_PAGE_SIZE) { + if (size <= (USB_PAGE_SIZE / 2)) { size *= 2; } #endif ==== //depot/projects/usb/src/sys/dev/usb2/core/usb2_transfer.c#29 (text+ko) ==== @@ -942,10 +942,12 @@ parm.size[1] = parm.size[0]; /* - * UHCI need DMA tags for fixup buffers. There - * is a maximum of one tag for each endpoint. + * The number of DMA tags required depends on + * the number of endpoints. The current estimate + * for maximum number of DMA tags per endpoint + * is two. */ - parm.dma_tag_max += MIN(n_setup, USB_EP_MAX); + parm.dma_tag_max += 2 * MIN(n_setup, USB_EP_MAX); /* * DMA tags for QH, TD, Data and more.