firefly-linux-kernel-4.4.55.git
11 years agomac80211: handle extended channel switch announcement
Johannes Berg [Tue, 26 Mar 2013 14:17:18 +0000 (15:17 +0100)]
mac80211: handle extended channel switch announcement

Handle the (public) extended channel switch announcement
action frames. Parts of the data in these frames isn't
really in IEs, but put it into the elems struct anyway
to simplify the handling.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211: support secondary channel offset in CSA
Johannes Berg [Mon, 25 Mar 2013 17:29:27 +0000 (18:29 +0100)]
mac80211: support secondary channel offset in CSA

Add support for the secondary channel offset IE in channel
switch announcements. This is necessary for proper handling
of CSA on HT access points.

For this to work it is also necessary to convert everything
here to use chandef structs instead of just channels. The
driver updates aren't really correct though. In particular,
the TI wl18xx driver update can't possibly be right since
it just ignores the new channel width for lack of firmware
API.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211: support extended channel switch
Johannes Berg [Tue, 26 Mar 2013 13:13:58 +0000 (14:13 +0100)]
mac80211: support extended channel switch

Support extended channel switch when the operating
class is one of the global operating classes as
defined in Annex E of 802.11-2012. If it isn't,
disconnect from the AP instead.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agocfg80211: add ieee80211_operating_class_to_band
Johannes Berg [Wed, 1 Aug 2012 15:00:55 +0000 (17:00 +0200)]
cfg80211: add ieee80211_operating_class_to_band

This function converts a (global only!) operating
class to an internal band identifier. This will
be needed for extended channel switch support.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211: unify CSA action frame/beacon processing
Johannes Berg [Tue, 26 Mar 2013 13:02:26 +0000 (14:02 +0100)]
mac80211: unify CSA action frame/beacon processing

CSA action frame content should be processed as variable IEs
rather than fixed to make it extensible. Unify the code and
process them just like CSA in beacons to make it easier to
extend for HT/VHT.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211: use second center_freq segment only in 80+80
Johannes Berg [Thu, 28 Mar 2013 09:26:17 +0000 (10:26 +0100)]
mac80211: use second center_freq segment only in 80+80

The field is otherwise reserved, so we shouldn't read
and reject it, though any sane system will probably
have to set it to 0 anyway.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agowireless: regulatory: fix channel disabling race condition
Johannes Berg [Tue, 16 Apr 2013 12:32:26 +0000 (14:32 +0200)]
wireless: regulatory: fix channel disabling race condition

When a full scan 2.4 and 5 GHz scan is scheduled, but then the 2.4 GHz
part of the scan disables a 5.2 GHz channel due to, e.g. receiving
country or frequency information, that 5.2 GHz channel might already
be in the list of channels to scan next. Then, when the driver checks
if it should do a passive scan, that will return false and attempt an
active scan. This is not only wrong but can also lead to the iwlwifi
device firmware crashing since it checks regulatory as well.

Fix this by not setting the channel flags to just disabled but rather
OR'ing in the disabled flag. That way, even if the race happens, the
channel will be scanned passively which is still (mostly) correct.

Cc: stable@vger.kernel.org
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agoNFC: pn544: Add MEI physical layer
Samuel Ortiz [Mon, 15 Apr 2013 22:14:35 +0000 (00:14 +0200)]
NFC: pn544: Add MEI physical layer

With the new mei_phy NFC driver API, the pn544 MEI physical layer is
minimal and similar to the microread one.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
11 years agoNFC: mei: Add a common mei bus API for NFC drivers
Eric Lapuyade [Mon, 15 Apr 2013 09:19:20 +0000 (11:19 +0200)]
NFC: mei: Add a common mei bus API for NFC drivers

This isolates the common code that is required to use an mei bus nfc
device from an NFC HCI drivers. This prepares for future drivers for
NFC chips connected behind an Intel Management Engine controller.
The microread_mei HCI driver is also modified to use that common code.

Signed-off-by: Eric Lapuyade <eric.lapuyade@intel.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
11 years agob43: use bcma_pmu_spuravoid_pllupdate()
Hauke Mehrtens [Fri, 12 Apr 2013 15:08:58 +0000 (17:08 +0200)]
b43: use bcma_pmu_spuravoid_pllupdate()

Do not implement this in b43, but use bcma_pmu_spuravoid_pllupdate().

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agoath5k: use more idiomatic tracing include style
Johannes Berg [Thu, 11 Apr 2013 14:22:08 +0000 (16:22 +0200)]
ath5k: use more idiomatic tracing include style

Pretty much everywhere that uses a trace definition
header that's not in include/trace/events/ uses the
make system for the include path rather than putting
it into the sources, so do that in ath5k as well.

This came up during backporting work (where this is
required), but since all other drivers do it this
way upstream it seemed applicable.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agobrcm80211: simplify makefiles
Johannes Berg [Thu, 11 Apr 2013 14:15:28 +0000 (16:15 +0200)]
brcm80211: simplify makefiles

This came up during my backporting work but it seems
perfectly appropriate for the kernel as well.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Acked-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agobrcmfmac: remove ifidx variable from brcmf_fws_process_skb()
Arend van Spriel [Thu, 11 Apr 2013 11:29:00 +0000 (13:29 +0200)]
brcmfmac: remove ifidx variable from brcmf_fws_process_skb()

The value can be obtained from the struct brcmf_if object pointer
and it is used only twice.

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>
11 years agobrcmfmac: rename brcmf_fws_mac_desc_ready()
Arend van Spriel [Thu, 11 Apr 2013 15:12:04 +0000 (17:12 +0200)]
brcmfmac: rename brcmf_fws_mac_desc_ready()

Replace the function by brcmf_fws_mac_desc_closed(). The new function
is used in the transmit path and in the dequeue worker.

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>
11 years agobrcmfmac: pass ifp pointer in brcmf_fws_find_mac_desc()
Arend van Spriel [Thu, 11 Apr 2013 11:28:58 +0000 (13:28 +0200)]
brcmfmac: pass ifp pointer in brcmf_fws_find_mac_desc()

