]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/log
mirror_ubuntu-hirsute-kernel.git
9 years agoMerge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless
John W. Linville [Mon, 8 Dec 2014 18:58:58 +0000 (13:58 -0500)]
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless

9 years agomwifiex: do not process broadcast mac address for del_sta
Avinash Patil [Fri, 5 Dec 2014 17:53:42 +0000 (23:23 +0530)]
mwifiex: do not process broadcast mac address for del_sta

Generally broadcast mac address deauth is followed by stop_ap or start_ap.
In both cases, FW already has provision to send deauth; so there is no
need to handle broadcast mac deauthentication.

Signed-off-by: Avinash Patil <patila@marvell.com>
Signed-off-by: Cathy Luo <cluo@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
9 years agomwifiex: guard station nodes access by station list lock
Avinash Patil [Fri, 5 Dec 2014 17:53:41 +0000 (23:23 +0530)]
mwifiex: guard station nodes access by station list lock

Station node entries should be guarded for whole of their reference
instead of just while getting node entry from station list.
It may happen that station node is retrieved may be deleted by
deauthentication event while it is still in use.

Reported by: Tim Shepard <shep@xplot.org>
Signed-off-by: Avinash Patil <patila@marvell.com>
Signed-off-by: Cathy Luo <cluo@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
9 years agomwifiex: delete peer station's RA list upon deauthentication
Avinash Patil [Fri, 5 Dec 2014 17:53:40 +0000 (23:23 +0530)]
mwifiex: delete peer station's RA list upon deauthentication

This patch adds support to delete peer station's RA lists
upon station deautheticate event on AP interface. Patch also
decrements TX pending count upon removing packets from RA list.

Signed-off-by: Avinash Patil <patila@marvell.com>
Signed-off-by: Cathy Luo <cluo@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
9 years agomwifiex: do not delete station entries in del_sta handler
Avinash Patil [Fri, 5 Dec 2014 17:53:39 +0000 (23:23 +0530)]
mwifiex: do not delete station entries in del_sta handler

A crash was observed while cfg80211 del_station handler is
called while stopping AP. This was happening because we were
deleting station list and Rx reorder table entries in del_sta
handler. While station entry is being deleted here, it may happen
that station deauth event from FW would also try to delete station
entry.

This patch fixes this crash by not deleting station entries in del_station
handler. Entry would be deleted while processing station deauth event; which
is triggered by del_station command to FW.

Reported by: Tim Shepard <shep@xplot.org>
Signed-off-by: Avinash Patil <patila@marvell.com>
Signed-off-by: Cathy Luo <cluo@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
9 years agoMerge branch 'for-upstream' of git://git.kernel.org/pub/scm/linux/kernel/git/bluetoot...
John W. Linville [Fri, 5 Dec 2014 19:12:24 +0000 (14:12 -0500)]
Merge branch 'for-upstream' of git://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth-next

9 years agoBluetooth: Enable events for P-256 Public Key and DHKey commands
Marcel Holtmann [Fri, 5 Dec 2014 15:20:15 +0000 (16:20 +0100)]
Bluetooth: Enable events for P-256 Public Key and DHKey commands

When the LE Read Local P-256 Public Key command is supported, then
enable its corresponding complete event. And when the LE Generate DHKey
command is supported, enable its corresponding complete event as well.

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
9 years agoBluetooth: Add support for enabling Extended Scanner Filter Policies
Marcel Holtmann [Fri, 5 Dec 2014 15:20:14 +0000 (16:20 +0100)]
Bluetooth: Add support for enabling Extended Scanner Filter Policies

The new Extended Scanner Filter Policies feature has to be enabled by
selecting the correct filter policy for the scan parameters. This
patch does that when the controller has been enabled to use LE Privacy.

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
9 years agoBluetooth: Add support for handling LE Direct Advertising Report events
Marcel Holtmann [Fri, 5 Dec 2014 15:20:13 +0000 (16:20 +0100)]
Bluetooth: Add support for handling LE Direct Advertising Report events

When the controller sends a LE Direct Advertising Report event, the host
must confirm that the resolvable random address provided matches with
its own identity resolving key. If it does, then that advertising report
needs to be processed. If it does not match, the report needs to be
ignored.

This patch adds full support for handling these new reports and using
them for device discovery and connection handling. This means when a
Bluetooth controller supports the Extended Scanner Filter Policies, it
is possible to use directed advertising with LE privacy.

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
9 years agoBluetooth: Enabled LE Direct Advertising Report event if supported
Marcel Holtmann [Fri, 5 Dec 2014 15:20:12 +0000 (16:20 +0100)]
Bluetooth: Enabled LE Direct Advertising Report event if supported

When the controller supports the Extended Scanner Filter Policies, it
supports the LE Direct Advertising Report event. However by default
that event is blocked by the LE event mask. It is required to enable
it during controller setup.

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
9 years agoBluetooth: Add definitions for LE Direct Advertising Report event
Marcel Holtmann [Fri, 5 Dec 2014 15:20:11 +0000 (16:20 +0100)]
Bluetooth: Add definitions for LE Direct Advertising Report event

This patch adds the event id and data structures for the LE Direct
Advertising Report event.

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
9 years agoBluetooth: Move LE advertising report defines to the right location
Marcel Holtmann [Fri, 5 Dec 2014 15:20:10 +0000 (16:20 +0100)]
Bluetooth: Move LE advertising report defines to the right location

All Bluetooth commands and events are ordered by its opcode or event
id, but for some reason this one now stands out. So move it to its
correct spot in the list.

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
9 years agocc2520: adds terminating newline
Varka Bhadram [Fri, 5 Dec 2014 11:49:10 +0000 (17:19 +0530)]
cc2520: adds terminating newline

Signed-off-by: Varka Bhadram <varkab@cdac.in>
Acked-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
9 years agomac802154: use goto label on failure
Varka Bhadram [Fri, 5 Dec 2014 11:49:09 +0000 (17:19 +0530)]
mac802154: use goto label on failure

Signed-off-by: Varka Bhadram <varkab@cdac.in>
Reviewed-by: Stefan Schmidt <s.schmidt@samsung.com>
Acked-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
9 years agoBluetooth: Report invalid RSSI for service discovery and background scan
Marcel Holtmann [Fri, 5 Dec 2014 12:03:35 +0000 (13:03 +0100)]
Bluetooth: Report invalid RSSI for service discovery and background scan

When using Start Service Discovery and when background scanning is used
to report devices, the RSSI is reported or the value 127 is provided in
case RSSI in unavailable.

