Date: Tue, 22 Mar 2011 14:40:10 +0000 From: Gavin Atkinson <gavin@FreeBSD.org> To: Hans Petter Selasky <hselasky@FreeBSD.org> 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 Message-ID: <1300804810.20711.12.camel@buffy.york.ac.uk> In-Reply-To: <201103212116.p2LLGPGF021033@svn.freebsd.org> References: <201103212116.p2LLGPGF021033@svn.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
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)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1300804810.20711.12.camel>