From owner-svn-src-all@FreeBSD.ORG Tue Mar 22 14:40:15 2011 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 60ABA106564A; Tue, 22 Mar 2011 14:40:15 +0000 (UTC) (envelope-from gavin@FreeBSD.org) Received: from gse-mta-27.emailfiltering.com (gse-mta-27-tx.emailfiltering.com [194.116.198.158]) by mx1.freebsd.org (Postfix) with ESMTP id 36D8C8FC27; Tue, 22 Mar 2011 14:40:13 +0000 (UTC) Received: from mail-gw12.york.ac.uk ([144.32.129.162]) by gse-mta-27.emailfiltering.com with emfmta (version 4.8.0.437) by TLS id 946253928 for hselasky@FreeBSD.org; 1a0728ac11f53231; Tue, 22 Mar 2011 14:40:12 +0000 Received: from buffy-128.york.ac.uk ([144.32.128.160]:17302 helo=buffy.york.ac.uk) by mail-gw12.york.ac.uk with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1Q22kl-0007ro-Px; Tue, 22 Mar 2011 14:40:11 +0000 Received: from buffy.york.ac.uk (localhost [127.0.0.1]) by buffy.york.ac.uk (8.14.4/8.14.4) with ESMTP id p2MEeBlL021881; Tue, 22 Mar 2011 14:40:11 GMT (envelope-from gavin@FreeBSD.org) Received: (from ga9@localhost) by buffy.york.ac.uk (8.14.4/8.14.4/Submit) id p2MEeA0J021880; Tue, 22 Mar 2011 14:40:11 GMT (envelope-from gavin@FreeBSD.org) X-Authentication-Warning: buffy.york.ac.uk: ga9 set sender to gavin@FreeBSD.org using -f From: Gavin Atkinson To: Hans Petter Selasky In-Reply-To: <201103212116.p2LLGPGF021033@svn.freebsd.org> References: <201103212116.p2LLGPGF021033@svn.freebsd.org> Content-Type: text/plain; charset="ASCII" Content-Transfer-Encoding: quoted-printable Date: Tue, 22 Mar 2011 14:40:10 +0000 Message-ID: <1300804810.20711.12.camel@buffy.york.ac.uk> Mime-Version: 1.0 X-Mailer: Evolution 2.32.1 FreeBSD GNOME Team Port Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, thompsa@FreeBSD.org Subject: Re: svn commit: r219845 - head/sys/dev/usb/controller X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Mar 2011 14:40:15 -0000 Hi, On Mon, 2011-03-21 at 21:16 +0000, Hans Petter Selasky wrote: > Date: Mon Mar 21 21:16:25 2011 > New Revision: 219845 > URL: http://svn.freebsd.org/changeset/base/219845 >=20 > Log: > - Bugfix: Fix a EHCI hardware race, where the hardware computed data to= ggle > value is updated after that we read it in the queue-head. This patch ca= n > fix problems with BULK timeouts. The issue was found on a Nvidia chipse= t. >=20 > Modified: > head/sys/dev/usb/controller/ehci.c >=20 > Modified: head/sys/dev/usb/controller/ehci.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/dev/usb/controller/ehci.c Mon Mar 21 21:16:12 2011 (r219844) > +++ head/sys/dev/usb/controller/ehci.c Mon Mar 21 21:16:25 2011 (r219845) > @@ -1180,6 +1180,26 @@ _ehci_remove_qh(ehci_qh_t *sqh, ehci_qh_ > return (last); > } > =20 > +static void > +ehci_data_toggle_update(struct usb_xfer *xfer, uint16_t actlen, uint16_t= xlen) > +{ > + uint8_t full =3D (actlen =3D=3D xlen); style(9) strongly advises against initialising variables in the declaration. > + uint8_t dt; > + > + /* count number of full packets */ > + dt =3D (actlen / xfer->max_packet_size) & 1; > + > + /* cumpute remainder */ > + actlen =3D actlen % xfer->max_packet_size; > + > + if (actlen > 0) > + dt ^=3D 1; /* short packet at the end */ > + else if (!full) Especially in this case - this would seem to be better written as else if (actlen !=3D xlen) > + dt ^=3D 1; /* zero length packet at the end */ > + > + xfer->endpoint->toggle_next ^=3D dt; > +} As an aside, over the years there are several PRs about bulk timeouts on EHCI on nVidia - is it possible that this fixes any of them? Some of the PRs date back to 6.x and 7.x - if I'm understanding the change properly, it seems that it is possible that this could be the cause? Do you have any opinions on whether this could fix any of those PRs? Thanks, Gavin --=20 Gavin Atkinson FreeBSD committer and bugmeister GPG: A093262B (313A A79F 697D 3A5C 216A EDF5 935D EF44 A093 262B)