Bluetooth: Connection Parameter Update Procedure

This patch adds support for LE Connection Parameters Request Link
Layer control procedure introduced in Core spec 4.1. This procedure
allows a Peripheral or Central to update the Link Layer connection
parameters of an established connection.

Regarding the acceptance of connection parameters, the LL procedure
follows the same approach of L2CAP procedure (see l2cap_conn_param_
update_req function). We accept any connection parameters values as
long as they are within the valid range.

Signed-off-by: Andre Guedes <andre.guedes@openbossa.org>
Bluetooth: New Connection Parameter Event

This patch indroduces a new Mgmt event called "New Connection Parameter".
This event indicates to userspace that the remote device requested new
connection parameters.

The user can store the parameters values specified in this event and
load them into kernel (an upcoming patch will introduce a Mgmt command
to do that). This way, next time a connection is established to that
device, the kernel will use those parameters values instead default
ones.

Signed-off-by: Andre Guedes <andre.guedes@openbossa.org>
Bluetooth: Save connection parameters in hci_conn

This patch saves the connection interval, latency and supervision
timeout parameters to hci_conn. This way, we are able to track what
values are being currently used in a given connection.

Signed-off-by: Andre Guedes <andre.guedes@openbossa.org>
Bluetooth: Add LE Conn Update Complete Event handler

This patch adds a handler for LE Conn Update Complete Event. When such
event occurs, we should update the connection parameters in hci_conn
object.

Signed-off-by: Andre Guedes <andre.guedes@openbossa.org>
Bluetooth: Remove min/max connection interval from hci_conn

The minimum and maximum connection interval values are reported
to user through a mgmt event (this event is sent during Connection
Parameter Update Procedure). Besides that, hci_conn already keeps
track of connection parameters values currently in use. That being
said, there is no reason to save minimum and maximum connection
interval values in hci_conn.

Therefore, this patch removes the minimum and maximum connection
interval from struct hci_conn. Since they are removed, this patch
also moves the connection parameters lookup to hci_req_add_le_
create_conn().

Signed-off-by: Andre Guedes <andre.guedes@openbossa.org>
Bluetooth: Export slave latency parameter

This patch exports slave latency parameter through Bluetooth debugfs
interface.  We already export minimum and maximum connection interval
parameters so it makes sense to also export slave latency parameter.

The default value is 0 and it may be changed by writing the new
value in conn_latenty file. The acceptable values range from 0x0000
to 0x01F3, according described in Core 4.1, Vol 2, 7.8.12.

Signed-off-by: Andre Guedes <andre.guedes@openbossa.org>
Bluetooth: Export supervision timeout parameter

This patch exports the supervision timeout parameter through Bluetooth
debugfs interface. We already export minimum/maximum connection interval
and latency parameters so it makes sense to also export the supervision
timeout parameter.

The default value is 0x002a and it may be changed by writing the new
value in conn_supervision_timeout file. The acceptable values range
from 0x000a to 0x0c80 according described in Core 4.1, Vol 2, 7.8.12.

Signed-off-by: Andre Guedes <andre.guedes@openbossa.org>
Bluetooth: Extend LE connection parameters infrastructure

This patch extends connection parameters infrastructure (hci_conn_
params and helper functions) to consider slave latency and supervision
timeout parameters.

Signed-off-by: Andre Guedes <andre.guedes@openbossa.org>
Bluetooth: Introduce hdev->le_auto_connect list

This patch simply adds a linked list to hdev and some helper functions
that perform basic operations such as add, delete, lookup and clear.

The hdev->le_auto_connect list will store the device addresses the
kernel should autonomously connect to.

This new linked list is needed because we want to remove the auto_connect
option from struct hci_conn_params, therefore we cannot rely on hdev->
le_conn_params list anymore.

Signed-off-by: Andre Guedes <andre.guedes@openbossa.org>
Bluetooth: Store auto connect information in le_auto_connect list

This patch changes the auto connect infrastructure so hdev->le_auto_conn
is used instead of hdev->le_conn_params list.

Besides that, since we now use le_auto_connect list we should delete
auto connect information during unpair and clear the list when hci
device is unregistered.

Signed-off-by: Andre Guedes <andre.guedes@openbossa.org>
Bluetooth: Remove auto_connect from hci_conn_params

This patch removes the auto_connect option from strcut hci_conn_params
as well as all helper functions. Auto connection is now handled by
le_auto_conn list so we can safely remove it.

Signed-off-by: Andre Guedes <andre.guedes@openbossa.org>
Bluetooth: Load Connection Parameters Command

This patch introduces the Load Connection Parameters command to
Management Interface. This command is used to inform the kernel
what connection parameters should be used during connection
establishment.

This command is only supported on controllers with LE support and
it can be issued while in power on or off mode. Finally, it only
accepts connection parameters from device with identity address.

Signed-off-by: Andre Guedes <andre.guedes@openbossa.org>