GitHub/LineageOS/G12/android_kernel_amlogic_linux-4.9.git
10 years agoMerge branch 'for-upstream' of git://git.kernel.org/pub/scm/linux/kernel/git/bluetoot...
John W. Linville [Fri, 18 Jul 2014 17:35:45 +0000 (13:35 -0400)]
Merge branch 'for-upstream' of git://git./linux/kernel/git/bluetooth/bluetooth-next

10 years agomwifiex: remove redundant TDLS setup action frame check and avoid leaks
Bing Zhao [Tue, 15 Jul 2014 03:53:34 +0000 (20:53 -0700)]
mwifiex: remove redundant TDLS setup action frame check and avoid leaks

The unwanted frame types are already handled in 'default' case
of the switch/case below.
The str_ptr is allocated but it can be leaked if the length check
fails in the REQUEST/RESP cases. Fix it by allocating sta_ptr
after the length checks.

Reported-by: Paul Stewart <pstew@chromium.org>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: Avinash Patil <patila@marvell.com>
Signed-off-by: Paul Stewart <pstew@chromium.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agossb: extract antenna gains from SPROMs revs 4+ properly
Rafał Miłecki [Sat, 12 Jul 2014 14:42:10 +0000 (16:42 +0200)]
ssb: extract antenna gains from SPROMs revs 4+ properly

They are encoded the same way as in older SPROMs.

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agossb: make code for antenna gain extraction more generic
Rafał Miłecki [Sat, 12 Jul 2014 14:42:09 +0000 (16:42 +0200)]
ssb: make code for antenna gain extraction more generic

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agowireless: zd1211rw: new url for fw, remove experimental
Xose Vazquez Perez [Sat, 12 Jul 2014 12:57:38 +0000 (14:57 +0200)]
wireless: zd1211rw: new url for fw, remove experimental

Cc: Daniel Drake <dsd@laptop.org>
Cc: Ulrich Kunitz <kune@deine-taler.de>
Cc: John W. Linville <linville@tuxdriver.com>
Cc: linux-wireless@vger.kernel.org
Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agob43: N-PHY: add missing TX gain table for radio 0x2057 rev 5
Rafał Miłecki [Sat, 12 Jul 2014 10:34:46 +0000 (12:34 +0200)]
b43: N-PHY: add missing TX gain table for radio 0x2057 rev 5

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agobrcmfmac: add brcmf_p2p_detach() call in brcmf_cfg80211_detach()
Arend van Spriel [Sat, 12 Jul 2014 06:49:42 +0000 (08:49 +0200)]
brcmfmac: add brcmf_p2p_detach() call in brcmf_cfg80211_detach()

The function brcmf_p2p_detach() was only called in error flow of the
brcmf_cfg80211_attach() routine, but it also needs to be called
upon brcmf_cfg80211_detach().

Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agobrcmfmac: rework wiphy structure setup
Arend van Spriel [Sat, 12 Jul 2014 06:49:41 +0000 (08:49 +0200)]
brcmfmac: rework wiphy structure setup

Instead of waiting for IFF_UP of the primary net device to determine
the band and channel information of the wiphy structure, this is now
done during driver initialization in brcmf_cfg80211_attach(). The
channel information is obtained from the device and the 2G band is
updated when 40MHz bandwidth is enabled for that band. Before this
change the band and channel objects were common between multiple
brcmfmac devices in the system, which make that information rather
unreliable. That is also fixed with this reworked implementation.

Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
Reviewed-by: Daniel (Deognyoun) Kim <dekim@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agobrcmfmac: moving some functions around
Arend van Spriel [Sat, 12 Jul 2014 06:49:40 +0000 (08:49 +0200)]
brcmfmac: moving some functions around

Just reordering the functions in preparation of subsequent changes.

Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agobrcmfmac: introduce feature and quirk handling
Arend van Spriel [Sat, 12 Jul 2014 06:49:39 +0000 (08:49 +0200)]
brcmfmac: introduce feature and quirk handling

Introducing a new source module that will be responsible for
identifying features and quirks related to the device being
handled.

Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
Reviewed-by: Daniel (Deognyoun) Kim <dekim@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agobrcmfmac: move attach and detach functions in wl_cfg80211.c
Arend van Spriel [Sat, 12 Jul 2014 06:49:38 +0000 (08:49 +0200)]
brcmfmac: move attach and detach functions in wl_cfg80211.c

Preparing for another patch move the functions in separate commit.

Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
Reviewed-by: Daniel (Deognyoun) Kim <dekim@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agobrcmfmac: Make firmware path a module parameter
Daniel Kim [Sat, 12 Jul 2014 06:49:37 +0000 (08:49 +0200)]
brcmfmac: Make firmware path a module parameter

This patch makes firmware path a module parameter so that firmware and
nvram files can be loaded from the specified path.

Signed-off-by: Daniel Kim <dekim@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agobrcmfmac: rework debugfs functions in the driver
Arend van Spriel [Sat, 12 Jul 2014 06:49:36 +0000 (08:49 +0200)]
brcmfmac: rework debugfs functions in the driver

Reworked the debugfs functions in the driver making it easier for
other driver parts to add a debugfs entry and keeping the information
they want to expose in debugfs private, ie. not in a header.