For Start Discovery the value 0 is reported to keep backwards
compatibility with the existing users.

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
9 years agoBluetooth: Fix discovery filter when no RSSI is available
Marcel Holtmann [Fri, 5 Dec 2014 12:03:34 +0000 (13:03 +0100)]
Bluetooth: Fix discovery filter when no RSSI is available

When no RSSI value is available then make sure that the result is
filtered out when the RSSI threshold filter is active.

This means that all Bluetooth 1.1 or earlier devices will not
report any results when using a RSSI threshold filter.

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
9 years agoBluetooth: Remove redundant reverse_base_uuid variable
Johan Hedberg [Fri, 5 Dec 2014 11:40:01 +0000 (13:40 +0200)]
Bluetooth: Remove redundant reverse_base_uuid variable

The mgmt.c file already has a bluetooth_base_uuid variable which has the
exact same value as the reverse_base_uuid one. This patch removes the
redundant variable.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
9 years agoBluetooth: Fix Get Conn Info to use cmd_complete callback
Johan Hedberg [Fri, 5 Dec 2014 11:42:57 +0000 (13:42 +0200)]
Bluetooth: Fix Get Conn Info to use cmd_complete callback

This patch fixes the Get Connection Information mgmt command to take
advantage of the new cmd_complete callback. This allows for great
simplifications in the logic for constructing the cmd_complete event.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
9 years agoBluetooth: Fix initializing hci_conn RSSI to invalid value
Johan Hedberg [Fri, 5 Dec 2014 11:36:08 +0000 (13:36 +0200)]
Bluetooth: Fix initializing hci_conn RSSI to invalid value

When we create the hci_conn object we should properly initialize the
RSSI to HCI_RSSI_INVALID.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
9 years agoBluetooth: Convert Get Clock Info to use cmd_complete callback
Johan Hedberg [Fri, 5 Dec 2014 11:36:07 +0000 (13:36 +0200)]
Bluetooth: Convert Get Clock Info to use cmd_complete callback

This patch converts the Get Clock Information mgmt command to take
advantage of the new cmd_complete callback for pending commands.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
9 years agoBluetooth: Convert discovery commands to use cmd_complete callback
Johan Hedberg [Fri, 5 Dec 2014 11:36:06 +0000 (13:36 +0200)]
Bluetooth: Convert discovery commands to use cmd_complete callback

This patch converts the Start/Stop Discovery mgmt commands to use the
cmd_complete callback of struct pending_cmd. Since both of these
commands return the same parameters as they take as input we can use the
existing generic_cmd_complete() helper for this.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
9 years agoBluetooth: Convert Unpair Device to use cmd_complete callback
Johan Hedberg [Fri, 5 Dec 2014 11:36:05 +0000 (13:36 +0200)]
Bluetooth: Convert Unpair Device to use cmd_complete callback

This patch updates the Unpair Device code to take advantage of the
cmd_complete callback of struct pending_cmd.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
9 years agoBluetooth: Convert Pair Device to use cmd_complete callback
Johan Hedberg [Fri, 5 Dec 2014 11:36:04 +0000 (13:36 +0200)]
Bluetooth: Convert Pair Device to use cmd_complete callback

This patch converts the Pair Device mgmt command to use the new
cmd_complete callback for pending mgmt commands. The already existing
pairing_complete() function is exactly what's needed and doesn't need
changing.

In addition to getting the return parameters always right this patch
actually fixes a reference counting bug and memory leak with the
hci_conn that's attached to the pending mgmt command - something that
would occur when powering off or unplugging the adapter while pairing is
in progress.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
9 years agoBluetooth: Use cmd_complete callback for authentication mgmt commands
Johan Hedberg [Fri, 5 Dec 2014 11:36:03 +0000 (13:36 +0200)]
Bluetooth: Use cmd_complete callback for authentication mgmt commands

This patch converts the user confirmation & PIN code mgmt commands to
take advantage of the new cmd_complete callback for pending mgmt
commands. The patch also adds a new generic addr_cmd_complete() helper
function to be used with commands that send a mgmt_addr_info response
based on a mgmt_addr_info in the beginning of the command parameters.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
9 years agoBluetooth: Convert Disconnect mgmt command to use cmd_complete callback
Johan Hedberg [Fri, 5 Dec 2014 11:36:02 +0000 (13:36 +0200)]
Bluetooth: Convert Disconnect mgmt command to use cmd_complete callback

This patch converts the Disconnect mgmt command to take advantage of the
new cmd_complete callback that's part of the pending_cmd struct. There
are many commands whose response parameters map 1:1 to the command
parameters and Disconnect is one of them. This patch adds a
generic_cmd_complete() function for such commands that can be reused in
subsequent patches.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
9 years agoBluetooth: Store parameter length with pending mgmt commands
Johan Hedberg [Fri, 5 Dec 2014 11:36:01 +0000 (13:36 +0200)]
Bluetooth: Store parameter length with pending mgmt commands

As preparation for making generic cmd_complete responses possible we'll
need to track the parameter length in addition to just a pointer to
them. This patch adds the necessary variable to the pending_cmd struct.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
9 years agoBluetooth: Add callback to create proper cmd_complete events
Johan Hedberg [Fri, 5 Dec 2014 11:36:00 +0000 (13:36 +0200)]
Bluetooth: Add callback to create proper cmd_complete events

We've got a couple of generic scenarios where all pending mgmt commands
are processed and responses are sent to them. These scenarios are
powering off the adapter and removing the adapter. So far the code has
been generating cmd_status responses with NOT_POWERED and INVALID_INDEX
resposes respectively, but this violates the mgmt specification for
commands that should always generate a cmd_complete.

This patch adds support for specifying a callback for the pending_cmd
context that each command handler can use for command-specific
cmd_complete event generation. The actual per-command event generators
will come in subsequent patches.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
9 years agonet/mac802154: No need for an extra space when casting
Stefan Schmidt [Thu, 4 Dec 2014 10:52:01 +0000 (11:52 +0100)]
net/mac802154: No need for an extra space when casting

Coding style cleanup.

Signed-off-by: Stefan Schmidt <s.schmidt@samsung.com>
Acked-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
9 years agonet/mac802154: Remove extra blank lines.
Stefan Schmidt [Thu, 4 Dec 2014 10:52:00 +0000 (11:52 +0100)]
net/mac802154: Remove extra blank lines.

Signed-off-by: Stefan Schmidt <s.schmidt@samsung.com>
Acked-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
9 years agonet/ieee802154: Remove and add extra blank lines as needed.
Stefan Schmidt [Thu, 4 Dec 2014 10:51:59 +0000 (11:51 +0100)]
net/ieee802154: Remove and add extra blank lines as needed.

