platform/kernel/linux-rpi.git
7 years agoiwlwifi: mvm: support MFUART dump in case of MFUART assert
Golan Ben-Ami [Tue, 15 Nov 2016 12:45:29 +0000 (14:45 +0200)]
iwlwifi: mvm: support MFUART dump in case of MFUART assert

In case of a MFUART assert, get a notification from the fw
that consists of the assert id and debug data.

The notification may be divided to multiple chunks, depending
on the size of the debug data sent to the driver, which would
be up to 1KB.

Get the notification, and if the debug info flag is enabled,
print the debug data to the dmesg.

Signed-off-by: Golan Ben-Ami <golan.ben.ami@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: pcie: use iwl_get_dma_hi_addr()
Johannes Berg [Mon, 9 Jan 2017 10:31:39 +0000 (11:31 +0100)]
iwlwifi: pcie: use iwl_get_dma_hi_addr()

Use iwl_get_dma_hi_addr() instead of open-coding it.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: pcie: use WFPM_GP for debugging D3 flows
Sara Sharon [Wed, 28 Dec 2016 08:04:23 +0000 (10:04 +0200)]
iwlwifi: pcie: use WFPM_GP for debugging D3 flows

This register is helpful for debugging D3 issues.
Driver turns all bits on, and then on exit reads the
updated value there.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: pcie: remove the active field in struct iwl_txq
Sara Sharon [Thu, 29 Sep 2016 11:31:24 +0000 (14:31 +0300)]
iwlwifi: pcie: remove the active field in struct iwl_txq

We already have queue_used in the transport - we can
use it instead.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoRevert "iwlwifi: introduce trans API to get byte count table"
Sara Sharon [Wed, 28 Sep 2016 12:56:21 +0000 (15:56 +0300)]
Revert "iwlwifi: introduce trans API to get byte count table"