This is accomplished by providing the function brcmf_debugfs_add_entry()
in which the caller provides a read function in which they provide the
content. The debugfs function will take care of creating the debugfs
entry and cleaning up upon removal.

Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
Reviewed-by: Daniel (Deognyoun) Kim <dekim@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agobrcmfmac: make use of seq_file API for debugfs entries
Arend van Spriel [Sat, 12 Jul 2014 06:49:35 +0000 (08:49 +0200)]
brcmfmac: make use of seq_file API for debugfs entries

The use of seq_file simplifies the debugfs code. Simpler is
better.

Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agobrcmfmac: Cleanup used device IDs.
Hante Meuleman [Sat, 12 Jul 2014 06:49:34 +0000 (08:49 +0200)]
brcmfmac: Cleanup used device IDs.

This patch cleans up used broadcom IDs, device IDs for all the
bus layers and uses consistent naming for all IDs.

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>
10 years agomwifiex: correct a typo in mwifiex_ret_tdls_oper
Bing Zhao [Sat, 12 Jul 2014 03:57:15 +0000 (20:57 -0700)]
mwifiex: correct a typo in mwifiex_ret_tdls_oper

This patch fixes this typo.

Reported-by: Paul Stewart <pstew@chromium.org>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: Avinash Patil <patila@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agomwifiex: declare sta_ptr in smaller scope
Bing Zhao [Sat, 12 Jul 2014 03:57:14 +0000 (20:57 -0700)]
mwifiex: declare sta_ptr in smaller scope

sta_ptr is used only in an 'if' branch in this function.
Move it to the smaller scope where it is used.

Reported-by: Paul Stewart <pstew@chromium.org>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: Avinash Patil <patila@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agomwifiex: define TDLS idle timeout macro with units
Bing Zhao [Sat, 12 Jul 2014 03:57:13 +0000 (20:57 -0700)]
mwifiex: define TDLS idle timeout macro with units

The unit of this timeout is in seconds.

Reported-by: Paul Stewart <pstew@chromium.org>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: Avinash Patil <patila@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agomwifiex: fix a cut-n-paste error in adhoc-start
Bing Zhao [Sat, 12 Jul 2014 03:54:32 +0000 (20:54 -0700)]
mwifiex: fix a cut-n-paste error in adhoc-start

The 'else if' branch never gets the chance as its condition
matches 'if' branch's.

Reported-by: David Binderman <dcb314@hotmail.com>
Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agomwifiex: fix corner case system hang issue
Amitkumar Karwar [Sat, 12 Jul 2014 03:53:14 +0000 (20:53 -0700)]
mwifiex: fix corner case system hang issue

Sometimes pending internal scan commands are delayed to give
preference to Tx traffic. 'scan_processing' flag has been
checked at the beginning of delay timer routine to know if in the
meantime scan operation has been cancelled.

There is a corner case where pending scan commands are emptied
after scan_processing flag check is passed. In this case
wrong pointer returned by list_first_entry() is passed to
list_del() which causes system hang.

This patch fixes the issue by adding list_empty() check.

Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agomwifiex: access rx_reorder_tbl_ptr only while holding lock
Amitkumar Karwar [Sat, 12 Jul 2014 03:53:13 +0000 (20:53 -0700)]
mwifiex: access rx_reorder_tbl_ptr only while holding lock

This patch fixes a bug in which rx_reorder_tbl_ptr is accessed
without holding spinlock at few places.

Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agowireless: rt2x00: add new rt2800usb devices
Xose Vazquez Perez [Fri, 11 Jul 2014 19:46:57 +0000 (21:46 +0200)]
wireless: rt2x00: add new rt2800usb devices

0x0b05 0x17e8 RT5372 USB 2.0  bgn 2x2 ASUS USB-N14
0x0411 0x0253 RT5572 USB 2.0 abgn 2x2 BUFFALO WLP-U2-300D
0x0df6 0x0078 RT???? Sitecom N300

Cc: Ivo van Doorn <IvDoorn@gmail.com>
Cc: Helmut Schaa <helmut.schaa@googlemail.com>
Cc: John W. Linville <linville@tuxdriver.com>
Cc: users@rt2x00.serialmonkey.com
Cc: linux-wireless@vger.kernel.org
Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agowlcore/wl18xx/wl12xx: convert bitmaps to unsigned longs
Eliad Peller [Fri, 11 Jul 2014 00:01:39 +0000 (03:01 +0300)]
wlcore/wl18xx/wl12xx: convert bitmaps to unsigned longs

The *_bit operations expect unsigned longs.
Instead of casting the pointers, simply define various
bitmaps as unsigned long (instead of u32).

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agowl18xx: make sure fw_status->priv exists before deref
Eliad Peller [Fri, 11 Jul 2014 00:01:38 +0000 (03:01 +0300)]
wl18xx: make sure fw_status->priv exists before deref

In some corner cases with specific timings, we might
try dequeueing tx before we got information about
the link status (e.g. due to recovery during tx).

Instead of NULL dereference, assume all
the links in this case have low priorities.

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agowl18xx: change the number of WLAN addrs per chip
Arik Nemtsov [Fri, 11 Jul 2014 00:01:37 +0000 (03:01 +0300)]
wl18xx: change the number of WLAN addrs per chip

Each 18xx chip contains only 2 real MAC addresses
usable for WLAN, forcing us to use the LAA bit
approach to obtain a third MAC address.

Signed-off-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agowlcore: don't switch channels on disconnected STA vifs
Arik Nemtsov [Fri, 11 Jul 2014 00:01:36 +0000 (03:01 +0300)]
wlcore: don't switch channels on disconnected STA vifs

