Commit Graph

17 Commits

Author SHA1 Message Date
Duy Truong
04e554807c Update copyright to The Linux Foundation
Change-Id: Ibead64ce2e901dede2ddd1b86088b88f2350ce92
Signed-off-by: Duy Truong <dtruong@codeaurora.org>
2013-03-15 17:07:39 -07:00
Stephen Boyd
9263fbdb9c bluetooth: Add interrupt.h and module.h
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
2013-02-25 11:39:39 -08:00
Peter Krystad
55456e1833 Bluetooth: Remove holding lock when sending A2MP message
Remove holding the AMP manger list lock when sending the
A2MP Change Notify message, as this uses L2CAP and will
lock the socket and possibly sleep.

This removes a potential deadlock and a "BUG: sleeping
function called from invalid context" message from the
kernel log.

Change-Id: Icf8c5afc1a5cde36517bb979820c83a20ee207fd
CRs-fixed: 358736
Signed-off-by: Peter Krystad <pkrystad@codeaurora.org>
2013-02-25 11:39:34 -08:00
Peter Krystad
ffbdb5f0b3 Bluetooth: Hold ref on hci_conn when setting up A2MP fixed channel
Take a reference on the hci_conn and do not de-reference l2cap_conn
while setting up the A2MP fixed channel. l2cap_conn is not reference
counted and may go away before the channel is set up.

This fixes scenario where the ACL disconnects (and l2cap_conn goes
away) while amp_conn_ind worker is running or is on the workqueue
waiting to run.

Change-Id: I10fc6d9b146fcc5e010f26a046f7e0570f2b93dd
CRs-fixed: 347079
Signed-off-by: Peter Krystad <pkrystad@codeaurora.org>
2013-02-25 11:39:21 -08:00
Peter Krystad
f142de5aa8 Bluetooth: Ensure full A2MP msg is pulled from skb
Ensure the full A2MP Get Info Response message is pulled from the
skb when the status is not SUCCESS. Also fix similiar scenario in
Get AMP Assoc and remove unneeded check for mismatched id's.

Change-Id: Ia676d89238113e24f06aaa5d9e955afcc4de0307
Signed-off-by: Peter Krystad <pkrystad@codeaurora.org>
2013-02-25 11:38:57 -08:00
Peter Krystad
bd53fa1368 Bluetooth: Use hci dev number as AMP controller ID
Previously an offset was added to the hci dev number to generate the
AMP controller ID, because it was possible for the PAL to register
as hci0, and 0 is invalid for an AMP controller ID. Since this commit
462bf76d294a480c775a040476bd7eb81f718ec2 it is not possible for
the PAL to register as hci0, so this offset is no longer necessary.

Change-Id: I4b01ddca5fad3aebeb4c138b5aee8819bb146f3d
Signed-off-by: Peter Krystad <pkrystad@codeaurora.org>
2013-02-25 11:38:34 -08:00
Peter Krystad
3f1b7befbd Bluetooth: Release module reference counts
In three places a reference was taken without being returned.

Change-Id: I15b9ab7de530a77832d8b10fe756cfdf0b01760f
Signed-off-by: Peter Krystad <pkrystad@codeaurora.org>
2013-02-25 11:38:34 -08:00
Peter Krystad
cc2c4bc328 Bluetooth: Remove _bh locking for AMP Manager
Since all AMP Manager processing is done on work queues no
bottom-half locking is required.

CRs-fixed: 318632
Change-Id: I3a07c412ccf30d62d68cc80124fad5700bcc0917
Signed-off-by: Peter Krystad <pkrystad@codeaurora.org>
2013-02-25 11:38:30 -08:00
Mat Martineau
b80939247e Bluetooth: Adjust socket reference count when setting up AMP link.
Using the reference count ensures that the socket pointer passed to
the AMP manager remains valid.