Some have been missing and some have been needed. Just cosmetics.

Signed-off-by: Stefan Schmidt <s.schmidt@samsung.com>
Acked-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
9 years agonet/ieee802154: Make sure alignment matches parenthesis..
Stefan Schmidt [Thu, 4 Dec 2014 10:51:58 +0000 (11:51 +0100)]
net/ieee802154: Make sure alignment matches parenthesis..

Follow coding style of the kernel.

Signed-off-by: Stefan Schmidt <s.schmidt@samsung.com>
Acked-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
9 years agonet/6lowpan: Remove FSF address from GPL statement.
Stefan Schmidt [Thu, 4 Dec 2014 10:51:57 +0000 (11:51 +0100)]
net/6lowpan: Remove FSF address from GPL statement.

This might change and we already deliver a copy of the license with
the kernel. This was already removed form the ieee802154 code but
missed here.

Signed-off-by: Stefan Schmidt <s.schmidt@samsung.com>
Acked-by: Alexander Aring <alex.aring@gmail.com>
Acked-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
9 years agoBluetooth: Clear discovery filter before starting background scan
Marcel Holtmann [Fri, 5 Dec 2014 10:45:23 +0000 (11:45 +0100)]
Bluetooth: Clear discovery filter before starting background scan

Currently the discovery filter information are only cleared when the
actual discovery procedure has been stopped. To make sure that none
of the filters interfere with the background scanning and its device
found event reporting, clear the filter before starting background
scanning.

This means that the discovery filter is now cleared before either
Start Discovery, Start Service Discovery or background scanning.

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
9 years agoBluetooth: Fix memory leaks from discovery filter UUID list
Marcel Holtmann [Fri, 5 Dec 2014 10:45:22 +0000 (11:45 +0100)]
Bluetooth: Fix memory leaks from discovery filter UUID list

In case of failure or when unplugging a controller, the allocated
memory for the UUID list of the discovery filter is not freed. Use
the newly introduced helper for reset the discovery filter and with
that also freeing existing memory.

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
9 years agoBluetooth: Add helper function for clearing the discovery filter
Marcel Holtmann [Fri, 5 Dec 2014 10:45:21 +0000 (11:45 +0100)]
Bluetooth: Add helper function for clearing the discovery filter

The discovery filter allocates memory for its UUID list. So use
a helper function to free it and reset it to default states.

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
9 years agoBluetooth: Add support for Start Service Discovery command
Jakub Pawlowski [Fri, 5 Dec 2014 09:55:59 +0000 (10:55 +0100)]
Bluetooth: Add support for Start Service Discovery command

This patch adds support for the Start Service Discovery command. It
does all the checks for command parameters and configured the discovery
filter settings correctly. However the actual support for filtering
will be added with another patch.

Signed-off-by: Jakub Pawlowski <jpawlowski@google.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
9 years agoBluetooth: Add logic for UUID filter handling
Jakub Pawlowski [Fri, 5 Dec 2014 09:55:58 +0000 (10:55 +0100)]
Bluetooth: Add logic for UUID filter handling

The previous patch provided the framework for integrating the UUID
filtering into the service discovery. This patch now provides the
actual filter logic.

Signed-off-by: Jakub Pawlowski <jpawlowski@google.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
9 years agoBluetooth: Add framework for device found filtering based on UUID
Marcel Holtmann [Fri, 5 Dec 2014 09:55:57 +0000 (10:55 +0100)]
Bluetooth: Add framework for device found filtering based on UUID

Using Start Service Discovery provides the option to specifiy a list
of UUID that are used to filter out device found events. This patch
provides the framework for hooking up the UUID filter.

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
9 years agoBluetooth: Filter device found events based on RSSI threshold
Marcel Holtmann [Fri, 5 Dec 2014 09:55:56 +0000 (10:55 +0100)]
Bluetooth: Filter device found events based on RSSI threshold

Using Start Service Discovery allows to provide a RSSI threshold. This
patch implements support for filtering out device found events based
on the provided value.

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
9 years agoBluetooth: Add extra discovery fields for storing filter information
Jakub Pawlowski [Fri, 5 Dec 2014 09:55:55 +0000 (10:55 +0100)]
Bluetooth: Add extra discovery fields for storing filter information

With the upcoming addition of support for Start Service Discovery, the
discovery handling needs to filter on RSSI and UUID values. For that
they need to be stored in the discovery handling. This patch adds the
appropiate fields and also make sure they are reset when discovery
has been stopped.

Signed-off-by: Jakub Pawlowski <jpawlowski@google.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
9 years agoBluetooth: Add definitions for MGMT_OP_START_SERVICE_DISCOVERY
Jakub Pawlowski [Fri, 5 Dec 2014 09:55:54 +0000 (10:55 +0100)]
Bluetooth: Add definitions for MGMT_OP_START_SERVICE_DISCOVERY

This patch adds the opcode and structure for Start Service Discovery
operation.

Signed-off-by: Jakub Pawlowski <jpawlowski@google.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
9 years agoBluetooth: Add HCI_RSSI_INVALID for unknown RSSI value
Marcel Holtmann [Fri, 5 Dec 2014 09:55:53 +0000 (10:55 +0100)]
Bluetooth: Add HCI_RSSI_INVALID for unknown RSSI value

The Bluetooth core specification defines the value 127 as invalid for
RSSI values. So instead of hard coding it, lets add a constant for it.

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
9 years agoMAINTAINERS: orphan rtl8180
John W. Linville [Thu, 4 Dec 2014 21:52:41 +0000 (16:52 -0500)]
MAINTAINERS: orphan rtl8180

Signed-off-by: John W. Linville <linville@tuxdriver.com>
9 years agobrcmfmac: add multiple BSS support.
Hante Meuleman [Wed, 3 Dec 2014 20:05:33 +0000 (21:05 +0100)]
brcmfmac: add multiple BSS support.

This patch adds support for multiple BSS interfaces (AP). In
total three AP configurations can be created. In order to use
multiple BSS firmware needs to support it.

Reviewed-by: Arend Van Spriel <arend@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
9 years agobrcmfmac: Add ifidx to logging of fwil cmds.
Hante Meuleman [Wed, 3 Dec 2014 20:05:32 +0000 (21:05 +0100)]
brcmfmac: Add ifidx to logging of fwil cmds.

Reviewed-by: Arend Van Spriel <arend@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
9 years agobrcmfmac: Fix vendor cmds used interface.
Hante Meuleman [Wed, 3 Dec 2014 20:05:31 +0000 (21:05 +0100)]
brcmfmac: Fix vendor cmds used interface.