Sending the FW a channel switch command on a disconnected
vif may result in a beacon loss event. Avoid this corner case.

Signed-off-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agowlcore: register vendor commands
Eliad Peller [Fri, 11 Jul 2014 00:01:35 +0000 (03:01 +0300)]
wlcore: register vendor commands

All the smart config code is in place now,
so register the relevant vendor commands.

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agowlcore: increase max roc duration to 30 seconds
Eliad Peller [Fri, 11 Jul 2014 00:01:34 +0000 (03:01 +0300)]
wlcore: increase max roc duration to 30 seconds

we don't have any actual limitation in the driver, so
increase it arbitrarily to 30 seconds.

The long ROC is needed for the smart config.flow.

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agowlcore/wl18xx: handle smart config events
Eliad Peller [Fri, 11 Jul 2014 00:01:33 +0000 (03:01 +0300)]
wlcore/wl18xx: handle smart config events

add defintions and handling for smart config events
(SMART_CONFIG_SYNC_EVENT_ID and SMART_CONFIG_DECODE_EVENT_ID)

parse the relevant info and send it to userspace as
vendor event.

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agowlcore: handle smart config vendor commands
Eliad Peller [Fri, 11 Jul 2014 00:01:32 +0000 (03:01 +0300)]
wlcore: handle smart config vendor commands

userspace can ask to perform various smart config
actions via custom vendor commands.

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agowlcore/wl18xx: add smart config commands
Eliad Peller [Fri, 11 Jul 2014 00:01:31 +0000 (03:01 +0300)]
wlcore/wl18xx: add smart config commands

These commands configures the fw to set key,
enter smart config mode, and exit it.

Add relevant hw ops as well.

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agowlcore: add smart config definitions
Eliad Peller [Fri, 11 Jul 2014 00:01:30 +0000 (03:01 +0300)]
wlcore: add smart config definitions

Add definitions for the smart config commands.

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agowlcore: use correct LAA bit
Eliad Peller [Fri, 11 Jul 2014 00:01:29 +0000 (03:01 +0300)]
wlcore: use correct LAA bit

The LAA bit is second bit of the MSB, not of the
third byte.

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agowl18xx: fix last tx rate calculation
Eliad Peller [Fri, 11 Jul 2014 00:01:28 +0000 (03:01 +0300)]
wl18xx: fix last tx rate calculation

The last tx rate calculation didn't take into account
the different indices of 11a and 11g rates tables.

Add the required alignment (count only from the first
11a rate in case of 11a)

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agowlcore: user smaller sqn padding for GEM
Eliad Peller [Fri, 11 Jul 2014 00:01:27 +0000 (03:01 +0300)]
wlcore: user smaller sqn padding for GEM

On recovery, we increase the current seq num by
WL1271_TX_SQN_POST_RECOVERY_PADDING in order to
compensate for packets we might have missed during
recovery.

It seems that some GEM APs have issues when the
gap is too big, so use a smaller padding in this case.

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agowlcore: save seq num only between recoveries
Eliad Peller [Fri, 11 Jul 2014 00:01:26 +0000 (03:01 +0300)]
wlcore: save seq num only between recoveries

We want seq num (freed_pkts) to be initialized
on each new connection, but keep persistent
between recoveries/suspends.

