Subject: Re: kern/34070: btconfig: SIOCSBTFLAGS: Resource temporarily
To: Matthias Drochner <M.Drochner@fz-juelich.de>
From: Iain Hibbert <plunky@rya-online.net>
List: netbsd-bugs
Date: 11/25/2006 09:32:02
On Fri, 24 Nov 2006, Matthias Drochner wrote:

> [data toggle code in ehci.c]
> M.Drochner@fz-juelich.de said:
> > The code above looks bogus - I can't imagine how transactions which
> > are not executed could contribute to the state of the data toggle
> > protocol.
>
> Now I understand that that code (partially) rolls back a data toggle
> pre-computation in ehci_alloc_sqtd_chain().

> There is an obvious flaw however: It doesn't care about alignment
> wrt wMaxPacketSize, so it will miss a packet under some conditions.

> I'm not so eager to mess with that code right now, but I see an easy
> workaround which is at least good to prove that theory: Allocate
> transfer buffers in multiples of wMaxPacketSize.

> With the appended patch my ubt initializes, and an "btconfig -vvv"
> finishes successfully.

Why 272, does 256 work?  HCI_EVENT_PKT_SIZE is 256 - I only subtract the 1
because USB adaptors do not provide the type octet, but it does not really
matter if an extra byte is allocated.

Not that I can suggest masking such a bug by conforming to a hidden magic
number (I wonder if 16 is a generally used value)

iain