The vendor specific commands was always using main interface,
change this to use the by caller supplied interface.

Reviewed-by: Arend Van Spriel <arend@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
9 years agobrcmfmac: switch to single message MSI
Franky Lin [Wed, 3 Dec 2014 20:05:30 +0000 (21:05 +0100)]
brcmfmac: switch to single message MSI

Use single message MSI to replace legacy interrupt.

Reviewed-by: Arend Van Spriel <arend@broadcom.com>
Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Signed-off-by: Franky Lin <frankyl@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
9 years agobrcmfmac: Add PCIE ids for 43602 devices.
Hante Meuleman [Wed, 3 Dec 2014 20:05:29 +0000 (21:05 +0100)]
brcmfmac: Add PCIE ids for 43602 devices.

Some 43602 devices are band specific and identify themselves
with different PCIE device ID. This patch adds support for the
43602 2.4G and 5.0G devices used in for example R8000 router.

Reviewed-by: Arend Van Spriel <arend@broadcom.com>
Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Reviewed-by: Daniel (Deognyoun) Kim <dekim@broadcom.com>
Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
9 years agobrcmfmac: Fix ifidx for rx data by msgbuf.
Hante Meuleman [Wed, 3 Dec 2014 20:05:28 +0000 (21:05 +0100)]
brcmfmac: Fix ifidx for rx data by msgbuf.

The ifidx provided by FW needs to be offsetted when receiving data
packets.

Cc: stable@vger.kernel.org # v3.17, v3.18
Reviewed-by: Arend Van Spriel <arend@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
9 years agobrcmfmac: Fix bitmap malloc bug in msgbuf.
Hante Meuleman [Wed, 3 Dec 2014 20:05:27 +0000 (21:05 +0100)]
brcmfmac: Fix bitmap malloc bug in msgbuf.

Cc: stable@vger.kernel.org # v3.17, v3.18
Reviewed-by: Arend Van Spriel <arend@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
9 years agoSSB / B44: fix WOL for BCM4401
Andrey Skvortsov [Thu, 4 Dec 2014 16:32:46 +0000 (11:32 -0500)]
SSB / B44: fix WOL for BCM4401

Wake On Lan was not working on laptop DELL Vostro 1500.
If WOL was turned on, BCM4401 was powered up in suspend mode. LEDs blinked.
But the laptop could not be woken up with the Magic Packet. The reason for
that was that PCIE was not enabled as a system wakeup source and
therefore the host PCI bridge was not powered up in suspend mode.
PCIE was not enabled in suspend by PM because no child devices were
registered as wakeup source during suspend process.
On laptop BCM4401 is connected through the SSB bus, that is connected to the
PCI-Express bus. SSB and B44 did not use standard PM wakeup functions
and did not forward wakeup settings to their parents.
To fix that B44 driver enables PM wakeup and registers new wakeup source
using device_set_wakeup_enable(). Wakeup is automatically reported to the parent SSB
bus via power.wakeup_path. SSB bus enables wakeup for the parent PCI bridge, if there is any
child devices with enabled wakeup functionality. All other steps are
done by PM core code.

Signed-off-by: Andrey Skvortsov <Andrej.Skvortzov@gmail.com>
Signed-off-by: Michael Buesch <m@bues.ch>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
9 years agoMerge git://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211-next
John W. Linville [Thu, 4 Dec 2014 16:29:10 +0000 (11:29 -0500)]
Merge git://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211-next

Johannes Berg <johannes@sipsolutions.net> says:

"This time I have Felix's no-status rate control work, which will allow
drivers to work better with rate control even if they don't have perfect
status reporting. In addition to this, a small hwsim fix from Patrik,
one of the regulatory patches from Arik, and a number of cleanups and
fixes I did myself.

Of note is a patch where I disable CFG80211_WEXT so that compatibility
is no longer selectable - this is intended as a wake-up call for anyone
who's still using it, and is still easily worked around (it's a one-line
patch) before we fully remove the code as well in the future."

Signed-off-by: John W. Linville <linville@tuxdriver.com>
9 years agoMerge tag 'nfc-next-3.19-1' of git://git.kernel.org/pub/scm/linux/kernel/git/sameo...
John W. Linville [Thu, 4 Dec 2014 16:27:40 +0000 (11:27 -0500)]
Merge tag 'nfc-next-3.19-1' of git://git.kernel.org/pub/scm/linux/kernel/git/sameo/nfc-next

Samuel Ortiz <sameo@linux.intel.com> says:

"NFC: 3.19 pull request

This is the NFC pull request for 3.19.

With this one we get:

- NFC digital improvements for DEP support: Chaining, NACK and ATN
  support added.

- NCI improvements: Support for p2p target, SE IO operand addition,
  SE operands extensions to support proprietary implementations, and
  a few fixes.

- NFC HCI improvements: OPEN_PIPE and NOTIFY_ALL_CLEARED support,
  and SE IO operand addition.

- A bunch of minor improvements and fixes for STMicro st21nfcb and
  st21nfca"

Signed-off-by: John W. Linville <linville@tuxdriver.com>
9 years agoBluetooth: Split triggering of discovery commands into separate function
Marcel Holtmann [Thu, 4 Dec 2014 10:36:36 +0000 (11:36 +0100)]
Bluetooth: Split triggering of discovery commands into separate function

The actual process of compiling the correct HCI commands for triggering
discovery is something that should be generic. So instead of mixing it
into the Start Discover operation handling, split it out into its own
function utilizing HCI request handling and just providing status in
case of errors or invalid parameters.

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
9 years agoBluetooth: Use {start,stop}_discovery_complete handler for cmd_complete
Marcel Holtmann [Thu, 4 Dec 2014 10:36:35 +0000 (11:36 +0100)]
Bluetooth: Use {start,stop}_discovery_complete handler for cmd_complete

Sending the required cmd_complete for the management commands should be
done in one place and not in multiple places. Especially for Start and
Stop Discovery commands this is split into to sending it in case of
failure from the complete handler, but in case of success from the
event state update function triggering mgmt_discovering. This is way
too convoluted and since hci_request serializes the HCI command
processing, send the cmd_complete response from the complete handler
for all cases.

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
9 years agoBluetooth: Simplify the error handling of Start Discovery command
Marcel Holtmann [Thu, 4 Dec 2014 10:36:34 +0000 (11:36 +0100)]
Bluetooth: Simplify the error handling of Start Discovery command

The Start Discovery command has some complicated code when it comes
to error handling. With the future introduction of Start Service
Discovery simplifying this makes it easier to read.

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
9 years agoBluetooth: Increment management interface revision
Marcel Holtmann [Wed, 3 Dec 2014 18:52:43 +0000 (19:52 +0100)]
Bluetooth: Increment management interface revision