This reverts commit 8aacf4b73fe8 ("iwlwifi: introduce trans API
to get byte count table").
The commit is not needed as a better approach will be taken.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: mvm: don't assume static queue numbers
Sara Sharon [Mon, 9 Jan 2017 10:07:16 +0000 (12:07 +0200)]
iwlwifi: mvm: don't assume static queue numbers

In a000 devices FW will assign the queue number. Prepare for
that by getting rid of static defines and store them in variables.
Enlarge to u16 since we may have up to 512 queues.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: mvm: optimize reorder timeout frame releasing
Sara Sharon [Wed, 4 Jan 2017 08:49:42 +0000 (10:49 +0200)]
iwlwifi: mvm: optimize reorder timeout frame releasing

Currently we release up to the last expired frame.
However, if there are consecutive frames after it - we can
optimize it further and release them as well - until the next
hole.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: mvm: support new ADD_MODIFY_STA_KEY command
Sara Sharon [Wed, 9 Nov 2016 13:43:26 +0000 (15:43 +0200)]
iwlwifi: mvm: support new ADD_MODIFY_STA_KEY command

The command was changed to support PN offload and TKIP offload.
The FW will do TKIP calculations in D0 only for a000 devices,
but API is aligned anyway.
However, for all devices we can stop sending the wowlan tkip
command.
Firmware will fetch the keys from the station key command.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: mvm: add multicast station
Sara Sharon [Tue, 3 Jan 2017 10:00:19 +0000 (12:00 +0200)]
iwlwifi: mvm: add multicast station

Currently multicast queue is associated with the broadcast
station.

This raises quite a few issues:

The multicast queue has a special treatment:
- It is sent in the MAC context command
- It is excluded from tfd_queue_mask

In DQA mode we end up enabling two queues - the probe response
queue and the multicast queue - with the same station (broadcast)
and TID while in DQA mode it should be unique RA-TID.
Firmware will enforce it for a000 devices, so this allocation
will fail.

In addition, in a000 devices the FW will set the FIFO and not
the driver. So there is a need for FW to know when we enable
the queue that it is multicast queue so it will be bound to
the multicast FIFO. There is no such way in current design.

In order to simplify driver and firmware handling of this queue
create a multicast station.
This solves the unique RA-TID issue in the short term and serves
as preparation for the long term.

In the long term we will also add a flag marking this station for
the FW as the multicast station.
Once we will do that the FW will know this is the multicast queue
immediately when it is added and bind it to the correct FIFO.
It will also enable removing the special treatment of the
queue in the MAC context command.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: add support for 9000 HW B-step NICs
Liad Kaufman [Sun, 8 Jan 2017 14:52:59 +0000 (16:52 +0200)]
iwlwifi: add support for 9000 HW B-step NICs

Once we remove support for A-step, we'll be able to
clean the code back again.

Signed-off-by: Liad Kaufman <liad.kaufman@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: use upper_32_bits/lower_32_bits where appropriate
Johannes Berg [Mon, 9 Jan 2017 10:28:47 +0000 (11:28 +0100)]
iwlwifi: use upper_32_bits/lower_32_bits where appropriate

That's a bit nicer than open-coding it.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: mvm: cleanup pending frames in DQA mode
Sara Sharon [Thu, 22 Dec 2016 11:03:40 +0000 (13:03 +0200)]
iwlwifi: mvm: cleanup pending frames in DQA mode

When a station is asleep, the fw will set it as "asleep".
All queues that are used only by one station will be stopped by
the fw.

In pre-DQA mode this was relevant for aggregation queues. However,
in DQA mode a queue is owned by one station only, so all queues
will be stopped.
As a result, we don't expect to get filtered frames back to
mac80211 and don't have to maintain the entire pending_frames
state logic, the same way as we do in aggregations.

The correct behavior is to align DQA behavior with the aggregation
queue behaviour pre-DQA:
- Don't count pending frames.
- Let mac80211 know we have frames in these queues so that it can
properly handle trigger frames.

When a trigger frame is received, mac80211 tells the driver to send
frames from the queues using release_buffered_frames.
The driver will tell the fw to let frames out even if the station
is asleep. This is done by iwl_mvm_sta_modify_sleep_tx_count.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: pcie: print less data upon firmware crash
Emmanuel Grumbach [Tue, 3 Jan 2017 08:04:44 +0000 (10:04 +0200)]
iwlwifi: pcie: print less data upon firmware crash

We don't need to print so much data in the kernel log.
Limit the data to be printed to the queue that actually
got stuck in case of a TFD queue hang, and stop dumping
all the CSR and FH registers. Over the course of time, the
CSR and FH values haven't proven themselves to be really
useful for debugging, and they are now in the firmware dump
anyway.

This comes as a preparation to the addition of more data
required to be printed by the firwmare team.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: mvm: fix RX SKB header size and align it properly
Johannes Berg [Wed, 14 Dec 2016 12:48:04 +0000 (13:48 +0100)]
iwlwifi: mvm: fix RX SKB header size and align it properly

When receiving a frame, we currently pull in sizeof(*hdr) plus
some extra (crypto/snap), which is too much, most headers aren't
actually sizeof(*hdr) since that takes into account the 4-address
format but doesn't take into account QoS. As a result, a typical
frame will have 4 bytes of the payload in the SKB header already.

Fix this by calculating the correct header length, and now that
we have that, align the end of the SKB header to a multiple of 4
so that the IP header will be aligned properly when pulled in.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: mvm: adjust new API of compressed BA
Sara Sharon [Thu, 29 Dec 2016 08:11:40 +0000 (10:11 +0200)]
iwlwifi: mvm: adjust new API of compressed BA

Final API has a reserved field - adjust accordingly.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: mvm: bump max API to 30
Luca Coelho [Mon, 19 Dec 2016 10:00:32 +0000 (12:00 +0200)]
iwlwifi: mvm: bump max API to 30

Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: remove support for deprecated RF
Luca Coelho [Tue, 27 Dec 2016 08:18:18 +0000 (10:18 +0200)]
iwlwifi: remove support for deprecated RF

One of the RF modules we support has been deprecated and never
released publicly.  Remove support for this module.

Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: mvm: add DQA_ENABLE_CMD to the command list
Emmanuel Grumbach [Mon, 19 Dec 2016 06:41:16 +0000 (08:41 +0200)]
iwlwifi: mvm: add DQA_ENABLE_CMD to the command list

This will allow to print the name of the commands in the
logs when we sent it.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: be more verbose about needed firmware
Luca Coelho [Wed, 28 Dec 2016 08:46:20 +0000 (10:46 +0200)]
iwlwifi: be more verbose about needed firmware

If the supported firmware versions are not found, we currently only
print "no suitable firmware found".  This is not very informative for
the user trying to find the correct version to use.  Improve this by
printing the exact firmware name(s) the driver supports and pointing
to the git repository where they can be found.

Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: mvm: support new binding API
Sara Sharon [Thu, 17 Nov 2016 11:57:32 +0000 (13:57 +0200)]
iwlwifi: mvm: support new binding API

For a000 devices the binding API needs to include relevant
lmac ID - support the new API.
The new API should be used regardless if the device had CDB or
not. If there is no actual CDB support the binding is bound
to first lmac regardless of the band.
There are some functionality changes in binding restrictions
and quota allocations that will be handled in future patches.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agomwifiex: apply radar flag
Karthik Ananthapadmanabha [Wed, 5 Apr 2017 11:36:20 +0000 (17:06 +0530)]
mwifiex: apply radar flag

When IEEE80211_CHAN_RADAR is set by cfg80211, passive scan must be
performed. In mwifiex,active scan is performed even though flag is
set from cfg80211. mwifiex_reg_apply_radar_flags() function added
in this patch correctly uses radar flag.

Signed-off-by: Karthik Ananthapadmanabha <karthida@marvell.com>
Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Ganapathi Bhat <gbhat@marvell.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agortlwifi: btcoex: 23b 2ant: new fw use h2c to control GNT_BT
Yan-Hsuan Chuang [Mon, 3 Apr 2017 18:41:42 +0000 (13:41 -0500)]
rtlwifi: btcoex: 23b 2ant: new fw use h2c to control GNT_BT

Earlier versions of the FW did not support h2c to set GNT_BT, but later
versions have that capability. Hence we check the FW version and decide
whether to use h2c or just write to the register.

Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Pkshih <pkshih@realtek.com>
Cc: Birming Chiu <birming@realtek.com>
Cc: Shaofu <shaofu@realtek.com>
Cc: Steven Ting <steventing@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agortlwifi: btcoex: 23b 2ant: add comments to describe how duration adjusted
Yan-Hsuan Chuang [Mon, 3 Apr 2017 18:41:41 +0000 (13:41 -0500)]
rtlwifi: btcoex: 23b 2ant: add comments to describe how duration adjusted

Since btcoex uses static variables to store the cumulative information
on the wifi status, some tricks are used that are a bit obscure. We add
some comments about the criteria we use to adjust wifi duration.

Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Pkshih <pkshih@realtek.com>
Cc: Birming Chiu <birming@realtek.com>
Cc: Shaofu <shaofu@realtek.com>
Cc: Steven Ting <steventing@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agortlwifi: btcoex: 23b 2ant: finer bt power adjustment
Yan-Hsuan Chuang [Mon, 3 Apr 2017 18:41:40 +0000 (13:41 -0500)]
rtlwifi: btcoex: 23b 2ant: finer bt power adjustment

The bt can specify a power level to decrease. Rather than decreasing by a
fixed value (usually 2), this change makes the driver fit to the
environment more quickly.

Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Pkshih <pkshih@realtek.com>
Cc: Birming Chiu <birming@realtek.com>
Cc: Shaofu <shaofu@realtek.com>
Cc: Steven Ting <steventing@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agortlwifi: btcoex: 23b 2ant: remove redundant bt stack report
Yan-Hsuan Chuang [Mon, 3 Apr 2017 18:41:39 +0000 (13:41 -0500)]
rtlwifi: btcoex: 23b 2ant: remove redundant bt stack report

New ICs have hardware mailbox to deliver bt information instead of doing
it by driver itself, so remove them.

Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Pkshih <pkshih@realtek.com>
Cc: Birming Chiu <birming@realtek.com>
Cc: Shaofu <shaofu@realtek.com>
Cc: Steven Ting <steventing@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agortlwifi: btcoex: 23b 2ant: coex table fine tune
Yan-Hsuan Chuang [Mon, 3 Apr 2017 18:41:38 +0000 (13:41 -0500)]
rtlwifi: btcoex: 23b 2ant: coex table fine tune

set coex table fine tune, for register settings

Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Pkshih <pkshih@realtek.com>
Cc: Birming Chiu <birming@realtek.com>
Cc: Shaofu <shaofu@realtek.com>
Cc: Steven Ting <steventing@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agortlwifi: btcoex: 23b 2ant: adjust wifi duration for bt a2dp
Yan-Hsuan Chuang [Mon, 3 Apr 2017 18:41:37 +0000 (13:41 -0500)]
rtlwifi: btcoex: 23b 2ant: adjust wifi duration for bt a2dp

The larger the bt a2dp bit pool is, the more time bt needs to receive
them. If we do not adjust the wifi duration, the voice quality will be
low. Hence we reduce the time that wifi holds, to improve the a2dp
service.

Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Pkshih <pkshih@realtek.com>
Cc: Birming Chiu <birming@realtek.com>
Cc: Shaofu <shaofu@realtek.com>
Cc: Steven Ting <steventing@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agortlwifi: btcoex: 23b 2ant: less sensitive to tx rate penalty
Yan-Hsuan Chuang [Mon, 3 Apr 2017 18:41:36 +0000 (13:41 -0500)]
rtlwifi: btcoex: 23b 2ant: less sensitive to tx rate penalty

modify h2c parameter so that the rate suffers less penalty from retry

Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Pkshih <pkshih@realtek.com>
Cc: Birming Chiu <birming@realtek.com>
Cc: Shaofu <shaofu@realtek.com>
Cc: Steven Ting <steventing@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agortlwifi: btcoex: 23b 2ant: monitor wifi counter for allocate tdma time
Yan-Hsuan Chuang [Mon, 3 Apr 2017 18:41:35 +0000 (13:41 -0500)]
rtlwifi: btcoex: 23b 2ant: monitor wifi counter for allocate tdma time

If there are too many CRC error packets, it means the wifi is operating
under low quality circumstances. If so, we need to reallocate the
resources of wifi and bt

Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Pkshih <pkshih@realtek.com>
Cc: Birming Chiu <birming@realtek.com>
Cc: Shaofu <shaofu@realtek.com>
Cc: Steven Ting <steventing@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agortlwifi: btcoex: 23b 2ant: detect if bt is slave, and modify tdma
Yan-Hsuan Chuang [Mon, 3 Apr 2017 18:41:34 +0000 (13:41 -0500)]
rtlwifi: btcoex: 23b 2ant: detect if bt is slave, and modify tdma

if the bt is slave, it may receive packet at any time, so we
need to mark them as high priority packets to avoid packet loss.

Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Pkshih <pkshih@realtek.com>
Cc: Birming Chiu <birming@realtek.com>
Cc: Shaofu <shaofu@realtek.com>
Cc: Steven Ting <steventing@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agortlwifi: btcoex: 23b 2ant: add btc8723b2ant_limited_rx to reduce agg size
Yan-Hsuan Chuang [Mon, 3 Apr 2017 18:41:33 +0000 (13:41 -0500)]
rtlwifi: btcoex: 23b 2ant: add btc8723b2ant_limited_rx to reduce agg size

For wifi and bt coexistence, if the aggregation size of wifi is too
large, the transmission time of the aggregated packet could be too long
and the bt packets might "cut off" the wifi packet. We need to reduce
the aggregation size to improve wifi performance.

Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Pkshih <pkshih@realtek.com>
Cc: Birming Chiu <birming@realtek.com>
Cc: Shaofu <shaofu@realtek.com>
Cc: Steven Ting <steventing@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agortlwifi: btcoex: follow linux coding style
Yan-Hsuan Chuang [Mon, 3 Apr 2017 18:41:32 +0000 (13:41 -0500)]
rtlwifi: btcoex: follow linux coding style

Fix a number of checkpatch.pl warnings. In addition, some variable and
function names are shortened, and/or renamed to be more consistent.

Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Pkshih <pkshih@realtek.com>
Cc: Birming Chiu <birming@realtek.com>
Cc: Shaofu <shaofu@realtek.com>
Cc: Steven Ting <steventing@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agortlwifi: btcoex: remove unused functions
Yan-Hsuan Chuang [Mon, 3 Apr 2017 18:41:31 +0000 (13:41 -0500)]
rtlwifi: btcoex: remove unused functions

A number of functions in the Bluetooth Coexistence routines are not used,
and can be removed.

Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Pkshih <pkshih@realtek.com>
Cc: Birming Chiu <birming@realtek.com>
Cc: Shaofu <shaofu@realtek.com>
Cc: Steven Ting <steventing@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agomwifiex: add missing IEs related to TDLS operation
Karthik Ananthapadmanabha [Mon, 3 Apr 2017 14:36:50 +0000 (20:06 +0530)]
mwifiex: add missing IEs related to TDLS operation

In mwifiex,IEs such as supported channels, supported operating classes
20/40 BSS COexistence are missing and also extra QOS capabilities IE
is added during TDLS discovery response, TDLS setup request and
TDLS setupresponse.
This patch adds require IEs and also removes extra IE.

Signed-off-by: Karthik Ananthapadmanabha <karthida@marvell.com>
Signed-off-by: Ganapathi Bhat <gbhat@marvell.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agowlcore: fix spelling mistakes in wl1271_warning
Colin Ian King [Mon, 3 Apr 2017 09:47:58 +0000 (10:47 +0100)]
wlcore: fix spelling mistakes in wl1271_warning

trivial fix to spelling mistakes in wl1271_warning error message, change
iligal to invalid and opperation to operation.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agomwifiex: catch mwifiex_fw_dpc() errors properly in reset
Brian Norris [Tue, 28 Mar 2017 23:59:33 +0000 (16:59 -0700)]
mwifiex: catch mwifiex_fw_dpc() errors properly in reset

When resetting the device, we take a synchronous firmware-loading code
path, which borrows a lot from the asynchronous path used at probe time.
We don't catch errors correctly though, which means that in the PCIe
driver, we may try to dereference the 'adapter' struct after
mwifiex_fw_dpc() has freed it. See this (erronous) print in
mwifiex_pcie_reset_notify():

mwifiex_dbg(adapter, INFO, "%s, successful\n", __func__);

Let's instead refactor the synchronous (or "!req_fw_nowait") path so
that we propagate errors and handle them properly.

This fixes a use-after-free issue in the PCIe driver, as well as a
misleading debug message ("successful"). It looks like the SDIO driver
doesn't have these problems, since it doesn't do anything after
mwifiex_reinit_sw().

Fixes: 4c5dae59d2e9 ("mwifiex: add PCIe function level reset support")
Signed-off-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agomwifiex: fix use-after-free for FW reinit errors
Brian Norris [Tue, 28 Mar 2017 23:59:32 +0000 (16:59 -0700)]
mwifiex: fix use-after-free for FW reinit errors

If we fail to reinit the FW when resetting the device (in the
synchronous version of mwifiex_init_hw_fw() -> mwifiex_fw_dpc()),
mwifiex_fw_dpc() will tear down the interface and free up the adapter.
But we don't actually check for all failure cases of mwifiex_fw_dpc(),
so some of them fall through and dereference adapter->fw_done with a
freed adapter, causing a use-after-free bug.

In any case, mwifiex_fw_dpc() will always signal FW completion -- in the
error OR success case -- so at best, this was repeat work. Let's not do
it.

Signed-off-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agobrcmfmac: no need for d11inf instance in brcmf_pno_start_sched_scan()
Arend Van Spriel [Tue, 28 Mar 2017 10:43:28 +0000 (11:43 +0100)]
brcmfmac: no need for d11inf instance in brcmf_pno_start_sched_scan()

In brcmf_pno_start_sched_scan() a local variable is declared and
assigned for struct brcmu_d11inf. However, there is no other reference
to it so it is unnecessary.

Reviewed-by: Hante Meuleman <hante.meuleman@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
Reviewed-by: Franky Lin <franky.lin@broadcom.com>
Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agobrcmfmac: restore bus state when enter_D3 fails
Arend Van Spriel [Tue, 28 Mar 2017 10:43:27 +0000 (11:43 +0100)]
brcmfmac: restore bus state when enter_D3 fails

In brcmf_pcie_suspend() we inform the firmware on the device that
it will enter in D3 state. Before this is done we already bring down
the bus state. However, When entering D3 fails we abort the suspend
and the bus state need to be restored.

Reviewed-by: Hante Meuleman <hante.meuleman@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
Reviewed-by: Franky Lin <franky.lin@broadcom.com>
Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agobrcmfmac: add support to move wiphy instance into network namespace
Arend Van Spriel [Tue, 28 Mar 2017 10:43:26 +0000 (11:43 +0100)]
brcmfmac: add support to move wiphy instance into network namespace

To support network namespace the driver must assure all created
network interfaces are in the same namespace as the wiphy instance
and flag the support using WIPHY_FLAG_NETNS_OK.

Verified using two terminals:

 Terminal 1 Terminal 2
 -------------------------- ---------------------------------
 # ip netns add brcm-wifi # iw dev
phy#0
Interface wlan3
ifindex 11
wdev 0x1
 # ip netns exec brcm-wifi bash
 # iw dev
 # echo $$
 20337 # iw phy0 set netns 20337
 # iw dev
 phy#0
Interface wlan3
ifindex 11
wdev 0x2
 # iw phy0 interface add wl3.ap type __ap
 # iw dev
 phy#0
Interface wl3.ap
ifindex 2
wdev 0x3
Interface wlan3
ifindex 11
wdev 0x2
# iw dev
 # iw phy0 set netns 1
 # iw dev
# iw dev
phy#0
Interface wl3.ap
ifindex 2
wdev 0x5
Interface wlan3
ifindex 11
wdev 0x4

Note:
increasing wdev identifier above indicates issue in
cfg80211 which is addressed separately.

Tested-by: Mark Asselstine <mark.asselstine@windriver.com>
Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Reviewed-by: Franky Lin <franky.lin@broadcom.com>
Reviewed-by: Hante Meuleman <hante.meuleman@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agobrcmfmac: move brcmf_fws_deinit to bcdc layer
Franky Lin [Tue, 28 Mar 2017 10:43:25 +0000 (11:43 +0100)]
brcmfmac: move brcmf_fws_deinit to bcdc layer

Move brcmf_fws_deinit into brcmf_proto_bcdc_detach since it is a bcdc
exclusive feature.

Signed-off-by: Franky Lin <franky.lin@broadcom.com>
Reviewed-by: Arend Van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agobrcmfmac: wrap brcmf_fws_init into bcdc layer
Franky Lin [Tue, 28 Mar 2017 10:43:24 +0000 (11:43 +0100)]
brcmfmac: wrap brcmf_fws_init into bcdc layer

Create a new protocol layer interface brcmf_proto_init_cb for protocol
layer to finish initialzation after core module components(fweh and
etc.) are initialized.

Signed-off-by: Franky Lin <franky.lin@broadcom.com>
Reviewed-by: Arend Van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agomwifiex: enable auto deep sleep mode for USB chipsets
Amitkumar Karwar [Mon, 27 Mar 2017 13:06:51 +0000 (18:36 +0530)]
mwifiex: enable auto deep sleep mode for USB chipsets

Chip goes into low power state when this feature is enabled.
This was already enabled for SDIO and PCIe interface based
chipsets.

Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agomwifiex: Support USB interrupt endpoint for command response/event
Ganapathi Bhat [Mon, 27 Mar 2017 12:57:44 +0000 (18:27 +0530)]
mwifiex: Support USB interrupt endpoint for command response/event

USB firmware added support for sending command response/event through
interrupt endpoint, to enhance RX throughput. Added corresponding changes
required to support this feature. This change takes care of backward
compatibility with older firmware.

Signed-off-by: Ganapathi Bhat <gbhat@marvell.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agobrcmfmac: update BRCMFMAC symbol description
Rafał Miłecki [Thu, 23 Mar 2017 10:29:28 +0000 (11:29 +0100)]
brcmfmac: update BRCMFMAC symbol description

For quite some time now brcmfmac supports 802.11ac chipsets and it's
not limited to embedded devices only. There are even standalone PCIe
cards based on BCM43602 or BCM4366.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Reviewed-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agoMerge ath-next from git://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git
Kalle Valo [Wed, 5 Apr 2017 07:14:09 +0000 (10:14 +0300)]
Merge ath-next from git://git./linux/kernel/git/kvalo/ath.git

ath.git patches for 4.12. Major changes:

ath10k

* improve firmware download time for QCA6174 and QCA9377, especially
  helps resume time

ath9k_htc

* add support AirTies 1eda:2315 AR9271 device

7 years agort2x00: add support for MT7620
Roman Yeryomin [Mon, 20 Mar 2017 23:43:00 +0000 (00:43 +0100)]
rt2x00: add support for MT7620

Basic support for MT7620 built-in wireless radio was added to
OpenWrt in r41441. It has seen some heavy cleaning and refactoring
since in order to match the Kernel's code quality standards.

Signed-off-by: Roman Yeryomin <roman@advem.lv>
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
Acked-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agozd1211rw: fix NULL-deref at probe
Johan Hovold [Mon, 13 Mar 2017 12:44:21 +0000 (13:44 +0100)]
zd1211rw: fix NULL-deref at probe

Make sure to check the number of endpoints to avoid dereferencing a
NULL-pointer or accessing memory beyond the endpoint array should a
malicious device lack the expected endpoints.

Fixes: a1030e92c150 ("[PATCH] zd1211rw: Convert installer CDROM device into WLAN device")
Cc: Daniel Drake <dsd@gentoo.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agort2x00: fix TX_PWR_CFG_4 register definition
Daniel Golle [Wed, 8 Mar 2017 23:54:22 +0000 (00:54 +0100)]
rt2x00: fix TX_PWR_CFG_4 register definition

Some of the macros used to describe the TX_PWR_CFG_4 register accidentally
refer to TX_PWR_CFG_3, probably a copy&paste error. Fix that.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
Acked-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agoipw2200: remove redundant check of rc < 0
Colin Ian King [Mon, 27 Feb 2017 23:40:19 +0000 (23:40 +0000)]
ipw2200: remove redundant check of rc < 0

The check for rc < 0 is always false so the check is redundant
and can be removed.

Detected with CoverityScan, CID#101143 ("Logically dead code")

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agobrcmfmac: wrap brcmf_fws_reset_interface into bcdc layer
Franky Lin [Fri, 10 Mar 2017 21:17:06 +0000 (21:17 +0000)]
brcmfmac: wrap brcmf_fws_reset_interface into bcdc layer

Create a new protocol interface function brcmf_proto_reset_if for core
module to notify protocol layer when interface role changes.

Signed-off-by: Franky Lin <franky.lin@broadcom.com>
Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agobrcmfmac: wrap brcmf_fws_del_interface into bcdc layer
Franky Lin [Fri, 10 Mar 2017 21:17:05 +0000 (21:17 +0000)]
brcmfmac: wrap brcmf_fws_del_interface into bcdc layer

Create a new protocol interface function brcmf_proto_del_if for core
module to notify protocol layer upon interface deletion.

Signed-off-by: Franky Lin <franky.lin@broadcom.com>
Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agobrcmfmac: wrap brcmf_fws_add_interface into bcdc layer
Franky Lin [Fri, 10 Mar 2017 21:17:04 +0000 (21:17 +0000)]
brcmfmac: wrap brcmf_fws_add_interface into bcdc layer

fwsignal is only used by bcdc. Create a new protocol interface function
brcmf_proto_add_if for core module to notify protocol layer upon a new
interface is created.

Signed-off-by: Franky Lin <franky.lin@broadcom.com>
Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agobrcmfmac: move brcmf_txcomplete to bcdc layer
Franky Lin [Fri, 10 Mar 2017 21:17:03 +0000 (21:17 +0000)]
brcmfmac: move brcmf_txcomplete to bcdc layer

brcmf_txcomplete is invoked by sdio and usb bus module which are using
bcdc protocol. So move it from core module into bcdc layer.

Signed-off-by: Franky Lin <franky.lin@broadcom.com>
Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agobrcmfmac: move brcmf_txflowblock to bcdc layer
Franky Lin [Fri, 10 Mar 2017 21:17:02 +0000 (21:17 +0000)]
brcmfmac: move brcmf_txflowblock to bcdc layer

brcmf_txflowblock is invoked by sdio and usb bus module which are using
bcdc protocol. This patch makes it a bcdc API instead of a core module
function.

Reviewed-by: Arend Van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: Franky Lin <franky.lin@broadcom.com>
Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agobrcmfmac: Handle status == BRCMF_E_STATUS_ABORT in cfg80211_escan_handler
Hans de Goede [Wed, 8 Mar 2017 13:50:17 +0000 (14:50 +0100)]
brcmfmac: Handle status == BRCMF_E_STATUS_ABORT in cfg80211_escan_handler

If a scan gets aborted BRCMF_SCAN_STATUS_BUSY gets cleared in
cfg->scan_status and when we receive an abort event from the firmware
the BRCMF_SCAN_STATUS_BUSY check in the cfg80211_escan_handler will
trigger resulting in multiple errors getting logged.

Check for a status of BRCMF_E_STATUS_ABORT and in this case simply
cleanly exit the cfg80211_escan_handler. This also avoids a
BRCMF_E_STATUS_ABORT event arriving after a new scan has been started
causing the new scan to complete prematurely without any data.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agobrcmfmac: Do not complain about country code "00"
Hans de Goede [Wed, 8 Mar 2017 13:50:16 +0000 (14:50 +0100)]
brcmfmac: Do not complain about country code "00"

The country code gets set to "00" by default at boot, ignore this
rather then logging an error about it.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agobrcmfmac: Do not print the firmware version as an error
Hans de Goede [Wed, 8 Mar 2017 13:50:15 +0000 (14:50 +0100)]
brcmfmac: Do not print the firmware version as an error

Using pr_err for things which are not errors is a bad idea. E.g. it
will cause the plymouth bootsplash screen to drop back to the text
console so that the user can see the error, which is not what we
normally want to happen.

Instead add a new brcmf_info macro and use that.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agobrcmfmac: always print error when PSM's watchdog fires
Rafał Miłecki [Fri, 24 Feb 2017 16:32:46 +0000 (17:32 +0100)]
brcmfmac: always print error when PSM's watchdog fires

So far we were attaching BRCMF_E_PSM_WATCHDOG event listener in
brcmf_debug_attach which gets compiled only with CONFIG_BRCMDBG. This
event means something went wrong and firmware / hardware usually can't
be expected to work (reliably).

Such a problem is significant for user experience so I believe we should
print an error unconditionally (even with debugging disabled). What can
be indeed optional is dumping bus memory as this is clearly part of
debugging process.

In the future we may also try to extend this listener by trying to
recover from the error or at least signal it to the cfg80211.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agobcma: fill core OF info independently of bus type
Rafał Miłecki [Fri, 3 Mar 2017 10:34:15 +0000 (11:34 +0100)]
bcma: fill core OF info independently of bus type

PCI devices can be described in DT as well so we should always execute
relevant code. This will make bcma e.g. set of_node for cores described
in DT.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agobcma: use helper function to set core dev's parent
Rafał Miłecki [Fri, 3 Mar 2017 10:34:14 +0000 (11:34 +0100)]
bcma: use helper function to set core dev's parent

A tiny code deduplication thanks to the bcma_bus_get_host_dev.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agobcma: drop unneeded check for CONFIG_OF_IRQ
Rafał Miłecki [Fri, 3 Mar 2017 10:33:30 +0000 (11:33 +0100)]
bcma: drop unneeded check for CONFIG_OF_IRQ

We already have the same check in bcma_of_get_irq which really calls
symbols available with CONFIG_OF_IRQ only. It appears this duplicated
check was accidentally added in commit c58d900cc96a ("bcma: fix building
without OF_IRQ"). The rest of code in bcma_of_fill_device should work
fine without CONFIG_OF_IRQ.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Cc: Arnd Bergmann <arnd@arndb.de>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agortlwifi: Add QoS-NULL and BT-QoS-NULL to reserved page.
Ping-Ke Shih [Thu, 23 Feb 2017 17:19:57 +0000 (11:19 -0600)]
rtlwifi: Add QoS-NULL and BT-QoS-NULL to reserved page.

Two additional preset responses are added to the reserved page on the
wifi device.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agortlwifi: Add code to read new versions of firmware
Larry Finger [Thu, 23 Feb 2017 17:19:56 +0000 (11:19 -0600)]
rtlwifi: Add code to read new versions of firmware

Changes in the drivers for RTL8723BE and RTL8821AE require corresponding
changes in the firmware. This new firmware has been accepted into the
Linux firmware repo. To handle the case where the kernel has been
updated before the firmware, the new versions have been given new names.
The code will attempt to read the new name, and fall back to the old one
if the new one is not available.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agortlwifi: Update 8812ae new phy parameters and its parser.
Ping-Ke Shih [Thu, 23 Feb 2017 17:19:55 +0000 (11:19 -0600)]
rtlwifi: Update 8812ae new phy parameters and its parser.

Update PHY tables for the RTL8812AE. A new parser is also needed.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agortlwifi: Update 8821ae new phy parameters and its parser.
Ping-Ke Shih [Thu, 23 Feb 2017 17:19:54 +0000 (11:19 -0600)]
rtlwifi: Update 8821ae new phy parameters and its parser.

There are new PHY table values for the RTL8821AE. The changes require
new parsing code.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agomwifiex: fix kernel crash after shutdown command timeout
Brian Norris [Thu, 16 Mar 2017 21:36:07 +0000 (14:36 -0700)]
mwifiex: fix kernel crash after shutdown command timeout

We observed a SHUTDOWN command timeout during reboot stress test due to
a corner case firmware bug. It can lead to either a use-after-free +
OOPS (on either the adapter structure, or the 'card' structure) or an
abort (where, e.g., the PCI device is "disabled" before we're done
dumping the FW).

We can avoid this by canceling/flushing the FW dump work:

(a) after we've terminated all other work queues (e.g., for processing
    commands which could time out)
(b) after we've disabled all interrupts (which could also queue more
    work for us)