Change-Id: I5b9cd4bdf25350f1daa436be2723745f57de0706
Signed-off-by: Mat Martineau <mathewm@codeaurora.org>
2013-02-25 11:37:42 -08:00
Peter Krystad
adf7b4f503 Bluetooth: Fix handling of simultaneous A2MP Create Phys Link requests
A2MP Create Physical Link requests must be processed sequentially. When
one is received while processing another defer it until the first one
is finished.

Change-Id: I83ff970e6d26372eb5e609885e5620ee87a79b9f
Signed-off-by: Peter Krystad <pkrystad@codeaurora.org>
CRs-fixed: 290103, 292790
2013-02-25 11:37:40 -08:00
Peter Krystad
43f853bc07 Bluetooth: Make A2MP default MTU and MPS equal
BT 3.0 spec states MTU and MPS for A2MP fixed channel are to be
equal.

Change-Id: Iad068234c2f5393c96b2ae33d0b7b65e09683e36
Signed-off-by: Peter Krystad <pkrystad@codeaurora.org>
2013-02-25 11:37:38 -08:00
Peter Krystad
d4aafb5c8b Bluetooth: Set A2MP CID as before calling kernel_connect()
Changes made for BT 4.0 mean the A2MP CID must be set before
kernel_bind() and kernel_connect() are used to create the A2MP
kernel socket.

Change-Id: Ie0d471701f0f323bd589b1f92b3044ab91537ec8
Signed-off-by: Peter Krystad <pkrystad@codeaurora.org>
2013-02-25 11:37:37 -08:00
Peter Krystad
b70d55655e Bluetooth: Check BR-EDR link security before creating AMP Physical Link
BT 3.0+HS spec requires that encryption be enabled on the BR-EDR ACL
link before any AMP links may be created.

CRs-fixed: 288818
Signed-off-by: Peter Krystad <pkrystad@codeaurora.org>
2013-02-25 11:37:35 -08:00
Peter Krystad
6bead50447 Bluetooth: Handle A2MP Discover Response extended feature mask
The A2MP Discover response may contain a variable length
feature mask field, which is extended by setting a bit every
two octets. Previously it was assumed this field was a fixed
size of 2 octets.

CRs-fixed: 285775
Change-Id: Iec5eab15c84c572530900b6e5028125a85bc0492
Signed-off-by: Peter Krystad <pkrystad@codeaurora.org>
2013-02-25 11:37:29 -08:00
Peter Krystad
e610a258ef Bluetooth: Cancel Phy Link creation when remote A2MP response != success
When an AMP Manager initiating a Physical Link receives the A2MP
Create Physical Link response message from the remote device it has
already started the physical link creation process with the local
AMP Controller. It should cancel this creation process if the remote
device indicates it will not accept the link.

Change-Id: I4dc67cf5f798347ace7030a94e0a50b0e74f93be
Signed-off-by: Mat Martineau <mathewm@codeaurora.org>
2013-02-25 11:37:19 -08:00
Peter Krystad
97eaabfa0f Bluetooth: Handle A2MP Get Info extended feature mask
The A2MP Discover response may contain a variable length
feature mask field, which is extended by setting a bit every
two octets. Previously it was assumed this field was a fixed
size of 2 octets.

Change-Id: I768d2a8d883fde293d46acdf7a6b36b185ecaa95
Signed-off-by: Mat Martineau <mathewm@codeaurora.org>
2013-02-25 11:37:18 -08:00
Peter Krystad
4b46819f6c Bluetooth: Added AMP manager and support for use of AMP channels.
Bluetooth 3.0+HS depends on an AMP manager to coordinate the setup and
teardown of AMP physical and logical links using the A2MP protocol.
There are also new L2CAP signals that allow two Bluetooth devices to
move L2CAP channels to and from a high-speed link, and a new socket
option for applications to use to control the type of Bluetooth link
used for L2CAP traffic.

Change-Id: I98067e0781b31f5d694e7b7da5cf5006dc21f514
Signed-off-by: Mat Martineau <mathewm@codeaurora.org>
2013-02-25 11:37:13 -08:00