This patch increments the management interface revision due to the
addition of support for LE Secure Connection feature.

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
9 years agoBluetooth: Increase minor version of core module
Marcel Holtmann [Wed, 3 Dec 2014 18:46:10 +0000 (19:46 +0100)]
Bluetooth: Increase minor version of core module

With the addition of support for Bluetooth Low Energy Secure Connections
feature, it makes sense to increase the minor version of the Bluetooth
core module.

The module version is not used anywhere, but it gives a nice extra
hint for debugging purposes.

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
9 years agoBluetooth: Add support for Broadcom BCM20702A0 variants firmware download
Heinrich Siebmanns [Wed, 3 Dec 2014 18:32:22 +0000 (19:32 +0100)]
Bluetooth: Add support for Broadcom BCM20702A0 variants firmware download

This requires the flag BTUSB_BCM_PATCHRAM to work.

Relevant details from /sys/kernel/debug/usb/devices for my device:

T:  Bus=03 Lev=02 Prnt=02 Port=03 Cnt=02 Dev#=  4 Spd=12   MxCh= 0
D:  Ver= 2.00 Cls=ff(vend.) Sub=01 Prot=01 MxPS=64 #Cfgs=  1
P:  Vendor=0489 ProdID=e031 Rev= 1.12
S:  Manufacturer=Broadcom Corp
S:  Product=BCM20702A0
S:  SerialNumber=3859F9CD2AEE
C:* #Ifs= 4 Cfg#= 1 Atr=e0 MxPwr=  0mA
I:* If#= 0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=01 Prot=01 Driver=btusb
E:  Ad=81(I) Atr=03(Int.) MxPS=  16 Ivl=1ms
E:  Ad=82(I) Atr=02(Bulk) MxPS=  64 Ivl=0ms
E:  Ad=02(O) Atr=02(Bulk) MxPS=  64 Ivl=0ms
I:* If#= 1 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=01 Prot=01 Driver=btusb
E:  Ad=83(I) Atr=01(Isoc) MxPS=   0 Ivl=1ms
E:  Ad=03(O) Atr=01(Isoc) MxPS=   0 Ivl=1ms
I:  If#= 1 Alt= 1 #EPs= 2 Cls=ff(vend.) Sub=01 Prot=01 Driver=btusb
E:  Ad=83(I) Atr=01(Isoc) MxPS=   9 Ivl=1ms
E:  Ad=03(O) Atr=01(Isoc) MxPS=   9 Ivl=1ms
I:  If#= 1 Alt= 2 #EPs= 2 Cls=ff(vend.) Sub=01 Prot=01 Driver=btusb
E:  Ad=83(I) Atr=01(Isoc) MxPS=  17 Ivl=1ms
E:  Ad=03(O) Atr=01(Isoc) MxPS=  17 Ivl=1ms
I:  If#= 1 Alt= 3 #EPs= 2 Cls=ff(vend.) Sub=01 Prot=01 Driver=btusb
E:  Ad=83(I) Atr=01(Isoc) MxPS=  25 Ivl=1ms
E:  Ad=03(O) Atr=01(Isoc) MxPS=  25 Ivl=1ms
I:  If#= 1 Alt= 4 #EPs= 2 Cls=ff(vend.) Sub=01 Prot=01 Driver=btusb
E:  Ad=83(I) Atr=01(Isoc) MxPS=  33 Ivl=1ms
E:  Ad=03(O) Atr=01(Isoc) MxPS=  33 Ivl=1ms
I:  If#= 1 Alt= 5 #EPs= 2 Cls=ff(vend.) Sub=01 Prot=01 Driver=btusb
E:  Ad=83(I) Atr=01(Isoc) MxPS=  49 Ivl=1ms
E:  Ad=03(O) Atr=01(Isoc) MxPS=  49 Ivl=1ms
I:* If#= 2 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none)
E:  Ad=84(I) Atr=02(Bulk) MxPS=  32 Ivl=0ms
E:  Ad=04(O) Atr=02(Bulk) MxPS=  32 Ivl=0ms
I:* If#= 3 Alt= 0 #EPs= 0 Cls=fe(app. ) Sub=01 Prot=01 Driver=(none)

The firmware was extracted from a Windows 7 32-bit installation
and converted from 'hex' to 'hcd' for use in Linux.

The firmware is named "BCM20702A0_001.001.024.0156.0204.hex"
and is located in "%SYSTEMROOT%\system32\drivers\"
(md5 d126e6c4e0e669d76c38cf9377f76b7f)
(sha1 145d1850b2785a953233b409e7ff77786927c7d2)

The firmware file is also available as a download at
http://support.ts.fujitsu.com/Download/
contained in "FTS_WIDCOMMBluetoothSoftware_6309000_1072149.zip"

Search for the file Win32/bcbtums-win7x86-brcm.inf in the archive,
look for the vendor and product ID of your adapter, see the section
'devices' in that file to find out what device name it uses. See
the device entry in the inf file (in my case it was 'RAMUSBE031')
to find out which hex file you need to convert to hcd for upload

'hcd' file should be placed at "brcm/BCM20702A0-0489-e031.hcd"
inside the firmware directory (e.g. "/lib/firmware")

Signed-off-by: Heinrich Siebmanns <harv@gmx.de>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
9 years agoBluetooth: btmrvl add firmware dump support
Xinming Hu [Mon, 24 Nov 2014 10:40:53 +0000 (02:40 -0800)]
Bluetooth: btmrvl add firmware dump support

This patch adds firmware dump support for marvell
bluetooth chipset. Currently only SD8897 is supported.
This is implemented based on dev_coredump, a new mechnism
introduced in kernel 3.18rc3

Firmware dump can be trigger by
echo 1 > /sys/kernel/debug/bluetooth/hci*/config/fw_dump
and when the dump operation is completed, data can be read by
cat /sys/class/devcoredump/devcd*/data

We have prepared following script to divide fw memory
dump data into multiple files based on memory type.

 [root]# cat btmrvl_split_dump_data.sh
 #!/bin/bash
 # usage: ./btmrvl_split_dump_data.sh dump_data

 fw_dump_data=$1

 mem_type="ITCM DTCM SQRAM APU CIU ICU MAC EXT7 EXT8 EXT9 EXT10 EXT11 EXT12 EXT13 EXTLAST"

 for name in ${mem_type[@]}
 do
         sed -n "/Start dump $name/,/End dump/p" $fw_dump_data  > tmp.$name.log
         if [ ! -s tmp.$name.log ]
                 then
                         rm -rf tmp.$name.log
                 else
                         # Remove the describle info "Start dump" and "End dump"
                         sed '1d' tmp.$name.log | sed '$d' > /data/$name.log
                         if [ -s /data/$name.log ]
                         then
                                 echo "generate /data/$name.log"
                         else
                                 sed '1d' tmp.$name.log | sed '$d' > /var/$name.log
                                 echo "generate /var/$name.log"
                         fi
                         rm -rf tmp.$name.log
         fi
 done

