Commit graph

22771 commits

Author SHA1 Message Date
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
bad519927b Bluetooth: Use proper sock reference counting in L2CAP
A socket can be shut down while pointer to that socket is stored in a
queued skbuff or in a pending workqueue struct. Correct use of socket
reference counting will make sure the socket struct stays around until
there are no remaining references.

Change-Id: Ic3679e023a46b224929b3cefb6370d7871e3368a
CRs-fixed: 313736
Signed-off-by: Mat Martineau <mathewm@codeaurora.org>
2013-02-25 11:38:27 -08:00
Royston Rodrigues
cab30986ca Bluetooth: EIR to carry update local device name.
Whenever local device name is changed, EIR payload
is updated with the modified local device name.

CRs-fixed: 314228
Change-Id: Ib2ec05b6ac4f4a55612716f0567ee04056579ed6
Signed-off-by: Royston Rodrigues <roystonr@codeaurora.org>
2013-02-25 11:38:26 -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
Brian Gix
260dc21726 Bluetooth: Don't use incomplete LE LTKs to secure link
If LE link gets terminated during the pairing process, it
may leave SMP with half of a Long Term Key. This fix ensures
that this partial information is not used for future links.

Change-Id: Ib834fc81d7b4b558cc3d242522acef80dd1d8827
Signed-off-by: Brian Gix <bgix@codeaurora.org>
2013-02-25 11:38:23 -08:00
Peter Krystad
129db6fdb3 Bluetooth: Check that remote supports A2MP before creating channel
Before attempting to create a channel directly on an AMP check
that the remote device supports A2MP signalling before starting
the physical link creation process.

Change-Id: Iac2bcebf9630368685e24e636e39ffa82651705d
Signed-off-by: Peter Krystad <pkrystad@codeaurora.org>
2013-02-25 11:38:21 -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
Brian Gix
bd7586d763 Bluetooth: Fix error returned to bluez on LE Pairing Failure
Change-Id: I1e7908e133d53b41bdd58a54a2e293526e96e160
Signed-off-by: Brian Gix <bgix@codeaurora.org>
2013-02-25 11:38:19 -08:00
Brian Gix
82c88a73d9 Bluetooth: Fix LE pairing scenarios when initiated remotely
Fix setting of ENCRYPTION_PENDING and Connection refcnt's that could
be out of sync due to remote slave issued security requests.

Change-Id: Ie72abd0648182db0ef60693820139f40ef2e4bf6
Signed-off-by: Brian Gix <bgix@codeaurora.org>
2013-02-25 11:38:18 -08:00
Inga Stotland
7b18f01664 Bluetooth: Socket lookup for a fixed L2CAP channel
Socket lookup for a fixed channel should be done based on both remote and
local device addresses.

Change-Id: I35f39bea8ade6fd5d8695640251efc54bf21beae
Signed-off-by: Inga Stotland <ingas@codeaurora.org>
2013-02-25 11:38:17 -08:00
Brian Gix
326abc1bd7 Bluetooth: Timeout LE Connection requests
If LE devices stop advertising or go out of range, we need
to apply a timeout because the baseband doesn't.

Change-Id: I115672e21fd8aef56ac688b2df4664bb74b725e4
Signed-off-by: Brian Gix <bgix@codeaurora.org>
2013-02-25 11:38:16 -08:00
Mat Martineau
dab4d4a92c Bluetooth: Revert "Bluetooth: Increase AUTO_OFF timeout for HCI devices"
This reverts commit 24fac10d7e110035f61cf4bd69018adc84f15fc1.

Signed-off-by: Mat Martineau <mathewm@codeaurora.org>
2013-02-25 11:38:15 -08:00
Mat Martineau
89a2ae611a Bluetooth: Increase AUTO_OFF timeout for HCI devices
The previous timeout (2 seconds) was too short for use with the 8960.
New timeout is 20 seconds.

Signed-off-by: Mat Martineau <mathewm@codeaurora.org>
2013-02-25 11:38:14 -08:00
Peter Krystad
360e44a15c 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.

Signed-off-by: Peter Krystad <pkrystad@codeaurora.org>

Conflicts:

	include/net/bluetooth/hci.h
	include/net/bluetooth/hci_core.h
	net/bluetooth/l2cap_core.c
2013-02-25 11:38:13 -08:00
Matt Wagantall
25b7dead80 msm: clock-8x60: Add local control of vpe_axi_clk and vpe_axi_clk
The MAXI_EN2 register is no longer owned by the RPM. Add local
control of the VPE and Rotator AXI clocks which are in it.