Instead of passing the ifidx and lookup the ifp inside the
function brcmf_fws_find_mac_desc() simply pass the ifp as
parameter.

Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Reviewed-by: Piotr Haber <phaber@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agobrcmfmac: obtain iftype for firmware-signal descriptor lookup
Arend van Spriel [Thu, 11 Apr 2013 15:08:37 +0000 (17:08 +0200)]
brcmfmac: obtain iftype for firmware-signal descriptor lookup

The function brcmf_fws_find_mac_desc() determines the descriptor
associated with a sk_buff for firmware-signalling. It needs the
interface type to do that. For this a helper function is added in
wl_cfg80211.c.

Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Reviewed-by: Piotr Haber <phaber@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agobrcmfmac: define and use platform specific data for SDIO.
Hante Meuleman [Fri, 12 Apr 2013 08:55:55 +0000 (10:55 +0200)]
brcmfmac: define and use platform specific data for SDIO.

This patch adds support for platform specific data for SDIO
fullmac devices. Currently OOB interrupts are configured by Kconfig
BRCMFMAC_SDIO_OOB but that is now determined dynamically by checking
availibility of platform data.

Cc: Hauke Mehrtens <hauke@hauke-m.de>
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: Piotr Haber <phaber@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>
11 years agobrcmfmac: Add drive strength programming for SDIO 43143.
Hante Meuleman [Thu, 11 Apr 2013 11:28:55 +0000 (13:28 +0200)]
brcmfmac: Add drive strength programming for SDIO 43143.

Reviewed-by: Arend Van Spriel <arend@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Reviewed-by: Piotr Haber <phaber@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>
11 years agobrcmfmac: Add 43143 SDIO support.
Hante Meuleman [Thu, 11 Apr 2013 11:28:54 +0000 (13:28 +0200)]
brcmfmac: Add 43143 SDIO support.

Added sdio device id to list of supported devices. 43143 is a new
802.11n single stream device.

Reviewed-by: Arend Van Spriel <arend@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Reviewed-by: Piotr Haber <phaber@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>
11 years agobrcmfmac: add BCM4335 sdio interface support
Franky Lin [Thu, 11 Apr 2013 11:28:53 +0000 (13:28 +0200)]
brcmfmac: add BCM4335 sdio interface support

BCM4335 is an a/b/g/n/ac WiFi chip that supports up to 80MHz channel. This patch
adds support for this chip through SDIO interface.

Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Reviewed-by: Arend van Spriel <arend@broadcom.com>
Reviewed-by: Piotr Haber <phaber@broadcom.com>
Signed-off-by: Franky Lin <frankyl@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agobrcmfmac: setup SDIO reset behavior
Piotr Haber [Thu, 11 Apr 2013 11:28:52 +0000 (13:28 +0200)]
brcmfmac: setup SDIO reset behavior

Set device in a manner that SDIO I/O card reset
will lead to WLAN backplane and PMU state reset.

Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
Reviewed-by: Arend van Spriel <arend@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
Signed-off-by: Piotr Haber <phaber@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agobrcmfmac: add support for dongle ARM CR4 core
Franky Lin [Thu, 11 Apr 2013 11:28:51 +0000 (13:28 +0200)]
brcmfmac: add support for dongle ARM CR4 core

Newer WiFi chip use ARM CR4 core to achieve higher performance. Add necessary
code for host driver in order to support CR4 core.

Reviewed-by: Arend van Spriel <arend@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Signed-off-by: Franky Lin <frankyl@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agobrcmfmac: adopt new d11 interface
Franky Lin [Thu, 11 Apr 2013 11:28:50 +0000 (13:28 +0200)]
brcmfmac: adopt new d11 interface

Adopting the new d11 interface for 11ac fullmac chip support.

Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Reviewed-by: Arend van Spriel <arend@broadcom.com>
Reviewed-by: Piotr Haber <phaber@broadcom.com>
Signed-off-by: Franky Lin <frankyl@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agobrcmutil: add new d11 interface support
Franky Lin [Thu, 11 Apr 2013 11:28:49 +0000 (13:28 +0200)]
brcmutil: add new d11 interface support

802.11 core interface is upgraded with 11ac support. Add channel spec support
code to brcmutil.

Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Reviewed-by: Arend van Spriel <arend@broadcom.com>
Reviewed-by: Piotr Haber <phaber@broadcom.com>
Signed-off-by: Franky Lin <frankyl@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agobrcmfmac: move chip download state code to sdio_chip.c
Franky Lin [Thu, 11 Apr 2013 11:28:48 +0000 (13:28 +0200)]
brcmfmac: move chip download state code to sdio_chip.c

enter/exit download state routine is going to diverge with new ARM core
introduced. Move corresponding code to sdio_chip.c for new ARM core support.

Reviewed-by: Arend van Spriel <arend@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Signed-off-by: Franky Lin <frankyl@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agobrcmfmac: aggregate dongle ram access interface
Franky Lin [Thu, 11 Apr 2013 11:28:47 +0000 (13:28 +0200)]
brcmfmac: aggregate dongle ram access interface

For fullmac chips host driver can access to dongle RAM through SDIO function 1.
Introduce brcmf_sdio_ramrw and place it at bcmsdh.c with other interface
functions.

Reviewed-by: Arend van Spriel <arend@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Signed-off-by: Franky Lin <frankyl@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agobrcmfmac: support save&restore firmware feature
Piotr Haber [Thu, 11 Apr 2013 11:28:46 +0000 (13:28 +0200)]
brcmfmac: support save&restore firmware feature

Save & restore is an advanced power saving feature,
supported only on selected devices.
SR operation is almost completely transparent to the driver.
Support for it is hardware and firmware dependent.

Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
Reviewed-by: Arend van Spriel <arend@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
Signed-off-by: Piotr Haber <phaber@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agoNFC: RFKILL support
Samuel Ortiz [Thu, 11 Apr 2013 09:52:20 +0000 (11:52 +0200)]
NFC: RFKILL support

All NFC devices will now get proper RFKILL support as long as they provide
some dev_up and dev_down hooks. Rfkilling an NFC device will bring it down
while it is left to userspace to bring it back up when being rfkill unblocked.
This is very similar to what Bluetooth does.

Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
11 years agorfkill: Add NFC to the list of supported radios
Samuel Ortiz [Thu, 11 Apr 2013 09:51:36 +0000 (11:51 +0200)]
rfkill: Add NFC to the list of supported radios