Signed-off-by: Xinming Hu <huxm@marvell.com>
Signed-off-by: Cathy Luo <cluo@marvell.com>
Signed-off-by: Avinash Patil <patila@marvell.com>
Reviewed-by: Johannes Berg <johannes@sipsolutions.net>
Reviewed-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
9 years agoBluetooth: btmrvl: remove extra newline character
Amitkumar Karwar [Mon, 24 Nov 2014 10:40:52 +0000 (02:40 -0800)]
Bluetooth: btmrvl: remove extra newline character

BT_INFO/BT_DBG etc. already takes care of adding a newline
An extra newline character inside message is removed in this
patch.

Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
9 years agoBluetooth: Fix false-positive "uninitialized" compiler warning
Johan Hedberg [Wed, 3 Dec 2014 14:26:37 +0000 (16:26 +0200)]
Bluetooth: Fix false-positive "uninitialized" compiler warning

Some gcc versions don't seem to be able to properly track the flow of
the smp_cmd_pairing_random() function and end up causing the following
types of (false-positive) warnings:

 smp.c:1995:6: warning: â€˜nb’ may be used uninitialized in this function [-Wmaybe-uninitialized]
   err = smp_g2(smp->tfm_cmac, pkax, pkbx, na, nb, &passkey);
 smp.c:1995:6: warning: â€˜na’ may be used uninitialized in this function [-Wmaybe-uninitialized]
   err = smp_g2(smp->tfm_cmac, pkax, pkbx, na, nb, &passkey);
       ^
 smp.c:1995:6: warning: â€˜pkbx’ may be used uninitialized in this function [-Wmaybe-uninitialized]
   err = smp_g2(smp->tfm_cmac, pkax, pkbx, na, nb, &passkey);
       ^
 smp.c:1995:6: warning: â€˜pkax’ may be used uninitialized in this function [-Wmaybe-uninitialized]
   err = smp_g2(smp->tfm_cmac, pkax, pkbx, na, nb, &passkey);

This patch fixes the issue by moving the pkax/pkbx and na/nb
initialization earlier in the function.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
9 years agoBluetooth: Fix minor coding style issue in smp.c
Johan Hedberg [Wed, 3 Dec 2014 14:07:13 +0000 (16:07 +0200)]
Bluetooth: Fix minor coding style issue in smp.c

The convention for checking for NULL pointers is !ptr and not
ptr == NULL. This patch fixes such an occurrence in smp.c.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
9 years agoBluetooth: Fix SMP debug key handling
Johan Hedberg [Wed, 3 Dec 2014 10:43:39 +0000 (12:43 +0200)]
Bluetooth: Fix SMP debug key handling

We need to keep debug keys around at least until the point that they are
used - otherwise e.g. slave role behavior wouldn't work as there'd be no
key to be looked up. The correct behavior should therefore be to return
any stored keys but when we clean up the SMP context to remove the key
from the hdev list if keeping debug keys around hasn't been requestsed.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
9 years agoBluetooth: Organize SMP crypto functions to logical sections
Johan Hedberg [Tue, 2 Dec 2014 11:39:23 +0000 (13:39 +0200)]
Bluetooth: Organize SMP crypto functions to logical sections

This patch organizes the various SMP crypto functions so that the LE SC
functions appear in one section and the legacy SMP functions in a
separate one.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
9 years agoBluetooth: Fix missing const declarations in SMP functions
Johan Hedberg [Tue, 2 Dec 2014 11:37:41 +0000 (13:37 +0200)]
Bluetooth: Fix missing const declarations in SMP functions

Several SMP functions take read-only data. This patch fixes the
declaration of these parameters to use the const specifier as
appropriate.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
9 years agoBluetooth: Introduce SMP_DBG macro for low-level debuging
Johan Hedberg [Mon, 1 Dec 2014 20:03:16 +0000 (22:03 +0200)]
Bluetooth: Introduce SMP_DBG macro for low-level debuging

The various inputs & outputs of the crypto functions as well as the
values of the ECDH keys can be considered security sensitive. They
should therefore not end up in dmesg by mistake. This patch introduces a
new SMP_DBG macro which requires explicit compilation with -DDEBUG to be
enabled. All crypto related data logs now use this macro instead of
BT_DBG.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
9 years agoBluetooth: Add basic LE SC OOB support for remote OOB data
Johan Hedberg [Tue, 28 Oct 2014 14:17:05 +0000 (15:17 +0100)]
Bluetooth: Add basic LE SC OOB support for remote OOB data

This patch adds basic OOB pairing support when we've received the remote
OOB data. This includes tracking the remote r value (in smp->rr) as well
as doing the appropriate f4() call when needed. Previously the OOB rand
would have been stored in smp->rrnd however these are actually two
independent values so we need separate variables for them. Na/Nb in the
spec maps to smp->prnd/rrnd and ra/rb maps to smp->rr with smp->pr to
come once local OOB data is supported.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
9 years agoBluetooth: Set SMP OOB flag if OOB data is available
Johan Hedberg [Sun, 26 Oct 2014 20:19:10 +0000 (21:19 +0100)]
Bluetooth: Set SMP OOB flag if OOB data is available

If we have OOB data available for the remote device in question we
should set the OOB flag appropriately in the SMP pairing request or
response.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
9 years agoBluetooth: Add support for adding remote OOB data for LE
Johan Hedberg [Sun, 26 Oct 2014 19:52:27 +0000 (20:52 +0100)]
Bluetooth: Add support for adding remote OOB data for LE

This patch adds proper support for passing LE OOB data to the
hci_add_remote_oob_data() function. For LE the 192-bit values are not
valid and should therefore be passed as NULL values.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
9 years agoBluetooth: Store address type with OOB data
Johan Hedberg [Sun, 26 Oct 2014 19:46:09 +0000 (20:46 +0100)]
Bluetooth: Store address type with OOB data

To be able to support OOB data for LE pairing we need to store the
address type of the remote device. This patch extends the relevant
functions and data types with a bdaddr_type variable.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
9 years agoBluetooth: Unify remote OOB data functions
Johan Hedberg [Sun, 26 Oct 2014 19:33:47 +0000 (20:33 +0100)]
Bluetooth: Unify remote OOB data functions

