From owner-p4-projects@FreeBSD.ORG Thu May 24 17:54:59 2007 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 4192216A469; Thu, 24 May 2007 17:54:59 +0000 (UTC) X-Original-To: perforce@FreeBSD.org Delivered-To: perforce@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id D344116A421 for ; Thu, 24 May 2007 17:54:58 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [69.147.83.41]) by mx1.freebsd.org (Postfix) with ESMTP id C2B7113C448 for ; Thu, 24 May 2007 17:54:58 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.8/8.13.8) with ESMTP id l4OHswED004579 for ; Thu, 24 May 2007 17:54:58 GMT (envelope-from hselasky@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.8/8.13.8/Submit) id l4OHswmn004567 for perforce@freebsd.org; Thu, 24 May 2007 17:54:58 GMT (envelope-from hselasky@FreeBSD.org) Date: Thu, 24 May 2007 17:54:58 GMT Message-Id: <200705241754.l4OHswmn004567@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 120326 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: Thu, 24 May 2007 17:54:59 -0000 http://perforce.freebsd.org/chv.cgi?CH=120326 Change 120326 by hselasky@hselasky_mini_itx on 2007/05/24 17:54:45 Improve starting of isochronous transfers when the isochronous pipe is empty, hence some USB devices does not like when there is excess data per timeslot. Affected files ... .. //depot/projects/usb/src/sys/dev/usb/ehci.c#30 edit .. //depot/projects/usb/src/sys/dev/usb/ohci.c#24 edit .. //depot/projects/usb/src/sys/dev/usb/uhci.c#25 edit Differences ... ==== //depot/projects/usb/src/sys/dev/usb/ehci.c#30 (text+ko) ==== @@ -2534,9 +2534,14 @@ buf_offset = (nframes - xfer->pipe->isoc_next) & (EHCI_VIRTUAL_FRAMELIST_COUNT-1); - if (buf_offset < xfer->nframes) { - /* not in use yet, schedule it a few frames ahead */ - /* data underflow */ + if ((LIST_FIRST(&(xfer->pipe->list_head)) == NULL) || + (buf_offset < xfer->nframes)) + { + /* If there is data underflow or the pipe queue is + * empty we schedule the transfer a few frames ahead + * of the current frame position. Else two + * isochronous transfers might overlap. + */ xfer->pipe->isoc_next = (nframes + 3) & (EHCI_VIRTUAL_FRAMELIST_COUNT-1); DPRINTFN(2,("start next=%d\n", xfer->pipe->isoc_next)); @@ -2790,9 +2795,14 @@ buf_offset = (nframes - xfer->pipe->isoc_next) & (EHCI_VIRTUAL_FRAMELIST_COUNT-1); - if (buf_offset < xfer->nframes) { - /* not in use yet, schedule it a few frames ahead */ - /* data underflow */ + if ((LIST_FIRST(&(xfer->pipe->list_head)) == NULL) || + (buf_offset < xfer->nframes)) + { + /* If there is data underflow or the pipe queue is + * empty we schedule the transfer a few frames ahead + * of the current frame position. Else two + * isochronous transfers might overlap. + */ xfer->pipe->isoc_next = (nframes + 3) & (EHCI_VIRTUAL_FRAMELIST_COUNT-1); DPRINTFN(2,("start next=%d\n", xfer->pipe->isoc_next)); ==== //depot/projects/usb/src/sys/dev/usb/ohci.c#24 (text+ko) ==== @@ -1946,16 +1946,15 @@ nframes = le32toh(hw_ptr->hcca.hcca_frame_number); usbd_page_dma_enter(&(sc->sc_hw_page)); - /* check if the frame index is within - * the window where the frames will be - * inserted and if the delay until start - * is too long - */ - if ((((nframes - xfer->pipe->isoc_next) & 0xFFFF) < xfer->nframes) || + if ((LIST_FIRST(&(xfer->pipe->list_head)) == NULL) || + (((nframes - xfer->pipe->isoc_next) & 0xFFFF) < xfer->nframes) || (((xfer->pipe->isoc_next - nframes) & 0xFFFF) >= 128)) { - /* not in use yet, schedule it a few frames ahead */ - /* data underflow */ + /* If there is data underflow or the pipe queue is + * empty we schedule the transfer a few frames ahead + * of the current frame position. Else two + * isochronous transfers might overlap. + */ xfer->pipe->isoc_next = (nframes + 3) & 0xFFFF; DPRINTFN(2,("start next=%d\n", xfer->pipe->isoc_next)); } ==== //depot/projects/usb/src/sys/dev/usb/uhci.c#25 (text+ko) ==== @@ -2048,9 +2048,14 @@ buf_offset = (nframes - xfer->pipe->isoc_next) & (UHCI_VFRAMELIST_COUNT-1); - if (buf_offset < xfer->nframes) { - /* not in use yet, schedule it a few frames ahead */ - /* data underflow */ + if ((LIST_FIRST(&(xfer->pipe->list_head)) == NULL) || + (buf_offset < xfer->nframes)) + { + /* If there is data underflow or the pipe queue is + * empty we schedule the transfer a few frames ahead + * of the current frame position. Else two + * isochronous transfers might overlap. + */ xfer->pipe->isoc_next = (nframes + 3) & (UHCI_VFRAMELIST_COUNT-1); DPRINTFN(2,("start next=%d\n", xfer->pipe->isoc_next)); }