And return the proper string for it.

Acked-by: Johannes Berg <johannes@sipsolutions.net>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
11 years agoBluetooth: Reject SCO when hci connection timeouts
Claudio Takahasi [Thu, 11 Apr 2013 16:54:56 +0000 (13:54 -0300)]
Bluetooth: Reject SCO when hci connection timeouts

This patch sends Reject Synchronous Connection Request Command when
hci_conn_timeout is triggered, and the SCO connection is in BT_CONNECT2
state. It prevents inconsistency if the remote host doesn't implement
properly the timeout for the connection request, and it removes the
connection reference left when the socket is closed for incoming SCO
connections.

[ 2650.129080] sco_sock_release: sock ffff8801ca417400, sk ffff88020c408800
[ 2650.129092] sco_sock_clear_timer: sock ffff88020c408800 state 6
[ 2650.129101] __sco_sock_close: sk ffff88020c408800 state 6 socket
ffff8801ca417400
[ 2650.129108] sco_chan_del: sk ffff88020c408800, conn ffff8801c650ea20,
err 104
[ 2650.129114] hci_conn_put: hcon ffff88020c40a800 orig refcnt 1
[ 2650.129128] sco_sock_kill: sk ffff88020c408800 state 9
[ 2650.129135] sco_sock_destruct: sk ffff88020c408800
[ 2650.138468] hci_conn_timeout: hcon ffff88020c40a800 state BT_CONNECT2

Signed-off-by: Claudio Takahasi <claudio.takahasi@openbossa.org>
Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@openbossa.org>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
11 years agoBluetooth: Remove unneeded parameter
Claudio Takahasi [Thu, 11 Apr 2013 16:55:50 +0000 (13:55 -0300)]
Bluetooth: Remove unneeded parameter

This patch removes the status parameter of the l2cap_conn_add function.
The parameter 'status' is always 0.

Signed-off-by: Claudio Takahasi <claudio.takahasi@openbossa.org>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
11 years agoBluetooth: Minor coding style fix
Claudio Takahasi [Thu, 11 Apr 2013 14:35:46 +0000 (11:35 -0300)]
Bluetooth: Minor coding style fix

This patch removes unneeded initialization and empty line.

Signed-off-by: Claudio Takahasi <claudio.takahasi@openbossa.org>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
11 years agoBluetooth: Use GFP_KERNEL in sco_conn_add
Claudio Takahasi [Thu, 11 Apr 2013 14:35:45 +0000 (11:35 -0300)]
Bluetooth: Use GFP_KERNEL in sco_conn_add

This patch changes the memory allocation flags in the sco_conn_add
function, replacing the type to GFP_KERNEL. This function is executed
in process context and it is not called inside an atomic section.

Signed-off-by: Claudio Takahasi <claudio.takahasi@openbossa.org>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
11 years agoBluetooth: Fix SCO connection reference
Claudio Takahasi [Thu, 11 Apr 2013 16:53:34 +0000 (13:53 -0300)]
Bluetooth: Fix SCO connection reference

This patch fixes decrementing SCO connection reference right after
stablishing the SCO connection with defer setup enabled. The dump below
shows a disconnection command with handle 0, the connection is still in
BT_CONNECT2 state and there isn't a handle associated with it.

< HCI Command: Accept Synchronous Connection (0x01|0x0029) plen 21
  bdaddr 78:47:1D:B3:72:6C
> HCI Event: Command Status (0x0f) plen 4
  Accept Synchronous Connection (0x01|0x0029) status 0x00 ncmd 1
< HCI Command: Disconnect (0x01|0x0006) plen 3
  handle 0 reason 0x13
  Reason: Remote User Terminated Connection
> HCI Event: Command Status (0x0f) plen 4
  Disconnect (0x01|0x0006) status 0x00 ncmd 1
> HCI Event: Synchronous Connect Complete (0x2c) plen 17
  status 0x00 handle 46 bdaddr 78:47:1D:B3:72:6C
  type eSCO
  Air mode: CVSD
< SCO data: handle 46 flags 0x00 dlen 48

Signed-off-by: Claudio Takahasi <claudio.takahasi@openbossa.org>
Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@openbossa.org>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
11 years agoBluetooth: rename hci_conn_put to hci_conn_drop
David Herrmann [Sat, 6 Apr 2013 18:28:37 +0000 (20:28 +0200)]
Bluetooth: rename hci_conn_put to hci_conn_drop

We use _get() and _put() for device ref-counting in the kernel. However,
hci_conn_put() is _not_ used for ref-counting, hence, rename it to
hci_conn_drop() so we can later fix ref-counting and introduce
hci_conn_put().

hci_conn_hold() and hci_conn_put() are currently used to manage how long a
connection should be held alive. When the last user drops the connection,
we spawn a delayed work that performs the disconnect. Obviously, this has
nothing to do with ref-counting for the _object_ but rather for the
keep-alive of the connection.

But we really _need_ proper ref-counting for the _object_ to allow
connection-users like rfcomm-tty, HIDP or others.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
11 years agoBluetooth: Use separate function for BCM92035 vendor setup
Marcel Holtmann [Wed, 10 Apr 2013 15:11:35 +0000 (08:11 -0700)]
Bluetooth: Use separate function for BCM92035 vendor setup

Trying to squeeze every single vendor setup routine into the same function
and have it assigned all the time is actually a bad idea. Especially since
the core can handle the absence of a setup routine perfectly fine.

To make this a lot simpler for future additions of vendor setup code,
split the BCM92035 setup into its own function and only assign it when
this specific device has been detected.

Doing it like this has the nice side benefit that we do not have to keep
a copy of the driver_info around.

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
11 years agoNFC: pn533: Turn radio on and off when bringing the device up and down
Samuel Ortiz [Thu, 11 Apr 2013 09:45:41 +0000 (11:45 +0200)]
NFC: pn533: Turn radio on and off when bringing the device up and down

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
11 years agoNFC: Prevent polling when device is down
Samuel Ortiz [Wed, 10 Apr 2013 10:25:30 +0000 (12:25 +0200)]
NFC: Prevent polling when device is down