There's no need to duplicate code for the 192 vs 192+256 variants of the
OOB data functions. This is also helpful to pave the way to support LE
SC OOB data where only 256 bit data is provided.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
9 years agoBluetooth: Add SC-only mode support for SMP
Johan Hedberg [Mon, 8 Sep 2014 23:59:18 +0000 (16:59 -0700)]
Bluetooth: Add SC-only mode support for SMP

When Secure Connections-only mode is enabled we should reject any
pairing command that does not have Secure Connections set in the
authentication requirements. This patch adds the appropriate logic for
this to the command handlers of Pairing Request/Response and Security
Request.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
9 years agoBluetooth: Add full SMP BR/EDR support
Johan Hedberg [Thu, 14 Aug 2014 09:34:26 +0000 (12:34 +0300)]
Bluetooth: Add full SMP BR/EDR support

When doing SMP over BR/EDR some of the routines can be shared with the
LE functionality whereas others needs to be split into their own BR/EDR
specific branches. This patch implements the split of BR/EDR specific
SMP code from the LE-only code, making sure SMP over BR/EDR works as
specified.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
9 years agoBluetooth: Add skeleton for BR/EDR SMP channel
Johan Hedberg [Wed, 13 Aug 2014 12:12:32 +0000 (15:12 +0300)]
Bluetooth: Add skeleton for BR/EDR SMP channel

This patch adds the very basic code for creating and destroying SMP
L2CAP channels for BR/EDR connections.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
9 years agoBluetooth: Add debugfs switch for forcing SMP over BR/EDR
Johan Hedberg [Thu, 16 Oct 2014 08:45:31 +0000 (10:45 +0200)]
Bluetooth: Add debugfs switch for forcing SMP over BR/EDR

To make it possible to use LE SC functionality over BR/EDR with pre-4.1
controllers (that do not support BR/EDR SC links) it's useful to be able
to force LE SC operations even over a traditional SSP protected link.
This patch adds a debugfs switch to force a special debug flag which is
used to skip the checks for BR/EDR SC support.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
9 years agoBluetooth: Add hci_conn flag for new link key generation
Johan Hedberg [Thu, 14 Aug 2014 09:33:17 +0000 (12:33 +0300)]
Bluetooth: Add hci_conn flag for new link key generation

For LE Secure Connections we want to trigger cross transport key
generation only if a new link key was actually created during the BR/EDR
connection. This patch adds a new flag to track this information.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
9 years agoBluetooth: Use debug keys for SMP when HCI_USE_DEBUG_KEYS is set
Johan Hedberg [Tue, 24 Jun 2014 12:22:59 +0000 (15:22 +0300)]
Bluetooth: Use debug keys for SMP when HCI_USE_DEBUG_KEYS is set

The HCI_USE_DEBUG_KEYS flag is intended to force our side to always use
debug keys for pairing. This means both BR/EDR SSP as well as SMP with
LE Secure Connections. This patch updates the SMP code to use the debug
keys instead of generating a random local key pair when the flag is set.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
9 years agoBluetooth: Add dummy handler for LE SC keypress notification
Johan Hedberg [Wed, 4 Jun 2014 19:45:57 +0000 (22:45 +0300)]
Bluetooth: Add dummy handler for LE SC keypress notification

Since we don not actively try to clear the keypress notification bit we
might get these PDUs. To avoid failing the pairing process add a simple
dummy handler for these for now.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
9 years agoBluetooth: Fix DHKey Check sending order for slave role
Johan Hedberg [Wed, 4 Jun 2014 08:07:40 +0000 (11:07 +0300)]
Bluetooth: Fix DHKey Check sending order for slave role

According to the LE SC specification the initiating device sends its
DHKey check first and the non-initiating devices sends its DHKey check
as a response to this. It's also important that the non-initiating
device doesn't send the response if it's still waiting for user input.
In order to synchronize all this a new flag is added.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
9 years agoBluetooth: Add passkey entry support for LE SC
Johan Hedberg [Wed, 25 Jun 2014 08:10:28 +0000 (11:10 +0300)]
Bluetooth: Add passkey entry support for LE SC

The passkey entry mechanism involves either both sides requesting the
user for a passkey, or one side requesting the passkey while the other
one displays it. The behavior as far as SMP PDUs are concerned are
considerably different from numeric comparison and therefore requires
several new functions to handle it.

In essence passkey entry involves both sides gradually committing to
each bit of the passkey which involves 20 rounds of pairing confirm and
pairing random PDUS being sent in both directions.

This patch adds a new smp->passkey_round variable to track the current
round of the passkey commitment and reuses the variables already present
in struct hci_conn for the passkey and entered key count.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
9 years agoBluetooth: Fix BR/EDR Link Key type when derived through LE SC
Johan Hedberg [Sun, 1 Jun 2014 13:33:39 +0000 (16:33 +0300)]
Bluetooth: Fix BR/EDR Link Key type when derived through LE SC

We need to set the correct Link Key type based on the properties of the
LE SC pairing that it was derived from. If debug keys were used the type
should be a debug key, and the authenticated vs unauthenticated
information should be set on what kind of security level was reached.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
9 years agoBluetooth: Add support for SC just-works pairing
Johan Hedberg [Sun, 1 Jun 2014 12:38:09 +0000 (15:38 +0300)]
Bluetooth: Add support for SC just-works pairing

If the just-works method was chosen we shouldn't send anything to user
space but simply proceed with sending the DHKey Check PDU. This patch
adds the necessary code for it.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
9 years agoBluetooth: Set correct LTK type and authentication for SC
Johan Hedberg [Sat, 31 May 2014 15:53:36 +0000 (18:53 +0300)]
Bluetooth: Set correct LTK type and authentication for SC

After generating the LTK we should set the correct type (normal SC or
debug) and authentication information for it.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
9 years agoBluetooth: Add check for accidentally generating a debug key
Johan Hedberg [Fri, 6 Jun 2014 12:33:30 +0000 (15:33 +0300)]
Bluetooth: Add check for accidentally generating a debug key

It is very unlikely, but to have a 100% guarantee of the generated key
type we need to reject any keys which happen to match the debug key.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
9 years agoBluetooth: Detect SMP SC debug keys
Johan Hedberg [Sat, 31 May 2014 15:52:28 +0000 (18:52 +0300)]
Bluetooth: Detect SMP SC debug keys

