platform/kernel/linux-rpi.git
6 years agoiwlwifi: mvm: allow reading UMAC error data from SMEM in A000 devices
Beni Lev [Thu, 28 Sep 2017 09:10:55 +0000 (12:10 +0300)]
iwlwifi: mvm: allow reading UMAC error data from SMEM in A000 devices

Currently, UMAC error data reading is restricted to DCCM.
A000 NICs use SMEM for this data.

Signed-off-by: Beni Lev <beni.lev@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
6 years agoiwlwifi: mvm: pass baid_data to iwl_mvm_release_frames()
Johannes Berg [Mon, 2 Oct 2017 11:43:27 +0000 (13:43 +0200)]
iwlwifi: mvm: pass baid_data to iwl_mvm_release_frames()

All callers of iwl_mvm_release_frames() already have the baid_data
pointer, so we don't need to (re)calculate it inside the function.
Just pass it instead.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
6 years agoiwlwifi: mvm: remove duplicated fields in mvm reorder buffer
Sara Sharon [Mon, 2 Oct 2017 09:07:59 +0000 (12:07 +0300)]
iwlwifi: mvm: remove duplicated fields in mvm reorder buffer

The reason station id and tid fields are both in baid data and
in the reorder buffer per queue is that we couldn't access the
baid_data in the reorder timer functions.
Now that we do some pointer math and access it anyway, those
fields can be removed.
This save some space and some code.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
6 years agoiwlwifi: mvm: allocate reorder buffer according to need
Johannes Berg [Tue, 26 Sep 2017 10:24:51 +0000 (12:24 +0200)]
iwlwifi: mvm: allocate reorder buffer according to need

Now that we may have up to 256 entries per reorder buffer, and possibly up
to 16 queues, we can use a LOT of memory for this (64k for each station).
Allocate it according to what we need, which is of course much less for HT
stations (only 16k at a max of 16 queues).

However, this comes at the expense of complicating the code a bit to
calculate the right entry structure to use for each frame.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
6 years agobcma: use bcma_debug and pr_cont in MIPS driver
Rafał Miłecki [Mon, 16 Oct 2017 12:54:32 +0000 (14:54 +0200)]
bcma: use bcma_debug and pr_cont in MIPS driver

Using bcma_debug gives a device-specific prefix for messages and pr_cont
is a common helper for continuing a line.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Acked-By: Hauke Mehrtens <hauke@hauke-m.de>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agortlwifi: Fix typo in if ... else if ... else construct
Larry Finger [Sun, 15 Oct 2017 01:54:02 +0000 (20:54 -0500)]
rtlwifi: Fix typo in if ... else if ... else construct

The kbuild test robot reports two conditions with no effect (if == else).
These are the result of copy and paste typographical errors.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Ping-Ke Shih <pkshih@realtek.com>
Cc: Yan-Hsuan Chuang <yhchuang@realtek.com>
Cc: Birming Chiu <birming@realtek.com>
Cc: Shaofu <shaofu@realtek.com>
Cc: Steven Ting <steventing@realtek.com>
Cc: kbuild-all@01.org
Cc: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agoMerge git://git.kernel.org/pub/scm/linux/kernel/git/kvalo/wireless-drivers.git
Kalle Valo [Mon, 16 Oct 2017 14:06:54 +0000 (17:06 +0300)]
Merge git://git./linux/kernel/git/kvalo/wireless-drivers.git

Mark Brown reported that there are conflicts in iwlwifi between the two trees
so fix those now.

6 years agorsi: fix integer overflow warning
Arnd Bergmann [Thu, 5 Oct 2017 12:05:24 +0000 (14:05 +0200)]
rsi: fix integer overflow warning

gcc produces a harmless warning about a recently introduced
signed integer overflow:

drivers/net/wireless/rsi/rsi_91x_hal.c: In function 'rsi_prepare_mgmt_desc':
include/uapi/linux/swab.h:13:15: error: integer overflow in expression [-Werror=overflow]
  (((__u16)(x) & (__u16)0x00ffU) << 8) |   \
   ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
include/uapi/linux/swab.h:104:2: note: in expansion of macro '___constant_swab16'
  ___constant_swab16(x) :   \
  ^~~~~~~~~~~~~~~~~~
include/uapi/linux/byteorder/big_endian.h:34:43: note: in expansion of macro '__swab16'
 #define __cpu_to_le16(x) ((__force __le16)__swab16((x)))
                                           ^~~~~~~~
include/linux/byteorder/generic.h:89:21: note: in expansion of macro '__cpu_to_le16'
 #define cpu_to_le16 __cpu_to_le16
                     ^~~~~~~~~~~~~