Some devices turn radio on whenever they're asked to start a poll.
To prevent that from happening, we just don't call into the driver
start_poll hook when the NFC device is down.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
11 years agoNFC: pn533: Add missing usb_put_dev
Marina Makienko [Tue, 26 Feb 2013 07:41:18 +0000 (11:41 +0400)]
NFC: pn533: Add missing usb_put_dev

Add missing usb_put_dev on failure path in pn533_probe().

Found by Linux Driver Verification project (linuxtesting.org).

Signed-off-by: Marina Makienko <makienko@ispras.ru>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
11 years agoNFC: llcp: Terminate connection when receiving a DISC on (0,0)
Samuel Ortiz [Wed, 3 Apr 2013 14:44:44 +0000 (16:44 +0200)]
NFC: llcp: Terminate connection when receiving a DISC on (0,0)

According to the LLCP specs, we must terminate the LLCP link when receiving
a DISC with both ssap and dsap set to 0.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
11 years agoNFC: llcp: Remove local_cleanup last argument
Samuel Ortiz [Wed, 3 Apr 2013 14:40:52 +0000 (16:40 +0200)]
NFC: llcp: Remove local_cleanup last argument

local_cleanup is always called with device set to false as it means the
local LLCP is going away. So no need to pass this switch as an argument.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
11 years agoNFC: llcp: Only keep raw sockets alive when the LLCP local leaves
Samuel Ortiz [Wed, 3 Apr 2013 14:34:19 +0000 (16:34 +0200)]
NFC: llcp: Only keep raw sockets alive when the LLCP local leaves

When the MAC goes down, connected and connection less sockets should be
notified, but raw sockets should be kept alive.
They will get notified only when the physical devices goes away.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
11 years agoNFC: pn533: Increase version number
Waldemar Rymarkiewicz [Wed, 3 Apr 2013 06:02:16 +0000 (08:02 +0200)]
NFC: pn533: Increase version number

Major features added in 0.2 version:

* frame ops added to support wider set of devices
* support of ACS ACR122U

Signed-off-by: Waldemar Rymarkiewicz <waldemar.rymarkiewicz@tieto.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
11 years agoNFC: pn533: Remove unused pn533_cmd_complete_t
Waldemar Rymarkiewicz [Wed, 3 Apr 2013 06:02:15 +0000 (08:02 +0200)]
NFC: pn533: Remove unused pn533_cmd_complete_t

Signed-off-by: Waldemar Rymarkiewicz <waldemar.rymarkiewicz@tieto.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
11 years agoNFC: pn533: Add pn533_abort_cmd procedure
Waldemar Rymarkiewicz [Wed, 3 Apr 2013 06:02:14 +0000 (08:02 +0200)]
NFC: pn533: Add pn533_abort_cmd procedure

pn533_abort_cmd() aborts last command sent to the controller
and cancels already requested urb.

As ACR122U does not support any mechanism (as ACK for standard
PN533) which aborts last command this cannot be issued for this
device. Otherwise, acr122u will behave in an unstable way.

Signed-off-by: Waldemar Rymarkiewicz <waldemar.rymarkiewicz@tieto.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
11 years agoNFC: pn533: Add support for ACS ACR122U reader
Waldemar Rymarkiewicz [Wed, 3 Apr 2013 06:02:13 +0000 (08:02 +0200)]
NFC: pn533: Add support for ACS ACR122U reader

ACS ACR122U is an USB NFC reader, PC/SC and CCID compilant, based
on NXP PN532 chip.

Internally, it's build of MCU, PN532 and an antenna. MCU makes the
device CCID and PC/SC compilant and provide USB connection.

In this achitecture, a host cannot talk directly to PN532 and must
rely on MCU. Luckily, MCU exposes pseud-APDU through PC/SC Escape
mechanism which let the host to transmit standard PN532 commands
directly to PN532 chip with some limitations.

The frame roughly looks like:

    CCID header    |          APDU header           |    PN532 header
(pc_to_rdr_escape) |  (pseudo apdu Direct Tramsmit) | (len, TFI, cmd, params)

Accordign to limitations, ACR122U does't provide any mechanism to
abort last issued command.

Signed-off-by: Waldemar Rymarkiewicz <waldemar.rymarkiewicz@tieto.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
11 years agoNFC: pn533: Add protocol type for frame ops
Waldemar Rymarkiewicz [Wed, 3 Apr 2013 06:02:12 +0000 (08:02 +0200)]
NFC: pn533: Add protocol type for frame ops

As not all devices require ACK confirmation of every request sent to the
controller, differentiate two protocol types.

First one, request-ack-response and the second one request-response type.

Signed-off-by: Waldemar Rymarkiewicz <waldemar.rymarkiewicz@tieto.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
11 years agoNFC: pn533: Move wq_in_error to cmd context
Waldemar Rymarkiewicz [Wed, 3 Apr 2013 06:02:11 +0000 (08:02 +0200)]
NFC: pn533: Move wq_in_error to cmd context

Rename 'wq_in_error' field to more relevant 'status'
and move it to cmd context struct.

Signed-off-by: Waldemar Rymarkiewicz <waldemar.rymarkiewicz@tieto.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
11 years agoNFC: pn533: Re-group fields in struct pn533
Waldemar Rymarkiewicz [Wed, 3 Apr 2013 06:02:10 +0000 (08:02 +0200)]
NFC: pn533: Re-group fields in struct pn533

Signed-off-by: Waldemar Rymarkiewicz <waldemar.rymarkiewicz@tieto.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
11 years agoNFC: pn533: Avoid function declarations
Waldemar Rymarkiewicz [Wed, 3 Apr 2013 06:02:09 +0000 (08:02 +0200)]
NFC: pn533: Avoid function declarations

Reorder code to avoid functions declaration.

Signed-off-by: Waldemar Rymarkiewicz <waldemar.rymarkiewicz@tieto.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
11 years agoNFC: pn533: Simplify __pn533_send_frame_async
Waldemar Rymarkiewicz [Wed, 3 Apr 2013 06:02:08 +0000 (08:02 +0200)]
NFC: pn533: Simplify __pn533_send_frame_async