(c) after we've unregistered the netdev and wiphy structures (and
    implicitly, and debugfs entries which could manually trigger FW dumps)
(d) before we've actually disabled the device (e.g.,
    pci_device_disable())

Altogether, this means no card->work will be scheduled if we sync at
a point that satisfies the above. This can be done at the beginning of
the .cleanup_if() callback.

Signed-off-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agomwifiex: send fewer channels to scan while connected
Amitkumar Karwar [Thu, 16 Mar 2017 10:46:11 +0000 (16:16 +0530)]
mwifiex: send fewer channels to scan while connected

Application triggers periodic background scans when device is connected.
We will scan less number of channels per scan command so that data
traffic won't get affected.

Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agomwifiex: fix for unaligned reads
Devidas Puranik [Thu, 9 Mar 2017 08:36:17 +0000 (14:06 +0530)]
mwifiex: fix for unaligned reads

Using the accessor function e.g. get_unaligned_le32 instead of
le32_to_cpu to avoid the unaligned access. This is for the
architectures that don't handle the unaligned memory access

Signed-off-by: Devidas Puranik <devidas@marvell.com>
Signed-off-by: Ganapathi Bhat <gbhat@marvell.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agomwifiex: Use accessors routines for unaligned values
Daniel Mentz [Thu, 9 Mar 2017 08:36:16 +0000 (14:06 +0530)]
mwifiex: Use accessors routines for unaligned values

