Commit graph

5063 commits

Author SHA1 Message Date
Sunny Kapdi
cdf6dea686 bluetooth: Add support for remote_features
Expose Bluetooth remote features to the userspace. A2DP profile
setup in the userspace would need this information to
determine if the remote side supports EDR ACL link or not.

Change-Id: Ib6713707baaf30ffe872247313b2185ae2897385
Signed-off-by: Sunny Kapdi <sunnyk@codeaurora.org>
2013-02-25 11:39:10 -08:00
Mat Martineau
bbe15d54ea Bluetooth: Lock sockets when closing HCI device
When a Bluetooth device is powered down while RFCOMM connections are
open, there are race conditions where RFCOMM tries to use an HCI
connection after the data structures have been deleted.  Since the
powerdown procedure runs in process context, it is possible to lock
sockets before accessing them to close connections.  This change adds
that locking, which will serialize socket access between processors
during powerdown.

Change-Id: I587720799b35d9ee6e66340bdeda8a2b9e2ea7b5
CRs-fixed: 336893
Signed-off-by: Mat Martineau <mathewm@codeaurora.org>
2013-02-25 11:39:09 -08:00
Brian Gix
cf04fcf4e7 Bluetooth: Use seperate socket for LE ATT Server
Because traffic between the local GATT client(s) and
remote servers are subject to different controls than
remote clients and the local server, all on the shared
fixed CID, it is important to manage the traffic on
seperate sockets.

Change-Id: I62385143c86522f4b123b32592b69f2a0ae6dc76
CRs-fixed: 336029
Signed-off-by: Brian Gix <bgix@codeaurora.org>
2013-02-25 11:39:06 -08:00
Brian Gix
155c8d2a6f Bluetooth: Fix ATT MTU size to 23
We only support a 23 octet MTU, so auto-respond to all
MTU change requests with the 23 octet response.

Change-Id: Ic69d5f068759d983f8cd98b329acbb9d3a481c49
CRs-fixed: 336025
Signed-off-by: Brian Gix <bgix@codeaurora.org>
2013-02-25 11:39:05 -08:00
Brian Gix
8cc56a66e6 Bluetooth: Fix LE Connection refcnts
Some rebalancing of refcnts due to issues found during testing:

Refcnt was not being released on security completion, if local side
was paired but the remote side had deleted the pairing info, and then
the re-pair failed to complete successfully.

Additionally, the refcnt was not held-released properly if pairing
was initiated due to the client socket being opened with security
level elevated from the start.

Change-Id: I120fed4dc74035d280781ca949a23d4cbcfa3f3e
CRs-fixed: 335993
Signed-off-by: Brian Gix <bgix@codeaurora.org>
2013-02-25 11:39:04 -08:00
Srinivas Krovvidi
6fefa46cee Bluetooth: Reading remote device lmp_version from controller.
On ACL connection complete with a remote device, the remote
device lmp version should be available with Controller. The
current change is to read this information from controller to
host and update to bluez userspace through management APIs.

Change-Id: Ie152ed98fa0a6cf9ab170a6bb8c6a05b5b9dfcb0
Signed-off-by: Srinivas Krovvidi <skrovvid@codeaurora.org>
2013-02-25 11:38:54 -08:00
Mat Martineau
b3d0386b2f Bluetooth: Fix timeout configuration for AMP channels
When doing L2CAP configuration, use the correct retransmit and monitor
timeouts when configuring (or reconfiguring) AMP channels. The host
stack needs to use the timeouts read from incoming configuration
responses, and write appropriate timeouts when sending configuration
responses.

Change-Id: I1271ade93dbfee58a1cac115280704a327e901b2
Signed-off-by: Mat Martineau <mathewm@codeaurora.org>
2013-02-25 11:38:54 -08:00
Brian Gix
a0bfd58531 Bluetooth: Discovery Timer stability fixes
This change prevents running timers from being re-initialized
which causes system instablility. Also prevents starting a
discovery operation when already in progress.

CRs-fixed: 328673
Change-Id: Icda36a25fdcb40dab4f95f9cc39ca124b299e308
Signed-off-by: Brian Gix <bgix@codeaurora.org>
2013-02-25 11:38:53 -08:00
Srinivas Krovvidi
ea33fe6962 Bluetooth: Support for writing hci flush timeout parameter.
Added Flush Timeout parameter setting for l2cap channel. Bluetooth
profiles using l2cap can set this parameter to flush out the data
when it cannot be sent over the air with in timeout duration.