In all cases (send_cmd_async, send_data_async and send_sync)
pn533_send_async_complete() handles all responses internally,
so there is no need to pass this as a callback.

Cmd context is passed to __pn533_send_frame_async in all the
cases as well. It's already kept in struct pn533 which is
available all the time the device is attached. So we can make
use of it instead.

Therefore, cmd_complete and cmd_complete_arg are no needed any more.

Signed-off-by: Waldemar Rymarkiewicz <waldemar.rymarkiewicz@tieto.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
11 years agoNFC: pn533: Fix incorrect kfree of complete args
Waldemar Rymarkiewicz [Wed, 3 Apr 2013 06:02:07 +0000 (08:02 +0200)]
NFC: pn533: Fix incorrect kfree of complete args

We must free 'cmd_complete_mi_arg' and not 'cmd_complete_arg'
when getting send error handling fragmented response.

Signed-off-by: Waldemar Rymarkiewicz <waldemar.rymarkiewicz@tieto.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
11 years agoNFC: pn533: Remove redundant cmd_ prefix in the struct
Waldemar Rymarkiewicz [Wed, 3 Apr 2013 06:02:06 +0000 (08:02 +0200)]
NFC: pn533: Remove redundant cmd_ prefix in the struct

'cmd->code' looks better then 'cmd->cmd_code'

Signed-off-by: Waldemar Rymarkiewicz <waldemar.rymarkiewicz@tieto.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
11 years agoNFC: pn533: Keep cmd context in pn533 struct
Waldemar Rymarkiewicz [Wed, 3 Apr 2013 06:02:05 +0000 (08:02 +0200)]
NFC: pn533: Keep cmd context in pn533 struct

Keep cmd context in pn533 struct instead of only cmd code.
The context already includes cmd_code.

Signed-off-by: Waldemar Rymarkiewicz <waldemar.rymarkiewicz@tieto.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
11 years agoNFC: pn533: Optimise issued cmd context tracking
Waldemar Rymarkiewicz [Wed, 3 Apr 2013 06:02:04 +0000 (08:02 +0200)]
NFC: pn533: Optimise issued cmd context tracking

Use struct pn533_cmd instead of pn533_send_async_complete_arg
to track the context of the issued cmd.

This way pn533_send_async_complete_arg struct is no needed
anymore. Just move issuer complete callback to pn533_cmd struct.

Signed-off-by: Waldemar Rymarkiewicz <waldemar.rymarkiewicz@tieto.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
11 years agoNFC: pn533: Fix memleak while scheduling next cmd
Waldemar Rymarkiewicz [Wed, 3 Apr 2013 06:02:03 +0000 (08:02 +0200)]
NFC: pn533: Fix memleak while scheduling next cmd

In case of error from __pn533_send_frame_async() while sending
next cmd from the queue (cmd_wq), cmd->req, cmd->resp and
cmd->arg pointers won't be freed.

Signed-off-by: Waldemar Rymarkiewicz <waldemar.rymarkiewicz@tieto.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
11 years agoNFC: pn533: Rename pn533_fw_reset appropriately
Waldemar Rymarkiewicz [Wed, 3 Apr 2013 06:02:02 +0000 (08:02 +0200)]
NFC: pn533: Rename pn533_fw_reset appropriately

Define explicitely it is Pasori specific reset command.

Signed-off-by: Waldemar Rymarkiewicz <waldemar.rymarkiewicz@tieto.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
11 years agoNFC: pn533: Update copyrights note
Waldemar Rymarkiewicz [Wed, 3 Apr 2013 06:02:01 +0000 (08:02 +0200)]
NFC: pn533: Update copyrights note

Remove duplicated authors info from the header as well.

Signed-off-by: Waldemar Rymarkiewicz <waldemar.rymarkiewicz@tieto.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
11 years agoNFC: pn533: Fix div by zero while stopping polling
Waldemar Rymarkiewicz [Wed, 3 Apr 2013 06:02:00 +0000 (08:02 +0200)]
NFC: pn533: Fix div by zero while stopping polling

Depends on timing division by zero can happen when user stops
polling.

pn533_stop_poll() resets modulation counter on stop_poll, but
meanwhile we get response for last poll request and try, despite
of stop poll request, to schedule next modulation for polling.

Log message:
[345.922515] pn533 1-1.3:1.0: pn533_stop_poll
[345.928314] pn533 1-1.3:1.0: pn533_send_ack
[345.932769] pn533 1-1.3:1.0: Received a frame.
[345.937438] PN533 RX: 00 00 ff 03 fd d5 4b 00 e0 00
[345.942840] pn533 1-1.3:1.0: pn533_poll_complete
[345.947753] pn533 1-1.3:1.0: pn533_start_poll_complete
[345.953186] Division by zero in kernel.
[345.957244] [<c001b38c>] (unwind_backtrace+0x0/0xf0)
[345.965698] [<c0260e78>] (Ldiv0+0x8/0x10)
[345.974060] [<c0260e60>] (__aeabi_idivmod+0x8/0x18)
[345.983978] [<c02e0064>] (pn533_poll_complete+0x3c0/0x500)
[345.994903] [<c02df690>] (pn533_send_async_complete+0x7c/0xc0)
[346.005828] [<c02e028c>] (pn533_wq_cmd_complete+0x1c/0x34)
[346.016113] [<c005d134>] (process_one_work+0x1ac/0x57c)
[346.025848] [<c005d85c>] (worker_thread+0x168/0x42c)
[346.034576] [<c00620c0>] (kthread+0xa4/0xb0)

Signed-off-by: Waldemar Rymarkiewicz <waldemar.rymarkiewicz@tieto.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
11 years agoNFC: pn533: Print out response status bits in hex
Waldemar Rymarkiewicz [Wed, 3 Apr 2013 06:01:59 +0000 (08:01 +0200)]
NFC: pn533: Print out response status bits in hex

For better debugging as the codes are defined in hex in the spec.