drivers/net/wireless/rsi/rsi_91x_hal.c:136:3: note: in expansion of macro 'cpu_to_le16'
   cpu_to_le16((tx_params->vap_id << RSI_DESC_VAP_ID_OFST) &
   ^~~~~~~~~~~

The problem is that the 'mask' value is a signed integer that gets
turned into a negative number when truncated to 16 bits. Making it
an unsigned constant avoids this.

Fixes: eac4eed3224b ("rsi: tx and rx path enhancements for p2p mode")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agoqtnfmac: do not cache current channel info in driver's state
Igor Mitsyanko [Thu, 5 Oct 2017 01:38:13 +0000 (18:38 -0700)]
qtnfmac: do not cache current channel info in driver's state

Linux Wireless device structure already has current channel
information that can be used when needed. Start using it.
Since driver's channel info is not used anymore, remove it.

Signed-off-by: Igor Mitsyanko <igor.mitsyanko.os@quantenna.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agoqtnfmac: make encryption info a part of CONNECT command.
Igor Mitsyanko [Thu, 5 Oct 2017 01:38:12 +0000 (18:38 -0700)]
qtnfmac: make encryption info a part of CONNECT command.

Encryption info is a constant part of STA settings, no point
to pass it as an optional TLV.
Remove QTN_TLV_ID_CRYPTO type as it's not used anymore.

Signed-off-by: Igor Mitsyanko <igor.mitsyanko.os@quantenna.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agoqtnfmac: do not cache BSS state in per-VIF structure
Igor Mitsyanko [Thu, 5 Oct 2017 01:38:11 +0000 (18:38 -0700)]
qtnfmac: do not cache BSS state in per-VIF structure

This cached state is used only once immediately after it is
initilized, except for BSSID value that is used for events processing.
There is no reason in keeping unused data in driver's state.

Signed-off-by: Igor Mitsyanko <igor.mitsyanko.os@quantenna.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agoqtnfmac: get rid of QTNF_STATE_AP_START flag
Igor Mitsyanko [Thu, 5 Oct 2017 01:38:10 +0000 (18:38 -0700)]
qtnfmac: get rid of QTNF_STATE_AP_START flag

QTNF_STATE_AP_START usage is redundant and imposes additional state
synchronization maintenance. We may as well leave state checking
to network card and upper layers (cfg80211, nl80211 and userspace).

Signed-off-by: Igor Mitsyanko <igor.mitsyanko.os@quantenna.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agoqtnfmac: get rid of QTNF_STATE_AP_CONFIG
Igor Mitsyanko [Thu, 5 Oct 2017 01:38:09 +0000 (18:38 -0700)]
qtnfmac: get rid of QTNF_STATE_AP_CONFIG

QTNF_STATE_AP_CONFIG is redundant and its usage can be safely removed.

Signed-off-by: Igor Mitsyanko <igor.mitsyanko.os@quantenna.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agoqtnfmac: pass channel definition to WiFi card on START_AP command
Igor Mitsyanko [Thu, 5 Oct 2017 01:38:08 +0000 (18:38 -0700)]
qtnfmac: pass channel definition to WiFi card on START_AP command

Introduce "channel definition" TLV containing full channel
description (center frequence for both segments + BW) and pass it to
wireless card in a payload to START_AP command.

Signed-off-by: Igor Mitsyanko <igor.mitsyanko.os@quantenna.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agoqtnfmac: pass all AP settings to wireless card for processing
Igor Mitsyanko [Thu, 5 Oct 2017 01:38:07 +0000 (18:38 -0700)]
qtnfmac: pass all AP settings to wireless card for processing

Modify QLINK START_AP command payload to pass all AP settings
contained within struct cfg80211_ap_settings.
Make most of settings a constant part of "config AP" command
instead of passing it as an optional TLVs.

Signed-off-by: Igor Mitsyanko <igor.mitsyanko.os@quantenna.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agoqtnfmac: do not cache AP settings in driver structures
Igor Mitsyanko [Thu, 5 Oct 2017 01:38:06 +0000 (18:38 -0700)]
qtnfmac: do not cache AP settings in driver structures

Cached AP setings are passed to WiFi card right after they are
initialized and are never used for anything else. There is no
point in keeping them in driver state.

Signed-off-by: Igor Mitsyanko <igor.mitsyanko.os@quantenna.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agortlwifi: Remove unused cur_rfstate variables
Christos Gkekas [Wed, 11 Oct 2017 21:15:15 +0000 (22:15 +0100)]
rtlwifi: Remove unused cur_rfstate variables

Clean up unused cur_rfstate variables in rtl8188ee, rtl8723ae, rtl8723be
and rtl8821ae.

Signed-off-by: Christos Gkekas <chris.gekas@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agortlwifi: Add module parameter ASPM
Ping-Ke Shih [Fri, 29 Sep 2017 19:48:00 +0000 (14:48 -0500)]
rtlwifi: Add module parameter ASPM

On some platforms, enable ASPM will cause AER error to be logged, thus
we use a parameter to selectively turn on ASPM.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Yan-Hsuan Chuang <yhchuang@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>
6 years agortlwifi: Add bw_update parameter for RA mask update.
Ping-Ke Shih [Fri, 29 Sep 2017 19:47:59 +0000 (14:47 -0500)]
rtlwifi: Add bw_update parameter for RA mask update.

- Add new parameter "is_bw_update" to control if current bandwidth setting
  is updated to FW RA.
- After this commit, we keep the same setting as before.
- Later, bandwidth update in watchdog is changed to false for 8822BE.

Signed-off-by: Tsang-Shian Lin <thlin@realtek.com>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Yan-Hsuan Chuang <yhchuang@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>
6 years agortlwifi: Remove BAND_NUM and related fields
Ping-Ke Shih [Fri, 29 Sep 2017 19:47:58 +0000 (14:47 -0500)]
rtlwifi: Remove BAND_NUM and related fields

These fields are unused, and we will define them in phydm later.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Yan-Hsuan Chuang <yhchuang@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>
6 years agortlwifi: Add RSSI and RF type to wifi.h for phydm
Ping-Ke Shih [Fri, 29 Sep 2017 19:47:57 +0000 (14:47 -0500)]
rtlwifi: Add RSSI and RF type to wifi.h for phydm

These definition will be used by phydm later.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Yan-Hsuan Chuang <yhchuang@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>
6 years agortlwifi: Add TX/RX throughput statistics in period
Ping-Ke Shih [Fri, 29 Sep 2017 19:47:56 +0000 (14:47 -0500)]
rtlwifi: Add TX/RX throughput statistics in period

The statistic variables use u64 to get higher precision.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Yan-Hsuan Chuang <yhchuang@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>
6 years agortlwifi: Add rtl_get_hal_edca_param() to generate register's format of EDCA.
Ping-Ke Shih [Fri, 29 Sep 2017 19:47:55 +0000 (14:47 -0500)]
rtlwifi: Add rtl_get_hal_edca_param() to generate register's format of EDCA.

Convert from the value of ieee80211_tx_queue_params to Realtek's
register value.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Yan-Hsuan Chuang <yhchuang@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>
6 years agortlwifi: Implement rtl_get_tx_hw_rate to yield correct hw_rate
Ping-Ke Shih [Fri, 29 Sep 2017 19:47:54 +0000 (14:47 -0500)]
rtlwifi: Implement rtl_get_tx_hw_rate to yield correct hw_rate

Originally, we get legacy rate only, so we extend to get HT and VHT rate.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Yan-Hsuan Chuang <yhchuang@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>
6 years agortlwifi: rtl8192ee: Make driver support 64bits DMA.
Ping-Ke Shih [Fri, 29 Sep 2017 19:47:53 +0000 (14:47 -0500)]
rtlwifi: rtl8192ee: Make driver support 64bits DMA.

1. Both 32-bit and 64-bit use the same TX/RX buffer desc layout
2. Extend set_desc() and get_desc() to set and get 64-bit address
3. Remove directive DMA_IS_64BIT
4. Add module parameter to turn on 64-bit dma

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Yan-Hsuan Chuang <yhchuang@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>
6 years agortlwifi: Remove redundant semicolon in wifi.h.
Ping-Ke Shih [Fri, 29 Sep 2017 19:47:52 +0000 (14:47 -0500)]
rtlwifi: Remove redundant semicolon in wifi.h.

The semicolon can cause compiler error, if it exists in if...else
statement.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Yan-Hsuan Chuang <yhchuang@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>
6 years agortlwifi: Fix MAX MPDU of VHT capability
Ping-Ke Shih [Fri, 29 Sep 2017 19:47:51 +0000 (14:47 -0500)]
rtlwifi: Fix MAX MPDU of VHT capability

We must choose only one of VHT_CAP among
IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_3895,
IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_7991 and
IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_11454.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Yan-Hsuan Chuang <yhchuang@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>
6 years agomwifiex: Use put_unaligned_le32
Himanshu Jha [Fri, 6 Oct 2017 15:04:39 +0000 (20:34 +0530)]
mwifiex: Use put_unaligned_le32

Use put_unaligned_le32 rather than using byte ordering function and
memcpy which makes code clear.
Also, add the header file where it is declared.

Done using Coccinelle and semantic patch used is :

@ rule1 @
identifier tmp; expression ptr,x; type T;
@@

- tmp = cpu_to_le32(x);

  <+... when != tmp
- memcpy(ptr, (T)&tmp, ...);
+ put_unaligned_le32(x,ptr);
  ...+>

@ depends on rule1 @
type j; identifier tmp;
@@

- j tmp;
  ...when != tmp

Signed-off-by: Himanshu Jha <himanshujha199640@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agomwifiex: double the size of chan_stats array in adapter
Rohit Fule [Wed, 4 Oct 2017 12:06:06 +0000 (17:36 +0530)]
mwifiex: double the size of chan_stats array in adapter

When a user requests scan, driver sends multiple scan requests
to firmware, which might be active or passive. Firmware will
send channel statistics for each channel in the request. This will
be stored in chan_stats array.

Few channels might report hidden SSIDs in passive scan results.
So, once the original scan request is finished, driver issues an
active scan request for all channels which reported hidden SSIDs.
This will cause duplicates in the chan_stats array. At worst,
every channel will have a hidden SSID, in which case the driver
can issue active scan requests for each channel. So the complete
scan statistics size will be twice of existing limit.

At present maximum number of channels returned in scan statistics
is 31(BG) + 14(A) = 45. Clearly there will be an overflow of the
chan_stats array in the above mentioned scenario. To fix this
double the size of chan_stats array.

Signed-off-by: Rohit Fule <rohitf@marvell.com>
Signed-off-by: Mangesh Malusare <mmangesh@marvell.com>
Signed-off-by: Ganapathi Bhat <gbhat@marvell.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agomwifiex: minor cleanups w/ sta_list_spinlock in cfg80211.c
Douglas Anderson [Tue, 3 Oct 2017 15:19:44 +0000 (20:49 +0530)]
mwifiex: minor cleanups w/ sta_list_spinlock in cfg80211.c

The sta_list_spinlock looks to be used to control locking of the
list. Specifically when someone has the lock they may be allowed
to modify or delete elements of the list.

That implies that we shouldn't access the fields of the elements
returned by mwifiex_get_sta_entry() after we've released the
spinlock. Let's make some small changes so this is true.

It's unlikely that this matters since it looks to be just error
handling, but it's nice to be clean.

Signed-off-by: Douglas Anderson <dianders@chromium.org>
Signed-off-by: Ganapathi Bhat <gbhat@marvell.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agomwifiex: kill useless list_empty checks
Douglas Anderson [Tue, 3 Oct 2017 15:19:43 +0000 (20:49 +0530)]
mwifiex: kill useless list_empty checks

There's absolutely no reason to check to see if a list is empty
before iterating through it.  It's just like writing code like
this:

if (count != 0) {
  for (i = 0; i < count; i++) {
     ...
  }
}

The loop will already be avoided if "count == 0" so there was no
reason to check.

Signed-off-by: Douglas Anderson <dianders@chromium.org>
Signed-off-by: Ganapathi Bhat <gbhat@marvell.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agobcma: keep *config menu together
Randy Dunlap [Wed, 27 Sep 2017 20:01:49 +0000 (13:01 -0700)]
bcma: keep *config menu together

Use "if BCMA"/"endif" around all Kconfig symbols so that they are
kept together in *config menus instead of showing up in unexpected
places. Also remove "depends on BCMA" since this is handled by the
"if BCMA" addition.

Tested with ARCH={x86_64,MIPS} using make {n,menu,g,x}config.

Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Cc: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agoMerge tag 'iwlwifi-next-for-kalle-2017-10-06-2' of git://git.kernel.org/pub/scm/linux...
Kalle Valo [Wed, 11 Oct 2017 08:36:47 +0000 (11:36 +0300)]
Merge tag 'iwlwifi-next-for-kalle-2017-10-06-2' of git://git./linux/kernel/git/iwlwifi/iwlwifi-next

First batch of iwlwifi patches for 4.15 (v2)

* Cleanups: - remove an unused value that we read from the NVM;
            - remove link quality measurement code that was never used;
* One FW command API update;
* A fix and an addition for PCI devices for the A000 family;
* Tiny refactor of ref/unref code used by runtime-PM;
* Some debugging improvements;
* Implementation of a more flexible way to define command queue sizes;
* ACPI code refactoring;
* Some coding-style fixes;
* Avoid redundant command to the firmware;
* Add a struct with the format of one FW command;
* Change an error log to a warning when the FW API is not aligned with
  the driver (important during development);
* Change a WARN_ON to WARN_ONCE to make it more descriptive and less
  noisy (i.e. no repeated warnings on a firmware triggered error);
* Dump PCI registers when an error occurs, to make it easier to debug;

6 years agomwifiex: Random MAC address during scanning
Karthik Ananthapadmanabha [Fri, 29 Sep 2017 10:53:10 +0000 (16:23 +0530)]
mwifiex: Random MAC address during scanning

Driver will advertise RANDOM_MAC support only if the device
supports this feature.

Signed-off-by: Karthik Ananthapadmanabha <karthida@marvell.com>
Signed-off-by: Ganapathi Bhat <gbhat@marvell.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agortlwifi: silence underflow warning
Dan Carpenter [Fri, 29 Sep 2017 07:52:34 +0000 (10:52 +0300)]
rtlwifi: silence underflow warning

My static checker complains that we have an upper bound but no lower
bound.  I suspect neither are really required but it doesn't hurt to add
a check for negatives.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agop54: don't unregister leds when they are not initialized
Andrey Konovalov [Tue, 26 Sep 2017 15:11:33 +0000 (17:11 +0200)]
p54: don't unregister leds when they are not initialized

ieee80211_register_hw() in p54_register_common() may fail and leds won't
get initialized. Currently p54_unregister_common() doesn't check that and
always calls p54_unregister_leds(). The fix is to check priv->registered
flag before calling p54_unregister_leds().

Found by syzkaller.

INFO: trying to register non-static key.
the code is fine but needs lockdep annotation.
turning off the locking correctness validator.
CPU: 1 PID: 1404 Comm: kworker/1:1 Not tainted
4.14.0-rc1-42251-gebb2c2437d80-dirty #205
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 01/01/2011
Workqueue: usb_hub_wq hub_event
Call Trace:
 __dump_stack lib/dump_stack.c:16
 dump_stack+0x292/0x395 lib/dump_stack.c:52
 register_lock_class+0x6c4/0x1a00 kernel/locking/lockdep.c:769
 __lock_acquire+0x27e/0x4550 kernel/locking/lockdep.c:3385
 lock_acquire+0x259/0x620 kernel/locking/lockdep.c:4002
 flush_work+0xf0/0x8c0 kernel/workqueue.c:2886
 __cancel_work_timer+0x51d/0x870 kernel/workqueue.c:2961
 cancel_delayed_work_sync+0x1f/0x30 kernel/workqueue.c:3081
 p54_unregister_leds+0x6c/0xc0 drivers/net/wireless/intersil/p54/led.c:160
 p54_unregister_common+0x3d/0xb0 drivers/net/wireless/intersil/p54/main.c:856
 p54u_disconnect+0x86/0x120 drivers/net/wireless/intersil/p54/p54usb.c:1073
 usb_unbind_interface+0x21c/0xa90 drivers/usb/core/driver.c:423
 __device_release_driver drivers/base/dd.c:861
 device_release_driver_internal+0x4f4/0x5c0 drivers/base/dd.c:893
 device_release_driver+0x1e/0x30 drivers/base/dd.c:918
 bus_remove_device+0x2f4/0x4b0 drivers/base/bus.c:565
 device_del+0x5c4/0xab0 drivers/base/core.c:1985
 usb_disable_device+0x1e9/0x680 drivers/usb/core/message.c:1170
 usb_disconnect+0x260/0x7a0 drivers/usb/core/hub.c:2124
 hub_port_connect drivers/usb/core/hub.c:4754
 hub_port_connect_change drivers/usb/core/hub.c:5009
 port_event drivers/usb/core/hub.c:5115
 hub_event+0x1318/0x3740 drivers/usb/core/hub.c:5195
 process_one_work+0xc7f/0x1db0 kernel/workqueue.c:2119
 process_scheduled_works kernel/workqueue.c:2179
 worker_thread+0xb2b/0x1850 kernel/workqueue.c:2255
 kthread+0x3a1/0x470 kernel/kthread.c:231
 ret_from_fork+0x2a/0x40 arch/x86/entry/entry_64.S:431

Cc: stable@vger.kernel.org
Signed-off-by: Andrey Konovalov <andreyknvl@google.com>
Acked-by: Christian Lamparter <chunkeey@googlemail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agoMerge tag 'iwlwifi-for-kalle-2017-10-06' of git://git.kernel.org/pub/scm/linux/kernel...
Kalle Valo [Mon, 9 Oct 2017 14:31:39 +0000 (17:31 +0300)]
Merge tag 'iwlwifi-for-kalle-2017-10-06' of git://git./linux/kernel/git/iwlwifi/iwlwifi-fixes

Second set of iwlwifi fixes for 4.14

* Fix support for 3168 device series;
* Fix a potential crash when using FW debugging recording;
* Improve channel flags parsing to avoid warnings on too long traces;
* Return -ENODATA when the temperature is not available, since the
  -EIO we were returning was causing fatal errors in userspace;
* Avoid printing too many messages in dmesg when using monitor mode,
  since this can become very noisy and completely flood the logs;

6 years agoiwlwifi: remove dflt_pwr_limit from the transport
Luca Coelho [Thu, 28 Sep 2017 12:29:27 +0000 (15:29 +0300)]
iwlwifi: remove dflt_pwr_limit from the transport

The default power limit read from the SPLC method in ACPI doesn't
have anything to do with the transport and is only used in the opmode,
so we can remove it from the trans.  Additionally, this value is only
user when the opmode is starting, so we don't need to store it
anywhere.

Remove the dflt_pwr_limit element from the trans and move call to
iwl_acpi_get_pwr_limit() call to mvm.

Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
6 years agoiwlwifi: mvm: warn on invalid statistics size
Johannes Berg [Tue, 26 Sep 2017 14:37:12 +0000 (16:37 +0200)]
iwlwifi: mvm: warn on invalid statistics size

Getting the wrong statistics size is a problem, having a warning
will help us catch it quicker during firmware/driver development.
In released firmware/driver versions, we obviously make sure this
won't happen.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
6 years agoiwlwifi: acpi: move code that reads SPLC to acpi
Luca Coelho [Thu, 28 Sep 2017 12:18:33 +0000 (15:18 +0300)]
iwlwifi: acpi: move code that reads SPLC to acpi

Move most of the set_dflt_pwr_limit() function to acpi.c and make it
return the pwr_limit value instead of setting directly.  Also rename
it to iwl_acpi_get_pwr_limit().

Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
6 years agoiwlwifi: fix indentation in a000 family configuration
Johannes Berg [Thu, 28 Sep 2017 10:59:00 +0000 (12:59 +0200)]
iwlwifi: fix indentation in a000 family configuration

Fix the double indentation in the configuration structs
for a000 family devices.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
6 years agoiwlwifi: acpi: move function to get mcc into acpi code
Luca Coelho [Tue, 26 Sep 2017 13:31:10 +0000 (16:31 +0300)]
iwlwifi: acpi: move function to get mcc into acpi code

The iwl_get_bios_mcc() function was in the iwl-nvm-parse.c file, but
it has nothing to do with the NVM.  Move it to fw/acpi.c and rename it
to iwl_acpi_get_mcc().

Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
6 years agoiwlwifi: acpi: remove a couple of unnecessary ifdefs
Luca Coelho [Tue, 26 Sep 2017 13:13:23 +0000 (16:13 +0300)]
iwlwifi: acpi: remove a couple of unnecessary ifdefs

Some of the #ifdef CONFIG_ACPI are not needed anymore, so they can be
removed.

Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
6 years agoiwlwifi: acpi: make iwl_get_bios_mcc() use the common acpi functions
Luca Coelho [Tue, 26 Sep 2017 12:33:56 +0000 (15:33 +0300)]
iwlwifi: acpi: make iwl_get_bios_mcc() use the common acpi functions

The way iwl_get_bios_mcc() gets the WiFi package and checks for its
integrity is almost identical to the new iwl_acpi_get_wifi_pkg()
function.  Instead of having duplicate code, convert it to use the
common code.

Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
6 years agoiwlwifi: acpi: use iwl_acpi_get_wifi_pkg when reading reading SPLC
Luca Coelho [Thu, 21 Sep 2017 11:45:27 +0000 (14:45 +0300)]
iwlwifi: acpi: use iwl_acpi_get_wifi_pkg when reading reading SPLC

Instead of finding the wifi package with its own code, we can reuse
the new iwl_acpi_get_wifi_pkg() function when reading the default
power limit from SPLC.

Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
6 years agoiwlwifi: acpi: generalize iwl_mvm_sar_find_wifi_pkg()
Luca Coelho [Thu, 21 Sep 2017 11:30:53 +0000 (14:30 +0300)]
iwlwifi: acpi: generalize iwl_mvm_sar_find_wifi_pkg()

Move this function to acpi.c, renaming it to iwl_acpi_get_wifi_pkg(),
because it can also be used with other methods (i.e. SPLC and WRDD).

Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
6 years agoiwlwifi: acpi: move ACPI-related definitions to acpi.h
Luca Coelho [Thu, 21 Sep 2017 10:22:59 +0000 (13:22 +0300)]
iwlwifi: acpi: move ACPI-related definitions to acpi.h

The ACPI table size definitions were spread around the different files
that used them.  Move them all to a common place.

Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
6 years agoiwlwifi: acpi: move ACPI method definitions to acpi.h
Luca Coelho [Thu, 21 Sep 2017 08:02:45 +0000 (11:02 +0300)]
iwlwifi: acpi: move ACPI method definitions to acpi.h

Instead of defining each method where they are used and re-defining
WIFI_DOMAIN in each one of them, move all the definitions to a central
place and define the domain only a single time.

Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
6 years agoiwlwifi: acpi: add common code to read from ACPI
Luca Coelho [Tue, 19 Sep 2017 09:35:18 +0000 (12:35 +0300)]
iwlwifi: acpi: add common code to read from ACPI

There are many places where the same process of invoking a method from
ACPI is used, causing a lot of duplicate code.  To improve this,
introduce a new function to get an ACPI object by invoking an ACPI
method that can be reused.

Additionally, since this function needs to be called when we only have
the trans, the opmode or the device, introduce a new debug macro that
gets the device as a parameter so it can be used in the new function.

Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
6 years agoiwlwifi: mvm: change warning to warn_once()
Sara Sharon [Thu, 28 Sep 2017 08:11:51 +0000 (11:11 +0300)]
iwlwifi: mvm: change warning to warn_once()

In case there is a FW bug where the BAID value in the
metadata is not properly initialized we hit the warning for
every RX packet.
Change it to warn once and add elaborate message.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
6 years agoiwlwifi: pcie: dump registers when HW becomes inaccessible
Rajat Jain [Thu, 17 Aug 2017 19:05:12 +0000 (12:05 -0700)]
iwlwifi: pcie: dump registers when HW becomes inaccessible

We conclude the HW became inaccessible when we timeout waiting for
a bit to be set in a memory mapped register (CSR_GP_CNTRL). This
conclusion may not be true because the bit may not get set due to:
- a firmware issue
- a driver issue
- a PCI bus issue
- a platform issue
There are a lot of such reports with really no good debug information
beyond this message to help us.

Add some debug information and attempt to dump the different register
spaces at such a failure:

* Dump some configuration space of device - this will tell us if
something very basic is broken in the PCIe bus (so that configuration
accesses are failing). If this works, the PCIe bus seems OK. If this
does not work, it is definitely an PCIe issue.

* Dump some memory mapped registers - if we're reading some sane'ish
values, this will tell us that the PCIe bus is OK, but may be a firmware
/ driver issue. If this does not work, it may be a PCI configuration
issue or a driver/firmware issue.

* Dump parent and device's AER registers, will give us some straws to
chew on.

This is the sample output:
[   13.082651] ------------[ cut here ]------------
[   13.086791] iwlwifi 0000:01:00.0: iwlwifi transaction failed, dumping registers
[   13.086793] iwlwifi 0000:01:00.0: iwlwifi device config registers:
[   13.086893] iwlwifi 0000:01:00.0: 00000000095a8086 00100406 02800059 00000000 00000004 00000000 00000000 00000000
[   13.086895] iwlwifi 0000:01:00.0: 0000002000000000 00000000 00000000 50108086 00000000 000000c8 00000000 00000100
[   13.086901] iwlwifi 0000:01:00.0: iwlwifi device memory mapped registers:
[   13.086989] iwlwifi 0000:01:00.0: 00000000ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff
[   13.086991] iwlwifi 0000:01:00.0: 00000020ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff
[   13.086999] iwlwifi 0000:01:00.0: iwlwifi device AER capability structure:
[   13.087033] iwlwifi 0000:01:00.0: 0000000014010001 00100000 00000000 00462031 00002000 00002000 00000014 40000001
[   13.087034] iwlwifi 0000:01:00.0: 000000200000000f d140000c 00000000
[   13.087036] iwlwifi 0000:01:00.0: iwlwifi parent port (0000:00:1c.0) config registers:
[   13.087074] iwlwifi 0000:00:1c.0: 000000009d108086 00100506 060400f1 00810010 00000000 00000000 00010100 200000f0
[   13.087075] iwlwifi 0000:00:1c.0: 00000020d140d140 0001fff1 00000000 00000000 00000000 00000040 00000000 0006010b
[   13.087087] ------------[ cut here ]------------
[   13.087095] WARNING: CPU: 0 PID: 1759 at drivers/net/wireless/iwl7000/iwlwifi/pcie/trans.c:2082 iwl_trans_pcie_reclaim+0x1ee4/0x2b9a [iwlwifi]()
[   13.087096] Timeout waiting for hardware access (CSR_GP_CNTRL 0xffffffff)

Signed-off-by: Rajat Jain <rajatja@google.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
6 years agoiwlwifi: fix minor code style issues
Christoph Böhmwalder [Sat, 23 Sep 2017 10:31:12 +0000 (12:31 +0200)]
iwlwifi: fix minor code style issues

Fixes three trivial issues as reported by checkpatch.pl, namely two
switch/case indentation issues and one alignment issue in a multiline
comment.

Signed-off-by: Christoph Böhmwalder <christoph@boehmwalder.at>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
6 years agoiwlwifi: mvm: add marker cmd response struct.
Mordechay Goodstein [Tue, 19 Sep 2017 15:52:13 +0000 (15:52 +0000)]
iwlwifi: mvm: add marker cmd response struct.

This helps for documentation and clarifies the code by defining the
exact response struct for the marker command.

Signed-off-by: Mordechay Goodstein <mordechay.goodstein@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
6 years agoiwlwifi: fw: api: remove excess enum value documentation
Johannes Berg [Tue, 19 Sep 2017 10:59:03 +0000 (12:59 +0200)]
iwlwifi: fw: api: remove excess enum value documentation

These enum values don't exist, so remove their documentation as well.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
6 years agoiwlwifi: mvm: don't send identical PHY_CTXT_CMD
Emmanuel Grumbach [Thu, 14 Sep 2017 12:45:44 +0000 (15:45 +0300)]
iwlwifi: mvm: don't send identical PHY_CTXT_CMD

When we have an AP which supports HT and a single HT
station is connected, we change the min_width from
NL80211_CHAN_WIDTH_20_NOHT to NL80211_CHAN_WIDTH_20. This
of course has no implication on the channel width but still
sends a command to the firmware.
Remember the last width that was sent and refrain from
sending unnecessary commands to the firmware.

Sending a PHY_CTXT_CMD to the firmware has a cost since it
recalculates the presence on the medium and because of that
it closes the transmit queues for a short while.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
6 years agoiwlwifi: remove redundant reading from NVM file
Chaya Rachel Ivgi [Wed, 13 Sep 2017 12:12:16 +0000 (15:12 +0300)]
iwlwifi: remove redundant reading from NVM file

The driver reads xtal_calib from NVM file, but actually never uses it.
This is only used in dvm driver.

Signed-off-by: Chaya Rachel Ivgi <chaya.rachel.ivgi@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
6 years agoiwlwifi: pcie: dynamic Tx command queue size
Shahar S Matityahu [Sun, 30 Jul 2017 14:33:48 +0000 (17:33 +0300)]
iwlwifi: pcie: dynamic Tx command queue size

Devices in the A000 family can use a different size for the command queue.
To allow this, make the command queue size configurable and set the size
for A000 devices to 32.

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
6 years agoiwlwifi: Add few debug prints to the WRT dump flow
Ilan Peer [Mon, 4 Sep 2017 11:39:22 +0000 (14:39 +0300)]
iwlwifi: Add few debug prints to the WRT dump flow

This would enable to better catch timing issues with
cases that WRT dump takes too much time.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
6 years agoiwlwifi: mvm: support firmware debug trigger on frame reorder timeout
Emmanuel Grumbach [Thu, 31 Aug 2017 08:52:30 +0000 (11:52 +0300)]
iwlwifi: mvm: support firmware debug trigger on frame reorder timeout

The trigger that collects data when a frame is released
because of the timer of the reordering buffer was not
implemented for 9000 devices.
Fix this.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
6 years agoiwlwifi: mvm: remove support for Link Quality Measurements
Emmanuel Grumbach [Thu, 31 Aug 2017 09:57:33 +0000 (12:57 +0300)]
iwlwifi: mvm: remove support for Link Quality Measurements

This was never used by any product. Remove it.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
6 years agoiwlwifi: mvm: Add new quota command API
David Spinadel [Wed, 30 Aug 2017 13:23:14 +0000 (16:23 +0300)]
iwlwifi: mvm: Add new quota command API

New quota command adds a field indicating low latency
direction per quota.

A TLV API bit was added to indicate the new API.

Signed-off-by: David Spinadel <david.spinadel@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
6 years agoiwlwifi: add a new a000 device
Oren Givon [Thu, 31 Aug 2017 10:15:09 +0000 (13:15 +0300)]
iwlwifi: add a new a000 device

Add a new a000 device with PCI ID (0x2720, 0x0030).

Signed-off-by: Oren Givon <oren.givon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
6 years agoiwlwifi: fix wrong struct for a000 device
Oren Givon [Mon, 28 Aug 2017 07:33:38 +0000 (10:33 +0300)]
iwlwifi: fix wrong struct for a000 device

The PCI ID (0x2720, 0x0070) was set with the config struct
iwla000_2ax_cfg_hr instead of iwla000_2ac_cfg_hr_cdb.

Fixes: 175b87c69253 ("iwlwifi: add the new a000_2ax series")
Signed-off-by: Oren Givon <oren.givon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
6 years agoiwlwifi: trans: move ref/unref code to the common part of the transport
Luca Coelho [Wed, 30 Mar 2016 19:09:34 +0000 (22:09 +0300)]
iwlwifi: trans: move ref/unref code to the common part of the transport

De-inline iwl_trans_ref/unref and move it to common transport code
in preparation for more common code to come to these functions.

Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
6 years agoiwlwifi: mvm: add dbgfs entry for fw info
Liad Kaufman [Wed, 16 Aug 2017 11:15:08 +0000 (14:15 +0300)]
iwlwifi: mvm: add dbgfs entry for fw info

Add a dbgfs entry for an easy way during runtime to
check what FW file was loaded, and get some general
FW-related data.

Signed-off-by: Liad Kaufman <liad.kaufman@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
6 years agoiwlwifi: nvm: set the correct offsets to 3168 series
Chaya Rachel Ivgi [Mon, 4 Sep 2017 11:40:06 +0000 (14:40 +0300)]
iwlwifi: nvm: set the correct offsets to 3168 series

The driver currently handles two NVM formats,
one for 7000 family and below, and one for 8000 family and above.
The 3168 series uses something in between,
so currently the driver uses incorrect offsets for it.
Fix the incorrect offsets.

Fixes: c4836b056d83 ("iwlwifi: Add PCI IDs for the new 3168 series")
Signed-off-by: Chaya Rachel Ivgi <chaya.rachel.ivgi@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
6 years agoiwlwifi: nvm-parse: unify channel flags printing
Johannes Berg [Thu, 21 Sep 2017 09:03:50 +0000 (11:03 +0200)]
iwlwifi: nvm-parse: unify channel flags printing

The current channel flags printing is very strange and messy,
in LAR we sometimes print the channel number and sometimes the
frequency, in both we print a calculated value (whether ad-hoc
is supported or not) etc.

Unify all this to
 * print the channel number, not the frequency
 * remove the band print (2.4/5.2 GHz, it's obvious)
 * remove the calculated Ad-Hoc print

Doing all of this also gets the length of the string to a max
of 101 characters, which is below the max of 110 for tracing,
and thus avoids the warning that came up on certain channels
with certain flag combinations.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
6 years agoiwlwifi: mvm: return -ENODATA when reading the temperature with the FW down
Luca Coelho [Mon, 18 Sep 2017 11:39:26 +0000 (14:39 +0300)]
iwlwifi: mvm: return -ENODATA when reading the temperature with the FW down

It seems that libsensors treats -EIO as a special non-recoverable
failure when it tries to read the temperature while the firmware is
not running.  To solve that, change the error code to a milder
-ENODATA.

This fixes https://bugzilla.kernel.org/show_bug.cgi?id=196941

Fixes: c221daf219b1 ("iwlwifi: mvm: add registration to thermal zone")
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
6 years agoiwlwifi: stop dbgc recording before stopping DMA
Golan Ben Ami [Tue, 12 Sep 2017 09:32:25 +0000 (12:32 +0300)]
iwlwifi: stop dbgc recording before stopping DMA

Today we stop the device and the DMA without stopping the dbgc
recording before. This causes host crashes when the DMA
rate is high.

Stop dbgc recording when clearing the fw debug configuration
to fix this.

Signed-off-by: Golan Ben Ami <golan.ben.ami@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
6 years agoiwlwifi: mvm: do not print security error in monitor mode
Shaul Triebitz [Wed, 13 Sep 2017 13:46:14 +0000 (16:46 +0300)]
iwlwifi: mvm: do not print security error in monitor mode

In monitor mode we are not expected to decrypt encrypted
packets (not having the keys).
Hence we are expected to get an unknown rx security status.
Keeping the print in monitor mode causes a print for each
captured packet flooding the dmesg.

Signed-off-by: Shaul Triebitz <shaul.triebitz@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
6 years agobrcmfmac: Delete redundant length check
Kevin Cernekee [Sun, 17 Sep 2017 04:08:23 +0000 (21:08 -0700)]
brcmfmac: Delete redundant length check

brcmf_fweh_process_event() sets event->datalen to the
endian-swapped value of event_packet->msg.datalen, which is the
same as emsg.datalen.  This length is already validated in
brcmf_fweh_process_event(), so there is no need to check it
again upon dequeuing the event.

Suggested-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: Kevin Cernekee <cernekee@chromium.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agobrcmfmac: Avoid possible out-of-bounds read
Kevin Cernekee [Sun, 17 Sep 2017 04:08:22 +0000 (21:08 -0700)]
brcmfmac: Avoid possible out-of-bounds read

In brcmf_p2p_notify_rx_mgmt_p2p_probereq(), chanspec is assigned before
the length of rxframe is validated.  This could lead to uninitialized
data being accessed (but not printed).  Since we already have a
perfectly good endian-swapped copy of rxframe->chanspec in ch.chspec,
and ch.chspec is not modified by decchspec(), avoid the extra
assignment and use ch.chspec in the debug print.

Suggested-by: Mattias Nissler <mnissler@chromium.org>
Signed-off-by: Kevin Cernekee <cernekee@chromium.org>
Reviewed-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agobrcmsmac: make some local variables 'static const' to reduce stack size
Arnd Bergmann [Fri, 22 Sep 2017 21:29:12 +0000 (23:29 +0200)]
brcmsmac: make some local variables 'static const' to reduce stack size

With KASAN and a couple of other patches applied, this driver is one
of the few remaining ones that actually use more than 2048 bytes of
kernel stack:

broadcom/brcm80211/brcmsmac/phy/phy_n.c: In function 'wlc_phy_workarounds_nphy_gainctrl':
broadcom/brcm80211/brcmsmac/phy/phy_n.c:16065:1: warning: the frame size of 3264 bytes is larger than 2048 bytes [-Wframe-larger-than=]
broadcom/brcm80211/brcmsmac/phy/phy_n.c: In function 'wlc_phy_workarounds_nphy':
broadcom/brcm80211/brcmsmac/phy/phy_n.c:17138:1: warning: the frame size of 2864 bytes is larger than 2048 bytes [-Wframe-larger-than=]

Here, I'm reducing the stack size by marking as many local variables as
'static const' as I can without changing the actual code.

This is the first of three patches to improve the stack usage in this
driver. It would be good to have this backported to stabl kernels
to get all drivers in 'allmodconfig' below the 2048 byte limit so
we can turn on the frame warning again globally, but I realize that
the patch is larger than the normal limit for stable backports.

The other two patches do not need to be backported.

Cc: <stable@vger.kernel.org>
Acked-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agobrcmfmac: Add check for short event packets
Kevin Cernekee [Sun, 17 Sep 2017 04:08:24 +0000 (21:08 -0700)]
brcmfmac: Add check for short event packets

The length of the data in the received skb is currently passed into
brcmf_fweh_process_event() as packet_len, but this value is not checked.
event_packet should be followed by DATALEN bytes of additional event
data.  Ensure that the received packet actually contains at least
DATALEN bytes of additional data, to avoid copying uninitialized memory
into event->data.

Cc: <stable@vger.kernel.org> # v3.8
Suggested-by: Mattias Nissler <mnissler@chromium.org>
Signed-off-by: Kevin Cernekee <cernekee@chromium.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agortlwifi: rtl8821ae: Fix connection lost problem
Larry Finger [Wed, 20 Sep 2017 21:15:05 +0000 (16:15 -0500)]
rtlwifi: rtl8821ae: Fix connection lost problem

In commit 40b368af4b75 ("rtlwifi: Fix alignment issues"), the read
of REG_DBI_READ was changed from 16 to 8 bits. For unknown reasonsi
this change results in reduced stability for the wireless connection.
This regression was located using bisection.

Fixes: 40b368af4b75 ("rtlwifi: Fix alignment issues")
Reported-and-tested-by: James Cameron <quozl@laptop.org>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Stable <stable@vger.kernel.org> # 4.11+
Cc: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agob43: make const arrays static, reduces object code size
Colin Ian King [Fri, 22 Sep 2017 15:39:02 +0000 (16:39 +0100)]
b43: make const arrays static, reduces object code size

Don't populate const arrays on the stack, instead make them static.
Makes the object code smaller by over 60 bytes:

Before:
   text    data     bss     dec     hex filename
  14816    1296       0   16112    3ef0 b43/phy_ht.o

After:
   text    data     bss     dec     hex filename
  14551    1496       0   16047    3eaf b43/phy_ht.o

(gcc 6.3.0, x86-64)

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agoiwlegacy: make const array static to shink object code size
Colin Ian King [Thu, 21 Sep 2017 22:56:30 +0000 (23:56 +0100)]
iwlegacy: make const array static to shink object code size

Don't populate const array ac_to_fifo on the stack in an inlined
function, instead make it static.  Makes the object code smaller
by over 800 bytes:

   text    data     bss     dec     hex filename
 159029   33154    1216  193399   2f377 4965-mac.o

   text    data     bss     dec     hex filename
 158122   33250    1216  192588   2f04c 4965-mac.o

(gcc version 7.2.0 x86_64)

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Acked-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agoqtnfmac: do not report channel changes until wiphy is registered
Igor Mitsyanko [Thu, 21 Sep 2017 21:34:37 +0000 (14:34 -0700)]
qtnfmac: do not report channel changes until wiphy is registered

Wireless device may send "channel changed" event before driver
registered this device with wireless core, which will result in
warnings.
Once device is registered, higher layer will query channel info
manually using .get_channel callback.

Signed-off-by: Igor Mitsyanko <igor.mitsyanko.os@quantenna.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agoqtnfmac: remove unused mac::status field
Igor Mitsyanko [Thu, 21 Sep 2017 21:34:36 +0000 (14:34 -0700)]
qtnfmac: remove unused mac::status field

There are no users of this field and it can safely be removed.

Signed-off-by: Igor Mitsyanko <igor.mitsyanko.os@quantenna.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agoqtnfmac: do not cache CSA chandef info
Igor Mitsyanko [Thu, 21 Sep 2017 21:34:35 +0000 (14:34 -0700)]
qtnfmac: do not cache CSA chandef info

It is never used for anything useful, and all logic is handled by
either WiFi card or higher layers.

Signed-off-by: Igor Mitsyanko <igor.mitsyanko.os@quantenna.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agoqtnfmac: pass VIF info to SendChannel command
Igor Mitsyanko [Thu, 21 Sep 2017 21:34:34 +0000 (14:34 -0700)]
qtnfmac: pass VIF info to SendChannel command

Do not assume whether wireless device can or can not handle switching
several interfaces on a single radio to different channels. Device will
handle it itself and will return appropriate error code.

Signed-off-by: Igor Mitsyanko <igor.mitsyanko.os@quantenna.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agoqtnfmac: let wifi card handle channel switch request to the same chan
Igor Mitsyanko [Thu, 21 Sep 2017 21:34:33 +0000 (14:34 -0700)]
qtnfmac: let wifi card handle channel switch request to the same chan

No reason to verify channel switch request in driver, it can simply be
forwarded to wireless device. Device can perform required checks and
return appropriate error code, and driver may not even have information
on current operational channel.

Signed-off-by: Igor Mitsyanko <igor.mitsyanko.os@quantenna.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agoqtnfmac: do not cache channel info from "connect" command
Igor Mitsyanko [Thu, 21 Sep 2017 21:34:32 +0000 (14:34 -0700)]
qtnfmac: do not cache channel info from "connect" command

This makes no sense because real operational channel is choosen based
on AP operation, not on what STA is configured to.

Signed-off-by: Igor Mitsyanko <igor.mitsyanko.os@quantenna.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agoqtnfmac: retrieve current channel info from EP
Igor Mitsyanko [Thu, 21 Sep 2017 21:34:31 +0000 (14:34 -0700)]
qtnfmac: retrieve current channel info from EP

Do not try to cache current operational channel info in driver, this
is a potential source of synchronization issues + driver does not
really need that info.

Introduce GET_CHANNEL command and process it appropriately.

Signed-off-by: Igor Mitsyanko <igor.mitsyanko.os@quantenna.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agoqtnfmac: make "Channel change" event report full channel info
Igor Mitsyanko [Thu, 21 Sep 2017 21:34:30 +0000 (14:34 -0700)]
qtnfmac: make "Channel change" event report full channel info

Specifically, it has to report center frequency, secondary center
frequency (for 80+80) and BW.
Introduce channel definition structure to qlink and modify channel
change event processing function accordingly.

Signed-off-by: Igor Mitsyanko <igor.mitsyanko.os@quantenna.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agoqtnfmac: convert channel width from bitfiled to simple enum
Igor Mitsyanko [Thu, 21 Sep 2017 21:34:29 +0000 (14:34 -0700)]
qtnfmac: convert channel width from bitfiled to simple enum

This will allow to use qlink channel width values to specify BW setting
corresponding to enum nl80211_chan_width.
Current user is converted to apply BIT() macro manually to each individual
qlink_channel_width enumeration value.

Signed-off-by: Igor Mitsyanko <igor.mitsyanko.os@quantenna.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agorsi: sdio suspend and resume support
Karun Eagalapati [Thu, 21 Sep 2017 12:51:28 +0000 (18:21 +0530)]
rsi: sdio suspend and resume support

SDIO suspend and resume handlers are implemented and verified
that device works after suspend/resume cycle.

Signed-off-by: Karun Eagalapati <karun256@gmail.com>
Signed-off-by: Amitkumar Karwar <amit.karwar@redpinesignals.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agorsi: add version information
Pavani Muthyala [Thu, 21 Sep 2017 12:50:34 +0000 (18:20 +0530)]
rsi: add version information

We will dump information about firmware version, firmware file
name and operating mode during initialization.

Signed-off-by: Pavani Muthyala <pavani.muthyala@redpinesignals.com>
Signed-off-by: Amitkumar Karwar <amit.karwar@redpinesignals.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agomwifiex: make const array tos_to_ac static, reduces object code size
Colin Ian King [Tue, 19 Sep 2017 21:05:00 +0000 (22:05 +0100)]
mwifiex: make const array tos_to_ac static, reduces object code size

Don't populate the read-only const array tos_to_ac on the stack,
instead make it static. Makes the object code smaller by 250 bytes:

Before:
   text    data     bss     dec     hex filename
  26104    2720     128   28952    7118 wmm.o

After:
   text    data     bss     dec     hex filename
  25758    2816     128   28702    701e wmm.o

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agortl8xxxu: Don't printk raw binary if serial number is not burned in.
Adam Borowski [Fri, 8 Sep 2017 10:30:00 +0000 (12:30 +0200)]
rtl8xxxu: Don't printk raw binary if serial number is not burned in.

I assume that a blank efuse comes with all ones, thus I did not bother
recognizing other possible junk values.  This matches 100% of dongles
I've seen (a single Gembird 8192eu).

Signed-off-by: Adam Borowski <kilobyte@angband.pl>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agobrcmsmac: make const array ucode_ofdm_rates static, reduces object code size
Colin Ian King [Fri, 22 Sep 2017 14:03:16 +0000 (15:03 +0100)]
brcmsmac: make const array ucode_ofdm_rates static, reduces object code size

Don't populate const array ucode_ofdm_rates on the stack, instead make it
static. Makes the object code smaller by 100 bytes:

Before:
   text    data     bss     dec     hex filename
  39482     564       0   40046    9c6e phy_cmn.o

After
   text    data     bss     dec     hex filename
  39326     620       0   39946    9c0a phy_cmn.o

(gcc 6.3.0, x86-64)

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Acked-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agobrcmfmac: use setup_timer() helper
Allen Pais [Thu, 21 Sep 2017 12:43:06 +0000 (18:13 +0530)]
brcmfmac: use setup_timer() helper

Use setup_timer function instead of initializing timer with the
function and data fields.

Signed-off-by: Allen Pais <allen.lkml@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agoMerge ath-current from ath.git
Kalle Valo [Mon, 25 Sep 2017 07:06:12 +0000 (10:06 +0300)]
Merge ath-current from ath.git

ath.git fixes for 4.14. Major changes:

ath10k

* fix a PCI PM related gcc warning

6 years agoath10k: mark PM functions as __maybe_unused
Arnd Bergmann [Wed, 6 Sep 2017 12:58:53 +0000 (14:58 +0200)]
ath10k: mark PM functions as __maybe_unused

When CONFIG_PM_SLEEP is disabled, we get a compile-time
warning:

drivers/net/wireless/ath/ath10k/pci.c:3417:12: error: 'ath10k_pci_pm_resume' defined but not used [-Werror=unused-function]
 static int ath10k_pci_pm_resume(struct device *dev)
            ^~~~~~~~~~~~~~~~~~~~
drivers/net/wireless/ath/ath10k/pci.c:3401:12: error: 'ath10k_pci_pm_suspend' defined but not used [-Werror=unused-function]
 static int ath10k_pci_pm_suspend(struct device *dev)

Rather than fixing the #ifdef, this just marks both functions
as __maybe_unused, which is a more robust way to do this.

Fixes: 32faa3f0ee50 ("ath10k: add the PCI PM core suspend/resume ops")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
6 years agomwifiex: use get_random_mask_addr() helper
Ganapathi Bhat [Mon, 18 Sep 2017 07:42:17 +0000 (13:12 +0530)]
mwifiex: use get_random_mask_addr() helper

Avoid calculating random MAC address in driver. Instead make
use of 'get_random_mask_addr()' function.

Signed-off-by: Ganapathi Bhat <gbhat@marvell.com>
Reviewed-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agomwifiex: avoid storing random_mac in private
Ganapathi Bhat [Mon, 18 Sep 2017 06:55:02 +0000 (12:25 +0530)]
mwifiex: avoid storing random_mac in private

Application will keep track of whether MAC address randomization
is enabled or not during scan. But at present driver is storing
'random_mac' in mwifiex_private which implies even after scan is
done driver has some reference to the earlier 'scan request'. To
avoid this, make use of 'mac_addr' variable in 'scan_request' to
store 'random_mac'. This structure will be freed by cfg80211 once
scan is done.

Signed-off-by: Ganapathi Bhat <gbhat@marvell.com>
Reviewed-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agomwifiex: make const arrays static to shink object code size
Colin Ian King [Sat, 16 Sep 2017 15:34:24 +0000 (16:34 +0100)]
mwifiex: make const arrays static to shink object code size

Don't populate const arrays on the stack, instead make them static
Makes the object code smaller by nearly 300 bytes:

Before:
   text    data     bss     dec     hex filename
  69260   16149     576   85985   14fe1 cfg80211.o

After:
   text    data     bss     dec     hex filename
  68385   16725     576   85686   14eb6 cfg80211.o

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agomwifiex: remove unnecessary call to memset
Himanshu Jha [Mon, 11 Sep 2017 12:46:04 +0000 (18:16 +0530)]
mwifiex: remove unnecessary call to memset

call to memset to assign 0 value immediately after allocating
memory with kzalloc is unnecesaary as kzalloc allocates the memory
filled with 0 value.

Semantic patch used to resolve this issue:

@@
expression e,e2; constant c;
statement S;
@@

  e = kzalloc(e2, c);
  if(e == NULL) S
- memset(e, 0, e2);

Signed-off-by: Himanshu Jha <himanshujha199640@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agomwifiex: check for mfg_mode in add_virtual_intf
Ganapathi Bhat [Thu, 7 Sep 2017 20:32:43 +0000 (02:02 +0530)]
mwifiex: check for mfg_mode in add_virtual_intf

If driver is loaded with 'mfg_mode' enabled, then the sending
commands are not allowed. So, skip sending commands, to firmware
in mwifiex_add_virtual_intf if 'mfg_mode' is enabled.

Fixes: 7311ea850079 ("mwifiex: fix AP start problem for newly added interface")
Signed-off-by: Ganapathi Bhat <gbhat@marvell.com>
Reviewed-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agomwifiex: notify cfg80211 about scan abort
Ganapathi Bhat [Wed, 30 Aug 2017 19:38:35 +0000 (01:08 +0530)]
mwifiex: notify cfg80211 about scan abort

Driver sends a series of scan commands to firmware to serve a
user scan request. If an intermediate scan command fails, driver
aborts the scan but it is not being informed to cfg80211. This
will cause issues in applications performing periodic scans.
Fix this by informing scan abort.

Signed-off-by: Cathy Luo <cluo@marvell.com>
Signed-off-by: Ganapathi Bhat <gbhat@marvell.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>