Change-Id: I60420c5be3a790aff26bc30e8089fdca47a99222
Signed-off-by: Srinivas Krovvidi <skrovvid@codeaurora.org>
2013-02-25 11:38:52 -08:00
Srinivas Krovvidi
94010817b9 Bluetooth: Management API changes in Bluetooth to update remote Class.
When connection initiated from the remote device the class of device
information is required to be updated to userspace through this
event.

Change-Id: I97d715a0b80e12d414ecf03d099955c8b12c82b4
Signed-off-by: Srinivas Krovvidi <skrovvid@codeaurora.org>
2013-02-25 11:38:48 -08:00
Peter Krystad
f349a2f099 Bluetooth: Fix possible access of hci_chan after it is deleted
When the connection is not in BT_CONNECTED state it was possible
for code in hci_chan_modify() to attempt to access the hci_chan
structure after it had already been deleted by hci_chan_put().

Change-Id: I5ae352ac12aa3b456e7bcf30633015d98b03e44b
CRs-fixed: 319934
Signed-off-by: Peter Krystad <pkrystad@codeaurora.org>
2013-02-25 11:38:41 -08:00
Brian Gix
387921f639 Bluetooth: Move Discovery timers to hci_dev struct
To prevent timers from expiring on potentiatially free'd dynamic memory.

Change-Id: I8b9685150bcee72fa7ca71b221bc54b54516021e
Signed-off-by: Brian Gix <bgix@codeaurora.org>
2013-02-25 11:38:38 -08:00
Prabhakaran Mc
17c20ba4e9 Bluetooth: changes to implement mgmt_encrypt_link procedure
mgmt_encrypt_link procedure is added by implementing
MGMT_OP_ENCRYPT_LINK and MGMT_EV_ENCRYPT_CHANGE

Change-Id: Ibed6e24c67bbea83318a67c636e02a93518de29d
Signed-off-by: Prabhakaran Mc <prabhakaranmc@codeaurora.org>
2013-02-25 11:38:36 -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
Brian Gix
145f2334b6 Bluetooth: Fix Init sequence when device is restarted
On some platforms, device state data can be left around, and some
commands may take longer than 1 second to execute. This change increases
the per command time-out, and reinitializes the features mask.

Change-Id: Ib707996b97139c97e9a0deacd4a11019cf75da8c
Signed-off-by: Brian Gix <bgix@codeaurora.org>
2013-02-25 11:38:28 -08:00
Brian Gix
3fb0b0ba88 Bluetooth: Add API to set LE Connection Parameters
Include auto-setting connection parameters during Pairing for
low latenecy, and default (high latency) settings for non-Pairing
connections.

Change-Id: Ie8e3f65da52213451dcc01fce38d95ae07d1b13b
Signed-off-by: Brian Gix <bgix@codeaurora.org>
2013-02-25 11:38:27 -08:00
Mat Martineau
90e0ae6107 Bluetooth: Align socket option definitions with upstream kernel
The upstream kernel has acquired new BT socket options since
BT_AMP_POLICY was first defined, now BT_FLUSHABLE is option 8 and
BT_POWER is option 9.  It will save us some future pain if we align
with upstream code now and make BT_AMP_POLICY be option 10.

In addition, the option values for BT_AMP_POLICY were changed during
the upstreaming process.

CRs-fixed: 313757
Change-Id: Ia31e9c8cfd5207a6dd44e40a605d3021f5ce9fd9
Signed-off-by: Mat Martineau <mathewm@codeaurora.org>
2013-02-25 11:38:25 -08:00
Brian Gix
064afd8708 Bluetooth: Cache LE Address Type with LTK, and use for reconnections
LE-Only devices require that an Address Type (Public or Random) be
included in Connection Requests. This info is available at Pairing
but must be cached so that it is available at reconnection time.
This change includes the Address type with the Pairing data.