Signed-off-by: Waldemar Rymarkiewicz <waldemar.rymarkiewicz@tieto.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
11 years agoNFC: pn533: Reword all std frame logic funct
Waldemar Rymarkiewicz [Wed, 3 Apr 2013 06:01:58 +0000 (08:01 +0200)]
NFC: pn533: Reword all std frame logic funct

Signed-off-by: Waldemar Rymarkiewicz <waldemar.rymarkiewicz@tieto.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
11 years agoNFC: llcp: Add support in getsockopt for RW, LTO, and MIU remote parameters
Thierry Escande [Tue, 2 Apr 2013 08:25:16 +0000 (10:25 +0200)]
NFC: llcp: Add support in getsockopt for RW, LTO, and MIU remote parameters

Useful for LLCP validation tests.

Signed-off-by: Thierry Escande <thierry.escande@linux.intel.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
11 years agoNFC: llcp: Reset RW, LTO, and MIU remote parameters when link goes down
Thierry Escande [Tue, 2 Apr 2013 08:25:15 +0000 (10:25 +0200)]
NFC: llcp: Reset RW, LTO, and MIU remote parameters when link goes down

This resets remote parameters in both local and socket llcp structures when the
link goes down. That way, nfc_llcp_getsockopt won't return values corresponding
to the previous link parameters.

Signed-off-by: Thierry Escande <thierry.escande@linux.intel.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
11 years agoNFC: llcp: Use localy stored remote_miu value if not set at socket level
Thierry Escande [Tue, 2 Apr 2013 08:25:14 +0000 (10:25 +0200)]
NFC: llcp: Use localy stored remote_miu value if not set at socket level

If remote_miu value is not set in the socket (i.e. connection-less socket) the
value stored in the local is used.

Signed-off-by: Thierry Escande <thierry.escande@linux.intel.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
11 years agoNFC: llcp: Aggregated frames support
Thierry Escande [Fri, 29 Mar 2013 10:47:43 +0000 (11:47 +0100)]
NFC: llcp: Aggregated frames support

This adds support for AGF PDUs. For each PDU contained in the AGF, a new sk_buff
is allocated and dispatched to its corresponding handler.

Signed-off-by: Thierry Escande <thierry.escande@linux.intel.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
11 years agoNFC: llcp: Fix zero octets length SDU handling
Olivier Guiter [Mon, 25 Mar 2013 10:24:21 +0000 (11:24 +0100)]
NFC: llcp: Fix zero octets length SDU handling

LLCP Validation test #2 (Connection-less information transfer) send a
service data unit of zero octets length. This is now handled correctly.

Signed-off-by: Olivier Guiter <olivier.guiter@linux.intel.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
11 years agoNFC: llcp: Fall back to local values when getting socket options
Samuel Ortiz [Wed, 20 Mar 2013 15:36:13 +0000 (16:36 +0100)]
NFC: llcp: Fall back to local values when getting socket options

If a socket option has not been set by the user, fall back to the LLCP
local ones.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
11 years agoNFC: llcp: Socket miux is a big endian field
Samuel Ortiz [Wed, 20 Mar 2013 15:06:12 +0000 (16:06 +0100)]
NFC: llcp: Socket miux is a big endian field

The MIUX must be transmitted in big endian and as such we have to convert
it properly.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
11 years agoNFC: pn533: Use dynamic debug for pn533 hex dumps
Samuel Ortiz [Wed, 20 Mar 2013 10:27:57 +0000 (11:27 +0100)]
NFC: pn533: Use dynamic debug for pn533 hex dumps

Those can be very verbose and we only want them when debugging pn533.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
11 years agomac80211: always pick a basic rate to tx RTS/CTS for pre-HT rates
Karl Beldan [Fri, 5 Apr 2013 10:06:24 +0000 (12:06 +0200)]
mac80211: always pick a basic rate to tx RTS/CTS for pre-HT rates

When the 1st rate control entry is a pre-HT rate we want to set
rts_cts_rate_idx "as the fastest basic rate that is not faster than the
data rate"(code comments).
But in case some bss allowed rate indexes are lower than the lowest bss
basic rate, if the rate control selects a rate among the formers for its
1st rate control entry, rts_cts_rate_idx remains 0 and is not a basic
rate index.
This commit sets rts_cts_rate_idx to the lowest bss basic rate index in
this situation.

Note that the code assumes that lowest indexes == lowest bitrates.

Signed-off-by: Karl Beldan <karl.beldan@rivierawaves.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211: fix ieee80211_queue_stopped()
Thomas Pedersen [Wed, 10 Apr 2013 22:41:40 +0000 (15:41 -0700)]
mac80211: fix ieee80211_queue_stopped()

Johannes Berg notes mac80211 drivers which use
ieee80211_queue_stopped() really only want to know if they
previously requested a queue stop.

Signed-off-by: Thomas Pedersen <thomas@cozybit.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211: provide SSID in IBSS mode
Marek Puzyniak [Wed, 10 Apr 2013 11:19:13 +0000 (13:19 +0200)]
mac80211: provide SSID in IBSS mode

Some drivers need SSID in AP and IBSS mode. AP SSID is provided
through BSS_CHANGED_SSID notification. There was no easy way to
do the same for IBSS. In IBSS mode SSID is known but was not
stored in BSS configuration. Extend the AP-mode functionality
to also work in IBSS mode.

Signed-off-by: Marek Puzyniak <marek.puzyniak@tieto.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211: always advertise STBC/MCSes even if no AP support
Johannes Berg [Sun, 7 Apr 2013 17:32:47 +0000 (19:32 +0200)]
mac80211: always advertise STBC/MCSes even if no AP support

Advertise STBC capabilities and MCS rates even if the AP
doesn't support them. This has always been the right thing
to do, but used to be problematic with some APs. Now WFA
testing requires this so re-enable it, problematic APs
would then presumably not pass the test and be fixed.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211: clear SSID when stopping AP
Marek Puzyniak [Wed, 10 Apr 2013 11:47:45 +0000 (13:47 +0200)]
mac80211: clear SSID when stopping AP

When AP interface is stopped ssid_len in the BSS configuration
isn't cleared which can confuse drivers when switching modes.
Set the length to zero when stopping the AP interface.