Save the freed_pkts in the private block of the
sta struct (we already do a similar thing for
AP's stations).

However, keep the old wlvif->total_freed_pkts
in order to avoid too intrusive change.

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agob43: don't warn about no 5 GHz support on 2.4 GHz devices
Rafał Miłecki [Tue, 8 Jul 2014 19:00:19 +0000 (21:00 +0200)]
b43: don't warn about no 5 GHz support on 2.4 GHz devices

This could be a bit confusing to see warning about lacking support for
5 GHz band if your device supports 2.4 GHz only.

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agob43: enable radio 0x2057 rev 9 (AKA BCM43228) support
Rafał Miłecki [Tue, 8 Jul 2014 13:11:10 +0000 (15:11 +0200)]
b43: enable radio 0x2057 rev 9 (AKA BCM43228) support

Support for N-PHY rev 8 with 0x2057 rev 5 is almost ready, but we still
need to figure out how to handle rev 9 first.

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agob43: N-PHY: implement channel switching of radio 0x2057 rev 5
Rafał Miłecki [Tue, 8 Jul 2014 13:11:09 +0000 (15:11 +0200)]
b43: N-PHY: implement channel switching of radio 0x2057 rev 5

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agob43: N-PHY: init and channel switching of radio 0x2057 rev 9
Rafał Miłecki [Tue, 8 Jul 2014 13:11:08 +0000 (15:11 +0200)]
b43: N-PHY: init and channel switching of radio 0x2057 rev 9

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agob43; N-PHY: write most of the missing code for revs 7+
Rafał Miłecki [Tue, 8 Jul 2014 13:11:07 +0000 (15:11 +0200)]
b43; N-PHY: write most of the missing code for revs 7+

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agob43: N-PHY: add placeholders for new devices support
Rafał Miłecki [Tue, 8 Jul 2014 13:11:06 +0000 (15:11 +0200)]
b43: N-PHY: add placeholders for new devices support

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agob43: N-PHY: add TX gain tables for devices with specific EPA
Rafał Miłecki [Tue, 8 Jul 2014 13:11:05 +0000 (15:11 +0200)]
b43: N-PHY: add TX gain tables for devices with specific EPA

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agob43: N-PHY: drop reg 0x1 access restriction on new PHY revs
Rafał Miłecki [Tue, 8 Jul 2014 13:11:04 +0000 (15:11 +0200)]
b43: N-PHY: drop reg 0x1 access restriction on new PHY revs

Initialization of N-PHY radio revs 5 and 7 requires writing to 0x1.

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agob43: always print info about radio (manuf, id, revision)
Rafał Miłecki [Wed, 2 Jul 2014 17:07:43 +0000 (19:07 +0200)]
b43: always print info about radio (manuf, id, revision)

Type of radio has a major meaning for the driver. There is quite some
code that does initialization/calibration depending on the radio rev.
Knowing radio params is quite important to provide help to users, so
print it even with debugging disabled.

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agoBluetooth: cmtp: Remove unnecessary null test
Himangi Saraogi [Mon, 14 Jul 2014 20:34:13 +0000 (02:04 +0530)]
Bluetooth: cmtp: Remove unnecessary null test

This patch removes the null test on ctrl. ctrl is initialized at the
beginning of the function to &session->ctrl. Since session is
dereferenced prior to the null test, session must be a valid pointer,
and &session->ctrl cannot be null.

The following Coccinelle script is used for detecting the change:

@r@
expression e,f;
identifier g,y;
statement S1,S2;
@@

*e = &f->g
<+...
 f->y
 ...+>
*if (e != NULL || ...)
 S1 else S2

Signed-off-by: Himangi Saraogi <himangi774@gmail.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
10 years agoBluetooth: Fix trying LTK re-encryption when we don't have an LTK
Johan Hedberg [Mon, 14 Jul 2014 11:34:55 +0000 (14:34 +0300)]
Bluetooth: Fix trying LTK re-encryption when we don't have an LTK

In the case that the key distribution bits cause us not to generate a
local LTK we should not try to re-encrypt if we're currently encrypted
with an STK. This patch fixes the check for this in the
smp_sufficient_security function.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
10 years agoBluetooth: Remove sco_chan_get helper function
Marcel Holtmann [Sun, 13 Jul 2014 23:30:15 +0000 (01:30 +0200)]
Bluetooth: Remove sco_chan_get helper function

The sco_chan_get helper function is only used in two places and really
only protects conn->sk with a lock. So instead of hiding that fact,
just put the actual code in place where it is used.

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
10 years agoBluetooth: Convert L2CAP ident spinlock into a mutex
Marcel Holtmann [Sun, 13 Jul 2014 18:50:15 +0000 (20:50 +0200)]
Bluetooth: Convert L2CAP ident spinlock into a mutex

The spinlock protecting the L2CAP ident number can be converted into
a mutex since the whole processing is run in a workqueue. So instead
of using a spinlock, just use a mutex here.

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
10 years agoBluetooth: Remove unneeded forward declaration of sco_chan_del
Marcel Holtmann [Sun, 13 Jul 2014 17:54:49 +0000 (19:54 +0200)]
Bluetooth: Remove unneeded forward declaration of sco_chan_del

The forward declaration of sco_chan_del is not needed and thus just
remove it. Move sco_chan_del into the proper location.

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
10 years agoBluetooth: Remove unneeded forward declaration of __sco_chan_add
Marcel Holtmann [Sun, 13 Jul 2014 17:54:48 +0000 (19:54 +0200)]
Bluetooth: Remove unneeded forward declaration of __sco_chan_add

The forward declaration of __sco_chan_add is not needed and thus just
remove it. Move __sco_chan_add into the proper location.

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
10 years agoBluetooth: Allocate struct inquiry_entry with GFP_KERNEL
Marcel Holtmann [Sun, 13 Jul 2014 15:22:25 +0000 (17:22 +0200)]
Bluetooth: Allocate struct inquiry_entry with GFP_KERNEL

The allocation of inquiry cache entries is triggered as a result of
processing HCI events. Since the processing is done in the context
of a workqueue, there is no needed to allocate with GFP_ATOMIC in
that case. Switch it to GFP_KERNEL.

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
10 years agoBluetooth: Enable LE Long Term Key Request event only when supported
Marcel Holtmann [Sat, 12 Jul 2014 22:29:22 +0000 (00:29 +0200)]
Bluetooth: Enable LE Long Term Key Request event only when supported

The support for LE encryption is optional and with that also the
LE Long Term Key Request event. If encryption is not supported, then
do not bother enabling this event.

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
10 years agoBluetooth: Enable LE encryption events only when supported
Marcel Holtmann [Sat, 12 Jul 2014 21:36:16 +0000 (23:36 +0200)]
Bluetooth: Enable LE encryption events only when supported

The support for LE encryption is optional. When encryption is not
supported then also do not enable the encryption related events.

This moves the event mask setting to the third initialization
stage to ensure that the LE features are available.

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
10 years agoBluetooth: Read LE Advertising Channel TX Power only when available
Marcel Holtmann [Sat, 12 Jul 2014 21:20:50 +0000 (23:20 +0200)]
Bluetooth: Read LE Advertising Channel TX Power only when available

The Read LE Advertising Channel TX Power command is not mandatory for
a Bluetooth HCI controller only supporting receiption. Move the command
to the third stage of the controller initialization and only execute it
when support for it has been indicated.

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
10 years agoBluetooth: Fix HCIUARTGETDEVICE ioctl when UART is not registered
Marcel Holtmann [Sat, 12 Jul 2014 15:00:29 +0000 (17:00 +0200)]
Bluetooth: Fix HCIUARTGETDEVICE ioctl when UART is not registered

The protocol for the UART might be configured, but that does not
mean the HCI device is registered. Return an error in that case
and only return the index number when HCI_UART_REGISTERED is set.

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
10 years agoMAINTAINERS: add net/6lowpan/ maintainer entry
Alexander Aring [Fri, 11 Jul 2014 08:24:19 +0000 (10:24 +0200)]
MAINTAINERS: add net/6lowpan/ maintainer entry

This patch add a maintainer entry for "net/6lowpan". Also add the current
IEEE 802.15.4 mailing list and bluetooth mailinglist to this branch,
because this code is shared between them.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Acked-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
10 years ago6lowpan: introduce new net/6lowpan directory
Alexander Aring [Fri, 11 Jul 2014 08:24:18 +0000 (10:24 +0200)]
6lowpan: introduce new net/6lowpan directory

This patch moves generic code which is used by bluetooth and ieee802154
6lowpan to a new net/6lowpan directory. This directory contains generic
6LoWPAN code which is shared between bluetooth and ieee802154 MAC-Layer.

This is the IPHC - "IPv6 Header Compression" format at the moment. Which
is described by RFC 6282 [0]. The BLTE 6LoWPAN draft describes that the
IPHC is the same format like IEEE 802.15.4, see [1].

Futuremore we can put more code into this directory which is shared
between BLTE and IEEE 802.15.4 6LoWPAN like RFC 6775 or the routing
protocol RPL RFC 6550.

To avoid naming conflicts I renamed 6lowpan-y to ieee802154_6lowpan-y
in net/ieee802154/Makefile.

[0] http://tools.ietf.org/html/rfc6282
[1] http://tools.ietf.org/html/draft-ietf-6lowpan-btle-12#section-3.2
[2] http://tools.ietf.org/html/rfc6775
[3] http://tools.ietf.org/html/rfc6550

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Acked-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
10 years agoBluetooth: Fix tracking local SSP authentication requirement
Johan Hedberg [Fri, 11 Jul 2014 12:32:23 +0000 (15:32 +0300)]
Bluetooth: Fix tracking local SSP authentication requirement

When we need to make the decision whether to perform just-works or real
user confirmation we need to know the exact local authentication
requirement that was passed to the controller. So far conn->auth_type
(the local requirement) wasn't in one case updated appropriately in fear
of the user confirmation being rejected later.

The real problem however was not really that conn->auth_type couldn't
represent the true value but that we were checking the local MITM
requirement in an incorrect way. It's perfectly fine to let auth_type
follow what we tell the controller since we're still tracking the target
security level with conn->pending_sec_level.

This patch updates the check for local MITM requirement in the
hci_user_confirm_request_evt function to use the locally requested
security level and ensures that auth_type always represents what we tell
the controller. All other code in hci_user_confirm_request_evt still
uses the auth_type instead of pending_sec_level for determining whether
to do just-works or not, since that's the only value that's in sync with
what the remote device knows.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Tested-by: Szymon Janc <szymon.janc@tieto.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Cc: stable@vger.kernel.org # 3.16
10 years agoBluetooth: Add support for external configuration with UART driver
Marcel Holtmann [Fri, 11 Jul 2014 05:12:58 +0000 (07:12 +0200)]
Bluetooth: Add support for external configuration with UART driver

The quirk for enabling external configuration with UART needs to be
provided via the HCI UART flags. Add a new flag for it and declare
it as valid.

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
10 years agoBluetooth: Check for valid HCI UART driver flags
Marcel Holtmann [Fri, 11 Jul 2014 05:12:57 +0000 (07:12 +0200)]
Bluetooth: Check for valid HCI UART driver flags

Providing unknown or invalid flags to the HCI UART driver should
result in an error. So check which flags are valid and otherwise
return an error.

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
10 years agoBluetooth: Move SCO timeout constants into net/bluetooth/sco.c
Marcel Holtmann [Fri, 11 Jul 2014 04:19:44 +0000 (06:19 +0200)]
Bluetooth: Move SCO timeout constants into net/bluetooth/sco.c

There is no external user of the SCO timeout constants and thus
move them into net/bluetooth/sco.c where they are actuallu used.

In addition just remove SCO_CONN_IDLE_TIMEOUT since it is unused.

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
10 years agoBluetooth: Remove unused SCO_DEFAULT_FLUSH_TO constant
Marcel Holtmann [Fri, 11 Jul 2014 04:19:43 +0000 (06:19 +0200)]
Bluetooth: Remove unused SCO_DEFAULT_FLUSH_TO constant

The SCO_DEFAULT_FLUSH_TO constant has been defined, but it is not
used anywhere and so just remove it.

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
10 years agoBluetooth: Move struct sco_conn into net/bluetooth/sco.c
Marcel Holtmann [Fri, 11 Jul 2014 04:19:42 +0000 (06:19 +0200)]
Bluetooth: Move struct sco_conn into net/bluetooth/sco.c

There exists no external user of struct sco_conn and thus move
it into the one place that is actually using it.

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
10 years agoBluetooth: Move struct sco_pinfo into net/bluetooth/sco.c
Marcel Holtmann [Fri, 11 Jul 2014 04:19:41 +0000 (06:19 +0200)]
Bluetooth: Move struct sco_pinfo into net/bluetooth/sco.c

There exists no external user of struct sco_pinfo and sco_pi and
thus move it into the one place that is actually using it.

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
10 years agoBluetooth: Update the list of L2CAP fixed channels
Marcel Holtmann [Fri, 11 Jul 2014 04:03:08 +0000 (06:03 +0200)]
Bluetooth: Update the list of L2CAP fixed channels

The list of L2CAP fixed channels increased with newer versions of the
specification. This just updates the constants for it.

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
10 years agoBluetooth: Move HCI request internals to net/bluetooth/hci_core.c
Marcel Holtmann [Fri, 11 Jul 2014 03:51:58 +0000 (05:51 +0200)]
Bluetooth: Move HCI request internals to net/bluetooth/hci_core.c

The internals of the HCI request framework should not be leaking to
its users. Move them all into net/bluetooth/hci_core.c and provide
a simple hci_req_pending helper function for the one user outside
the framework.

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
10 years agoBluetooth: Move struct hci_pinfo into net/bluetooth/hci_sock.c
Marcel Holtmann [Fri, 11 Jul 2014 03:41:00 +0000 (05:41 +0200)]
Bluetooth: Move struct hci_pinfo into net/bluetooth/hci_sock.c

There exists no external user of struct hci_pinfo and hci_pi and thus
move it into the one place that is actually using it.

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
10 years agoBluetooth: Delcare the hci_sec_filter as const
Marcel Holtmann [Fri, 11 Jul 2014 03:36:40 +0000 (05:36 +0200)]
Bluetooth: Delcare the hci_sec_filter as const

The hci_sec_filter socket filter details do not change. They are fixed
and with that they can also be delcared as const.

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
10 years agoBluetooth: Move struct hci_sec_filter next to its user
Marcel Holtmann [Fri, 11 Jul 2014 03:36:39 +0000 (05:36 +0200)]
Bluetooth: Move struct hci_sec_filter next to its user

There is only single location using struct hci_sec_filter and with
that there is no point in putting this declaration into a global
header file. So move it right next to its user and make the code
a lot more simpler.

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
10 years agoBluetooth: Move HCI socket definitions into its own header file
Marcel Holtmann [Fri, 11 Jul 2014 02:58:29 +0000 (04:58 +0200)]
Bluetooth: Move HCI socket definitions into its own header file

All the HCI sockets and ioctl based definitions have been in a global
header file that also includes all the HCI protocol structures. To
make this a bit cleaner, move them into its own file.

This also adjusts fs/compat_ioctl.c to only include this new file
and not all the protocol structures that are not needed.

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
10 years agoMerge branch 'for-upstream' of git://git.kernel.org/pub/scm/linux/kernel/git/bluetoot...
John W. Linville [Thu, 10 Jul 2014 21:00:34 +0000 (17:00 -0400)]
Merge branch 'for-upstream' of git://git./linux/kernel/git/bluetooth/bluetooth-next

10 years agoMerge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless
John W. Linville [Thu, 10 Jul 2014 21:00:24 +0000 (17:00 -0400)]
Merge branch 'master' of git://git./linux/kernel/git/linville/wireless

10 years agoBluetooth: Set HCI_PAIRABLE during power on for legacy ioctl
Marcel Holtmann [Thu, 10 Jul 2014 13:25:22 +0000 (15:25 +0200)]
Bluetooth: Set HCI_PAIRABLE during power on for legacy ioctl

When the controller is brought up using legacy ioctl, the setting of
the HCI_PAIRABLE flag should happen then. Previously it was set during
enumeration and when retrieving device information.

This change also will not set the HCI_PAIRABLE flag when the controller
is used with the HCI User Channel operation.

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
10 years agoBluetooth: Mark controller is down when HCI_AUTO_OFF is set
Marcel Holtmann [Thu, 10 Jul 2014 11:17:37 +0000 (13:17 +0200)]
Bluetooth: Mark controller is down when HCI_AUTO_OFF is set

During the initial setup phase, the controller is powered on and will
be powered off again if it is not used within the auto-off timeout.

Userspace using ioctl does not know about the difference between the
initial setup phase and a controller being present. It is a bad idea
to keep the controller powered by just looking at the device list or
device information. Instead just tell userspace that the controller
is still down.

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
10 years agoBluetooth: Remove unneeded mgmt_write_scan_failed function
Johan Hedberg [Thu, 10 Jul 2014 09:09:09 +0000 (12:09 +0300)]
Bluetooth: Remove unneeded mgmt_write_scan_failed function

The Set Connectable/Discoverable mgmt handlers use a hci_request with a
proper callback to handle the HCI command sending. It makes therefore
little sense to have this extra function to be called from hci_event.c
for command failures.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
10 years agoBluetooth: Remove unneeded mgmt_discoverable function
Johan Hedberg [Thu, 10 Jul 2014 09:09:08 +0000 (12:09 +0300)]
Bluetooth: Remove unneeded mgmt_discoverable function

Since the HCISETSCAN ioctl is the only non-mgmt user we care about for
setting the right discoverable state we can simply do the necessary
updates in the ioctl handler function instead. This then allows the
removal of the mgmt_discoverable function and should simplify that state
handling considerably.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
10 years agoBluetooth: Refactor ioctl scan state update to its own function
Johan Hedberg [Thu, 10 Jul 2014 09:09:07 +0000 (12:09 +0300)]
Bluetooth: Refactor ioctl scan state update to its own function

With subsequent patches we'll also need to update the discoverable
state. As the code grows bigger it's better to move this out from the
switch statement into its own function.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
10 years agoBluetooth: Remove unneeded mgmt_connectable function
Johan Hedberg [Thu, 10 Jul 2014 09:09:06 +0000 (12:09 +0300)]
Bluetooth: Remove unneeded mgmt_connectable function

The mgmt_connectable function has been used to ensure that the right
actions to HCI_CONNECTABLE are taken when the HCI_Write_Scan_Enable
command is triggered by something else than mgmt. The only other user
that we really care about is the HCISETSCAN ioctl code, so we can
actually more simply perform the needed changes there instead.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
10 years agoBluetooth: Fix using test_and_clear instead of test_and_set
Johan Hedberg [Thu, 10 Jul 2014 08:50:27 +0000 (11:50 +0300)]
Bluetooth: Fix using test_and_clear instead of test_and_set

The code for updating the HCI_CONNECTABLE flag was incorrectly using
test_and_set_bit instead of test_and_clear_bit when HCI_CONNECTABLE is
to be cleared.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
10 years agoBluteooth: Reject SMP bonding if HCI_PAIRABLE is not set
Johan Hedberg [Thu, 10 Jul 2014 08:02:07 +0000 (11:02 +0300)]
Bluteooth: Reject SMP bonding if HCI_PAIRABLE is not set

If the remote device tries to initiate bonding with us and we don't have
HCI_PAIRABLE set we should just flat out reject the request. This brings
SMP in line with how the flag is used for BR/EDR SSP.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
10 years agoBluetooth: Fix advertising parameter update when toggling connectable
Johan Hedberg [Thu, 10 Jul 2014 07:51:27 +0000 (10:51 +0300)]
Bluetooth: Fix advertising parameter update when toggling connectable

When we change the connectable state and have advertising enabled we
should update the advertising parameters no matter what. The code was
incorrectly only updating them if advertising was not already active.
This patch fixes the issue.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
10 years agoBluetooth: Fix incorrect clearing of SMP_FLAG_INITIATOR
Johan Hedberg [Wed, 9 Jul 2014 16:18:11 +0000 (19:18 +0300)]
Bluetooth: Fix incorrect clearing of SMP_FLAG_INITIATOR

When the SMP context is created all flags default to zero. To determine
that we are the initiators it's therefore best to simply change the flag
value when we know we're sending the first SMP PDU. Clearing the flag
when receiving a Pairing Request is not correct since the request may be
a response to a previous Security Request from us (for which we would
already have correctly set the flag). Same goes for receiving a Security
Request which may be coming after us already starting pairing by sending
a Pairing Request.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
10 years agoBluetooth: Fix forcing SMP just-works with no-bonding
Johan Hedberg [Wed, 9 Jul 2014 16:18:10 +0000 (19:18 +0300)]
Bluetooth: Fix forcing SMP just-works with no-bonding

Whether we bond or not should not have any impact on the user
interaction model. This patch removes an incorrect fall-back from
JUST_CFM to JUST_WORKS in case we're not bonding.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
10 years agoBluetooth: Always confirm incoming SMP just-works requests
Johan Hedberg [Wed, 9 Jul 2014 16:18:09 +0000 (19:18 +0300)]
Bluetooth: Always confirm incoming SMP just-works requests

For incoming requests we want to let the user know that pairing is
happening since otherwise there could be access to MEDIUM security
services without any user interaction at all. Therefore, set the
selected method to JUST_CFM instead of JUST_WORKS and let it be
converted back to JUST_WORKS later if we are the initators.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
10 years agoBluetooth: Don't send ERTM configuration option when disabled
Marcel Holtmann [Wed, 9 Jul 2014 09:53:35 +0000 (11:53 +0200)]
Bluetooth: Don't send ERTM configuration option when disabled

When ERTM support is disabled, then do not even send ERTM configuration
option even if the remote side supports it.

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
10 years agoBluetooth: Fix setting HCI_CONNECTABLE from ioctl code
Johan Hedberg [Wed, 9 Jul 2014 10:28:26 +0000 (13:28 +0300)]
Bluetooth: Fix setting HCI_CONNECTABLE from ioctl code

When the white list is in use the code would not update the
HCI_CONNECTABLE flag if it gets changed through the ioctl code (e.g.
hciconfig hci0 pscan). Since the flag is important for properly
accepting incoming connections add code to fix it up if necessary and
emit a New Settings mgmt event.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
10 years agoBluetooth: Add white list lookup for incoming connection requests
Johan Hedberg [Wed, 9 Jul 2014 09:59:19 +0000 (12:59 +0300)]
Bluetooth: Add white list lookup for incoming connection requests

This patch adds support for looking up entries in the white list when
HCI_CONNECTABLE is not set. The logic is fairly simple: if we're
connectable check the black list, if we're not connectable check the
white list.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
10 years agoBluetooth: Enable page scan also if there are white list entries
Johan Hedberg [Wed, 9 Jul 2014 09:59:18 +0000 (12:59 +0300)]
Bluetooth: Enable page scan also if there are white list entries

Page scan should be enabled either if the connectable setting is set or
if there are any entries in the BR/EDR white list. This patch implements
such behavior by updating the two places that were making decisions on
whether to enable page scan or not.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
10 years agoBluetooth: Refactor connection request handling
Johan Hedberg [Wed, 9 Jul 2014 09:59:17 +0000 (12:59 +0300)]
Bluetooth: Refactor connection request handling

The conditions for accepting an incoming connections are already
non-trivial and will become more so once a white list is added. This
patch breaks up the checks for when to reject the request by creating a
helper function for it.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
10 years agoBluetooth: Fix incorrectly setting HCI_CONNECTABLE
Johan Hedberg [Wed, 9 Jul 2014 09:59:16 +0000 (12:59 +0300)]
Bluetooth: Fix incorrectly setting HCI_CONNECTABLE

Since page scan might be enabled by Add Device we should not implicitly
set connectable whenever something else than Set Connectable changes it.
This patch makes sure that we don't set HCI_CONNECTABLE for these cases
if there are any entries in the white list.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
10 years agoBluetooth: Update page scan when necessary for Add/Remove Device
Johan Hedberg [Wed, 9 Jul 2014 09:59:15 +0000 (12:59 +0300)]
Bluetooth: Update page scan when necessary for Add/Remove Device

When we're removing the last item in the white list or adding the first
one to it and HCI_CONNECTABLE is not set we need to update the current
page scan. This patch adds a simple helper function for the purpose and
calls it from the respective mgmt command handlers.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
10 years agoBluetooth: Introduce a whitelist for BR/EDR devices
Johan Hedberg [Wed, 9 Jul 2014 09:59:14 +0000 (12:59 +0300)]
Bluetooth: Introduce a whitelist for BR/EDR devices

This patch extends the Add/Remove device commands by letting user space
pass BR/EDR addresses to them. The resulting entries get stored in a new
hdev->whitelist list. The idea is that we can now selectively accept
connections from devices in the list even though HCI_CONNECTABLE is not
set (the actual implementation of this is coming in a subsequent patch).

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
10 years agoBluetooth: Unify helpers for bdaddr_list manipulations
Johan Hedberg [Wed, 9 Jul 2014 09:59:13 +0000 (12:59 +0300)]
Bluetooth: Unify helpers for bdaddr_list manipulations

We already have several lists with struct bdaddr_list entries, and there
will be more in the future. Since the operations for adding, removing,
looking up and clearing entries in these lists are exactly the same it
doesn't make sense to define new functions for every single list. This
patch unifies the functions by passing the list_head to them instead of
a hci_dev pointer.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
10 years agoBluetooth: Fix enabling Authenticated Payload Timeout Expired event
Marcel Holtmann [Wed, 9 Jul 2014 07:49:05 +0000 (09:49 +0200)]
Bluetooth: Fix enabling Authenticated Payload Timeout Expired event

The Authenticated Payload Timeout Expired event is valid for
controllers with BR/EDR Secure Connections support, but also for
LE only controllers supporting LE Ping feature. When either of them
is available enable this event. Previous it was not enabled when
the controller was only supporting LE operation.

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
10 years agoBluetooth: Add support for Acer [13D3:3432]
Anantha Krishnan [Tue, 8 Jul 2014 13:55:08 +0000 (19:25 +0530)]
Bluetooth: Add support for Acer [13D3:3432]

Add support for the QCA6174 chip.

    T:  Bus=04 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 30 Spd=12  MxCh= 0
    D:  Ver= 1.10 Cls=e0(wlcon) Sub=01 Prot=01 MxPS=64 #Cfgs=  1
    P:  Vendor=13d3 ProdID=3432 Rev=00.02
    C:  #Ifs= 2 Cfg#= 1 Atr=e0 MxPwr=100mA
    I:  If#= 0 Alt= 0 #EPs= 3 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
    I:  If#= 1 Alt= 0 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb

Signed-off-by: Anantha Krishnan <ananthk@codeaurora.org>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
10 years agoBluetooth: Fix clearing HCI_LE_ADV for LE connections
Johan Hedberg [Tue, 8 Jul 2014 14:21:51 +0000 (17:21 +0300)]
Bluetooth: Fix clearing HCI_LE_ADV for LE connections

All LE controllers always implicitly stop advertising when establishing
connections. Therefore, be sure to clear the flag in the event handler
for new LE connections.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
10 years agoBluetooth: Fix toggling background scan when changing connectable state
Johan Hedberg [Tue, 8 Jul 2014 13:35:34 +0000 (16:35 +0300)]
Bluetooth: Fix toggling background scan when changing connectable state

If the connectable state change doesn't require any special HCI commands
the set_connectable_update_settings() function is used instead of the
set_connectable_complete() function. We must therefore make sure to call
hci_update_background_scan() there as well. This code path is used also
when we're powered off, but that's fine since hci_update_background_scan()
has the necessary checks for it.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
10 years agoBluetooth: Fix connectable and discoverable supported settings values
Johan Hedberg [Tue, 8 Jul 2014 13:07:34 +0000 (16:07 +0300)]
Bluetooth: Fix connectable and discoverable supported settings values

The connectable and discoverable mgmt settings are supported both for LE
and BR/EDR controllers so they do not belong behind a lmp_bredr_capable()
condition. This patch fixes the issue in get_supported_settings().

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
10 years agoBluetooth: Fix setting STOPPING state for discovery
Johan Hedberg [Tue, 8 Jul 2014 13:05:06 +0000 (16:05 +0300)]
Bluetooth: Fix setting STOPPING state for discovery

If any of the HCI commands from the hci_stop_discovery function were
successfully sent we need to set the discovery state to STOPPING. The
Stop Discovery code was already handling this, but the code in
clean_up_hci_state was not. This patch updates the hci_stop_discovery to
return a bool to indicate whether it queued any commands and the
clean_up_hci_state() function respectively to look at the return value
and call hci_discovery_set_state() if necessary.

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