Change-Id: I50c78ad31d8be70f5c3f49a0529039e4a26daaac
Signed-off-by: Brian Gix <bgix@codeaurora.org>
2013-02-25 11:38:24 -08:00
Peter Krystad
5f3e4d2248 Bluetooth: Set A2MP response timeout to 8 seconds
The A2MP response timeout should be greater than the Connection
Accept timeout set for AMP links, but less than the Link Supervision
Timeout on the BR-EDR link.

This allows for A2MP to fail, but the ACL connection can remain
established, so transfer can continue on BR-EDR.

Change-Id: I654ed12149d9cf194c07b1eb3433e8c23720a209
Signed-off-by: Peter Krystad <pkrystad@codeaurora.org>
2013-02-25 11:38:22 -08:00
Brian Gix
8d6e23ed66 Bluetooth: Generate generic Fails for undeliverable ATT messages
Change-Id: I04f9ec62b15abb090cb90d81442a83caf8caa447
Signed-off-by: Brian Gix <bgix@codeaurora.org>
2013-02-25 11:38:21 -08:00
Brian Gix
caeb7623c8 Bluetooth: Fix Limited Discoverability for MGMTOPS
CRs-fixed: 309551
Change-Id: I42c46c62dcb4b227d9ac48146ee61cb52063a6ae
Signed-off-by: Brian Gix <bgix@codeaurora.org>
2013-02-25 11:38:20 -08:00
Ankur Nandwani
8423582ff1 msm: bluetooth: Adding SMD as a HCI transport
Add the #define for HCI_SMD.

Change-Id: Ie945abc9f18862b3f9997cafba9019c1cb4de782
Signed-off-by: Ankur Nandwani <ankurn@codeaurora.org>
2013-02-25 11:38:12 -08:00
Brian Gix
79ba864f6a Bluetooth: Add EIR flags to LE Adv data cache
Use the EIR flags to prevent LE pairing attempts to
BR/EDR capable (Dual Mode) devices.

Change-Id: I41fc96ea5d912b49502ff15ab5f77da5190beaf4
Signed-off-by: Brian Gix <bgix@codeaurora.org>
2013-02-25 11:38:09 -08:00
Brian Gix
58507d6ea0 Bluetooth: Fix LE Pairing time-out
Timer that was started at beginning of LE Pairing did not correctly
terminate pairing process when it fired, and was not properly cleaned
up on pairing completion.

Change-Id: Idf51bc8bf85cd6939d1d42fc16c7ee3071ab2420
Signed-off-by: Brian Gix <bgix@codeaurora.org>
2013-02-25 11:38:07 -08:00
Brian Gix
cfa732f906 Bluetooth: Add LE/BR flag to Connect notification
When remote device is connected outside the control of BlueZ, it
needs to be informed of whether the new connection is LE or BR/EDR.

Change-Id: I58efe8ed3cf5db2b7cc0b3417447b1e3abcdc1c2
Signed-off-by: Brian Gix <bgix@codeaurora.org>
2013-02-25 11:38:00 -08:00
Prabhakaran Mc
4fd178a155 Bluetooth: SAP Authentication changes
SAP profile requires 16 pin length authentication for BT 1.2/2.0
devices as per specification. These changes were present for hciops
pluging, the current changes are for Management operations plugin.

Change-Id: I4c27c3f833a001dfe7a4abf3db42253939544658
Signed-off-by: Prabhakaran Mc <prabhakaranmc@codeaurora.org>
2013-02-25 11:37:51 -08:00
Brian Gix
d81a637f4d Bluetooth: Add LE SecMgr and mgmtops support
Enabled ECB Block encoding for Low Energy pairing
Implemented missing components of MGMTOPS interface
Differentiated as needed between BR/EDR pairing and LE pairing

Change-Id: Ifb26a9c8ca0c57286fcee92e840835560930c093
Signed-off-by: Brian Gix <bgix@codeaurora.org>
2013-02-25 11:37:48 -08:00
Kun Han Kim
d69ac7ee48 Bluetooth: Added support for HFP 1.6 Wide Band Speech
Signed-off-by: Kun Han Kim <kunhank@codeaurora.org>
Change-Id: Ibc34a0170c1744ff50503a2c0c57dea721715aa8
2013-02-25 11:37:47 -08:00
Peter Krystad
706754941e Bluetooth: Aggregate Best Effort extended flow specs
When multiple Best Effort flow specs with known data rates exist
on an AMP logical link they must be combined and the Flow Spec Modify
command issued for the aggregate flow spec.