Signed-off-by: Marek Puzyniak <marek.puzyniak@tieto.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211: fix recalc_radar hwconf sync problem
Simon Wunderlich [Mon, 8 Apr 2013 20:43:16 +0000 (22:43 +0200)]
mac80211: fix recalc_radar hwconf sync problem

local->hw.conf maybe not be synced when recalcing whether radar is
enabled, sometimes leaving radar enabled even if it's not neccesary
anymore.

Fix this by:
 * setting radar_enabled when creating the chanctx
 * turning radar_enabled off before destroying the last channel context

Reported-by: Zefir Kurtisi <zefir.kurtisi@neratec.com>
Signed-off-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211: stringify another plink state
Thomas Pedersen [Mon, 8 Apr 2013 18:06:16 +0000 (11:06 -0700)]
mac80211: stringify another plink state

The patch "mac80211: stringify mesh peering events" missed
an opportunity to print the peering state as a string.

Signed-off-by: Thomas Pedersen <thomas@cozybit.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211: unset FC retry bit in mesh fwding path
Thomas Pedersen [Mon, 8 Apr 2013 18:06:12 +0000 (11:06 -0700)]
mac80211: unset FC retry bit in mesh fwding path

Otherwise forwarded frames would keep the retry bit set
from the previous link transmission.

Signed-off-by: Thomas Pedersen <thomas@cozybit.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211_hwsim: Register and bind to driver
Martin Pitt [Mon, 8 Apr 2013 09:30:01 +0000 (11:30 +0200)]
mac80211_hwsim: Register and bind to driver

Properly register our mac80211_hwsim_driver, attach it to the platform bus.
Bind newly created hwsim devices to that driver, so that our wlan devices get
a proper "driver" sysfs attribute.

This makes mac80211_hwsim interfaces work with NetworkManager.

Signed-off-by: Martin Pitt <martin.pitt@ubuntu.com>
[fix an old and a new message to not be line-broken,
 also fix the driver_register error path]
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agoipw2x00: move to kstrto* functions
Andy Shevchenko [Wed, 10 Apr 2013 11:01:18 +0000 (14:01 +0300)]
ipw2x00: move to kstrto* functions

There is better to use kstrto* instead of simple_strtoul. In this case it
applies a bit stricter rules for input as well.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agortlwifi: rtl8188ee: Fix loop that ends early
Larry Finger [Tue, 9 Apr 2013 00:53:21 +0000 (19:53 -0500)]
rtlwifi: rtl8188ee: Fix loop that ends early

In routine _rtl8188e_read_power_value_fromprom(), there are loops initializing
index_cck_base and index_bw40_base from the PROM. As the result of a typo, the
second loop is ended one element too soon.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agoath9k: implement buffer holding handling for EDMA FIFO
Felix Fietkau [Sun, 7 Apr 2013 22:04:13 +0000 (00:04 +0200)]
ath9k: implement buffer holding handling for EDMA FIFO

Inside one FIFO slot queue, EDMA chipsets have the same link pointer
re-read race condition as older chipsets, so the same buffer holding
logic needs to be used in order to avoid use-after-free bugs.
Unlike on older chips, it can be skipped for the end of the queue.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agoath9k: detect more kinds of invalid descriptors
Felix Fietkau [Sun, 7 Apr 2013 22:04:12 +0000 (00:04 +0200)]
ath9k: detect more kinds of invalid descriptors

If AR_CRCErr, AR_PHYErr, AR_DecryptCRCErr or AR_MichaelErr is indicated
in the rx status word, but AR_RxFrameOK is also set, the descriptor
contents are typically invalid. This can show up as a warning about
invalid MCS rates in a frame. Even with those checks in place, a
descriptor with invalid MCS rates can still sometimes make it through to
the driver (mostly on older hardware like AR91xx).

Detect such errors in the last descriptor of a frame and discard the
whole frame if present.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agoath9k: fix handling of broken descriptors
Felix Fietkau [Sun, 7 Apr 2013 22:04:11 +0000 (00:04 +0200)]
ath9k: fix handling of broken descriptors

As the comment in ath_get_next_rx_buf indicates, if a descriptor with
the done bit set follows one with the done bit cleared, both descriptors
should be discarded, however the driver is not doing that yet.

To fix this, use the rs->rs_more flag as an indicator that the following
frame should be discarded. This also helps with the split buffer case:
if the first part of the frame is discarded, the following parts need to
be discarded as well, since they contain no valid header or usable data.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agoath9k: improve dma map failure handling
Felix Fietkau [Sun, 7 Apr 2013 22:04:10 +0000 (00:04 +0200)]
ath9k: improve dma map failure handling

Instead of leaving the buffer without skb and breaking out of the loop
(which could leak the rx buffer), use the common error path.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agoath9k_common: remove ath9k_cmn_padpos
Felix Fietkau [Sun, 7 Apr 2013 22:04:09 +0000 (00:04 +0200)]
ath9k_common: remove ath9k_cmn_padpos

It is equivalent to ieee80211_hdrlen

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agoath9k_hw: make various ar5416/ar91xx rf banks const
Felix Fietkau [Sun, 7 Apr 2013 22:04:08 +0000 (00:04 +0200)]
ath9k_hw: make various ar5416/ar91xx rf banks const

Banks 0-3,7 are neither modified at run time, nor SREV dependent.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agoath9k_hw: clean up RF Bank6 handling on AR5416/AR91xx
Felix Fietkau [Sun, 7 Apr 2013 22:04:07 +0000 (00:04 +0200)]
ath9k_hw: clean up RF Bank6 handling on AR5416/AR91xx

There are two sets of initvals for this RF bank, one with TPC support and
one without.
The TPC one always gets used, so remove the other one to avoid confusion.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agort2x00: rt2x00mmio: remove unused rt2x00pci_* defines
Gabor Juhos [Fri, 5 Apr 2013 06:27:05 +0000 (08:27 +0200)]
rt2x00: rt2x00mmio: remove unused rt2x00pci_* defines

All users are converted to use the rt2x00mmio_*
functions so remove the now unused defines.