Synopsys' ARCompact architecture does not support loading from or
storing values to unaligned memory locations. We saw a series of
misaligned access exceptions on ARC. To work around this issue, we bulk
replaced le16_to_cpu and le32_to_cpu with get_unaligned_le16 and
get_unaligned_le32, respectively. We also added le16_unaligned_add_cpu
which is similar to le16_add_cpu but works with unaligned values.

Signed-off-by: Daniel Mentz <danielmentz@google.com>
Signed-off-by: Ganapathi Bhat <gbhat@marvell.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agomwifiex: add qualifier to firmware structures
Karthik Ananthapadmanabha [Thu, 9 Mar 2017 08:36:15 +0000 (14:06 +0530)]
mwifiex: add qualifier to firmware structures

Adding qualifier "__packed" indicates that no padding should be
performed on the qualified object for alignment.
This patch adds qualifier __packed to the required firmware
structures in mwifiex driver.

Signed-off-by: Karthik Ananthapadmanabha <karthida@marvell.com>
Signed-off-by: Ganapathi Bhat <gbhat@marvell.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agomwifiex: pcie: clean up error prints in mwifiex_pcie_reset_notify()
Brian Norris [Tue, 7 Mar 2017 20:47:46 +0000 (12:47 -0800)]
mwifiex: pcie: clean up error prints in mwifiex_pcie_reset_notify()

We shouldn't be printing a kernel pointer as a decimal integer. But we
really shouldn't be printing this case at all; we should never get here
with NULL drvdata. We've eliminated this unnecessary conditional in
several other places, so kill it here too.

Similarly, there's no need to check for '!pdev'; we are guaranteed to
have a real device here.

And finally, use dev_err() instead of pr_err().

This yields (for failed PCIe resets):

[   68.286586] mwifiex_pcie 0000:01:00.0: mwifiex_pcie_reset_notify: adapter structure is not valid

instead of:

[   82.932658] mwifiex_pcie: mwifiex_pcie_reset_notify: Card or adapter structure is not valid (-270880688088)

Signed-off-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agomwifiex: wake system up when receives a wake irq
Jeffy Chen [Fri, 24 Feb 2017 06:24:31 +0000 (14:24 +0800)]
mwifiex: wake system up when receives a wake irq

Currrently we are disabling this wake irq after receiving it. If this
happens before we finish suspend and the pm event check is disabled,
the system will continue suspending, and this irq would not work again.

We may need to abort system suspend to avoid that.

Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agoatmel: remove time_t usage
Alexandre Belloni [Thu, 23 Feb 2017 16:14:45 +0000 (17:14 +0100)]
atmel: remove time_t usage

last_qual never really holds a time. It only holds jiffies. Make it the
same type as jiffies.

Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agoath6kl: Remove old 802.11a-only channels
Rostyslav Khudolii [Thu, 16 Mar 2017 09:22:17 +0000 (11:22 +0200)]
ath6kl: Remove old 802.11a-only channels

Channels 34/38/42/46 can only be used for compatibility with old devices sold
in Japan. Modern products, such as AR6003/AR6004 don't support these channels.
Keeping them in the upstream is error prone and requires full network stack
support. A custom patch should be used in case such compatibility is required.

Without this one, a user is able to start an AP using wpa_supplicant,
for example, on one of these channels (34/38/42/46), without getting
any warning/error from the cfg80211 or ath6kl - which is correct
(since these channels match regdom rules). However, the AR6003 and its
firmware (we're using v3.4.0.225) will fail and return
"WMI_CMDERROR_EVENTID" with "INVALID_PARAM" error code.

Signed-off-by: Rostyslav Khudolii <rkhudolii@airtame.com>
Cc: Attila Sukosd <attila@airtame.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
7 years agoath10k: remove redundant check of len with buf_len
Colin Ian King [Wed, 15 Mar 2017 16:36:41 +0000 (16:36 +0000)]
ath10k: remove redundant check of len with buf_len

The check of len > buf_len is redundant as len is initialized
to 0 and buf_len to 4096, so this comparison is always false.
Remove it.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
7 years agoath10k: fix typo in wmi header file
Mohammed Shafi Shajakhan [Tue, 14 Mar 2017 11:33:24 +0000 (17:03 +0530)]
ath10k: fix typo in wmi header file

Fix typo (spelling mistake) in wmi.h

Signed-off-by: Mohammed Shafi Shajakhan <mohammed@qti.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
7 years agoath10k: fix warnings from an earlier commit
Kalle Valo [Thu, 16 Mar 2017 09:11:02 +0000 (11:11 +0200)]
ath10k: fix warnings from an earlier commit

I failed to notice that commit 523f6701dbab ("ath10k: update available channel
list for 5G radio") added two new warnings:

drivers/net/wireless/ath/ath10k/mac.c:3129:6: warning: symbol 'ath10k_mac_update_channel_list' was not declared. Should it be static?
drivers/net/wireless/ath/ath10k/mac.c:3170: Alignment should match open parenthesis

Fix those.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
7 years agoath10k: fix fetching channel during potential radar detection
Mohammed Shafi Shajakhan [Wed, 8 Mar 2017 12:33:32 +0000 (18:03 +0530)]
ath10k: fix fetching channel during potential radar detection

Fetch target operating channel during potential radar detection when
the interface is just brought up, but no channel is assigned from
userspace. In this scenario rx_channel may not be having a valid pointer
hence fetch the target operating channel to avoid warnings as below
which can be triggered by the commands with DFS testing over longer run

comamnds:
iw wlan1 set type mesh
ifconfig wlan1 up (valid tgt_oper_chan only)
iw wlan1 cac trigger freq 5260 HT20 (valid rx_channel, tgt_oper_chan)
iw wlan1 cac trigger freq 5280 HT20
iw wlan1 cac trigger freq 5300 HT20

Once the CAC expires, current channel context will be removed and
we are only left with the fallback option of using 'target operating
channel'

Firmware and driver log:
ath: phy1: DFS: radar found on freq=5300: id=1, pri=1125, count=5,
count_false=4
ath: phy1: DFS: radar found on freq=5260: id=5, pri=3151, count=6,
count_false=11
ath: phy1: DFS: radar found on freq=5280: id=1, pri=1351, count=6,
count_false=4
ath: phy1: DFS: radar found on freq=5300: id=1, pri=1125, count=5,
count_false=4
ath10k_pci 0001:01:00.0: failed to derive channel for radar pulse,
treating as radar
ath10k_pci 0001:01:00.0: failed to derive channel for radar pulse,
treating as radar

Call trace:

WARNING: CPU: 1 PID: 2145 at
backports-20161201-3.14.77-9ab3068/net/wireless/chan.c:265
cfg80211_set_dfs_state+0x3c/0x88 [cfg80211]()

 Workqueue: phy1 ieee80211_dfs_radar_detected_work
[mac80211]
[<c0320770>] (warn_slowpath_null) from [<bf79b90c>]
(cfg80211_set_dfs_state+0x3c/0x88 [cfg80211])
[<bf79b90c>] (cfg80211_set_dfs_state [cfg80211]) from
[<bf79697c>] (cfg80211_radar_event+0xc4/0x140 [cfg80211])
[<bf79697c>] (cfg80211_radar_event [cfg80211]) from
[<bf83c058>] (ieee80211_dfs_radar_detected_work+0xa8/0xb4 [mac80211])
[<bf83c058>] (ieee80211_dfs_radar_detected_work
[mac80211]) from [<c0339518>] (process_one_work+0x298/0x4a4)

Signed-off-by: Mohammed Shafi Shajakhan <mohammed@qti.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
7 years agoath10k: remove redundant error check
Colin Ian King [Tue, 28 Feb 2017 11:14:39 +0000 (11:14 +0000)]
ath10k: remove redundant error check

The check on ret for an error is redundant because it is already been
checked for non-zero earlier on and ret is never non-zero at this point.
Fix this by removing the redundant check and error message.

Detected by CoverityScan, CID#1357170 ("Logically Dead Code")

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
7 years agoath9k: don't trigger spectral scan when not enabled
Zefir Kurtisi [Mon, 27 Feb 2017 14:49:36 +0000 (15:49 +0100)]
ath9k: don't trigger spectral scan when not enabled

Doing so enables the FFT generation without prior
configuration, leading to an IRQ storm caused by
invalid (or at least unwanted) PHY errors.

Signed-off-by: Zefir Kurtisi <zefir.kurtisi@neratec.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
7 years agoath10k: update available channel list for 5G radio
Tamizh chelvam [Thu, 23 Feb 2017 13:18:22 +0000 (18:48 +0530)]
ath10k: update available channel list for 5G radio

If a 5 GHz radio is calibrated for operation in both
the low band (channels 36 to 64) and high band(channels 100 to 169),
hardware allows operations in all the listed channels. However,
if the chip has been calibrated only for the low/high band and
a high/low band channel is configured, due to lack of calibration
there will be potentially invalid signal on those non calibrated channels.
To avoid this problem this patch sets IEEE80211_CHAN_DISABLED flag for
those non calibrated channels by using low_5ghz_chan and high_5ghz_chan
values which we get from target through wmi service ready event.

Driver initialized flags are getting re initialized in handle_channel
in cfg80211. So calling the function to disable the non supported channel
from reg_notifier().

Signed-off-by: Tamizh chelvam <c_traja@qti.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
7 years agoath10k: disallow DFS simulation if DFS channel is not enabled
Mohammed Shafi Shajakhan [Wed, 22 Feb 2017 15:33:11 +0000 (21:03 +0530)]
ath10k: disallow DFS simulation if DFS channel is not enabled

If DFS is not enabled in hostapd (ieee80211h=0) DFS channels shall
not be available for use even though the hardware may have the capability
to support DFS. With this configuration (DFS disabled in hostapd) trying to
bring up ath10k device in DFS channel for AP mode fails and trying to
simulate DFS in ath10k debugfs results in a warning in cfg80211 complaining
invalid channel and this should be avoided in the driver itself rather than
false propogating RADAR detection to mac80211/cfg80211. Fix this by
checking for the first vif 'is_started' state(should work for client mode
as well) as all the vifs shall be configured for the same channel

sys/kernel/debug/ieee80211/phy1/ath10k# echo 1 > dfs_simulate_radar

WARNING: at net/wireless/chan.c:265 cfg80211_radar_event+0x24/0x60
Workqueue: phy0 ieee80211_dfs_radar_detected_work [mac80211]
[<c022f2d4>] (warn_slowpath_null) from
[<bf72dab8>] (cfg80211_radar_event+0x24/0x60 [cfg80211])
[<bf72dab8>] (cfg80211_radar_event [cfg80211]) from
[<bf7813e0>] (ieee80211_dfs_radar_detected_work+0x94/0xa0 [mac80211])
[<bf7813e0>] (ieee80211_dfs_radar_detected_work [mac80211]) from
[<c0242320>] (process_one_work+0x20c/0x32c)

WARNING: at net/wireless/nl80211.c:2488 nl80211_get_mpath+0x13c/0x4cc
 Workqueue: phy0 ieee80211_dfs_radar_detected_work [mac80211]
[<c022f2d4>] (warn_slowpath_null) from
[<bf72dab8>] (cfg80211_radar_event+0x24/0x60 [cfg80211])
[<bf72dab8>] (cfg80211_radar_event [cfg80211]) from
[<bf7813e0>] (ieee80211_dfs_radar_detected_work+0x94/0xa0 [mac80211])
[<bf7813e0>] (ieee80211_dfs_radar_detected_work [mac80211]) from
[<c0242320>] (process_one_work+0x20c/0x32c)

Signed-off-by: Mohammed Shafi Shajakhan <mohammed@qti.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
7 years agowil6210: add oob_mode for AP certification
Lior David [Wed, 8 Mar 2017 11:52:19 +0000 (13:52 +0200)]
wil6210: add oob_mode for AP certification

Add a new value to the oob_mode module parameter for
supporting AP certification.
All enabled values of oob_mode (>0) are intended only
for debugging and diagnostics.

Signed-off-by: Lior David <qca_liord@qca.qualcomm.com>
Signed-off-by: Maya Erez <qca_merez@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
7 years agowil6210: correctly report locally generated disconnect in STA mode
Dedy Lansky [Wed, 8 Mar 2017 11:52:18 +0000 (13:52 +0200)]
wil6210: correctly report locally generated disconnect in STA mode

Driver always invoke cfg80211_disconnected() with locally_generated as
false.
Fix this by reporting true whenever the disconnect is triggered from
upper layers (cfg80211) or from within the driver itself (reset,
deinit).

Signed-off-by: Dedy Lansky <qca_dlansky@qca.qualcomm.com>
Signed-off-by: Maya Erez <qca_merez@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
7 years agowil6210: use WMI_DISCONNECT_CMDID upon connect timeout
Dedy Lansky [Wed, 8 Mar 2017 11:52:17 +0000 (13:52 +0200)]
wil6210: use WMI_DISCONNECT_CMDID upon connect timeout

Upon connect timeout driver invokes _wil6210_disconnect() which iterates
over sta array and disconnects each connected sta. In practice, because
the connection is still ongoing and because cid is not yet allocated,
disconnect is not actually happening. This leaves FW in connecting
state while driver is in disconnected state.
To fix this, upon connect timeout, explicitly send WMI_DISCONNECT_CMDID
to FW to make sure it gets disconnected.

Signed-off-by: Dedy Lansky <qca_dlansky@qca.qualcomm.com>
Signed-off-by: Maya Erez <qca_merez@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
7 years agowil6210: protect list of pending wmi events during flush
Hamad Kadmany [Wed, 8 Mar 2017 11:52:16 +0000 (13:52 +0200)]
wil6210: protect list of pending wmi events during flush

When flush is done, pending events list is manipulated
without taking the proper spinlock, which could lead to
memory corruption if list is manipulated by wmi worker
or by interrupt routine.

Signed-off-by: Hamad Kadmany <qca_hkadmany@qca.qualcomm.com>
Signed-off-by: Maya Erez <qca_merez@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
7 years agowil6210: store bss object and use cfg80211_connect_bss()
Dedy Lansky [Wed, 8 Mar 2017 11:52:15 +0000 (13:52 +0200)]
wil6210: store bss object and use cfg80211_connect_bss()

In a fast disconnect/connect sequence, cfg80211_connect_result() can
fail to find the bss object which the driver is connecting to. Detailed
sequence of events:
* Driver is connected in STA mode
* Disconnect request arrives from user space. Driver disconnects and
  calls cfg80211_disconnected() which adds new event to the
  cfg80211_wq worker thread
* Connect request arrives from user space. cfg80211_connect() stores
  ssid/ssid_len and calls rdev_connect()
* __cfg80211_disconnected() runs in worker thread and zero
  wdev->ssid_len
* Connect succeeds. Driver calls cfg80211_connect_result() which fails
  to find the bss because wdev->ssid_len is zero

To overcome this, upon connect request, store the bss object in the
driver and upon connect completion pass it to kernel using
cfg80211_connect_bss().

Signed-off-by: Dedy Lansky <qca_dlansky@qca.qualcomm.com>
Signed-off-by: Maya Erez <qca_merez@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
7 years agowil6210: missing reinit_completion in HALP voting
Maya Erez [Wed, 8 Mar 2017 11:52:14 +0000 (13:52 +0200)]
wil6210: missing reinit_completion in HALP voting

After setting HALP ICR bit, we keep it set until HALP unvote.
Masking HALP ICR should protect the driver from hitting the HALP ICR
over and over again. However, in case there is another MISC ICR
we will read the HALP ICR and issue a completion. This can lead to
a case where HALP voting is completed immediately, as the completion
is already set.
Reinit the HALP completion before the actual vote will clear previous
completions and protect from such cases.

Signed-off-by: Maya Erez <qca_merez@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
7 years agowil6210: use print_hex_dump_debug instead of print_hex_dump_bytes
Dedy Lansky [Wed, 8 Mar 2017 11:52:13 +0000 (13:52 +0200)]
wil6210: use print_hex_dump_debug instead of print_hex_dump_bytes

Some dynamic debug printouts in driver are using print_hex_dump_bytes.
However, with dynamic debug disabled, print_hex_dump_bytes outputs to
log unconditionally.
Use print_hex_dump_debug instead to prevent log pollution when dynamic
debug disabled.

Signed-off-by: Dedy Lansky <qca_dlansky@qca.qualcomm.com>
Signed-off-by: Maya Erez <qca_merez@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
7 years agowil6210: bus_request platform operation refinement
Lior David [Wed, 8 Mar 2017 11:52:12 +0000 (13:52 +0200)]
wil6210: bus_request platform operation refinement

The driver uses the bus_request platform operation to
request resources from the platform for a specific bandwidth.
Currently the driver requests resources for the maximum
theoretical bandwidth, when interface is brought up.
Refine this process a bit: now the driver will request a
small amount of resources when interface is up, and will only
issue the maximum request when connected.
This mechanism will be improved further in the future to make
more refined requests based on actual bandwidth.

Signed-off-by: Lior David <qca_liord@qca.qualcomm.com>
Signed-off-by: Maya Erez <qca_merez@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
7 years agowil6210: do not start regular scan on stopped p2p device
Lior David [Wed, 8 Mar 2017 11:52:11 +0000 (13:52 +0200)]
wil6210: do not start regular scan on stopped p2p device

The driver should not allow starting any type of scan on a stopped
P2P device. Current implementation only checked social scan.

Signed-off-by: Lior David <qca_liord@qca.qualcomm.com>
Signed-off-by: Maya Erez <qca_merez@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
7 years agowil6210: set dma mask to reflect device capability
Hamad Kadmany [Wed, 8 Mar 2017 11:52:10 +0000 (13:52 +0200)]
wil6210: set dma mask to reflect device capability

device supports 48bit addresses, reflect that by
setting the dma mask accordingly.

Signed-off-by: Hamad Kadmany <qca_hkadmany@qca.qualcomm.com>
Signed-off-by: Maya Erez <qca_merez@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
7 years agowcn36xx: Fix error handling
Christophe Jaillet [Wed, 8 Mar 2017 11:52:09 +0000 (13:52 +0200)]
wcn36xx: Fix error handling

Reorder 'out_free_dxe_pool' and 'out_free_dxe_ctl' error handling labels
in order to match the way resources have been allocated.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
7 years agoath10k: fix a warning during channel switch with multiple vaps
Mohammed Shafi Shajakhan [Wed, 8 Mar 2017 11:52:06 +0000 (13:52 +0200)]
ath10k: fix a warning during channel switch with multiple vaps

Doing a channel switch via hostapd_cli seems to update
the new channel context for each VAP's appropriately as below
in 'ath10k_mac_update_vif_chan', hence we can safely suppress the
warning that shows up during this operation and dump the warning only
if no vaps are available for channel switch

hostapd_cli -i wlan0 chan_switch 5 5200
OK

ath10k_pci : mac chanctx switch n_vifs 3 mode 1
ath10k_pci : mac chanctx switch vdev_id 2 freq 5180->5200 width 0->0
ath10k_pci : mac chanctx switch vdev_id 1 freq 5180->5200 width 0->0
ath10k_pci : mac chanctx switch vdev_id 0 freq 5180->5200 width 0->0

Call Trace:

WARNING: backports-20161201-3.14.77-9ab3068/drivers/net/wireless/ath/ath10k/mac.c:7126
[<c022f2d4>] (warn_slowpath_null) from [<bf7f150c>]
(ath10k_reconfig_complete+0xe4/0x25c [ath10k_core])
[<bf7f150c>] (ath10k_reconfig_complete [ath10k_core])
[<bf7f35f0>] (ath10k_mac_vif_ap_csa_work+0x214/0x370 [ath10k_core])
[<bf7f38b8>] (ath10k_mac_op_change_chanctx+0x108/0x128 [ath10k_core])
[<bf782ac0>] (ieee80211_recalc_chanctx_min_def+0x30c/0x430 [mac80211])
[<bf7830a4>] (ieee80211_recalc_smps_chanctx+0x2ec/0x840 [mac80211])
[<bf7843e8>] (ieee80211_vif_use_reserved_context+0x7c/0xf8 [mac80211])
[<bf7843e8>] (ieee80211_vif_use_reserved_context [mac80211])
[<bf76e5d4>] (ieee80211_csa_finalize_work+0x5c/0x88 [mac80211])

Fixes: d7bf4b4aba05 ("ath10k: fix ar->rx_channel updating logic")
Signed-off-by: Mohammed Shafi Shajakhan <mohammed@qti.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
7 years agoath9k_htc: Add support of AirTies 1eda:2315 AR9271 device
Dmitry Tunin [Wed, 8 Mar 2017 11:52:07 +0000 (13:52 +0200)]
ath9k_htc: Add support of AirTies 1eda:2315 AR9271 device

T:  Bus=01 Lev=02 Prnt=02 Port=02 Cnt=01 Dev#=  7 Spd=480 MxCh= 0
D:  Ver= 2.00 Cls=ff(vend.) Sub=ff Prot=ff MxPS=64 #Cfgs=  1
P:  Vendor=1eda ProdID=2315 Rev=01.08
S:  Manufacturer=ATHEROS
S:  Product=USB2.0 WLAN
S:  SerialNumber=12345
C:  #Ifs= 1 Cfg#= 1 Atr=80 MxPwr=500mA
I:  If#= 0 Alt= 0 #EPs= 6 Cls=ff(vend.) Sub=00 Prot=00 Driver=(none)

Signed-off-by: Dmitry Tunin <hanipouspilot@gmail.com>
Cc: stable@vger.kernel.org
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
7 years agoath10k: improve the firmware download time for QCA9377
Ryan Hsu [Wed, 8 Mar 2017 11:52:05 +0000 (13:52 +0200)]
ath10k: improve the firmware download time for QCA9377

QCA9377 is the family of QCA61x4 which shared the same procedure
to enable the hardware clock that could improve the firmware download time.

Signed-off-by: Ryan Hsu <ryanhsu@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
7 years agoath10k: improve the firmware download time for QCA6174
Ryan Hsu [Wed, 8 Mar 2017 11:52:04 +0000 (13:52 +0200)]
ath10k: improve the firmware download time for QCA6174

Len Brown reported the system resume time is taking more than 2 seconds in
bug - https://bugzilla.kernel.org/show_bug.cgi?id=185621.

The reason of the 2 seconds is due to the firmware download time.

The chip is booted up in the default reference clock speed to handle the
firmware download to chip memory and advanced to the support higher speed
clock to run the firmware after all. The default reference clock in the
hardware is slow so that the firmware download time is taking up to 2
seconds for a 600KB firmware file.

[76796.349701] ath10k_pci : boot uploading firmware image len 688691
[76798.334612] ath10k_pci : htt tx max num pending tx 1056

The resolution here is to enable the higher speed clock if the hardware
supported before the firmware download at BMI stage, so that the hardware
can handle the firmare download in a more efficient way. This can help to
improve the firmware download time from 2 seconds to around 500ms for the
same 600KB firmware file.

[322858.577919] ath10k_pci boot uploading firmware image len 688691
[322859.093094] ath10k_pci htt tx max num pending tx 1056

The steps to advance to the higher speed clock is very hardware specific,
so adding the hardware ops for the hardware that can support this.

Reported-by: Len Brown <lenb@kernel.org>
Tested-by: Paul Menzel <pmenzel@molgen.mpg.de>
Signed-off-by: Ryan Hsu <ryanhsu@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
7 years agortlwifi: fix spelling mistake: "conuntry" -> "country"
Colin Ian King [Wed, 22 Feb 2017 23:35:52 +0000 (23:35 +0000)]
rtlwifi: fix spelling mistake: "conuntry" -> "country"

trivial fix to spelling mistake in RT_TRACE message

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agortl8187: Enable monitor mode to fix multicast reception
Nils Holland [Sun, 19 Feb 2017 23:59:28 +0000 (00:59 +0100)]
rtl8187: Enable monitor mode to fix multicast reception

The rtl8187 cards don't seem to receive multicast frames, which,
among other things, makes them fail to receive RAs in IPv6 networks.
The cause seems to be that the RTL818X_RX_CONF_MULTICAST flag doesn't
have the desired effect.

Fix the issue by setting RTL818X_RX_CONF_MONITOR instead, which puts the
card into monitor mode and resolves the problem so that multicast frames
are sucessfully passed to the kernel.

The existence of the problem and the effectiveness of the solution has
originally been confirmed on an 8187B based card with the USB id of
0bda:8197. Subsequent testing by Larry Finger on an 8187L based card,
which follows the second (8187, i.e. "non-b") code path in the driver,
has confirmed that the fix does not cause any noticeable regresssions
there either.

Signed-off-by: Nils Holland <nholland@tisys.org>
Acked-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>