Change-Id: Iacab516c3caa4aac8415c107e7f2ec132ea5ddd2
Signed-off-by: Peter Krystad <pkrystad@codeaurora.org>
2013-02-25 11:37:46 -08:00
Peter Krystad
ddbe47015c Bluetooth: Add support for L2CAP Extended Flow Spec option.
Add send and receive of Extended Flow Spec option during L2CAP
lockstep configuration and passing the flow specs to HCI.

Change-Id: I3b229afb5c5e27fd5f36eb0e671c1d2739322c64
Signed-off-by: Peter Krystad <pkrystad@codeaurora.org>
2013-02-25 11:37:45 -08:00
Prabhakaran Mc
98f57fdbad Bluetooth: SAP Authentication changes
The change enables the Bluez user space to  read
security and ssp_mode of current connection.

Change-Id: Ia30a99b6a3d9aaf912ac19548ff7dbf9190113d1
Signed-off-by: Prabhakaran MC <prabhakaranmc@codeaurora.org>
2013-02-25 11:37:44 -08:00
Mat Martineau
2da314c0c6 Bluetooth: Add L2CAP "create channel" functionality
When setting up an initial link over AMP, use "create channel" signals
to start the link rather than doing an initial connection over BR/EDR
and moving the channel to AMP.

Change-Id: I5ebef97d6214e5333f0d1475d90b6f66f89e2d87
Signed-off-by: Mat Martineau <mathewm@codeaurora.org>
2013-02-25 11:37:43 -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
Mat Martineau
7415b2155e Bluetooth: Set outgoing HCI packet boundary flags correctly for AMP.
The Bluetooth spec requires that AMP data packets be flagged as a
"complete L2CAP PDU".

Change-Id: I81339ec4beef40ade3b56e32a923cf52ead07ae2
CRs-fixed: 288928
Signed-off-by: Peter Krystad <pkrystad@codeaurora.org>
Signed-off-by: Mat Martineau <mathewm@codeaurora.org>
2013-02-25 11:37:34 -08:00
Mat Martineau
a50a21e8ee Bluetooth: Add socket buffer headroom for Qualcomm PAL headers.
The Qualcomm AMP PAL needs room to add 802.11 headers to outgoing
frames, but the extra memory overhead is not necessary in other
cases.

CRs-fixed: 288438
Change-Id: Ie546bf702d56e80918c54019b4b0bb4c8bb40e0b
Signed-off-by: Mat Martineau <mathewm@codeaurora.org>
2013-02-25 11:37:33 -08:00
Peter Krystad
86e18bd3a4 Bluetooth: Correct L2CAP timeout constant definitions
Two L2CAP timeouts constants were defined in units of milliseconds but
used as if they were jiffies. Change definition to jiffies.

Change-Id: Ia2837a62bff2a891956b70096c2a9a271060f212
Signed-off-by: Peter Krystad <pkrystad@codeaurora.org>
2013-02-25 11:37:30 -08:00
Mat Martineau
0632037156 Bluetooth: Align LMP_NO_FLUSH with the Bluetooth spec.
Commit 98b351bd from Google incorrectly set the LMP_NO_FLUSH flag
to 0x01, which is actually the extended inquiry flag.

Change-Id: I1014c155105db168f9a67bb6065bbd3c18137345
Signed-off-by: Mat Martineau <mathewm@codeaurora.org>
2013-02-25 11:37:28 -08:00
NaveenKumar
6fa553bd2f Bluetooth: Notify Bluesleep driver about HCI send frame.
Bluesleep driver, out-of-band sleep protocol, needs to be
notified in case of MSM initiated datatransfer to wakeup
BTS chip. This notification is required to turn on UART
clocks. This change was missing in the .38 kernel
which is vital for Bluetooth to work in 7x27.

Change-Id: I6e2004c13d140901c9bdee7a98ca43e2f9c07dc3
Signed-off-by: NaveenKumar <naveenr@codeaurora.org>
2013-02-25 11:37:28 -08:00
Peter Krystad
b897bc4434 Bluetooth: Use common fields for packet- and block-based flow control
Packet-based and block-based flow control use the same counting
method, so re-use the hci_dev fields instead of making a second set.

