From: Marcel Holtmann <marcel@holtmann.org>
To: Oliver Neukum <oliver@neukum.org>
Cc: linux-bluetooth@vger.kernel.org, linux-usb@vger.kernel.org
Subject: Re: [rfc]btusb with SCO support
Date: Mon, 18 Aug 2008 16:10:20 +0200 [thread overview]
Message-ID: <1219068620.7591.52.camel@violet.holtmann.net> (raw)
In-Reply-To: <200808181552.52655.oliver@neukum.org>
Hi Oliver,
> > > > > > > here's my current version of btusb with SCO support. This is preliminary.
> > > > > > > I am still looking at a way to delay using the higher altsettings until SCO
> > > > > > > is actually used, but the timeouts seem to be too long to do the obvious.
> > > > > >
> > > > > > the module parameter and blacklist/quirks stuff has been merged upstream
> > > > > > with Linus now. Feel free to update your SCO support patch and then lets
> > > > > > get this merged.
> > > > >
> > > > > Still testing. I am new to bluetooth so getting a sound testing environment
> > > > > up takes a bit of time. I am getting iso urbs to complete now.
> > > >
> > > > I hacked up a version that does work fine for me and has been tested on
> > > > my Quad G5. The attached applies on top of 2.6.27-rc3.
> > > >
> > > > The alternate settings are still fixed to selecting #2, however the
> > > > change to always select the appropriate one would be simple. We only
> > > > need to calculate the right value. The killing and re-submitting URB
> > > > code is already present.
> > >
> > > This approach has a principal race condition. You have no idea when
> > > the work queue will be run. Thus you can lose the first SCO packages.
> >
> > I am open for suggestions, but I don't see any other way to get support
> > for this. We can't keep the isoc URBs running all the time, because that
> > consumes power.
>
> How much? Or rather why not change the altsetting to the maximum
> on open and defer submitting the URBs to notify() ?
run powertop and you will see why we can't do that. Also there is no max
altsetting. It doesn't work like this. You have to pick the right one.
The Bluetooth USB spec. is messed up when it comes to SCO.
> > On the other hand, this is audio and I don't really care if we loose a
> > packet or not.
>
> It isn't limited to sound. The URBs for acl reception can also be delayed
> arbitrarily long.
We can move that into the notify() callback, but the killing the URBs
becomes a problem.
On the other hand, ACL shouldn't be any problem since there is a HCI
connection setup in between and the ACL part of Bluetooth is reliable
and we have flow control on it.
Also these are bulk URBs. I am under the assumption that the Bluetooth
controller will queue packets up until we submit the first URB.
> > > Secondly, what happens when this next event comes so quickly that
> > > the work is still scheduled or running? it seems to me that the work handler
> > > can read stale conn_hash values.
> >
> > I don't see that happening since Bluetooth connection setup is
> > serialized and we only have to make sure that bulk and isoc URBs are
> > running when the connection is up.
>
> CPU A CPU B
> HCI_NOTIFY_CONN_ADD
> schedule_work(&data->work);
> hdev->conn_hash.acl_num > 0
> HCI_NOTIFY_CONN_DEL
> schedule_work(&data->work);
>
> will the work handler run again?
As I said, the ACL and SCO connection setup is serialized. While in
theory this can happen, I don't see it in practice.
What would be your proposal to handle this in a cleaner way?
Regards
Marcel
next prev parent reply other threads:[~2008-08-18 14:10 UTC|newest]
Thread overview: 47+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-07-31 12:52 [rfc]btusb with SCO support Oliver Neukum
2008-07-31 14:03 ` Marcel Holtmann
2008-07-31 15:21 ` Oliver Neukum
2008-08-01 17:42 ` Marcel Holtmann
2008-08-02 23:47 ` Alan Stern
2008-08-01 10:32 ` Oliver Neukum
2008-08-01 17:43 ` Marcel Holtmann
2008-08-01 11:57 ` Oliver Neukum
2008-08-01 17:45 ` Marcel Holtmann
2008-08-04 8:33 ` Oliver Neukum
2008-08-04 16:05 ` Marcel Holtmann
2008-08-04 16:23 ` Oliver Neukum
2008-08-04 16:33 ` Marcel Holtmann
2008-08-04 17:01 ` Oliver Neukum
2008-08-04 17:25 ` Marcel Holtmann
2008-08-04 18:32 ` Oliver Neukum
2008-08-04 20:24 ` Marcel Holtmann
2008-08-05 11:15 ` Oliver Neukum
2008-08-08 21:14 ` Marcel Holtmann
2008-08-12 20:53 ` Oliver Neukum
2008-08-12 21:36 ` Marcel Holtmann
2008-08-13 15:16 ` Oliver Neukum
2008-08-13 18:23 ` Marcel Holtmann
2008-08-18 10:13 ` Marcel Holtmann
2008-08-18 12:57 ` Oliver Neukum
2008-08-18 13:38 ` Marcel Holtmann
2008-08-18 13:52 ` Oliver Neukum
2008-08-18 14:10 ` Marcel Holtmann [this message]
2008-08-18 14:27 ` Oliver Neukum
2008-08-18 14:36 ` Marcel Holtmann
2008-08-18 14:38 ` Oliver Neukum
2008-08-18 15:12 ` Marcel Holtmann
2008-08-18 16:03 ` Oliver Neukum
2008-08-18 17:07 ` Marcel Holtmann
2008-08-18 21:26 ` Oliver Neukum
2008-08-19 4:05 ` Marcel Holtmann
2008-08-19 7:03 ` Oliver Neukum
2008-08-19 7:19 ` Marcel Holtmann
2008-08-19 7:30 ` Oliver Neukum
2008-08-19 7:52 ` Marcel Holtmann
2008-08-19 14:49 ` Alan Stern
2008-08-19 15:18 ` Marcel Holtmann
2008-08-19 15:53 ` Alan Stern
2008-08-19 18:19 ` Marcel Holtmann
2008-08-19 18:57 ` Alan Stern
2008-08-20 6:39 ` Dave Higton
2008-08-20 13:50 ` Alan Stern
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1219068620.7591.52.camel@violet.holtmann.net \
--to=marcel@holtmann.org \
--cc=linux-bluetooth@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=oliver@neukum.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox