firefly-linux-kernel-4.4.55.git
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 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 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>
11 years agobrcmfmac: support creation of P2P_DEVICE through user-space
Arend van Spriel [Fri, 5 Apr 2013 08:57:50 +0000 (10:57 +0200)]
brcmfmac: support creation of P2P_DEVICE through user-space

The current driver code creates a P2P_DEVICE through a module
parameter. This device has a dummy netdevice which is not how this
interface type is intended. This patch add proper support for the
P2P_DEVICE interface type. This requires a wpa_supplicant with such
support as well.

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>
11 years agobrcmfmac: use struct brcmf_if instance iso netdevice in escan functions
Arend van Spriel [Fri, 5 Apr 2013 08:57:49 +0000 (10:57 +0200)]
brcmfmac: use struct brcmf_if instance iso netdevice in escan functions

escan functionality is also required for P2P device operations so it
is better not to rely on struct netdevice instances.

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>
11 years agobrcmfmac: use struct brcmf_if instance as parameter in brcmf_set_mpc()
Arend van Spriel [Fri, 5 Apr 2013 08:57:48 +0000 (10:57 +0200)]
brcmfmac: use struct brcmf_if instance as parameter in brcmf_set_mpc()

Remove use of struct netdevice as parameter to brcmf_set_mpc() as it
will not always be available, ie. there will be non-netdevice interfaces.

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>
11 years agobrcmfmac: remove use of unconditional access of struct wireless_dev::netdev
Arend van Spriel [Fri, 5 Apr 2013 08:57:47 +0000 (10:57 +0200)]
brcmfmac: remove use of unconditional access of struct wireless_dev::netdev

With the introduction of the P2P_DEVICE interface type an instance of
struct wireless_dev does not always have a netdev assigned to it. Better
use container_of() construct to obtain internal structure and go from
there.

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>
11 years agobrcmfmac: remove condition for calling event handler
Arend van Spriel [Fri, 5 Apr 2013 08:57:46 +0000 (10:57 +0200)]
brcmfmac: remove condition for calling event handler

In fweh module the event handler was only called if the
struct brcmf_if instance had a non-null netdev associated.
This restriction is no longer valid for P2P_DEVICE type
of interface. This patch removes that restriction.

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: add role attribute to struct brcmf_if_event definition
Arend van Spriel [Fri, 5 Apr 2013 08:57:45 +0000 (10:57 +0200)]
brcmfmac: add role attribute to struct brcmf_if_event definition

According specification the IF event has an additional field indicating
the role or type of the interface for which this event is sent.

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: add hexadecimal trace of message payload
Arend van Spriel [Fri, 5 Apr 2013 08:57:44 +0000 (10:57 +0200)]
brcmfmac: add hexadecimal trace of message payload

Adds a trace function used in brcmf_dbg_hex_dump() which adds the
raw binary data to the trace. It requires trace-cmd plugin to see
this data.

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: firmware shared data version fix
Piotr Haber [Fri, 5 Apr 2013 08:57:43 +0000 (10:57 +0200)]
brcmfmac: firmware shared data version fix

Firware shared data structure is backward compatible for fields
we are interested in.
Allow reading of shared data in case of version mismatch.

Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
Reviewed-by: Arend van Spriel <arend@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@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: read firmware console without trap indication
Piotr Haber [Fri, 5 Apr 2013 08:57:42 +0000 (10:57 +0200)]
brcmfmac: read firmware console without trap indication

Firmware console output can be read also when there was
no trap indication.

Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
Reviewed-by: Arend van Spriel <arend@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@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: handle firmware signals requesting for packets
Arend van Spriel [Fri, 5 Apr 2013 08:57:41 +0000 (10:57 +0200)]
brcmfmac: handle firmware signals requesting for packets

The firmware can request the host driver for packets, by sending
either the MAC_REQUEST_CREDIT or the MAC_REQUEST_PACKET primitive.
This patch adds handling of these primitives.

Reviewed-by: Pieter-Paul Giesberts <pieterpg@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>
11 years agobrcmfmac: handle firmware signalling destination entry state
Arend van Spriel [Fri, 5 Apr 2013 08:57:40 +0000 (10:57 +0200)]
brcmfmac: handle firmware signalling destination entry state

Firmware can signal whether the host driver may sent packets for
a specific destination or interface. This can happen when a
destination is sleeping or when going off-channel.

Reviewed-by: Pieter-Paul Giesberts <pieterpg@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>
11 years agobrcmfmac: fix unaligned access in TXSTATUS signal handling
Arend van Spriel [Fri, 5 Apr 2013 08:57:39 +0000 (10:57 +0200)]
brcmfmac: fix unaligned access in TXSTATUS signal handling

reported by Hante. Needs to be squashed in commit 187fbcec.

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>
11 years agomwifiex: hold proper locks when accessing ra_list / bss_prio lists
Andreas Fenkart [Fri, 5 Apr 2013 03:03:53 +0000 (20:03 -0700)]
mwifiex: hold proper locks when accessing ra_list / bss_prio lists

Not locking ra_list when dequeuing packets creates race conditions.
When adding a packet 'tx_pkts_queued' is modified before setting
highest_priority_queue. If in-between the main loop starts, it will
see a packet queued (tx_pkts_queued > 0) but will not find it, since
max prio is not set yet. Depending on the scheduling, the thread
trying to add the packet could complete and restore the situation.
But this is not something to rely on.

Another race condition exists, if a new packet, exceeding current
max prio is added. If concurrently a packet is dequeued, the newly
set max prio will be overwritten with the value of the dequeued
packet. This can occur, because selecting a packet and modifying
the max prio is not atomic. The result in an infinite loop unless,
a new packet is added that has at least the priority of the hidden
packet.

Same applies to bss_prio_tbl. Forward iteration is no proper
lock-free technique and provides no protection from calls to
list_del. Although BSS are currently not added/removed dynamically,
this must not be the case in the future. Hence always hold proper
locks when accessing those lists.

Signed-off-by: Andreas Fenkart <andreas.fenkart@streamunlimited.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agomwifiex: fix infinite loop by removing NO_PKT_PRIO_TID
Andreas Fenkart [Fri, 5 Apr 2013 03:03:52 +0000 (20:03 -0700)]
mwifiex: fix infinite loop by removing NO_PKT_PRIO_TID

Using NO_PKT_PRIO_TID and tx_pkts_queued to check for an empty
state, can lead to a contradictory state, resulting in an
infinite loop. Currently queueing and dequeuing of packets is
not synchronized, and can happen concurrently. While tx_pkts_queued
is incremented when adding a packet, max prio is set to NO_PKT when
the WMM list is empty. If a packet is added right after the check
for empty, but before setting max prio to NO_PKT, that packet is
trapped and creates an infinite loop.

Because of the new packet, tx_pkts_queued is at least 1, indicating
wmm lists are not empty. Opposing that max prio is NO_PKT, which
means "skip this wmm queue, it has no packets". The infinite loop
results, because the main loop checks the wmm lists for not empty
via tx_pkts_queued, but for dequeing it uses max_prio to see if it
can skip current list. This will never end, unless a new packet is
added which will restore max prio to the level of the trapped packet.

The solution here is to rely on tx_pkts_queued solely for checking
wmm queue to be empty, and drop the NO_PKT define. It does not
address the locking issue.

Signed-off-by: Andreas Fenkart <andreas.fenkart@streamunlimited.com>
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>
11 years agomwifiex: remove unused tid_tbl_lock from mwifiex_tid_tbl
Andreas Fenkart [Fri, 5 Apr 2013 03:03:51 +0000 (20:03 -0700)]
mwifiex: remove unused tid_tbl_lock from mwifiex_tid_tbl

ra_list_spinlock is used to protect struct mwifiex_wmm_desc and
embedded structures such as ra_list. tid_tbl_lock while more fine
grained, is not used but in one function. That function is not
called reentrantly. To protect ra_list from concurrent modification
ra_list_spinlock must be held.

Signed-off-by: Andreas Fenkart <andreas.fenkart@streamunlimited.com>
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>
11 years agomwifiex: correct wrong list in list_empty check
Andreas Fenkart [Fri, 5 Apr 2013 03:03:50 +0000 (20:03 -0700)]
mwifiex: correct wrong list in list_empty check

adapter->bss_prio_tbl list has already been checked in outer loop.
The inner loop works with priv_tmp->wmm.tid_tbl_ptr list. Also the
lock taken, gives hint that this is likely a copy-paste error.

Signed-off-by: Andreas Fenkart <andreas.fenkart@streamunlimited.com>
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>
11 years agortlwifi: rtl8188ee: Fix allyesconfig build failures
Larry Finger [Thu, 4 Apr 2013 19:41:06 +0000 (14:41 -0500)]
rtlwifi: rtl8188ee: Fix allyesconfig build failures

An allyesconfig build of rtl8188ee yields the following duplicate entry points:

drivers/net/wireless/rtlwifi/rtl8188ee/built-in.o: In function `.rtl92c_phy_ap_calibrate':
(.text+0x21d14): multiple definition of `.rtl92c_phy_ap_calibrate'
drivers/net/wireless/rtlwifi/rtl8192c/built-in.o:(.text+0xb1e8): first defined here
drivers/net/wireless/rtlwifi/rtl8188ee/built-in.o: In function `rtl_hal_pwrseqcmdparsing':
(.opd+0xed0): multiple definition of `rtl_hal_pwrseqcmdparsing'

One of the routines is not used and can be deleted, the other is renamed.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agortlwifi: rtl8188ee: Fix linker warnings
Larry Finger [Thu, 4 Apr 2013 01:36:06 +0000 (20:36 -0500)]
rtlwifi: rtl8188ee: Fix linker warnings

Building rtl8188ee yields warnings such as the following:

x86_64-linux-gcc: warning: drivers/net/wireless/rtlwifi: linker input file unused because linking not done

The only potential cause is an extraneous space in the make file.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Tested-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agoath9k: add support for DFS master mode
Zefir Kurtisi [Wed, 3 Apr 2013 16:31:31 +0000 (18:31 +0200)]
ath9k: add support for DFS master mode

These are the remaining knobs in ath9k to support DFS:
* mark AR9280 and AR9580 as DFS tested
* synchronize DFS regulatory domain to reg notifyer
* set required RX filter flags for radar detection
* process radar PHY errors at DFS detector
* notify DFS master on radar detection

DFS support requires CONFIG_ATH9K_DFS_CERTIFIED to be set.

Signed-off-by: Zefir Kurtisi <zefir.kurtisi@neratec.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agoath9k: add debugfs based DFS radar simulation
Zefir Kurtisi [Wed, 3 Apr 2013 16:31:30 +0000 (18:31 +0200)]
ath9k: add debugfs based DFS radar simulation

This helps testing DFS without radar generating
equipment and is required for certification.

Signed-off-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
Signed-off-by: Zefir Kurtisi <zefir.kurtisi@neratec.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agoath9k: add interface combinations for DFS master
Zefir Kurtisi [Wed, 3 Apr 2013 16:31:29 +0000 (18:31 +0200)]
ath9k: add interface combinations for DFS master

Signed-off-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
Signed-off-by: Zefir Kurtisi <zefir.kurtisi@neratec.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agoath: Let user know which keycache method is complaining.
Ben Greear [Mon, 1 Apr 2013 22:37:29 +0000 (15:37 -0700)]
ath: Let user know which keycache method is complaining.

Should make the warning messages more useful.

Signed-off-by: Ben Greear <greearb@candelatech.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agomwifiex: fix negative cmd_pending count
Bing Zhao [Mon, 1 Apr 2013 19:44:46 +0000 (12:44 -0700)]
mwifiex: fix negative cmd_pending count

cmd_pending is increased in mwifiex_wait_queue_complete() and
decreased in mwifiex_complete_cmd() currently.
If there are two or more commands in the cmd_pending_q the main
worker thread will pick up next command from cmd_pending_q
automatically after finishing current command. As a result
mwifiex_wait_queue_complete() will not be called because
the command is alreay completed. This leads to a negative
number in cmd_pending count.

Fix it by increasing cmd_pending when a cmd is queued into
cmd_pending_q and decreasing when that cmd is recycled. For scan
commands we don't perform inc/dec operations until it's moved
from scan_pending_q to cmd_pending_q. This covers both
synchronous and asynchronous commands.

Reported-by: Daniel Drake <dsd@laptop.org>
Tested-by: Daniel Drake <dsd@laptop.org>
Tested-by: Marco Cesarano <marco@marvell.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agoiwlwifi: dvm: handle FLUSH ampdu actions from mac80211
Emmanuel Grumbach [Sun, 7 Apr 2013 07:13:44 +0000 (10:13 +0300)]
iwlwifi: dvm: handle FLUSH ampdu actions from mac80211

Until now we didn't handle properly the FLUSH ampdu action
coming from mac80211. This could result in SCD queue leak:
mac80211 would STOP_FLUSH an AMPDU Tx session and remove
the station. If we had still packets on the ring, we
wouldn't deallocate the SCD queue and wait for it to be
empty.
The indication of the queue being empty comes from the Tx
response flow which relies on the tid_data structure. The
problem is that this structure has been cleared when the
station has been removed.
In order to solve this issue, block in the STOP_FLUSH
ampdu_action until the SCD queue is flushed, and only then,
let mac80211 move forward to remove the station.
iwlagn_txfifo_flush had to be enhanced to allow this.

The bug fixed here caused the "txq_id mismatch: 12 0" print.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agoiwlwifi: mvm: remove users of nvm_data->valid_tx_ant
Emmanuel Grumbach [Wed, 3 Apr 2013 17:10:06 +0000 (20:10 +0300)]
iwlwifi: mvm: remove users of nvm_data->valid_tx_ant

In commit 332235427a566d8be04b9676a7ac380c8853aa9b
"iwlwifi: mvm: take the valid_{rx,tx}_ant from the TLV"

I replaced the access to nvm_data->valid_tx_ant to an inline
cheking the TLV flags but forgot a few occurences. Fix that.

Change-Id: I92daac735b46738d97fe2dbd5934bb177fd0751b
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Reviewed-on: https://gerrit.rds.intel.com/12308
Tested-by: IWL Jenkins
Reviewed-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agoiwlwifi: print warning on request_module failure
Johannes Berg [Thu, 4 Apr 2013 08:35:23 +0000 (10:35 +0200)]
iwlwifi: print warning on request_module failure

If request_module() failed then we didn't have the correct
opmode module that the driver needs to function, so print
a warning in this case to make it more obvious what could
be wrong. This still won't catch the case where the module
simply doesn't exist because it wasn't compiled though.

Reviewed-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211: make ieee802_11_parse_elems an inline
Johannes Berg [Wed, 27 Mar 2013 13:55:31 +0000 (14:55 +0100)]
mac80211: make ieee802_11_parse_elems an inline

This (slightly) reduces the code size.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211: don't start new netdev queues if driver stopped
Johannes Berg [Tue, 26 Mar 2013 21:23:20 +0000 (22:23 +0100)]
mac80211: don't start new netdev queues if driver stopped

If a new netdev (e.g. an AP VLAN) is created while the driver
has queues stopped, the new netdev queues will be started even
though they shouldn't. This will lead to frames accumulating
on the internal mac80211 pending queues instead of properly
being held on the netdev queues.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211: replace some dead code by a warning
Johannes Berg [Tue, 26 Mar 2013 21:10:02 +0000 (22:10 +0100)]
mac80211: replace some dead code by a warning

Given the (nested) switch statements, this code can't
be reached, so make it warn instead of manipulating
the carrier state which seems purposeful.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211: don't fiddle with netdev queues in MLME code
Johannes Berg [Tue, 26 Mar 2013 21:02:42 +0000 (22:02 +0100)]
mac80211: don't fiddle with netdev queues in MLME code

The netdev queues should always represent the state that
the driver gave them, so fiddling with them isn't really
appropriate in the mlme code. Also, since we stop queues
for flushing now, this really isn't necessary any more.

As the scan/offchannel code has also been modified to no
longer do this a while ago, remove the outdated smp_mb()
and comments about it.

While at it, also add a pair of braces that was missing.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211: disable uAPSD if all ACs are under ACM
Alexander Bondar [Tue, 2 Apr 2013 12:30:14 +0000 (15:30 +0300)]
mac80211: disable uAPSD if all ACs are under ACM

It's unlikely that an AP requires WMM mandatory admission control
for all access categories, and if it does then we still transmit
on the background AC without requesting admission. However, avoid
using uAPSD in this case since the implementation could run into
issues and might use other ACs etc.

Signed-off-by: Alexander Bondar <alexander.bondar@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211: fix do_stop handling while suspended
Johannes Berg [Wed, 27 Mar 2013 22:24:53 +0000 (23:24 +0100)]
mac80211: fix do_stop handling while suspended

When a device is unplugged while suspended, mac80211 is
de-initialized and all interfaces are removed while no
state is actually present in the driver. This can cause
warnings and driver confusion.

Fix this by reordering the do_stop code to not call the
driver when it is suspended, i.e. when there's no state
in the driver anyway.

The previous patches removed a few corner cases in ROC
and virtual monitor interfaces so that now this is safe
to do and no state should be left over.

Reported-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211: destroy virtual monitor interface across suspend
Johannes Berg [Wed, 27 Mar 2013 22:20:27 +0000 (23:20 +0100)]
mac80211: destroy virtual monitor interface across suspend

It has to be removed from the driver, but completely
destroying it helps handle unplug of a device during
suspend since then the channel context handling etc.
doesn't have to happen later when it's removed.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211: purge remain-on-channel items when suspending
Johannes Berg [Wed, 27 Mar 2013 21:49:19 +0000 (22:49 +0100)]
mac80211: purge remain-on-channel items when suspending

They can't really be executed while suspended and could
trigger work warnings, so abort all ROC items. When the
system resumes the notifications about this will be
delivered to userspace which can then act accordingly
(though it will assume they were canceled/finished.)

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211: remove outdated comment referring to master interface
Johannes Berg [Wed, 27 Mar 2013 21:40:22 +0000 (22:40 +0100)]
mac80211: remove outdated comment referring to master interface

The code now explicitly calls ieee80211_configure_filter()
anyway, so nothing needs to be explained.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211: return new mpath from mesh_path_add()
Bob Copeland [Fri, 29 Mar 2013 13:38:39 +0000 (09:38 -0400)]
mac80211: return new mpath from mesh_path_add()

Most times that mesh_path_add() is called, it is followed by
a lookup to get the just-added mpath.  We can instead just
return the new mpath in the case that we allocated one (or the
existing one if already there), so do that.  Also, reorder the
code in mesh_path_add a bit so that we don't need to allocate
in the pre-existing case.

Signed-off-by: Bob Copeland <bob@cozybit.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211: fix the PREP mesh hwmp debug message
Chun-Yeow Yeoh [Wed, 3 Apr 2013 09:49:53 +0000 (17:49 +0800)]
mac80211: fix the PREP mesh hwmp debug message

The mesh hwmp debug message is a bit confusing. The "sending PREP
to %p" should be the MAC address of mesh STA that has originated
the PREQ message and the "received PREP from %pM" should be the MAC
address of the mesh STA that has originated the PREP message.

Signed-off-by: Chun-Yeow Yeoh <yeohchunyeow@gmail.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211: parse Timeout Interval Element using a struct
Johannes Berg [Wed, 27 Mar 2013 13:38:07 +0000 (14:38 +0100)]
mac80211: parse Timeout Interval Element using a struct

Instead of open-coding the accesses and length check do
the length check in the IE parser and assign a struct
pointer for use in the remaining code.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211: check ERP info IE length in parser
Johannes Berg [Wed, 27 Mar 2013 13:31:53 +0000 (14:31 +0100)]
mac80211: check ERP info IE length in parser

It's always just one byte, so check for that and
remove the length field from the parser struct.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211: check DSSS params IE length in parser
Johannes Berg [Wed, 27 Mar 2013 13:30:12 +0000 (14:30 +0100)]
mac80211: check DSSS params IE length in parser

It's always just one byte, so check for that and
remove the length field from the parser struct.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211: remove unused IE pointers from parser
Johannes Berg [Wed, 27 Mar 2013 13:27:01 +0000 (14:27 +0100)]
mac80211: remove unused IE pointers from parser

There's no need to parse IEs that aren't used
so just remove them.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211: remove ancient reference to master interface
Johannes Berg [Tue, 26 Mar 2013 20:54:24 +0000 (21:54 +0100)]
mac80211: remove ancient reference to master interface

The master interface no longer exists ... and hasn't for
a few years now, so remove this reference :-)

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211: be more careful about sending beacon-loss-events
Ben Greear [Mon, 25 Mar 2013 18:19:35 +0000 (11:19 -0700)]
mac80211: be more careful about sending beacon-loss-events

I don't think we should send the events unless it was actually
a beacon that was lost...not just any probe of an AP.

Signed-off-by: Ben Greear <greearb@candelatech.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>