openwrt/staging/blogic.git
10 years agoNFC: st21nfcb: few code clean up
Christophe Ricard [Sun, 25 May 2014 20:46:58 +0000 (22:46 +0200)]
NFC: st21nfcb: few code clean up

Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
10 years agoNFC: nci: Add T1T support notification
Christophe Ricard [Sun, 25 May 2014 20:35:40 +0000 (22:35 +0200)]
NFC: nci: Add T1T support notification

Add T1T matching with Jewel during notification.
It was causing "the target found does not have the desired protocol"
to show up.

Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
10 years agoNFC: dts: st21nfcb_i2c: Add DTS Documentation
Christophe Ricard [Sun, 25 May 2014 20:35:39 +0000 (22:35 +0200)]
NFC: dts: st21nfcb_i2c: Add DTS Documentation

Describe the properties used by the st21nfcb NFC controller driver.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
10 years agoNFC: st21nfcb: Add driver for STMicroelectronics ST21NFCB NFC chip
Christophe Ricard [Sun, 25 May 2014 20:35:38 +0000 (22:35 +0200)]
NFC: st21nfcb: Add driver for STMicroelectronics ST21NFCB NFC chip

Add driver for STMicroelectronics ST21NFCB NFC controller.
ST21NFCB is using NCI protocol and a proprietary low level transport
protocol called NDLC used on top.

NDLC:
The protocol defines 2 types of frame:
- One type carrying NCI data (referred as DATAFRAME frames).
- One type carrying protocol information used for flow control and error
control mechanisms (referred as SUPERVISOR frames).

After each frame transmission to the NFC controller, the device host
SHALL waitfor  an ACK (SUPERVISOR frame) reception before sending a
new frame.
The NFC controller MAY send a frame at anytime to the device host.
The NFC controller MAY send a specific WAIT supervisor frame to indicate
to device host that a NCI data packet has been received but that it could
take significant time before the NFC controller sends an ACK and thus
allows next data reception.

Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
10 years agoNFC: digital: Add digital framing calls when in target mode
Mark A. Greer [Wed, 2 Jul 2014 17:16:15 +0000 (10:16 -0700)]
NFC: digital: Add digital framing calls when in target mode

Add new "NFC_DIGITAL_FRAMING_*" calls to the digital
layer so the driver can make the necessary adjustments
when performing anticollision while in target mode.

The driver must ensure that the effect of these calls
happens after the following response has been sent but
before reception of the next request begins.

Acked-by: Thierry Escande <thierry.escande@linux.intel.com>
Signed-off-by: Mark A. Greer <mgreer@animalcreek.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
10 years agoNFC: digital: Clear poll_tech_count before activating target
Mark A. Greer [Wed, 2 Jul 2014 16:03:49 +0000 (09:03 -0700)]
NFC: digital: Clear poll_tech_count before activating target

Currently, digital_target_found() has a race between
the events started by calling nfc_targets_found()
(which ultimately expect ddev->poll_tech_count to be
zero) and setting ddev->poll_tech_count to zero after
the call to nfc_targets_found().  When the race is
"lost" (i.e., ddev->poll_tech_count is found to not
be zero by the events started by nfc_targets_found()),
an error message is printed and the target is not found.
A similar race exists when digital_tg_recv_atr_req()
calls nfc_tm_activated().

Fix this by first saving the current value of
ddev->poll_tech_count and then clearing it before
calling nfc_targets_found()/nfc_tm_activated().
Clearing ddev->poll_tech_count before calling
nfc_targets_found()/nfc_tm_activated() eliminates
the race.  Saving the value is required so it can be
restored when nfc_targets_found()/nfc_tm_activated()
fails and polling needs to continue.

Acked-by: Thierry Escande <thierry.escande@linux.intel.com>
Signed-off-by: Mark A. Greer <mgreer@animalcreek.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
10 years agoNFC: digital: Check for NFC-DEP before checking for Type 4 tag
Mark A. Greer [Wed, 2 Jul 2014 16:01:56 +0000 (09:01 -0700)]
NFC: digital: Check for NFC-DEP before checking for Type 4 tag

In digital_in_recv_sel_res(), the code that determines
the tag type will interpret bits 7:6 (lsb being b1 as
per the Digital Specification) of a SEL RES set to 11b
as a Type 4 tag.  This is okay except that the neard
will interpret the same value as an NFC-DEP device
(in src/tag.c:set_tag_type() in the neard source).

Make the digital layer's interpretation match neard's
interpretation by changing the order of the checks in
digital_in_recv_sel_res() so that a value of 11b in
bits 7:6 is interpreted as an NFC-DEP device instead
of a Type 4 tag.

Acked-by: Thierry Escande <thierry.escande@linux.intel.com>
Signed-off-by: Mark A. Greer <mgreer@animalcreek.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
10 years agomwifiex: remove redundant timestamps in debug prints
Bing Zhao [Thu, 17 Jul 2014 22:55:09 +0000 (15:55 -0700)]
mwifiex: remove redundant timestamps in debug prints

We don't need wall-clock time here, and in most configurations
that care, there are already timestamps in the kernel using
CONFIG_PRINTK_TIME=y.

Reported-by: Paul Stewart <pstew@chromium.org>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agomwifiex: do not re-associate when already connected
Ujjal Roy [Thu, 17 Jul 2014 18:49:55 +0000 (11:49 -0700)]
mwifiex: do not re-associate when already connected