We need to be able to detect if the remote side used a debug key for the
pairing. This patch adds the debug key defines and sets a flag to
indicate that a debug key was used. The debug private key (debug_sk) is
also added in this patch but will only be used in a subsequent patch
when local debug key support is implemented.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
9 years agoBluetooth: Add selection of the SC authentication method
Johan Hedberg [Sat, 31 May 2014 15:51:02 +0000 (18:51 +0300)]
Bluetooth: Add selection of the SC authentication method

This patch adds code to select the authentication method for Secure
Connections based on the local and remote capabilities. A new
DSP_PASSKEY method is also added for displaying the passkey - something
that is not part of legacy SMP pairing.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
9 years agoBluetooth: Track authentication method in SMP context
Johan Hedberg [Sat, 31 May 2014 15:48:26 +0000 (18:48 +0300)]
Bluetooth: Track authentication method in SMP context

For Secure Connections we'll select the authentication method as soon as
we receive the public key, but only use it later (both when actually
triggering the method as well as when determining the quality of the
resulting LTK). Store the method therefore in the SMP context.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
9 years agoBluetooth: Add support for LE SC key generation
Johan Hedberg [Fri, 6 Jun 2014 08:54:04 +0000 (11:54 +0300)]
Bluetooth: Add support for LE SC key generation

As the last step of the LE SC pairing process it's time to generate and
distribute keys. The generation part is unique to LE SC and so this
patch adds a dedicated function for it. We also clear the distribution
bits for keys which are not distributed with LE SC, so that the code
shared with legacy SMP will not go ahead and try to distribute them.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
9 years agoBluetooth: Add support for LE SC DHKey check PDU
Johan Hedberg [Fri, 6 Jun 2014 08:47:30 +0000 (11:47 +0300)]
Bluetooth: Add support for LE SC DHKey check PDU

Once we receive the DHKey check PDU it's time to first verify that the
value is correct and then proceed with encrypting the link.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
9 years agoBluetooth: Add support for handling LE SC user response
Johan Hedberg [Fri, 6 Jun 2014 08:44:05 +0000 (11:44 +0300)]
Bluetooth: Add support for handling LE SC user response

With LE SC, once the user has responded to the numeric comparison it's
time to send DHKey check values in both directions. The DHKey check
value is generated using new smp_f5 and smp_f6 cryptographic functions.
The smp_f5 function is responsible for generating the LTK and the MacKey
values whereas the smp_f6 function takes the MacKey as input and
generates the DHKey Check value.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
9 years agoBluetooth: Add support for LE SC numeric comparison
Johan Hedberg [Fri, 6 Jun 2014 08:39:49 +0000 (11:39 +0300)]
Bluetooth: Add support for LE SC numeric comparison

After the Pairing Confirm and Random PDUs have been exchanged in LE SC
it's time to generate a numeric comparison value using a new smp_g2
cryptographic function (which also builds on AES-CMAC). This patch adds
the smp_g2 implementation and updates the Pairing Random PDU handler to
proceed with the value genration and user confirmation.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
9 years agoBluetooth: Add LE SC support for responding to Pairing Confirm PDU
Johan Hedberg [Fri, 6 Jun 2014 08:36:38 +0000 (11:36 +0300)]
Bluetooth: Add LE SC support for responding to Pairing Confirm PDU

When LE SC is being used we should always respond to it by sending our
local random number. This patch adds a convenience function for it which
also contains a check for the pre-requisite public key exchange
completion

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
9 years agoBluetooth: Add support for sending LE SC Confirm value
Johan Hedberg [Fri, 6 Jun 2014 08:30:08 +0000 (11:30 +0300)]
Bluetooth: Add support for sending LE SC Confirm value

Once the public key exchange is complete the next step is for the
non-initiating device to send a SMP Pairing Confirm PDU to the
initiating device. This requires the use of a new smp_f4 confirm value
generation function which in turn builds on the AES-CMAC cryptographic
function.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
9 years agoBluetooth: Add handler function for receiving LE SC public key
Johan Hedberg [Fri, 6 Jun 2014 08:09:28 +0000 (11:09 +0300)]
Bluetooth: Add handler function for receiving LE SC public key

This patch adds a handler function for the LE SC SMP Public Key PDU.
When we receive the key we proceed with generating the shared DHKey
value from the remote public key and local private key.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
9 years agoBluetooth: Add basic support for sending our LE SC public key
Johan Hedberg [Fri, 6 Jun 2014 07:50:15 +0000 (10:50 +0300)]
Bluetooth: Add basic support for sending our LE SC public key

When the initial pairing request & response PDUs have been exchanged and
both have had the LE SC bit set the next step is to generate a ECDH
key pair and to send the public key to the remote side. This patch adds
basic support for generating the key pair and sending the public key
using the new Public Key SMP PDU. It is the initiating device that sends
the public key first and the non-initiating device responds by sending
its public key respectively (in a subsequent patch).

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
9 years agoBluetooth: Add ECC library for LE Secure Connections
Johan Hedberg [Tue, 29 Apr 2014 10:07:45 +0000 (13:07 +0300)]
Bluetooth: Add ECC library for LE Secure Connections

This patch adds a simple ECC library that will act as a fundamental
building block for LE Secure Connections. The library has a simple API
consisting of two functions: one for generating a public/private key
pair and another one for generating a Diffie-Hellman key from a local
private key and a remote public key.

The code has been taken from https://github.com/kmackay/easy-ecc and
modified to conform with the kernel coding style.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
9 years agoBluetooth: Add basic support for AES-CMAC
Johan Hedberg [Fri, 2 May 2014 11:19:47 +0000 (14:19 +0300)]
Bluetooth: Add basic support for AES-CMAC

Most of the LE Secure Connections SMP crypto functions build on top of
the AES-CMAC function. This patch adds access to AES-CMAC in the kernel
crypto subsystem by allocating a crypto_hash handle for it in a similar
way that we have one for AES-CBC.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
9 years agoBluetooth: Set link key generation bit if necessary for LE SC
Johan Hedberg [Fri, 6 Jun 2014 07:39:56 +0000 (10:39 +0300)]
Bluetooth: Set link key generation bit if necessary for LE SC

Depending on whether Secure Connections is enabled or not we may need to add
the link key generation bit to the key distribution. This patch does the
necessary modifications to the build_pairing_cmd() function.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
9 years agoBluetooth: Rename hci_find_ltk_by_addr to hci_find_ltk
Johan Hedberg [Thu, 29 May 2014 12:02:59 +0000 (15:02 +0300)]
Bluetooth: Rename hci_find_ltk_by_addr to hci_find_ltk

Now that hci_find_ltk_by_addr is the only LTK lookup function there's no
need to keep the long name anymore. This patch shortens the function
name to simply hci_find_ltk.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>