The patch contain no functional changes.

Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
Acked-by: Helmut Schaa <helmut.schaa@googlemail.com>
Acked-by: Gertjan van Wingerde <gwingerde@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agort2x00: rt2800pci: use the rt2x00mmio_* routines
Gabor Juhos [Fri, 5 Apr 2013 06:27:04 +0000 (08:27 +0200)]
rt2x00: rt2800pci: use the rt2x00mmio_* routines

Use the recently introduced rt2x00mmio_* routines
instead of the rt2x00pci_* variants.

The patch contains no functional changes.

Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
Acked-by: Helmut Schaa <helmut.schaa@googlemail.com>
Acked-by: Gertjan van Wingerde <gwingerde@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agort2x00: rt61pci: use the rt2x00mmio_* routines
Gabor Juhos [Fri, 5 Apr 2013 06:27:03 +0000 (08:27 +0200)]
rt2x00: rt61pci: use the rt2x00mmio_* routines

Use the recently introduced rt2x00mmio_* routines
instead of the rt2x00pci_* variants.

The patch contains no functional changes.

Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
Acked-by: Helmut Schaa <helmut.schaa@googlemail.com>
Acked-by: Gertjan van Wingerde <gwingerde@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agort2x00: rt2500pci: use the rt2x00mmio_* routines
Gabor Juhos [Fri, 5 Apr 2013 06:27:02 +0000 (08:27 +0200)]
rt2x00: rt2500pci: use the rt2x00mmio_* routines

Use the recently introduced rt2x00mmio_* routines
instead of the rt2x00pci_* variants.

The patch contains no functional changes.

Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
Acked-by: Helmut Schaa <helmut.schaa@googlemail.com>
Acked-by: Gertjan van Wingerde <gwingerde@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agort2x00: rt2400pci: use the rt2x00mmio_* routines
Gabor Juhos [Fri, 5 Apr 2013 06:27:01 +0000 (08:27 +0200)]
rt2x00: rt2400pci: use the rt2x00mmio_* routines

Use the recently introduced rt2x00mmio_* routines
instead of the rt2x00pci_* variants.

The patch contains no functional changes.

Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
Acked-by: Helmut Schaa <helmut.schaa@googlemail.com>
Acked-by: Gertjan van Wingerde <gwingerde@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agort2x00: rt2x00mmio: use rt2x00mmio prefix in function names
Gabor Juhos [Fri, 5 Apr 2013 06:27:00 +0000 (08:27 +0200)]
rt2x00: rt2x00mmio: use rt2x00mmio prefix in function names

The functions in the rt2x00mmio module has been
moved from the rt2x00pci module. Each function
uses the rt2x00pci prefix which is a bit confusing.
Use the r2x000mmio prefix for each function to make
it consistent with the module name.

The renamed functions are used by several modules,
and updating the names in all of them would result
in a big patch. In order to keep the patch simple,
add compatibility defines for the old function
names. This allows to update the names in each
module separately. After each module is updated,
the defines can be removed.

The patch contains no functional changes.

Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
Acked-by: Helmut Schaa <helmut.schaa@googlemail.com>
Acked-by: Gertjan van Wingerde <gwingerde@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agoMerge branch 'for-john' of git://git.kernel.org/pub/scm/linux/kernel/git/iwlwifi...
John W. Linville [Wed, 10 Apr 2013 18:10:24 +0000 (14:10 -0400)]
Merge branch 'for-john' of git://git./linux/kernel/git/iwlwifi/iwlwifi-next

11 years agoMerge branch 'for-john' of git://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac802...
John W. Linville [Wed, 10 Apr 2013 18:09:54 +0000 (14:09 -0400)]
Merge branch 'for-john' of git://git./linux/kernel/git/jberg/mac80211-next

Conflicts:
drivers/net/wireless/ath/carl9170/debug.c
drivers/net/wireless/ath/carl9170/main.c
net/mac80211/ieee80211_i.h

11 years agoMerge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless
John W. Linville [Wed, 10 Apr 2013 13:31:39 +0000 (09:31 -0400)]
Merge branch 'master' of git://git./linux/kernel/git/linville/wireless

Conflicts:
drivers/net/wireless/rt2x00/rt2x00pci.c

11 years agobrcmfmac: only use ifidx from BDC header in brcmf_rx_frames()
Arend van Spriel [Fri, 5 Apr 2013 08:57:54 +0000 (10:57 +0200)]
brcmfmac: only use ifidx from BDC header in brcmf_rx_frames()

In brcmf_rx_frames() the call to brcmf_fweh_process_skb() could
change the ifidx using information in the event data. This is
only different to the BDC ifidx for IF ADD event. However, the
creation of the new interface is deferred to event worker so
it does not exist. After brcmf_fweh_process_skb() it is only
used to set statistics.

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>
11 years agobrcmfmac: obtain wdev using vif object in action frame rx
Arend van Spriel [Fri, 5 Apr 2013 08:57:53 +0000 (10:57 +0200)]
brcmfmac: obtain wdev using vif object in action frame rx

The function brcmf_p2p_notify_action_frame_rx() the wireless_dev
is needed to pass the action frame to cfg80211. The wireless_dev
is held in brcmf_cfg80211_vif object. Use that instead of the
ieee80211_ptr in net_device as P2P_DEVICE interface does not have
a net_device associated with it.

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>
11 years agobrcmfmac: fix reception of P2P probe requests on P2P_DEVICE interface
Arend van Spriel [Fri, 5 Apr 2013 08:57:52 +0000 (10:57 +0200)]
brcmfmac: fix reception of P2P probe requests on P2P_DEVICE interface

The probe requests received on P2P_DEVICE interface were not sent
to wpa_supplicant, which makes the device not discoverable by peers.

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>
11 years agobrcmfmac: wait for firmware event when creating P2P_DEVICE interface
Arend van Spriel [Fri, 5 Apr 2013 08:57:51 +0000 (10:57 +0200)]
brcmfmac: wait for firmware event when creating P2P_DEVICE interface

The firmware sends a IF event to notify the host driver that the
P2P_DEVICE interface has been created. Wait for the event before
returning the related wireless_dev.

Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Reviewed-by: Piotr Haber <phaber@broadcom.com>
Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>