In managed mode if the driver is getting a re-associate command
from cfg80211, driver deauthenticates with the AP internally and
sends a disconnected event to cfg80211 before completion of its
association process. The disconnected event then modifies the
SSID length as wdev->ssid_len = 0. So, upon receiving the connect
result event from driver, cfg80211 is unable to get that BSS from
the device's BSS list and generates the following WARN_ON message.

WARNING: CPU: 0 PID: 857 at net/wireless/sme.c:658
         __cfg80211_connect_result+0x3a6/0x3e0 [cfg80211]()

Avoid re-association while the device is already associated to a
network. Also remove the internal deauthentication from the
association path.

Signed-off-by: Ujjal Roy <royujjal@gmail.com>
Signed-off-by: Avinash Patil <patila@marvell.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agomwifiex: remove needless current_bssid variable
Avinash Patil [Thu, 17 Jul 2014 18:48:47 +0000 (11:48 -0700)]
mwifiex: remove needless current_bssid variable

This local variable is not used anywhere in function.

Signed-off-by: Avinash Patil <patila@marvell.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agob43: N-PHY: update spur avoidance to support newer devices
Rafał Miłecki [Thu, 17 Jul 2014 17:31:06 +0000 (19:31 +0200)]
b43: N-PHY: update spur avoidance to support newer devices

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agob43: use one shared function for setting MAC frequency
Rafał Miłecki [Thu, 17 Jul 2014 17:31:05 +0000 (19:31 +0200)]
b43: use one shared function for setting MAC frequency

By the way add few chipsets that were tracked with "wl" dumps.

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agob43: N-PHY: set band on every channel switch
Rafał Miłecki [Thu, 17 Jul 2014 17:31:04 +0000 (19:31 +0200)]
b43: N-PHY: set band on every channel switch

Seems to be required by some hardware, wl does it every time.

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agob43: N-PHY: complete 0x2057 radio init calibration
Rafał Miłecki [Thu, 17 Jul 2014 17:31:03 +0000 (19:31 +0200)]
b43: N-PHY: complete 0x2057 radio init calibration

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agob43: N-PHY: add tables for radio 0x2057 rev 14
Rafał Miłecki [Thu, 17 Jul 2014 17:31:02 +0000 (19:31 +0200)]
b43: N-PHY: add tables for radio 0x2057 rev 14

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agob43: N-PHY: fix channel switching with 2 GHz radio 0x2057
Rafał Miłecki [Thu, 17 Jul 2014 17:31:01 +0000 (19:31 +0200)]
b43: N-PHY: fix channel switching with 2 GHz radio 0x2057

Values were written to wrong registers.

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agoath9k: drop negativity checks for unsigned values coming from kstrtoul()
Andrey Utkin [Thu, 17 Jul 2014 13:56:37 +0000 (16:56 +0300)]
ath9k: drop negativity checks for unsigned values coming from kstrtoul()

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=80471
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=80481
Reported-by: David Binderman <dcb314@hotmail.com>
Signed-off-by: Andrey Utkin <andrey.krieger.utkin@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agoath9k: set up tx power into the MRR
Lorenzo Bianconi [Wed, 16 Jul 2014 21:20:10 +0000 (23:20 +0200)]
ath9k: set up tx power into the MRR

Set up tx power for each MRR segment in the tx descriptor

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi83@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agoath9k: fix pending tx frames accounting
Felix Fietkau [Wed, 16 Jul 2014 18:26:05 +0000 (20:26 +0200)]
ath9k: fix pending tx frames accounting

Packets originally buffered for the regular hardware tx queues can end
up being transmitted through the U-APSD queue (via PS-Poll or U-APSD).
When packets are dropped due to retransmit failures, the pending frames
counter is not always updated properly.
Fix this by keeping track of the queue that a frame was accounted for in
the ath_frame_info struct, and using that on completion to decide
whether the counter should be updated.
This fixes some spurious transmit queue hangs.

Cc: stable@vger.kernel.org
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agobcma: add support for BCM43217 found in Tenda W322E (14e4:43a9)
Rafał Miłecki [Tue, 15 Jul 2014 17:44:28 +0000 (19:44 +0200)]
bcma: add support for BCM43217 found in Tenda W322E (14e4:43a9)

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agobcma: extract antenna gains from SPROM correctly
Rafał Miłecki [Tue, 15 Jul 2014 14:54:47 +0000 (16:54 +0200)]
bcma: extract antenna gains from SPROM correctly

Just like in case of SSB SPROMs they are encoded in a bit tricky way.
SPROM struct already uses s8 type and it's supposed to store decoded
values.

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agossb: extract power info from SPROM revs 4 and 5
Rafał Miłecki [Tue, 15 Jul 2014 14:18:57 +0000 (16:18 +0200)]
ssb: extract power info from SPROM revs 4 and 5

This is needed to properly handle early 802.11n devices like BCM4321.

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agowil6210: add new register region for AGC table
Vladimir Kondratiev [Mon, 14 Jul 2014 06:49:43 +0000 (09:49 +0300)]
wil6210: add new register region for AGC table

New register area defined in the firmware

Signed-off-by: Vladimir Kondratiev <qca_vkondrat@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
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>