Signed-off-by: Matt Wagantall <mattw@codeaurora.org>
2013-02-25 11:38:13 -08:00
Brian Gix
396b6c6960 Bluetooth: Complete LE Auth failure notification
Change-Id: Iccfe8abb7e1043196765748accbcc89fbd31578b
Signed-off-by: Brian Gix <bgix@codeaurora.org>
2013-02-25 11:38:11 -08:00
Peter Krystad
b92ec8a86c Bluetooth: Guarantee BR-EDR device will be registered as hci0
Change-Id: Ia7ed658dbae6e856ea861511ab6b912d5845c758
Signed-off-by: Peter Krystad <pkrystad@codeaurora.org>
2013-02-25 11:38:10 -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
4c6beba56e Bluetooth: Balance LE hdev refcnt when not pairing.
Change-Id: I6a7df0b22c0e016e36b5b765c148bf1c2dc1c79a
Signed-off-by: Brian Gix <bgix@codeaurora.org>
2013-02-25 11:38:08 -08:00
Srinivas Krovvidi
315ced665e Bluetooth: Storing Link key persistantly based on the Auth Req.
Store the link key persistently if one of the following is true:
 1. this is a legacy link key
 2. this is a changed combination key and there was a previously
    stored one
 3. neither local nor remote side had no-bonding as a requirement
 4. the local side had dedicated bonding as a requirement
 5. the remote side is using dedicated bonding since in that case
    also the local requirements are set to dedicated bonding
 If none of the above match only keep the link key around for
 this connection and set the temporary flag for the device.

Change-Id: Ib41bbd16dd964fd21214d9e784579b7092658a66
CRs-Fixed: 309161
Signed-off-by: Srinivas Krovvidi <skrovvid@codeaurora.org>
2013-02-25 11:38:07 -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
Peter Krystad
178a82f936 Revert "Bluetooth: check L2CAP length in first ACL fragment"
This reverts commit 8979481328

CRs-fixed: 305959
Change-Id: I897ba350fc9106f32265ba8cabb846494fb36f69
Signed-off-by: Peter Krystad <pkrystad@codeaurora.org>
2013-02-25 11:38:06 -08:00
Mat Martineau
7ae9dd7d4c Bluetooth: AMP move collision loser should not change move state
During a move collision, both devices start out thinking they are the
initiator. The loser of the collision switches from the initiator role
to the responder role when receiving a move request from the remote
device.  However, a move response will also be received by the loser
after the role switch has occurred.

The loser of the collision was incorrectly modifying the AMP move
state in the move response handler.  This kept it from sending a move
channel response to the remote device, which stalled the channel move
process.

This change makes sure the AMP move state remains valid, so the
channel move succeeds.

CRs-fixed: 308382
Change-Id: Ib7897782e5f3276ab93dddb0ebc0cd662ae45937
Signed-off-by: Mat Martineau <mathewm@codeaurora.org>
2013-02-25 11:38:05 -08:00
Prabhakaran Mc
79da2d5cf4 Bluetooth: Remove old link key before reinitiating authentication
When remote device do not have link key, DUT will try to reinitiate
authentication process. We should remove the link key before
reinitiating authentication process. This was fixed in hciops in
Bluez user space. Adding this change for mgmtops to handle this
case in kernel space.

CRs-fixed: 307063
Change-Id: I6a3f7ee2b73b609a663bf18b21a6852230668c29
Signed-off-by: Prabhakaran Mc <prabhakaranmc@codeaurora.org>
2013-02-25 11:38:04 -08:00
Mat Martineau
912ad18e18 Bluetooth: Wait for info response before accepting AMP connection
An incoming AMP "create channel" connection would trigger an info
request and an AMP physical accept sequence at the same time.  Since
accepting an AMP physical link is a local operation, it would complete
quickly and send a config request before the info response was
received.

If there is an outstanding info request, the AMP physical link should
not be accepted yet.  Existing logic in l2cap_conn_start() will accept
the physical link when the info response is received.

CRs-fixed: 307243
Change-Id: I600f25f9d7a2fbb9619639e4114ec0757afc6703
Signed-off-by: Mat Martineau <mathewm@codeaurora.org>
2013-02-25 11:38:03 -08:00
Brian Gix
535024c78e Bluetooth: Fix Deadlock on Legacy Scan/Pair
Fix nested calls to hci_dev_lock().

Change-Id: I968faaae59f300bb5a45cd279028488bd7dfcb11
Signed-off-by: Brian Gix <bgix@codeaurora.org>
2013-02-25 11:38:02 -08:00
Inga Stotland
4031d1ffbd Bluetooth: Fix logic in hci_power_on().
If hci_dev_open() returns no error or EALREADY, allow the power on
sequence to proceed.

Change-Id: Ia0a66bc210cfb90b4d889a6d400a889fa19ba240
Signed-off-by: Inga Stotland <ingas@codeaurora.org>
2013-02-25 11:38:01 -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
Brian Gix
4caf0d49b4 Bluetooth: Fix LE Pairing on previous connections
There was a crashing issue when pairing was performed on LE connections
that were already up, due to a NULL function pointer being followed.

Change-Id: Idba323c8fea58dff516ded91c893f8ca1f293f91
Signed-off-by: Brian Gix <bgix@codeaurora.org>
2013-02-25 11:38:00 -08:00
Brian Gix
3cc80ce399 Bluetooth: Fix dead-lock failure during LE scan
Timer being deleted durings it's time-out callback execution caused
spinlock deadlock on multicore systems.