Change-Id: I2022ae49487a2a56f27d803f3bf522bd5350e60c
Signed-off-by: Mat Martineau <mathewm@codeaurora.org>
2013-02-25 11:37:21 -08:00
Mat Martineau
cf6fb818af Bluetooth: Simplify L2CAP ERTM local busy handling.
Discard any frames received while in the local busy state.  This makes
the code less complex, and results in fewer retransmitted packets
when dealing with lost data.

Change-Id: Id06f923609df1c4e5f7c553355bb8db7794bbe2d
Signed-off-by: Mat Martineau <mathewm@codeaurora.org>
2013-02-25 11:37:21 -08:00
NaveenKumar
375cef1458 net: bluetooth: ioctl entry to modify auth info.
According to the current distributed security logic between
kernel-userspace, the kernel is not aware of the level of
security that a link-key provides when userspace responds
to the link key request. Adding a ioctl entry which will
update the kernel space auth_key's level of security as soon
as userspace responds to the link key request.

CRs-fixed: 264601
Change-Id: I6765cce92a6f8b761742d57ea94e81502f6e7fcf
Signed-off-by: NaveenKumar <naveenr@codeaurora.org>
2013-02-25 11:37:16 -08:00
Inga Stotland
772ed1935f Bluetooth: Reconfiguration of the AMP channel following a move.
AMP controllers have different optimal settings for packet sizes
and checksums, so BT3.0+HS includes the ability to reconfigure
the L2CAP settings when a channel is moved between controllers.

Change-Id: Iad1592104ebc6ac4a9d9ed54b1d763b1786f4a1b
Signed-off-by: Mat Martineau <mathewm@codeaurora.org>
2013-02-25 11:37:14 -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
Mat Martineau
1406338486 Bluetooth: Add L2CAP ERTM fixed channel support.
The A2MP protocol uses a reliable ERTM channel to coordinate
high-speed AMP channels between two Bluetooth devices.  This
is done using a fixed channel ID, but ERTM carries a lot of
state so the existing approach of hard-coded fixed channel
handlers does not work.  This adds hooks for creation and
use of fixed channel sockets for use within the kernel.

Change-Id: I27363b7882ffc8ec643ffe792b078f253700089b
Signed-off-by: Mat Martineau <mathewm@codeaurora.org>
2013-02-25 11:37:11 -08:00
Peter Krystad
843f44994b Bluetooth: HCI support for AMP controllers.
This adds support for AMP controllers to the Bluetooth HCI layer.
The architecture was agreed upon at the 2010 BlueZ Summit.
A new notion of an "HCI channel" is introduced, which corresponds
with AMP logical links.  AMP controllers are also a new device type,
with a new set of HCI commands and events that need to be supported.

Change-Id: I6dbf96f800cbd6878a37c0a463f5261c8681134c
Signed-off-by: Mat Martineau <mathewm@codeaurora.org>
2013-02-25 11:37:10 -08:00
Mat Martineau
3feca6c5e2 Bluetooth: L2CAP ERTM enhancements.
Enhanced Retransmission Mode (ERTM) is a new feature in BT3.0, and
is a requirement for BT3.0+HS with high-speed AMP controllers.
Some work had already been done to add ERTM support to BlueZ,
but the high-speed feature is more demanding in terms of efficiency
and needs some extended control over ERTM operation.  This commit
includes more robust state machines, no copying of received data,
improved transmit queue management, support for extended headers,
and more robust locking.

Change-Id: I21aba0e3fecb02e901bb174787a37533a923c327
Signed-off-by: Mat Martineau <mathewm@codeaurora.org>
2013-02-25 11:37:09 -08:00
Stephen Boyd
069047086b Revert upstream bluetooth
This undoes all upstream bluetooth core changes since around
b79f44c (Bluetooth: Fix keeping the command timer running,
2011-04-11).

Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
2013-02-25 11:37:04 -08:00
Colin Cross
5500e4fab2 Merge commit 'v3.4' into android-3.4 2012-05-25 13:56:28 -07:00
John W. Linville
6037463148 Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless into for-davem 2012-05-15 16:38:00 -04:00