GitHub/LineageOS/android_kernel_motorola_exynos9610.git
10 years agowil6210: map RGF_USER_USAGE_1 on the debugfs
Vladimir Kondratiev [Mon, 14 Jul 2014 06:49:42 +0000 (09:49 +0300)]
wil6210: map RGF_USER_USAGE_1 on the debugfs

Firmware sets this register with the offset of the firmware trace area
within the peripheral memory region. Critical for the firmware trace
to work

Signed-off-by: Vladimir Kondratiev <qca_vkondrat@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agowil6210: use same mapping table for FW addr translation and debugfs
Vladimir Kondratiev [Mon, 14 Jul 2014 06:49:41 +0000 (09:49 +0300)]
wil6210: use same mapping table for FW addr translation and debugfs

Use single data source for all information regarding the firmware
memory map. With this change "ucode_xxx" regions disappears since
they are in fact part of larger "upper area" region

Signed-off-by: Vladimir Kondratiev <qca_vkondrat@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agowil6210: fix memory leak on error path in wil_write_file_rxon()
Vladimir Kondratiev [Mon, 14 Jul 2014 06:49:40 +0000 (09:49 +0300)]
wil6210: fix memory leak on error path in wil_write_file_rxon()

If copy_from_user() fails, buffer allocated for parameters would leak

Signed-off-by: Vladimir Kondratiev <qca_vkondrat@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agowil6210: fix double definition of 'ctx'
Vladimir Kondratiev [Mon, 14 Jul 2014 06:49:39 +0000 (09:49 +0300)]
wil6210: fix double definition of 'ctx'

Variable 'ctx' declarad again in the inner loop. Should use
one from outer loop instead.

Signed-off-by: Vladimir Kondratiev <qca_vkondrat@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agowil6210: export FW/HW versions through debugfs
Vladimir Kondratiev [Mon, 14 Jul 2014 06:49:38 +0000 (09:49 +0300)]
wil6210: export FW/HW versions through debugfs

Signed-off-by: Vladimir Kondratiev <qca_vkondrat@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agowil6210: support for "sparrow" hardware
Vladimir Kondratiev [Mon, 14 Jul 2014 06:49:37 +0000 (09:49 +0300)]
wil6210: support for "sparrow" hardware

New hardware release appears; it require some changes to properly support  it.
Introduce struct wil_board and "board" attribute in wil6210_priv;
keep hardware variant information in this structure.
fill it on probe(). Used in the reset flow.

Signed-off-by: Vladimir Kondratiev <qca_vkondrat@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agoMerge tag 'for-linville-20140717' of git://github.com/kvalo/ath
John W. Linville [Fri, 18 Jul 2014 17:44:50 +0000 (13:44 -0400)]
Merge tag 'for-linville-20140717' of git://github.com/kvalo/ath

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 agoath10k: sanitize tx ring index access properly
Michal Kazior [Mon, 14 Jul 2014 13:25:25 +0000 (16:25 +0300)]
ath10k: sanitize tx ring index access properly

The tx ring index was immediately trimmed with a
bitmask. This discarded the 0xFFFFFFFF error case
(which theoretically can happen when a device is
abruptly disconnected) and led to using an invalid
tx ring index. This could lead to memory
corruption.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
10 years agoath10k: fix bmi exchange tx/rx race
Michal Kazior [Mon, 14 Jul 2014 13:25:25 +0000 (16:25 +0300)]
ath10k: fix bmi exchange tx/rx race

It was possible for tx completion not to be
processed. In that case an old stack pointer was
left on copy engine tx ring. Next bmi exchange
would immediately pop it and use complete() on the
completion struct there causing corruption.

Make sure to wait for both tx and rx completions
properly.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.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 agoath10k: fix unregister deadlock when fw probe fails
Michal Kazior [Mon, 14 Jul 2014 13:07:29 +0000 (16:07 +0300)]
ath10k: fix unregister deadlock when fw probe fails

If firmware probing worker failed it called
device_release_driver() which synchronously called
remove() pci callback. The callback in turn waited
for the worker that called it to finish resulting
in a deadlock.

Waiting for a completion instead of a worker, like
some other drivers do, doesn't seem like the best
idea either:

  Syscall                 Worker

                          probe_fw()
  rmmod
  dev_lock()
  pci->remove()
  wait_for_completion()
                          complete_all()
                          device_release_driver()
                          dev_lock()
                          [sleep]
  free(ar)
  dev_unlock()
                          [resume]

There's no guarantee that Worker upon resuming can
still access any data/code of the module.

Leaving device bound to a driver is not as harmful
as deadlocking so remove the call to
device_release_driver() while a proper solution is
figured out.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
10 years agoath6kl: add support for ar6004 hw3.0
Jessica Wu [Tue, 17 Jun 2014 09:41:16 +0000 (12:41 +0300)]
ath6kl: add support for ar6004 hw3.0

This change enables ath6kl driver to support ar6004 hw3.0. At the same time do
some fixes in firmware initialisation which applies to ar6004 hw1.3 as well.

Signed-off-by: Jessica Wu <wjessica@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
10 years agoath6kl: add support wmi rate tables with mcs15
Jessica Wu [Tue, 17 Jun 2014 09:41:10 +0000 (12:41 +0300)]
ath6kl: add support wmi rate tables with mcs15

Some of the firmware versions support rate tables up to mcs15, add support for
that.

Signed-off-by: Jessica Wu <wjessica@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
10 years agoath6kl: don't set hi_refclk_hz if hardware version doesn't need it
Kalle Valo [Tue, 17 Jun 2014 09:41:04 +0000 (12:41 +0300)]
ath6kl: don't set hi_refclk_hz if hardware version doesn't need it

Needed for ar6004 hw3.0 support.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
10 years agoath6kl: implement rx flush for htc pipe
Jessica Wu [Tue, 17 Jun 2014 09:40:58 +0000 (12:40 +0300)]
ath6kl: implement rx flush for htc pipe

rx flush was not implemented for htc pipe, add that now. Doesn't fix any known
issues.

Also free the skb if htc control messages get canceled.

Signed-off-by: Jessica Wu <wjessica@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
10 years agoath6kl: convert ar6004 hardware flags to firmware feature flags
Kalle Valo [Tue, 17 Jun 2014 09:40:52 +0000 (12:40 +0300)]
ath6kl: convert ar6004 hardware flags to firmware feature flags

The functionality defined through these flags were actually firmware features
which can change between firmware versions. To make it possible to support
different firmware versions with the same driver, convert the flags to firmware
feature flags.

For backwards compatibility support for old ar6004 firmware FW
API 3 or smaller images we forcefully set the feature bits in the driver.
Starting from FW API 5 the firmware image needs to set them.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
10 years agoath6kl: Fix ath6kl_bmi_read_hi32 macro
Frederic Danis [Mon, 2 Jun 2014 18:19:46 +0000 (21:19 +0300)]
ath6kl: Fix ath6kl_bmi_read_hi32 macro

tmp may be used uninitialized if ath6kl_bmi_read() returns an error.

Signed-off-by: Frederic Danis <frederic.danis@linux.intel.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
10 years agoath10k: add implementation for configure max amsdu, ampdu
Janusz Dziedzic [Mon, 2 Jun 2014 18:19:46 +0000 (21:19 +0300)]
ath10k: add implementation for configure max amsdu, ampdu

Allow to setup maximum subframes for AMSDU and AMPDU aggregation
via debugfs htt_max_amsdu_ampdu file.

Eg.
echo "2 64" > htt_max_amsdu_ampdu
will setup maximum amsdu subframes equal 2 and
maximum ampdu subframes equal to 64.

Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
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>