CRs-fixed: 305677
Change-Id: Id3d9b41410ea30120c9292f8a15fdbf2d86941e4
Signed-off-by: Brian Gix <bgix@codeaurora.org>
2013-02-25 11:37:59 -08:00
Brian Gix
b0fd66f9f6 Bluetooth: Fix balancing of hci_conn refcnts
When LE was added, the refcnt's for the hci_conns used were not balanced
and some of this bleeded over between LE pairing and Legacy pairing.

CRs-fixed: 305391
Change-Id: I31070ae827f2eb5a59b317a0ee4bd80eae9e2aa0
Signed-off-by: Brian Gix <bgix@codeaurora.org>
2013-02-25 11:37:58 -08:00
Peter Krystad
2b89059eed Bluetooth: Only send mgmt_ops messages for BR-EDR devices
Change-Id: I68ef90d9c6626fe4070424a9334442362e4586ef
Signed-off-by: Peter Krystad <pkrystad@codeaurora.org>
2013-02-25 11:37:57 -08:00
Brian Gix
4fe35cf404 Bluetooth: Fix balance of hci_dev_get/hci_dev_put
Change-Id: I343a5a4db31e9f6ee696de34ca094c63319e7722
Signed-off-by: Brian Gix <bgix@codeaurora.org>
2013-02-25 11:37:56 -08:00
Brian Gix
815e25827f Bluetooth: Fix Init Link Policy
Redundant calls to hci_setup_event_mask() prematurly exited Init state
when first call when erroneously detected as the last cmd sent.

CRs-fixed: 302804

Change-Id: Ifac887ba134c52df524ecfe289d2f930ba360a2c
Signed-off-by: Brian Gix <bgix@codeaurora.org>
2013-02-25 11:37:55 -08:00
Srinivas Krovvidi
3e3c49c4b8 Bluetooth: Changes to handle cfm cb only after dlc is linked to session.
Change-Id: Ic017491ad1a27ced8fa7d217a4671f7c0faac6b0
CRs-Fixed: 304043
Signed-off-by: Srinivas Krovvidi <skrovvid@codeaurora.org>
2013-02-25 11:37:55 -08:00
Brian Gix
1fc4bd4dd3 Bluetooth: Fix kernel hci_dev_open timeout reset
Handle -EALREADY error in hci_sock of hci_dev_open as indication that
the HCI device is already open. This was causing reset inducing timeout,
and removed unused/useless check of failure in power-up code.

Change-Id: Iaa4365616df0b444cf7ed320fec5ecce82e1c256
Signed-off-by: Brian Gix <bgix@codeaurora.org>
2013-02-25 11:37:54 -08:00
Mallikarjuna GB
4d53fe7deb Bluetooth : RFCOMM Frame size change
RFCOMM Frame size changes to accomodate the credits in the data packet.
Earlier implementation was not considering the 1 Byte required for
Credits information in data packet and hence was considering the
RFCOMM header plus FCS as 5 Bytes.
Because of this if the remote device sends a data packet with
negotiated frame size and credits information,packet size exceeds L2CAPMTU
and will be discarded by L2CAP.

CRs-fixed: 303518

Change-Id: Ib1be3c53a64745b916a3a3cdb5119e6acd892717
Signed-off-by: Mallikarjuna GB <gbmalli@codeaurora.org>
2013-02-25 11:37:53 -08:00
Brian Gix
85f95b4d26 Bluetooth: Fix size of data for LTK Randomizer
Change-Id: Idf37da646def68be6e744cff1e1fb5092eccb09a
Signed-off-by: Brian Gix <bgix@codeaurora.org>
2013-02-25 11:37:52 -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
Inga Stotland
a9342681d8 Bluetooth: Handle disconnect for LE links.
Additional check whether the disconnect request is
coming on LE link.

Change-Id: I525efe6f3b0eeafbec2c5b60ba0a10b7cd298eea
Signed-off-by: Inga Stotland <ingas@codeaurora.org>
2013-02-25 11:37:50 -08:00
Mat Martineau
4c0394c36c Bluetooth: Change socket release context
When sock_put() is called on an L2CAP socket, if the reference count
on a sock goes to 0, l2cap_sock_release() is called. As part of the
release, l2cap_sock_shutdown() locks the socket. This is not allowable
in interrupt context.  This change makes calls to sock_put() on the
system workqueue, where it can safely lock.

This addresses "scheduling while atomic" issues in both the Bluetooth
mgmt_ops pairing code and when RFCOMM sessions are deleted in a
security_cfm callback.

Change-Id: I4ff91a6849ec29707731adce2ccd40a7ada386a8
Signed-off-by: Mat Martineau <mathewm@codeaurora.org>
2013-02-25 11:37:49 -08:00
Brian Gix
dc7314fec4 Bluetooth: Fix Connection persistence, SSP caching
Fix key storage when not bonding
Fix when LE ACL is disconnected after use

Change-Id: I4425612ebc3720d614c43574ddfc449722eb26d2
Signed-off-by: Brian Gix <bgix@codeaurora.org>
2013-02-25 11:37:49 -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