Re: [PATCH v2] rtlwifi: Replace hardcode value with macro

2017-06-28 Thread Souptick Joarder
Hi Kalle,

On Wed, Jun 28, 2017 at 9:47 PM, Kalle Valo  wrote:
> Souptick Joarder  writes:
>
>> In _rtl_init_mac80211(), hardcoded value for hw->max_listen_interval
>> and hw->max_rate_tries are replaced by macro.
>>
>> Signed-off-by: Souptick Joarder 
>> ---
>> Changes in v2:
>>- Signed-off was missing in previous one.

As Signed-off was missing in first patch, so I send v2 with change
logs mentioned the same.
Just for clarification, shall I replace the comment mentioned in
change log with "no change"?

>>
>>  drivers/net/wireless/realtek/rtlwifi/base.c | 6 +++---
>>  drivers/net/wireless/realtek/rtlwifi/base.h | 2 ++
>>  2 files changed, 5 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/net/wireless/realtek/rtlwifi/base.c 
>> b/drivers/net/wireless/realtek/rtlwifi/base.c
>> index bdc3791..f45d093 100644
>> --- a/drivers/net/wireless/realtek/rtlwifi/base.c
>> +++ b/drivers/net/wireless/realtek/rtlwifi/base.c
>> @@ -422,9 +422,9 @@ static void _rtl_init_mac80211(struct ieee80211_hw *hw)
>>   hw->extra_tx_headroom = RTL_TX_HEADER_SIZE;
>>
>>   /* TODO: Correct this value for our hw */
>> - /* TODO: define these hard code value */
>> - hw->max_listen_interval = 10;
>> - hw->max_rate_tries = 4;
>> + /* defined these hard code values */
>> + hw->max_listen_interval = MAX_LISTEN_INTERVAL;
>> + hw->max_rate_tries = MAX_RATE_TRIES;
>
> Like Larry said, the comment does not make any sense. Please remove it
> and send v3.
>
> --
> Kalle Valo

Souptick


Re: ti: wl18xx: add checks on wl18xx_top_reg_write() return value

2017-06-28 Thread Gustavo A. R. Silva


Quoting Kalle Valo :


"Gustavo A. R. Silva"  wrote:


Check return value from call to wl18xx_top_reg_write(),
so in case of error jump to goto label out and return.

Also, remove unnecessary value check before goto label out.

Addresses-Coverity-ID: 1226938
Signed-off-by: Gustavo A. R. Silva 


The prefix should be "wl18xx:", I'll fix that.



Thanks, Kalle.
--
Gustavo A. R. Silva







Re: Adding nfc-next to linux-next

2017-06-28 Thread Stephen Rothwell
Hi Samuel,

On Wed, 28 Jun 2017 09:25:31 +0200 Samuel Ortiz  wrote:
>
> Could you please add the nfc-next tree to linux-next?
> 
> It's here:
> 
> https://git.kernel.org/pub/scm/linux/kernel/git/sameo/nfc-next.git/
> 
> and the branch is the master one.

Added from today.

Thanks for adding your subsystem tree as a participant of linux-next.  As
you may know, this is not a judgement of your code.  The purpose of
linux-next is for integration testing and to lower the impact of
conflicts between subsystems in the next merge window. 

You will need to ensure that the patches/commits in your tree/series have
been:
 * submitted under GPL v2 (or later) and include the Contributor's
Signed-off-by,
 * posted to the relevant mailing list,
 * reviewed by you (or another maintainer of your subsystem tree),
 * successfully unit tested, and 
 * destined for the current or next Linux merge window.

Basically, this should be just what you would send to Linus (or ask him
to fetch).  It is allowed to be rebased if you deem it necessary.

-- 
Cheers,
Stephen Rothwell 
s...@canb.auug.org.au


Re: [PATCH 19/31] iwlwifi: pcie: improve debug in iwl_pcie_rx_handle_rb()

2017-06-28 Thread Joe Perches
On Wed, 2017-06-28 at 23:13 +0300, Luca Coelho wrote:
> Print the queue for the existing debug message and add a new
> debug message indicating where the RB ended.

trivia:

> diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/rx.c 
> b/drivers/net/wireless/intel/iwlwifi/pcie/rx.c
[]
> @@ -1137,8 +1141,8 @@ static void iwl_pcie_rx_handle_rb(struct iwl_trans 
> *trans,
>   FH_RSCSR_RXQ_POS);
>  
>   IWL_DEBUG_RX(trans,
> -  "cmd at offset %d: %s (%.2x.%2x, seq 0x%x)\n",
> -  rxcb._offset,
> +  "Q %d: cmd at offset %d: %s (%.2x.%2x, seq 
> 0x%x)\n",
> +  rxq->id, offset,
>iwl_get_cmd_string(trans,
>   iwl_cmd_id(pkt->hdr.cmd,
>  pkt->hdr.group_id,

Perhaps %02x.%02x instead of %.2x.%2x

Most uses are %.2x.%.2x, but %02x.%02x seems clearer
at least to me.



Re: [PATCH] ieee80211: update public action codes

2017-06-28 Thread Peter Oh



On 06/28/2017 01:16 PM, Arend van Spriel wrote:

On 28-06-17 00:07, peter...@bowerswilkins.com wrote:

From: Peter Oh 

Update Public Action field values as updated in IEEE Std 802.11-2016,
so that modules/drivers can refer it.

Hi Peter,

I am pretty sure there are a lot of other definitions in the 802.11 spec
that are not in a linux header file. So are you planning on submitting
driver patches using the added definitions. Stuff is mostly added as needed.
I have extra patches that uses the new values, but doubt if it's fit to 
be upstream.

Regards,
Arend




Re: [PATCH 00/31] iwlwifi: updates intended for v4.13 2017-06-28

2017-06-28 Thread Coelho, Luciano
On Wed, 2017-06-28 at 23:12 +0300, Luca Coelho wrote:
> From: Luca Coelho 
> 
> Hi Kalle,
> 
> Here is one more batch that I'd like to get into v4.13, hopefully it's
> not too late.  I'm also going to send some more tomorrow.  The changes
> are:
> 
> * Some important fixes for 9000 HW;
> * FW API changes for the upcoming -30 ucode release;
> * A few new PCI IDs for 9000 series;
> * Reorganization of common files;
> * Some more fixes and improvements here and there
> 
> Thanks!

Forgot to say that these patches already passed kbuildbot test.

--
Cheers,
Luca.

[PATCH 29/31] iwlwifi: move notification wait into fw/

2017-06-28 Thread Luca Coelho
From: Johannes Berg 

Move the notification wait code into the new fw interaction directory.

Signed-off-by: Johannes Berg 
Signed-off-by: Luca Coelho 
---
 drivers/net/wireless/intel/iwlwifi/Makefile | 2 +-
 drivers/net/wireless/intel/iwlwifi/dvm/dev.h| 2 +-
 .../net/wireless/intel/iwlwifi/{iwl-notif-wait.c => fw/notif-wait.c}| 2 +-
 .../net/wireless/intel/iwlwifi/{iwl-notif-wait.h => fw/notif-wait.h}| 0
 drivers/net/wireless/intel/iwlwifi/mvm/mvm.h| 2 +-
 drivers/net/wireless/intel/iwlwifi/mvm/ops.c| 2 +-
 drivers/net/wireless/intel/iwlwifi/mvm/time-event.c | 2 +-
 7 files changed, 6 insertions(+), 6 deletions(-)
 rename drivers/net/wireless/intel/iwlwifi/{iwl-notif-wait.c => 
fw/notif-wait.c} (99%)
 rename drivers/net/wireless/intel/iwlwifi/{iwl-notif-wait.h => 
fw/notif-wait.h} (100%)

diff --git a/drivers/net/wireless/intel/iwlwifi/Makefile 
b/drivers/net/wireless/intel/iwlwifi/Makefile
index 411cb91c102f..7733fc41ce98 100644
--- a/drivers/net/wireless/intel/iwlwifi/Makefile
+++ b/drivers/net/wireless/intel/iwlwifi/Makefile
@@ -3,7 +3,6 @@ obj-$(CONFIG_IWLWIFI)   += iwlwifi.o
 iwlwifi-objs   += iwl-io.o
 iwlwifi-objs   += iwl-drv.o
 iwlwifi-objs   += iwl-debug.o
-iwlwifi-objs   += iwl-notif-wait.o
 iwlwifi-objs   += iwl-eeprom-read.o iwl-eeprom-parse.o
 iwlwifi-objs   += iwl-phy-db.o iwl-nvm-parse.o
 iwlwifi-objs   += pcie/drv.o pcie/rx.o pcie/tx.o pcie/trans.o
@@ -11,6 +10,7 @@ iwlwifi-objs  += pcie/ctxt-info.o pcie/trans-gen2.o 
pcie/tx-gen2.o
 iwlwifi-$(CONFIG_IWLDVM) += iwl-1000.o iwl-2000.o iwl-5000.o iwl-6000.o
 iwlwifi-$(CONFIG_IWLMVM) += iwl-7000.o iwl-8000.o iwl-9000.o iwl-a000.o
 iwlwifi-objs   += iwl-trans.o
+iwlwifi-objs   += fw/notif-wait.o
 
 iwlwifi-objs += $(iwlwifi-m)
 
diff --git a/drivers/net/wireless/intel/iwlwifi/dvm/dev.h 
b/drivers/net/wireless/intel/iwlwifi/dvm/dev.h
index 025db135b63c..cceb4cd8e501 100644
--- a/drivers/net/wireless/intel/iwlwifi/dvm/dev.h
+++ b/drivers/net/wireless/intel/iwlwifi/dvm/dev.h
@@ -44,7 +44,7 @@
 #include "iwl-debug.h"
 #include "iwl-agn-hw.h"
 #include "iwl-op-mode.h"
-#include "iwl-notif-wait.h"
+#include "fw/notif-wait.h"
 #include "iwl-trans.h"
 
 #include "led.h"
diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-notif-wait.c 
b/drivers/net/wireless/intel/iwlwifi/fw/notif-wait.c
similarity index 99%
rename from drivers/net/wireless/intel/iwlwifi/iwl-notif-wait.c
rename to drivers/net/wireless/intel/iwlwifi/fw/notif-wait.c
index 68412ff2112e..29bb92e3df59 100644
--- a/drivers/net/wireless/intel/iwlwifi/iwl-notif-wait.c
+++ b/drivers/net/wireless/intel/iwlwifi/fw/notif-wait.c
@@ -65,7 +65,7 @@
 #include 
 
 #include "iwl-drv.h"
-#include "iwl-notif-wait.h"
+#include "notif-wait.h"
 
 
 void iwl_notification_wait_init(struct iwl_notif_wait_data *notif_wait)
diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-notif-wait.h 
b/drivers/net/wireless/intel/iwlwifi/fw/notif-wait.h
similarity index 100%
rename from drivers/net/wireless/intel/iwlwifi/iwl-notif-wait.h
rename to drivers/net/wireless/intel/iwlwifi/fw/notif-wait.h
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h 
b/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
index 33979b48ac0a..0f0cd6c9ce8b 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
@@ -79,7 +79,7 @@
 
 #include "iwl-op-mode.h"
 #include "iwl-trans.h"
-#include "iwl-notif-wait.h"
+#include "fw/notif-wait.h"
 #include "iwl-eeprom-parse.h"
 #include "fw/file.h"
 #include "iwl-config.h"
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/ops.c 
b/drivers/net/wireless/intel/iwlwifi/mvm/ops.c
index d93f1fcdf879..32233cba6786 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/ops.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/ops.c
@@ -68,7 +68,7 @@
 #include 
 #include 
 
-#include "iwl-notif-wait.h"
+#include "fw/notif-wait.h"
 #include "iwl-trans.h"
 #include "iwl-op-mode.h"
 #include "fw/img.h"
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/time-event.c 
b/drivers/net/wireless/intel/iwlwifi/mvm/time-event.c
index 3e4fa853b44d..5a682722adce 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/time-event.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/time-event.c
@@ -66,7 +66,7 @@
 #include 
 #include 
 
-#include "iwl-notif-wait.h"
+#include "fw/notif-wait.h"
 #include "iwl-trans.h"
 #include "fw-api.h"
 #include "time-event.h"
-- 
2.11.0



[PATCH 30/31] iwlwifi: move configuration into sub-directory

2017-06-28 Thread Luca Coelho
From: Johannes Berg 

Since we now support 8 device families, move their configuration
files into a new subdirectory "cfg".

Signed-off-by: Johannes Berg 
Signed-off-by: Luca Coelho 
---
 drivers/net/wireless/intel/iwlwifi/Makefile   | 4 ++--
 drivers/net/wireless/intel/iwlwifi/{iwl-1000.c => cfg/1000.c} | 0
 drivers/net/wireless/intel/iwlwifi/{iwl-2000.c => cfg/2000.c} | 0
 drivers/net/wireless/intel/iwlwifi/{iwl-5000.c => cfg/5000.c} | 0
 drivers/net/wireless/intel/iwlwifi/{iwl-6000.c => cfg/6000.c} | 0
 drivers/net/wireless/intel/iwlwifi/{iwl-7000.c => cfg/7000.c} | 0
 drivers/net/wireless/intel/iwlwifi/{iwl-8000.c => cfg/8000.c} | 0
 drivers/net/wireless/intel/iwlwifi/{iwl-9000.c => cfg/9000.c} | 0
 drivers/net/wireless/intel/iwlwifi/{iwl-a000.c => cfg/a000.c} | 0
 9 files changed, 2 insertions(+), 2 deletions(-)
 rename drivers/net/wireless/intel/iwlwifi/{iwl-1000.c => cfg/1000.c} (100%)
 rename drivers/net/wireless/intel/iwlwifi/{iwl-2000.c => cfg/2000.c} (100%)
 rename drivers/net/wireless/intel/iwlwifi/{iwl-5000.c => cfg/5000.c} (100%)
 rename drivers/net/wireless/intel/iwlwifi/{iwl-6000.c => cfg/6000.c} (100%)
 rename drivers/net/wireless/intel/iwlwifi/{iwl-7000.c => cfg/7000.c} (100%)
 rename drivers/net/wireless/intel/iwlwifi/{iwl-8000.c => cfg/8000.c} (100%)
 rename drivers/net/wireless/intel/iwlwifi/{iwl-9000.c => cfg/9000.c} (100%)
 rename drivers/net/wireless/intel/iwlwifi/{iwl-a000.c => cfg/a000.c} (100%)

diff --git a/drivers/net/wireless/intel/iwlwifi/Makefile 
b/drivers/net/wireless/intel/iwlwifi/Makefile
index 7733fc41ce98..20bd261223af 100644
--- a/drivers/net/wireless/intel/iwlwifi/Makefile
+++ b/drivers/net/wireless/intel/iwlwifi/Makefile
@@ -7,8 +7,8 @@ iwlwifi-objs+= iwl-eeprom-read.o iwl-eeprom-parse.o
 iwlwifi-objs   += iwl-phy-db.o iwl-nvm-parse.o
 iwlwifi-objs   += pcie/drv.o pcie/rx.o pcie/tx.o pcie/trans.o
 iwlwifi-objs   += pcie/ctxt-info.o pcie/trans-gen2.o pcie/tx-gen2.o
-iwlwifi-$(CONFIG_IWLDVM) += iwl-1000.o iwl-2000.o iwl-5000.o iwl-6000.o
-iwlwifi-$(CONFIG_IWLMVM) += iwl-7000.o iwl-8000.o iwl-9000.o iwl-a000.o
+iwlwifi-$(CONFIG_IWLDVM) += cfg/1000.o cfg/2000.o cfg/5000.o cfg/6000.o
+iwlwifi-$(CONFIG_IWLMVM) += cfg/7000.o cfg/8000.o cfg/9000.o cfg/a000.o
 iwlwifi-objs   += iwl-trans.o
 iwlwifi-objs   += fw/notif-wait.o
 
diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-1000.c 
b/drivers/net/wireless/intel/iwlwifi/cfg/1000.c
similarity index 100%
rename from drivers/net/wireless/intel/iwlwifi/iwl-1000.c
rename to drivers/net/wireless/intel/iwlwifi/cfg/1000.c
diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-2000.c 
b/drivers/net/wireless/intel/iwlwifi/cfg/2000.c
similarity index 100%
rename from drivers/net/wireless/intel/iwlwifi/iwl-2000.c
rename to drivers/net/wireless/intel/iwlwifi/cfg/2000.c
diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-5000.c 
b/drivers/net/wireless/intel/iwlwifi/cfg/5000.c
similarity index 100%
rename from drivers/net/wireless/intel/iwlwifi/iwl-5000.c
rename to drivers/net/wireless/intel/iwlwifi/cfg/5000.c
diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-6000.c 
b/drivers/net/wireless/intel/iwlwifi/cfg/6000.c
similarity index 100%
rename from drivers/net/wireless/intel/iwlwifi/iwl-6000.c
rename to drivers/net/wireless/intel/iwlwifi/cfg/6000.c
diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-7000.c 
b/drivers/net/wireless/intel/iwlwifi/cfg/7000.c
similarity index 100%
rename from drivers/net/wireless/intel/iwlwifi/iwl-7000.c
rename to drivers/net/wireless/intel/iwlwifi/cfg/7000.c
diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-8000.c 
b/drivers/net/wireless/intel/iwlwifi/cfg/8000.c
similarity index 100%
rename from drivers/net/wireless/intel/iwlwifi/iwl-8000.c
rename to drivers/net/wireless/intel/iwlwifi/cfg/8000.c
diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-9000.c 
b/drivers/net/wireless/intel/iwlwifi/cfg/9000.c
similarity index 100%
rename from drivers/net/wireless/intel/iwlwifi/iwl-9000.c
rename to drivers/net/wireless/intel/iwlwifi/cfg/9000.c
diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-a000.c 
b/drivers/net/wireless/intel/iwlwifi/cfg/a000.c
similarity index 100%
rename from drivers/net/wireless/intel/iwlwifi/iwl-a000.c
rename to drivers/net/wireless/intel/iwlwifi/cfg/a000.c
-- 
2.11.0



Re: [PATCH] ieee80211: update public action codes

2017-06-28 Thread Arend van Spriel
On 28-06-17 00:07, peter...@bowerswilkins.com wrote:
> From: Peter Oh 
> 
> Update Public Action field values as updated in IEEE Std 802.11-2016,
> so that modules/drivers can refer it.

Hi Peter,

I am pretty sure there are a lot of other definitions in the 802.11 spec
that are not in a linux header file. So are you planning on submitting
driver patches using the added definitions. Stuff is mostly added as needed.

Regards,
Arend

> Signed-off-by: Peter Oh 
> ---
>  include/linux/ieee80211.h | 35 ++-
>  1 file changed, 34 insertions(+), 1 deletion(-)


[PATCH 31/31] iwlwifi: mvm: remove version 2 of paging command

2017-06-28 Thread Luca Coelho
From: Johannes Berg 

Only a000-series devices were going to use this, but actually
initialize using the context info, which includes paging, so
this code is never invoked; remove it.

Signed-off-by: Johannes Berg 
Signed-off-by: Luca Coelho 
---
 drivers/net/wireless/intel/iwlwifi/mvm/fw-api.h | 25 ++--
 drivers/net/wireless/intel/iwlwifi/mvm/fw.c | 39 -
 2 files changed, 15 insertions(+), 49 deletions(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/fw-api.h 
b/drivers/net/wireless/intel/iwlwifi/mvm/fw-api.h
index f3ca61ff9f58..3e297c95e8ff 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/fw-api.h
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/fw-api.h
@@ -326,7 +326,7 @@ enum iwl_legacy_cmds {
 
/**
 * @FW_PAGING_BLOCK_CMD:
-*  iwl_fw_paging_cmd or  iwl_fw_paging_cmd_v1
+*  iwl_fw_paging_cmd
 */
FW_PAGING_BLOCK_CMD = 0x4f,
 
@@ -999,25 +999,6 @@ struct iwl_nvm_access_cmd {
 #define NUM_OF_FW_PAGING_BLOCKS33 /* 32 for data and 1 block for CSS */
 
 /**
- * struct iwl_fw_paging_cmd_v1 - paging layout
- *
- * (FW_PAGING_BLOCK_CMD = 0x4f)
- *
- * Send to FW the paging layout in the driver.
- *
- * @flags: various flags for the command
- * @block_size: the block size in powers of 2
- * @block_num: number of blocks specified in the command.
- * @device_phy_addr: virtual addresses from device side
- */
-struct iwl_fw_paging_cmd_v1 {
-   __le32 flags;
-   __le32 block_size;
-   __le32 block_num;
-   __le32 device_phy_addr[NUM_OF_FW_PAGING_BLOCKS];
-} __packed; /* FW_PAGING_BLOCK_CMD_API_S_VER_1 */
-
-/**
  * struct iwl_fw_paging_cmd - paging layout
  *
  * (FW_PAGING_BLOCK_CMD = 0x4f)
@@ -1033,8 +1014,8 @@ struct iwl_fw_paging_cmd {
__le32 flags;
__le32 block_size;
__le32 block_num;
-   __le64 device_phy_addr[NUM_OF_FW_PAGING_BLOCKS];
-} __packed; /* FW_PAGING_BLOCK_CMD_API_S_VER_2 */
+   __le32 device_phy_addr[NUM_OF_FW_PAGING_BLOCKS];
+} __packed; /* FW_PAGING_BLOCK_CMD_API_S_VER_1 */
 
 /*
  * Fw items ID's
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/fw.c 
b/drivers/net/wireless/intel/iwlwifi/mvm/fw.c
index 80c42ef981c0..79e7a7a285dc 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/fw.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/fw.c
@@ -384,44 +384,29 @@ static int iwl_save_fw_paging(struct iwl_mvm *mvm,
 /* send paging cmd to FW in case CPU2 has paging image */
 static int iwl_send_paging_cmd(struct iwl_mvm *mvm, const struct fw_img *fw)
 {
-   union {
-   struct iwl_fw_paging_cmd v2;
-   struct iwl_fw_paging_cmd_v1 v1;
-   } paging_cmd = {
-   .v2.flags =
-   cpu_to_le32(PAGING_CMD_IS_SECURED |
-   PAGING_CMD_IS_ENABLED |
-   (mvm->num_of_pages_in_last_blk <<
-   PAGING_CMD_NUM_OF_PAGES_IN_LAST_GRP_POS)),
-   .v2.block_size = cpu_to_le32(BLOCK_2_EXP_SIZE),
-   .v2.block_num = cpu_to_le32(mvm->num_of_paging_blk),
+   struct iwl_fw_paging_cmd paging_cmd = {
+   .flags = cpu_to_le32(PAGING_CMD_IS_SECURED |
+PAGING_CMD_IS_ENABLED |
+(mvm->num_of_pages_in_last_blk <<
+ PAGING_CMD_NUM_OF_PAGES_IN_LAST_GRP_POS)),
+   .block_size = cpu_to_le32(BLOCK_2_EXP_SIZE),
+   .block_num = cpu_to_le32(mvm->num_of_paging_blk),
};
-   int blk_idx, size = sizeof(paging_cmd.v2);
-
-   /* A bit hard coded - but this is the old API and will be deprecated */
-   if (!iwl_mvm_has_new_tx_api(mvm))
-   size = sizeof(paging_cmd.v1);
+   int blk_idx;
 
/* loop for for all paging blocks + CSS block */
for (blk_idx = 0; blk_idx < mvm->num_of_paging_blk + 1; blk_idx++) {
dma_addr_t addr = mvm->fw_paging_db[blk_idx].fw_paging_phys;
+   __le32 phy_addr;
 
addr = addr >> PAGE_2_EXP_SIZE;
-
-   if (iwl_mvm_has_new_tx_api(mvm)) {
-   __le64 phy_addr = cpu_to_le64(addr);
-
-   paging_cmd.v2.device_phy_addr[blk_idx] = phy_addr;
-   } else {
-   __le32 phy_addr = cpu_to_le32(addr);
-
-   paging_cmd.v1.device_phy_addr[blk_idx] = phy_addr;
-   }
+   phy_addr = cpu_to_le32(addr);
+   paging_cmd.device_phy_addr[blk_idx] = phy_addr;
}
 
return iwl_mvm_send_cmd_pdu(mvm, iwl_cmd_id(FW_PAGING_BLOCK_CMD,
IWL_ALWAYS_LONG_GROUP, 0),
-   0, size, _cmd);
+   0, sizeof(paging_cmd), _cmd);
 }
 
 /*
-- 
2.11.0



[PATCH 16/31] iwlwifi: mvm: use proper CDB check in PHY context modify

2017-06-28 Thread Luca Coelho
From: Johannes Berg 

When the firmware supports CDB, PHY contexts cannot be modified to
change their band, but need to be added/remove instead. Instead of
relying on iwl_mvm_has_new_tx_api(), check the right FW capa flag
IWL_UCODE_TLV_CAPA_BINDING_CDB_SUPPORT and remove the comment.

Signed-off-by: Johannes Berg 
Signed-off-by: Luca Coelho 
---
 drivers/net/wireless/intel/iwlwifi/mvm/phy-ctxt.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/phy-ctxt.c 
b/drivers/net/wireless/intel/iwlwifi/mvm/phy-ctxt.c
index d59efe804356..fb9eaf003ea5 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/phy-ctxt.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/phy-ctxt.c
@@ -255,8 +255,8 @@ int iwl_mvm_phy_ctxt_changed(struct iwl_mvm *mvm, struct 
iwl_mvm_phy_ctxt *ctxt,
 
lockdep_assert_held(>mutex);
 
-   /* In CDB mode we cannot modify PHY context between bands so... */
-   if (iwl_mvm_has_new_tx_api(mvm) &&
+   if (fw_has_capa(>fw->ucode_capa,
+   IWL_UCODE_TLV_CAPA_BINDING_CDB_SUPPORT) &&
ctxt->channel->band != chandef->chan->band) {
int ret;
 
-- 
2.11.0



[PATCH 21/31] iwlwifi: mvm: support multi tid ba notif

2017-06-28 Thread Luca Coelho
From: Liad Kaufman 

When receiving a BA_NOTIF on new TX API, it can
contain BAs for several TIDs. Go over them and
reclaim TX for every TID.

Note that although the small API change, the API
version still isn't bumped forward, as this NIC
isn't still officially released.

Signed-off-by: Liad Kaufman 
Signed-off-by: Luca Coelho 
---
 drivers/net/wireless/intel/iwlwifi/mvm/fw-api-tx.h |  4 +++-
 drivers/net/wireless/intel/iwlwifi/mvm/tx.c| 28 ++
 2 files changed, 15 insertions(+), 17 deletions(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/fw-api-tx.h 
b/drivers/net/wireless/intel/iwlwifi/mvm/fw-api-tx.h
index 9d2a991221cf..97d7eed32622 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/fw-api-tx.h
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/fw-api-tx.h
@@ -668,13 +668,15 @@ struct iwl_mvm_ba_notif {
  * @q_num: TFD queue number
  * @tfd_index: Index of first un-acked frame in the  TFD queue
  * @scd_queue: For debug only - the physical queue the TFD queue is bound to
+ * @tid: TID of the queue (0-7)
  * @reserved: reserved for alignment
  */
 struct iwl_mvm_compressed_ba_tfd {
__le16 q_num;
__le16 tfd_index;
u8 scd_queue;
-   u8 reserved[3];
+   u8 tid;
+   u8 reserved[2];
 } __packed; /* COMPRESSED_BA_TFD_API_S_VER_1 */
 
 /**
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/tx.c 
b/drivers/net/wireless/intel/iwlwifi/mvm/tx.c
index c89bb453c496..627befb0d8d1 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/tx.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/tx.c
@@ -1813,6 +1813,7 @@ void iwl_mvm_rx_ba_notif(struct iwl_mvm *mvm, struct 
iwl_rx_cmd_buffer *rxb)
if (iwl_mvm_has_new_tx_api(mvm)) {
struct iwl_mvm_compressed_ba_notif *ba_res =
(void *)pkt->data;
+   int i;
 
sta_id = ba_res->sta_id;
ba_info.status.ampdu_ack_len = (u8)le16_to_cpu(ba_res->done);
@@ -1825,22 +1826,17 @@ void iwl_mvm_rx_ba_notif(struct iwl_mvm *mvm, struct 
iwl_rx_cmd_buffer *rxb)
if (!le16_to_cpu(ba_res->tfd_cnt))
goto out;
 
-   /*
-* TODO:
-* When supporting multi TID aggregations - we need to move
-* next_reclaimed to be per TXQ and not per TID or handle it
-* in a different way.
-* This will go together with SN and AddBA offload and cannot
-* be handled properly for now.
-*/
-   WARN_ON(le16_to_cpu(ba_res->ra_tid_cnt) != 1);
-   tid = ba_res->ra_tid[0].tid;
-   if (tid == IWL_MGMT_TID)
-   tid = IWL_MAX_TID_COUNT;
-   iwl_mvm_tx_reclaim(mvm, sta_id, tid,
-  (int)(le16_to_cpu(ba_res->tfd[0].q_num)),
-  le16_to_cpu(ba_res->tfd[0].tfd_index),
-  _info, le32_to_cpu(ba_res->tx_rate));
+   /* Free per TID */
+   for (i = 0; i < le16_to_cpu(ba_res->tfd_cnt); i++) {
+   struct iwl_mvm_compressed_ba_tfd *ba_tfd =
+   _res->tfd[i];
+
+   iwl_mvm_tx_reclaim(mvm, sta_id, ba_tfd->tid,
+  (int)(le16_to_cpu(ba_tfd->q_num)),
+  le16_to_cpu(ba_tfd->tfd_index),
+  _info,
+  le32_to_cpu(ba_res->tx_rate));
+   }
 
 out:
IWL_DEBUG_TX_REPLY(mvm,
-- 
2.11.0



[PATCH 22/31] iwlwifi: unify external & internal modparam names

2017-06-28 Thread Luca Coelho
From: Johannes Berg 

Where possible (all except for "11n_disable", which isn't valid in C)
rename the internal names for module parameters to be the same as the
externally visible names, to aid finding their use etc.

Signed-off-by: Johannes Berg 
Signed-off-by: Luca Coelho 
---
 drivers/net/wireless/intel/iwlwifi/dvm/debugfs.c   |  6 +++---
 drivers/net/wireless/intel/iwlwifi/dvm/lib.c   |  2 +-
 drivers/net/wireless/intel/iwlwifi/dvm/mac80211.c  |  8 
 drivers/net/wireless/intel/iwlwifi/dvm/main.c  |  4 ++--
 drivers/net/wireless/intel/iwlwifi/dvm/rx.c|  2 +-
 drivers/net/wireless/intel/iwlwifi/dvm/rxon.c  |  2 +-
 drivers/net/wireless/intel/iwlwifi/iwl-drv.c   | 12 ++--
 drivers/net/wireless/intel/iwlwifi/iwl-modparams.h | 16 
 drivers/net/wireless/intel/iwlwifi/mvm/d3.c|  8 
 drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c   |  4 ++--
 drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c  |  6 +++---
 drivers/net/wireless/intel/iwlwifi/mvm/mvm.h   |  2 +-
 drivers/net/wireless/intel/iwlwifi/mvm/ops.c   |  8 
 drivers/net/wireless/intel/iwlwifi/mvm/scan.c  |  4 ++--
 drivers/net/wireless/intel/iwlwifi/pcie/drv.c  |  2 +-
 15 files changed, 43 insertions(+), 43 deletions(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/dvm/debugfs.c 
b/drivers/net/wireless/intel/iwlwifi/dvm/debugfs.c
index 937be04c6c71..482ac8fdc67b 100644
--- a/drivers/net/wireless/intel/iwlwifi/dvm/debugfs.c
+++ b/drivers/net/wireless/intel/iwlwifi/dvm/debugfs.c
@@ -2308,10 +2308,10 @@ static ssize_t iwl_dbgfs_fw_restart_write(struct file 
*file,
  size_t count, loff_t *ppos)
 {
struct iwl_priv *priv = file->private_data;
-   bool restart_fw = iwlwifi_mod_params.restart_fw;
+   bool fw_restart = iwlwifi_mod_params.fw_restart;
int __maybe_unused ret;
 
-   iwlwifi_mod_params.restart_fw = true;
+   iwlwifi_mod_params.fw_restart = true;
 
mutex_lock(>mutex);
 
@@ -2320,7 +2320,7 @@ static ssize_t iwl_dbgfs_fw_restart_write(struct file 
*file,
 
mutex_unlock(>mutex);
 
-   iwlwifi_mod_params.restart_fw = restart_fw;
+   iwlwifi_mod_params.fw_restart = fw_restart;
 
return count;
 }
diff --git a/drivers/net/wireless/intel/iwlwifi/dvm/lib.c 
b/drivers/net/wireless/intel/iwlwifi/dvm/lib.c
index 74e52f7c5aa1..2b6ffbc46fa5 100644
--- a/drivers/net/wireless/intel/iwlwifi/dvm/lib.c
+++ b/drivers/net/wireless/intel/iwlwifi/dvm/lib.c
@@ -1157,7 +1157,7 @@ int iwlagn_suspend(struct iwl_priv *priv, struct 
cfg80211_wowlan *wowlan)
if (ret)
goto out;
 
-   if (!iwlwifi_mod_params.sw_crypto) {
+   if (!iwlwifi_mod_params.swcrypto) {
/* mark all keys clear */
priv->ucode_key_table = 0;
ctx->key_mapping_keys = 0;
diff --git a/drivers/net/wireless/intel/iwlwifi/dvm/mac80211.c 
b/drivers/net/wireless/intel/iwlwifi/dvm/mac80211.c
index 444c74371929..82caae02dd09 100644
--- a/drivers/net/wireless/intel/iwlwifi/dvm/mac80211.c
+++ b/drivers/net/wireless/intel/iwlwifi/dvm/mac80211.c
@@ -138,7 +138,7 @@ int iwlagn_mac_setup_register(struct iwl_priv *priv,
 * packets, so enabling it with software crypto isn't safe)
 */
if (priv->fw->ucode_capa.flags & IWL_UCODE_TLV_FLAGS_MFP &&
-   !iwlwifi_mod_params.sw_crypto)
+   !iwlwifi_mod_params.swcrypto)
ieee80211_hw_set(hw, MFP_CAPABLE);
 
hw->sta_data_size = sizeof(struct iwl_station_priv);
@@ -171,7 +171,7 @@ int iwlagn_mac_setup_register(struct iwl_priv *priv,
 WIPHY_WOWLAN_DISCONNECT |
 WIPHY_WOWLAN_EAP_IDENTITY_REQ |
 WIPHY_WOWLAN_RFKILL_RELEASE;
-   if (!iwlwifi_mod_params.sw_crypto)
+   if (!iwlwifi_mod_params.swcrypto)
priv->wowlan_support.flags |=
WIPHY_WOWLAN_SUPPORTS_GTK_REKEY |
WIPHY_WOWLAN_GTK_REKEY_FAILURE;
@@ -348,7 +348,7 @@ static void iwlagn_mac_set_rekey_data(struct ieee80211_hw 
*hw,
 {
struct iwl_priv *priv = IWL_MAC80211_GET_DVM(hw);
 
-   if (iwlwifi_mod_params.sw_crypto)
+   if (iwlwifi_mod_params.swcrypto)
return;
 
IWL_DEBUG_MAC80211(priv, "enter\n");
@@ -624,7 +624,7 @@ static int iwlagn_mac_set_key(struct ieee80211_hw *hw, enum 
set_key_cmd cmd,
 
IWL_DEBUG_MAC80211(priv, "enter\n");
 
-   if (iwlwifi_mod_params.sw_crypto) {
+   if (iwlwifi_mod_params.swcrypto) {
IWL_DEBUG_MAC80211(priv, "leave - hwcrypto disabled\n");
return -EOPNOTSUPP;
}
diff --git a/drivers/net/wireless/intel/iwlwifi/dvm/main.c 

[PATCH 28/31] iwlwifi: create new subdirectory for FW interaction

2017-06-28 Thread Luca Coelho
From: Johannes Berg 

There's a lot of mvm code that really should be more generic
and part of the iwlwifi module. Start by making a place to
keep such code - in the new "fw" subdirectory - and already
move the firmware related header files there.

Signed-off-by: Johannes Berg 
Signed-off-by: Luca Coelho 
---
 drivers/net/wireless/intel/iwlwifi/dvm/dev.h   |  2 +-
 drivers/net/wireless/intel/iwlwifi/{iwl-fw-api.h => fw/api.h}  |  0
 .../intel/iwlwifi/{iwl-fw-error-dump.h => fw/error-dump.h} |  0
 .../net/wireless/intel/iwlwifi/{iwl-fw-file.h => fw/file.h}|  0
 drivers/net/wireless/intel/iwlwifi/{iwl-fw.h => fw/img.h}  | 10 +-
 drivers/net/wireless/intel/iwlwifi/iwl-drv.c   |  2 +-
 drivers/net/wireless/intel/iwlwifi/iwl-trans.h |  4 ++--
 drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c   |  2 +-
 drivers/net/wireless/intel/iwlwifi/mvm/fw-dbg.h|  4 ++--
 drivers/net/wireless/intel/iwlwifi/mvm/fw.c|  2 +-
 drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c  |  2 +-
 drivers/net/wireless/intel/iwlwifi/mvm/mvm.h   |  2 +-
 drivers/net/wireless/intel/iwlwifi/mvm/ops.c   |  2 +-
 drivers/net/wireless/intel/iwlwifi/pcie/trans.c|  2 +-
 14 files changed, 17 insertions(+), 17 deletions(-)
 rename drivers/net/wireless/intel/iwlwifi/{iwl-fw-api.h => fw/api.h} (100%)
 rename drivers/net/wireless/intel/iwlwifi/{iwl-fw-error-dump.h => 
fw/error-dump.h} (100%)
 rename drivers/net/wireless/intel/iwlwifi/{iwl-fw-file.h => fw/file.h} (100%)
 rename drivers/net/wireless/intel/iwlwifi/{iwl-fw.h => fw/img.h} (98%)

diff --git a/drivers/net/wireless/intel/iwlwifi/dvm/dev.h 
b/drivers/net/wireless/intel/iwlwifi/dvm/dev.h
index 8148df61a916..025db135b63c 100644
--- a/drivers/net/wireless/intel/iwlwifi/dvm/dev.h
+++ b/drivers/net/wireless/intel/iwlwifi/dvm/dev.h
@@ -38,7 +38,7 @@
 #include 
 #include 
 
-#include "iwl-fw.h"
+#include "fw/img.h"
 #include "iwl-eeprom-parse.h"
 #include "iwl-csr.h"
 #include "iwl-debug.h"
diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-fw-api.h 
b/drivers/net/wireless/intel/iwlwifi/fw/api.h
similarity index 100%
rename from drivers/net/wireless/intel/iwlwifi/iwl-fw-api.h
rename to drivers/net/wireless/intel/iwlwifi/fw/api.h
diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-fw-error-dump.h 
b/drivers/net/wireless/intel/iwlwifi/fw/error-dump.h
similarity index 100%
rename from drivers/net/wireless/intel/iwlwifi/iwl-fw-error-dump.h
rename to drivers/net/wireless/intel/iwlwifi/fw/error-dump.h
diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-fw-file.h 
b/drivers/net/wireless/intel/iwlwifi/fw/file.h
similarity index 100%
rename from drivers/net/wireless/intel/iwlwifi/iwl-fw-file.h
rename to drivers/net/wireless/intel/iwlwifi/fw/file.h
diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-fw.h 
b/drivers/net/wireless/intel/iwlwifi/fw/img.h
similarity index 98%
rename from drivers/net/wireless/intel/iwlwifi/iwl-fw.h
rename to drivers/net/wireless/intel/iwlwifi/fw/img.h
index d323b70b510a..e6bc9cb60700 100644
--- a/drivers/net/wireless/intel/iwlwifi/iwl-fw.h
+++ b/drivers/net/wireless/intel/iwlwifi/fw/img.h
@@ -64,12 +64,12 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#ifndef __iwl_fw_h__
-#define __iwl_fw_h__
+#ifndef __iwl_fw_img_h__
+#define __iwl_fw_img_h__
 #include 
 
-#include "iwl-fw-file.h"
-#include "iwl-fw-error-dump.h"
+#include "file.h"
+#include "error-dump.h"
 
 /**
  * enum iwl_ucode_type
@@ -339,4 +339,4 @@ iwl_get_ucode_image(const struct iwl_fw *fw, enum 
iwl_ucode_type ucode_type)
return >img[ucode_type];
 }
 
-#endif  /* __iwl_fw_h__ */
+#endif  /* __iwl_fw_img_h__ */
diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-drv.c 
b/drivers/net/wireless/intel/iwlwifi/iwl-drv.c
index b5ebd0fcfbf6..6fdb5921e17f 100644
--- a/drivers/net/wireless/intel/iwlwifi/iwl-drv.c
+++ b/drivers/net/wireless/intel/iwlwifi/iwl-drv.c
@@ -76,7 +76,7 @@
 #include "iwl-trans.h"
 #include "iwl-op-mode.h"
 #include "iwl-agn-hw.h"
-#include "iwl-fw.h"
+#include "fw/img.h"
 #include "iwl-config.h"
 #include "iwl-modparams.h"
 
diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-trans.h 
b/drivers/net/wireless/intel/iwlwifi/iwl-trans.h
index 57db6250a329..eb6842abb4c7 100644
--- a/drivers/net/wireless/intel/iwlwifi/iwl-trans.h
+++ b/drivers/net/wireless/intel/iwlwifi/iwl-trans.h
@@ -74,9 +74,9 @@
 
 #include "iwl-debug.h"
 #include "iwl-config.h"
-#include "iwl-fw.h"
+#include "fw/img.h"
 #include "iwl-op-mode.h"
-#include "iwl-fw-api.h"
+#include "fw/api.h"
 
 /**
  * DOC: Transport layer - what is it ?
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c 
b/drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c
index 

[PATCH 26/31] iwlwifi: mvm: fix deduplication start logic

2017-06-28 Thread Luca Coelho
From: Johannes Berg 

If the first frame on a given TID is received with seqno 0 and needed
to be retransmitted, we erroneously drop it because the deduplication
data is initialized to zero, and then comparing

if (unlikely(ieee80211_has_retry(hdr->frame_control) &&
 dup_data->last_seq[tid] == hdr->seq_ctrl &&
 dup_data->last_sub_frame[tid] >= sub_frame_idx))
return true;

will return in iwl_mvm_is_dup() since last_sub_frame is also set to
zero, and sub_frame_idx is usually zero since this only covers the
relatively rare case of A-MSDU.

Fix this by initializing the last_seq array to 0x, which is an
impossible value for hdr->seq_ctrl to have here because the lower
four bits are the fragment number, and fragments aren't handled in
this code but go to mac80211 instead.

Fixes: a571f5f635ef ("iwlwifi: mvm: add duplicate packet detection per rx 
queue")
Signed-off-by: Johannes Berg 
Signed-off-by: Luca Coelho 
---
 drivers/net/wireless/intel/iwlwifi/mvm/sta.c | 17 +++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/sta.c 
b/drivers/net/wireless/intel/iwlwifi/mvm/sta.c
index ee7c978fe5ab..4df5f13fcdae 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/sta.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/sta.c
@@ -1402,11 +1402,24 @@ int iwl_mvm_add_sta(struct iwl_mvm *mvm,
 
if (iwl_mvm_has_new_rx_api(mvm) &&
!test_bit(IWL_MVM_STATUS_IN_HW_RESTART, >status)) {
+   int q;
+
dup_data = kcalloc(mvm->trans->num_rx_queues,
-  sizeof(*dup_data),
-  GFP_KERNEL);
+  sizeof(*dup_data), GFP_KERNEL);
if (!dup_data)
return -ENOMEM;
+   /*
+* Initialize all the last_seq values to 0x which can never
+* compare equal to the frame's seq_ctrl in the check in
+* iwl_mvm_is_dup() since the lower 4 bits are the fragment
+* number and fragmented packets don't reach that function.
+*
+* This thus allows receiving a packet with seqno 0 and the
+* retry bit set as the very first packet on a new TID.
+*/
+   for (q = 0; q < mvm->trans->num_rx_queues; q++)
+   memset(dup_data[q].last_seq, 0xff,
+  sizeof(dup_data[q].last_seq));
mvm_sta->dup_data = dup_data;
}
 
-- 
2.11.0



[PATCH 20/31] iwlwifi: mvm: change when the BT_COEX is sent

2017-06-28 Thread Luca Coelho
From: Emmanuel Grumbach 

The BT_COEX command should not be sent to the INIT
firmware image starting from 8000 family.
The firmware team also requested to send the BT_COEX
command after the PHY_DB_CMD and the PHY_CFG_CMD.

While at it:
s/iwl_send_bt_init_conf/iwl_mvm_send_bt_init_conf/

Signed-off-by: Emmanuel Grumbach 
Signed-off-by: Luca Coelho 
---
 drivers/net/wireless/intel/iwlwifi/mvm/coex.c|  2 +-
 drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c |  2 +-
 drivers/net/wireless/intel/iwlwifi/mvm/fw.c  | 16 +---
 drivers/net/wireless/intel/iwlwifi/mvm/mvm.h |  2 +-
 4 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/coex.c 
b/drivers/net/wireless/intel/iwlwifi/mvm/coex.c
index fe7f1e424f55..34dd5c40ce77 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/coex.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/coex.c
@@ -406,7 +406,7 @@ iwl_get_coex_type(struct iwl_mvm *mvm, const struct 
ieee80211_vif *vif)
return ret;
 }
 
-int iwl_send_bt_init_conf(struct iwl_mvm *mvm)
+int iwl_mvm_send_bt_init_conf(struct iwl_mvm *mvm)
 {
struct iwl_bt_coex_cmd bt_cmd = {};
u32 mode;
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c 
b/drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c
index c3ab13ee4097..f87a43dad086 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c
@@ -644,7 +644,7 @@ iwl_dbgfs_bt_force_ant_write(struct iwl_mvm *mvm, char *buf,
   modes_str[mvm->bt_force_ant_mode]);
 
if (iwl_mvm_firmware_running(mvm))
-   ret = iwl_send_bt_init_conf(mvm);
+   ret = iwl_mvm_send_bt_init_conf(mvm);
else
ret = 0;
 
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/fw.c 
b/drivers/net/wireless/intel/iwlwifi/mvm/fw.c
index 273e19460016..07308912486a 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/fw.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/fw.c
@@ -836,9 +836,11 @@ int iwl_run_init_mvm_ucode(struct iwl_mvm *mvm, bool 
read_nvm)
goto error;
}
 
-   ret = iwl_send_bt_init_conf(mvm);
-   if (ret)
-   goto error;
+   if (mvm->cfg->device_family < IWL_DEVICE_FAMILY_8000) {
+   ret = iwl_mvm_send_bt_init_conf(mvm);
+   if (ret)
+   goto error;
+   }
 
/* Read the NVM only at driver load time, no need to do this twice */
if (read_nvm) {
@@ -1545,10 +1547,6 @@ int iwl_mvm_up(struct iwl_mvm *mvm)
if (ret)
goto error;
 
-   ret = iwl_send_bt_init_conf(mvm);
-   if (ret)
-   goto error;
-
/* Send phy db control command and then phy db calibration*/
if (!iwl_mvm_has_new_tx_api(mvm)) {
ret = iwl_send_phy_db_data(mvm->phy_db);
@@ -1560,6 +1558,10 @@ int iwl_mvm_up(struct iwl_mvm *mvm)
goto error;
}
 
+   ret = iwl_mvm_send_bt_init_conf(mvm);
+   if (ret)
+   goto error;
+
/* Init RSS configuration */
/* TODO - remove a000 disablement when we have RXQ config API */
if (iwl_mvm_has_new_rx_api(mvm) && !iwl_mvm_has_new_tx_api(mvm)) {
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h 
b/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
index 9b777b847e22..f2f1e04f471d 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
@@ -1680,7 +1680,7 @@ int iwl_mvm_exit_d0i3(struct iwl_op_mode *op_mode);
 int _iwl_mvm_exit_d0i3(struct iwl_mvm *mvm);
 
 /* BT Coex */
-int iwl_send_bt_init_conf(struct iwl_mvm *mvm);
+int iwl_mvm_send_bt_init_conf(struct iwl_mvm *mvm);
 void iwl_mvm_rx_bt_coex_notif(struct iwl_mvm *mvm,
  struct iwl_rx_cmd_buffer *rxb);
 void iwl_mvm_bt_rssi_event(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
-- 
2.11.0



[PATCH 24/31] iwlwifi: pcie: warn if paging is already initialized during init

2017-06-28 Thread Luca Coelho
From: Johannes Berg 

This appears to happen in some cases, like when iwlmvm is unloaded and
loaded again without also unloading iwlwifi. Warn in this case and free
the paging data to be able to continue without causing corruption and
kernel crashes due to it (otherwise, paging data is overwritten, but
dram->paging_cnt gets to be twice as big as it should be, and then an
eventual free will crash.)

Signed-off-by: Johannes Berg 
Signed-off-by: Luca Coelho 
---
 drivers/net/wireless/intel/iwlwifi/pcie/ctxt-info.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/ctxt-info.c 
b/drivers/net/wireless/intel/iwlwifi/pcie/ctxt-info.c
index 00d1a5f048b3..eddaca76d514 100644
--- a/drivers/net/wireless/intel/iwlwifi/pcie/ctxt-info.c
+++ b/drivers/net/wireless/intel/iwlwifi/pcie/ctxt-info.c
@@ -137,6 +137,11 @@ static int iwl_pcie_ctxt_info_init_fw_sec(struct iwl_trans 
*trans,
struct iwl_context_info_dram *ctxt_dram = _info->dram;
int i, ret, lmac_cnt, umac_cnt, paging_cnt;
 
+   if (WARN(dram->paging,
+"paging shouldn't already be initialized (%d pages)\n",
+dram->paging_cnt))
+   iwl_pcie_ctxt_info_free_paging(trans);
+
lmac_cnt = iwl_pcie_get_num_sections(fw, 0);
/* add 1 due to separator */
umac_cnt = iwl_pcie_get_num_sections(fw, lmac_cnt + 1);
-- 
2.11.0



[PATCH 27/31] iwlwifi: mvm: rename iwl_shared_mem_cfg_v1 to the correct _v2

2017-06-28 Thread Luca Coelho
From: Johannes Berg 

This structure represents V2, V1 has the three last fields missing.
Rename it to be more accurate.

Signed-off-by: Johannes Berg 
Signed-off-by: Luca Coelho 
---
 drivers/net/wireless/intel/iwlwifi/mvm/fw-api.h | 6 +++---
 drivers/net/wireless/intel/iwlwifi/mvm/fw.c | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/fw-api.h 
b/drivers/net/wireless/intel/iwlwifi/mvm/fw-api.h
index 17475e269ef5..f3ca61ff9f58 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/fw-api.h
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/fw-api.h
@@ -724,7 +724,7 @@ enum iwl_system_subcmd_ids {
/**
 * @SHARED_MEM_CFG_CMD:
 * response in  iwl_shared_mem_cfg or
-*  iwl_shared_mem_cfg_v1
+*  iwl_shared_mem_cfg_v2
 */
SHARED_MEM_CFG_CMD = 0x0,
 
@@ -2546,7 +2546,7 @@ struct iwl_tdls_config_res {
 #define TX_FIFO_INTERNAL_MAX_NUM   6
 
 /**
- * struct iwl_shared_mem_cfg_v1 - Shared memory configuration information
+ * struct iwl_shared_mem_cfg_v2 - Shared memory configuration information
  *
  * @shared_mem_addr: shared memory addr (pre 8000 HW set to 0x0 as MARBH is not
  * accessible)
@@ -2568,7 +2568,7 @@ struct iwl_tdls_config_res {
  * NOTE: on firmware that don't have IWL_UCODE_TLV_CAPA_EXTEND_SHARED_MEM_CFG
  *  set, the last 3 members don't exist.
  */
-struct iwl_shared_mem_cfg_v1 {
+struct iwl_shared_mem_cfg_v2 {
__le32 shared_mem_addr;
__le32 shared_mem_size;
__le32 sample_buff_addr;
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/fw.c 
b/drivers/net/wireless/intel/iwlwifi/mvm/fw.c
index 07308912486a..c5445be36701 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/fw.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/fw.c
@@ -955,7 +955,7 @@ static void iwl_mvm_parse_shared_mem_a000(struct iwl_mvm 
*mvm,
 static void iwl_mvm_parse_shared_mem(struct iwl_mvm *mvm,
 struct iwl_rx_packet *pkt)
 {
-   struct iwl_shared_mem_cfg_v1 *mem_cfg = (void *)pkt->data;
+   struct iwl_shared_mem_cfg_v2 *mem_cfg = (void *)pkt->data;
int i;
 
mvm->smem_cfg.num_lmacs = 1;
-- 
2.11.0



[PATCH 23/31] iwlwifi: pcie: make ctxt-info free idempotent

2017-06-28 Thread Luca Coelho
From: Johannes Berg 

By setting the pointers to NULL at the end, these functions
are made idempotent.

Signed-off-by: Johannes Berg 
Signed-off-by: Luca Coelho 
---
 drivers/net/wireless/intel/iwlwifi/pcie/ctxt-info.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/ctxt-info.c 
b/drivers/net/wireless/intel/iwlwifi/pcie/ctxt-info.c
index b1f43397bb59..00d1a5f048b3 100644
--- a/drivers/net/wireless/intel/iwlwifi/pcie/ctxt-info.c
+++ b/drivers/net/wireless/intel/iwlwifi/pcie/ctxt-info.c
@@ -103,6 +103,7 @@ static void iwl_pcie_ctxt_info_free_fw_img(struct iwl_trans 
*trans)
 
kfree(dram->fw);
dram->fw_cnt = 0;
+   dram->fw = NULL;
 }
 
 void iwl_pcie_ctxt_info_free_paging(struct iwl_trans *trans)
@@ -124,6 +125,7 @@ void iwl_pcie_ctxt_info_free_paging(struct iwl_trans *trans)
 
kfree(dram->paging);
dram->paging_cnt = 0;
+   dram->paging = NULL;
 }
 
 static int iwl_pcie_ctxt_info_init_fw_sec(struct iwl_trans *trans,
-- 
2.11.0



[PATCH 18/31] iwlwifi: mvm: support aggs of 64 frames in A000 family

2017-06-28 Thread Luca Coelho
From: Liad Kaufman 

A SCD bug was fixed in the A000 family, allowing to
support aggregations of 64 frames (rather than 63).

Signed-off-by: Liad Kaufman 
Signed-off-by: Luca Coelho 
---
 drivers/net/wireless/intel/iwlwifi/mvm/rs.c  |  6 +-
 drivers/net/wireless/intel/iwlwifi/mvm/rs.h  |  2 ++
 drivers/net/wireless/intel/iwlwifi/mvm/sta.c | 11 +--
 3 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/rs.c 
b/drivers/net/wireless/intel/iwlwifi/mvm/rs.c
index a02dda8d9ea3..65beca3a457a 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/rs.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/rs.c
@@ -3233,7 +3233,11 @@ static void rs_build_rates_table_from_fixed(struct 
iwl_mvm *mvm,
if (num_of_ant(ant) == 1)
lq_cmd->single_stream_ant_msk = ant;
 
-   lq_cmd->agg_frame_cnt_limit = LINK_QUAL_AGG_FRAME_LIMIT_DEF;
+   if (!mvm->trans->cfg->gen2)
+   lq_cmd->agg_frame_cnt_limit = LINK_QUAL_AGG_FRAME_LIMIT_DEF;
+   else
+   lq_cmd->agg_frame_cnt_limit =
+   LINK_QUAL_AGG_FRAME_LIMIT_GEN2_DEF;
 }
 #endif /* CONFIG_MAC80211_DEBUGFS */
 
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/rs.h 
b/drivers/net/wireless/intel/iwlwifi/mvm/rs.h
index 3abde1cb0303..32b4d66debea 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/rs.h
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/rs.h
@@ -145,6 +145,8 @@ enum {
 
 #define LINK_QUAL_AGG_FRAME_LIMIT_DEF  (63)
 #define LINK_QUAL_AGG_FRAME_LIMIT_MAX  (63)
+#define LINK_QUAL_AGG_FRAME_LIMIT_GEN2_DEF (64)
+#define LINK_QUAL_AGG_FRAME_LIMIT_GEN2_MAX (64)
 #define LINK_QUAL_AGG_FRAME_LIMIT_MIN  (0)
 
 #define LQ_SIZE2   /* 2 mode tables:  "Active" and 
"Search" */
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/sta.c 
b/drivers/net/wireless/intel/iwlwifi/mvm/sta.c
index 9ec427966533..ee7c978fe5ab 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/sta.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/sta.c
@@ -1354,7 +1354,10 @@ int iwl_mvm_add_sta(struct iwl_mvm *mvm,
mvm_sta->mac_id_n_color = FW_CMD_ID_AND_COLOR(mvmvif->id,
  mvmvif->color);
mvm_sta->vif = vif;
-   mvm_sta->max_agg_bufsize = LINK_QUAL_AGG_FRAME_LIMIT_DEF;
+   if (!mvm->trans->cfg->gen2)
+   mvm_sta->max_agg_bufsize = LINK_QUAL_AGG_FRAME_LIMIT_DEF;
+   else
+   mvm_sta->max_agg_bufsize = LINK_QUAL_AGG_FRAME_LIMIT_GEN2_DEF;
mvm_sta->tx_protection = 0;
mvm_sta->tt_tx_protection = false;
mvm_sta->sta_type = sta->tdls ? IWL_STA_TDLS_LINK : IWL_STA_LINK;
@@ -2677,7 +2680,11 @@ int iwl_mvm_sta_tx_agg_oper(struct iwl_mvm *mvm, struct 
ieee80211_vif *vif,
BUILD_BUG_ON((sizeof(mvmsta->agg_tids) * BITS_PER_BYTE)
 != IWL_MAX_TID_COUNT);
 
-   buf_size = min_t(int, buf_size, LINK_QUAL_AGG_FRAME_LIMIT_DEF);
+   if (!mvm->trans->cfg->gen2)
+   buf_size = min_t(int, buf_size, LINK_QUAL_AGG_FRAME_LIMIT_DEF);
+   else
+   buf_size = min_t(int, buf_size,
+LINK_QUAL_AGG_FRAME_LIMIT_GEN2_DEF);
 
spin_lock_bh(>lock);
ssn = tid_data->ssn;
-- 
2.11.0



[PATCH 17/31] iwlwifi: pcie: improve "invalid queue" warning

2017-06-28 Thread Luca Coelho
From: Johannes Berg 

Print out both queue IDs to be able to see what went wrong.

Signed-off-by: Johannes Berg 
Signed-off-by: Luca Coelho 
---
 drivers/net/wireless/intel/iwlwifi/pcie/rx.c | 8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/rx.c 
b/drivers/net/wireless/intel/iwlwifi/pcie/rx.c
index cd109740632d..6544facc2e0c 100644
--- a/drivers/net/wireless/intel/iwlwifi/pcie/rx.c
+++ b/drivers/net/wireless/intel/iwlwifi/pcie/rx.c
@@ -1129,8 +1129,12 @@ static void iwl_pcie_rx_handle_rb(struct iwl_trans 
*trans,
if (pkt->len_n_flags == cpu_to_le32(FH_RSCSR_FRAME_INVALID))
break;
 
-   WARN_ON((le32_to_cpu(pkt->len_n_flags) & FH_RSCSR_RXQ_MASK) >>
-   FH_RSCSR_RXQ_POS != rxq->id);
+   WARN((le32_to_cpu(pkt->len_n_flags) & FH_RSCSR_RXQ_MASK) >>
+   FH_RSCSR_RXQ_POS != rxq->id,
+"frame on invalid queue - is on %d and indicates %d\n",
+rxq->id,
+(le32_to_cpu(pkt->len_n_flags) & FH_RSCSR_RXQ_MASK) >>
+   FH_RSCSR_RXQ_POS);
 
IWL_DEBUG_RX(trans,
 "cmd at offset %d: %s (%.2x.%2x, seq 0x%x)\n",
-- 
2.11.0



[PATCH 14/31] iwlwifi: add the new a000_2ax series

2017-06-28 Thread Luca Coelho
From: Tzipi Peres 

Add a new config struct for the new a000 2ax series and add
the five PCI ID for it.

Signed-off-by: Tzipi Peres 
Signed-off-by: Luca Coelho 
---
 drivers/net/wireless/intel/iwlwifi/iwl-a000.c   | 10 ++
 drivers/net/wireless/intel/iwlwifi/iwl-config.h |  1 +
 drivers/net/wireless/intel/iwlwifi/pcie/drv.c   |  5 +
 3 files changed, 16 insertions(+)

diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-a000.c 
b/drivers/net/wireless/intel/iwlwifi/iwl-a000.c
index 4634c46d1eb4..2940c0a6c3d6 100644
--- a/drivers/net/wireless/intel/iwlwifi/iwl-a000.c
+++ b/drivers/net/wireless/intel/iwlwifi/iwl-a000.c
@@ -158,5 +158,15 @@ const struct iwl_cfg iwla000_2ac_cfg_jf = {
.max_ht_ampdu_exponent = IEEE80211_HT_MAX_AMPDU_64K,
 };
 
+const struct iwl_cfg iwla000_2ax_cfg_hr = {
+   .name = "Intel(R) Dual Band Wireless AX a000",
+   .fw_name_pre = IWL_A000_HR_FW_PRE,
+   IWL_DEVICE_A000,
+   .ht_params = _a000_ht_params,
+   .nvm_ver = IWL_A000_NVM_VERSION,
+   .nvm_calib_ver = IWL_A000_TX_POWER_VERSION,
+   .max_ht_ampdu_exponent = IEEE80211_HT_MAX_AMPDU_64K,
+};
+
 MODULE_FIRMWARE(IWL_A000_HR_MODULE_FIRMWARE(IWL_A000_UCODE_API_MAX));
 MODULE_FIRMWARE(IWL_A000_JF_MODULE_FIRMWARE(IWL_A000_UCODE_API_MAX));
diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-config.h 
b/drivers/net/wireless/intel/iwlwifi/iwl-config.h
index 127017efdd87..c52623cb7c2a 100644
--- a/drivers/net/wireless/intel/iwlwifi/iwl-config.h
+++ b/drivers/net/wireless/intel/iwlwifi/iwl-config.h
@@ -462,6 +462,7 @@ extern const struct iwl_cfg iwl9560_2ac_cfg;
 extern const struct iwl_cfg iwla000_2ac_cfg_hr;
 extern const struct iwl_cfg iwla000_2ac_cfg_hr_cdb;
 extern const struct iwl_cfg iwla000_2ac_cfg_jf;
+extern const struct iwl_cfg iwla000_2ax_cfg_hr;
 #endif /* CONFIG_IWLMVM */
 
 #endif /* __IWL_CONFIG_H__ */
diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/drv.c 
b/drivers/net/wireless/intel/iwlwifi/pcie/drv.c
index a8fb77483313..e995b055be4e 100644
--- a/drivers/net/wireless/intel/iwlwifi/pcie/drv.c
+++ b/drivers/net/wireless/intel/iwlwifi/pcie/drv.c
@@ -539,6 +539,11 @@ static const struct pci_device_id iwl_hw_card_ids[] = {
 /* a000 Series */
{IWL_PCI_DEVICE(0x2720, 0x0A10, iwla000_2ac_cfg_hr_cdb)},
{IWL_PCI_DEVICE(0x34F0, 0x0310, iwla000_2ac_cfg_jf)},
+   {IWL_PCI_DEVICE(0x2720, 0x, iwla000_2ax_cfg_hr)},
+   {IWL_PCI_DEVICE(0x34F0, 0x0070, iwla000_2ax_cfg_hr)},
+   {IWL_PCI_DEVICE(0x2720, 0x0078, iwla000_2ax_cfg_hr)},
+   {IWL_PCI_DEVICE(0x2720, 0x0070, iwla000_2ax_cfg_hr)},
+   {IWL_PCI_DEVICE(0x2720, 0x1080, iwla000_2ax_cfg_hr)},
 #endif /* CONFIG_IWLMVM */
 
{0}
-- 
2.11.0



[PATCH 19/31] iwlwifi: pcie: improve debug in iwl_pcie_rx_handle_rb()

2017-06-28 Thread Luca Coelho
From: Johannes Berg 

Print the queue for the existing debug message and add a new
debug message indicating where the RB ended.

Signed-off-by: Johannes Berg 
Signed-off-by: Luca Coelho 
---
 drivers/net/wireless/intel/iwlwifi/pcie/rx.c | 10 +++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/rx.c 
b/drivers/net/wireless/intel/iwlwifi/pcie/rx.c
index 6544facc2e0c..1618a59a8a2f 100644
--- a/drivers/net/wireless/intel/iwlwifi/pcie/rx.c
+++ b/drivers/net/wireless/intel/iwlwifi/pcie/rx.c
@@ -1126,8 +1126,12 @@ static void iwl_pcie_rx_handle_rb(struct iwl_trans 
*trans,
 
pkt = rxb_addr();
 
-   if (pkt->len_n_flags == cpu_to_le32(FH_RSCSR_FRAME_INVALID))
+   if (pkt->len_n_flags == cpu_to_le32(FH_RSCSR_FRAME_INVALID)) {
+   IWL_DEBUG_RX(trans,
+"Q %d: RB end marker at offset %d\n",
+rxq->id, offset);
break;
+   }
 
WARN((le32_to_cpu(pkt->len_n_flags) & FH_RSCSR_RXQ_MASK) >>
FH_RSCSR_RXQ_POS != rxq->id,
@@ -1137,8 +1141,8 @@ static void iwl_pcie_rx_handle_rb(struct iwl_trans *trans,
FH_RSCSR_RXQ_POS);
 
IWL_DEBUG_RX(trans,
-"cmd at offset %d: %s (%.2x.%2x, seq 0x%x)\n",
-rxcb._offset,
+"Q %d: cmd at offset %d: %s (%.2x.%2x, seq 
0x%x)\n",
+rxq->id, offset,
 iwl_get_cmd_string(trans,
iwl_cmd_id(pkt->hdr.cmd,
   pkt->hdr.group_id,
-- 
2.11.0



[PATCH 13/31] iwlwifi: mvm: simplify CHECK_MLME_TRIGGER macro

2017-06-28 Thread Luca Coelho
From: Luca Coelho 

There's no reason to pass mvm and trig as parameters to the macro,
since it will be expanded inside the function itself.  Also remove the
bogus buf parameter which doesn't exist and is not used.

Signed-off-by: Luca Coelho 
---
 drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c | 24 +--
 1 file changed, 9 insertions(+), 15 deletions(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c 
b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
index d04a88c6c593..b98978d6cb21 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
@@ -4151,11 +4151,11 @@ static void iwl_mvm_event_mlme_callback(struct iwl_mvm 
*mvm,
struct ieee80211_vif *vif,
const struct ieee80211_event *event)
 {
-#define CHECK_MLME_TRIGGER(_mvm, _trig, _buf, _cnt, _fmt...)   \
+#define CHECK_MLME_TRIGGER(_cnt, _fmt...)  \
do {\
-   if ((_cnt) && --(_cnt)) \
+   if ((trig_mlme->_cnt) && --(trig_mlme->_cnt))   \
break;  \
-   iwl_mvm_fw_dbg_collect_trig(_mvm, _trig, _fmt);\
+   iwl_mvm_fw_dbg_collect_trig(mvm, trig, _fmt);   \
} while (0)
 
struct iwl_fw_dbg_trigger_tlv *trig;
@@ -4171,31 +4171,25 @@ static void iwl_mvm_event_mlme_callback(struct iwl_mvm 
*mvm,
 
if (event->u.mlme.data == ASSOC_EVENT) {
if (event->u.mlme.status == MLME_DENIED)
-   CHECK_MLME_TRIGGER(mvm, trig, buf,
-  trig_mlme->stop_assoc_denied,
+   CHECK_MLME_TRIGGER(stop_assoc_denied,
   "DENIED ASSOC: reason %d",
event->u.mlme.reason);
else if (event->u.mlme.status == MLME_TIMEOUT)
-   CHECK_MLME_TRIGGER(mvm, trig, buf,
-  trig_mlme->stop_assoc_timeout,
+   CHECK_MLME_TRIGGER(stop_assoc_timeout,
   "ASSOC TIMEOUT");
} else if (event->u.mlme.data == AUTH_EVENT) {
if (event->u.mlme.status == MLME_DENIED)
-   CHECK_MLME_TRIGGER(mvm, trig, buf,
-  trig_mlme->stop_auth_denied,
+   CHECK_MLME_TRIGGER(stop_auth_denied,
   "DENIED AUTH: reason %d",
   event->u.mlme.reason);
else if (event->u.mlme.status == MLME_TIMEOUT)
-   CHECK_MLME_TRIGGER(mvm, trig, buf,
-  trig_mlme->stop_auth_timeout,
+   CHECK_MLME_TRIGGER(stop_auth_timeout,
   "AUTH TIMEOUT");
} else if (event->u.mlme.data == DEAUTH_RX_EVENT) {
-   CHECK_MLME_TRIGGER(mvm, trig, buf,
-  trig_mlme->stop_rx_deauth,
+   CHECK_MLME_TRIGGER(stop_rx_deauth,
   "DEAUTH RX %d", event->u.mlme.reason);
} else if (event->u.mlme.data == DEAUTH_TX_EVENT) {
-   CHECK_MLME_TRIGGER(mvm, trig, buf,
-  trig_mlme->stop_tx_deauth,
+   CHECK_MLME_TRIGGER(stop_tx_deauth,
   "DEAUTH TX %d", event->u.mlme.reason);
}
 #undef CHECK_MLME_TRIGGER
-- 
2.11.0



[PATCH 11/31] iwlwifi: pcie: fix 9000-series RF-kill interrupt propagation

2017-06-28 Thread Luca Coelho
From: Johannes Berg 

A hardware issue on 9000 series devices sometimes causes RF-kill
interrupts to not be propagated to the host properly if ASPM is
enabled. Work around this by setting the right hardware bit to
allow it to interrupt the host for this reason (rfkill).

Signed-off-by: Johannes Berg 
Signed-off-by: Luca Coelho 
---
 drivers/net/wireless/intel/iwlwifi/iwl-csr.h   |  2 +-
 drivers/net/wireless/intel/iwlwifi/pcie/internal.h | 10 ++
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-csr.h 
b/drivers/net/wireless/intel/iwlwifi/iwl-csr.h
index e239b1d92cf9..c6c1876c1ad4 100644
--- a/drivers/net/wireless/intel/iwlwifi/iwl-csr.h
+++ b/drivers/net/wireless/intel/iwlwifi/iwl-csr.h
@@ -312,7 +312,7 @@
 #define CSR_GP_CNTRL_REG_VAL_MAC_ACCESS_EN   (0x0001)
 
 #define CSR_GP_CNTRL_REG_MSK_POWER_SAVE_TYPE (0x0700)
-#define CSR_GP_CNTRL_REG_FLAG_MAC_POWER_SAVE (0x0400)
+#define CSR_GP_CNTRL_REG_FLAG_RFKILL_WAKE_L1A_EN (0x0400)
 #define CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW  (0x0800)
 
 
diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/internal.h 
b/drivers/net/wireless/intel/iwlwifi/pcie/internal.h
index 1f4bc933f0f2..7ec2d96ccceb 100644
--- a/drivers/net/wireless/intel/iwlwifi/pcie/internal.h
+++ b/drivers/net/wireless/intel/iwlwifi/pcie/internal.h
@@ -674,6 +674,16 @@ static inline void iwl_enable_rfkill_int(struct iwl_trans 
*trans)
iwl_enable_hw_int_msk_msix(trans,
   MSIX_HW_INT_CAUSES_REG_RF_KILL);
}
+
+   if (trans->cfg->device_family == IWL_DEVICE_FAMILY_9000) {
+   /*
+* On 9000-series devices this bit isn't enabled by default, so
+* when we power down the device we need set the bit to allow it
+* to wake up the PCI-E bus for RF-kill interrupts.
+*/
+   iwl_set_bit(trans, CSR_GP_CNTRL,
+   CSR_GP_CNTRL_REG_FLAG_RFKILL_WAKE_L1A_EN);
+   }
 }
 
 void iwl_pcie_handle_rfkill_irq(struct iwl_trans *trans);
-- 
2.11.0



[PATCH 15/31] iwlwifi: add twelve new 9560 series PCI IDs

2017-06-28 Thread Luca Coelho
From: Tzipi Peres 

Add twelve new PCI IDs for the 9560 series.

Signed-off-by: Tzipi Peres 
Signed-off-by: Luca Coelho 
---
 drivers/net/wireless/intel/iwlwifi/pcie/drv.c | 15 ++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/drv.c 
b/drivers/net/wireless/intel/iwlwifi/pcie/drv.c
index e995b055be4e..7bf765ba5235 100644
--- a/drivers/net/wireless/intel/iwlwifi/pcie/drv.c
+++ b/drivers/net/wireless/intel/iwlwifi/pcie/drv.c
@@ -7,7 +7,7 @@
  *
  * Copyright(c) 2007 - 2014 Intel Corporation. All rights reserved.
  * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
- * Copyright(c) 2016 Intel Deutschland GmbH
+ * Copyright(c) 2016-2017 Intel Deutschland GmbH
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of version 2 of the GNU General Public License as
@@ -35,6 +35,7 @@
  * Copyright(c) 2005 - 2014 Intel Corporation. All rights reserved.
  * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
  * All rights reserved.
+ * Copyright(c) 2017 Intel Deutschland GmbH
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -535,6 +536,18 @@ static const struct pci_device_id iwl_hw_card_ids[] = {
{IWL_PCI_DEVICE(0x31DC, 0x0030, iwl9560_2ac_cfg)},
{IWL_PCI_DEVICE(0x2526, 0x1030, iwl9560_2ac_cfg)},
{IWL_PCI_DEVICE(0xA370, 0x1030, iwl9560_2ac_cfg)},
+   {IWL_PCI_DEVICE(0x9DF0, 0x0034, iwl9560_2ac_cfg)},
+   {IWL_PCI_DEVICE(0xA370, 0x0034, iwl9560_2ac_cfg)},
+   {IWL_PCI_DEVICE(0x31DC, 0x0034, iwl9560_2ac_cfg)},
+   {IWL_PCI_DEVICE(0x2526, 0x0038, iwl9560_2ac_cfg)},
+   {IWL_PCI_DEVICE(0x2526, 0x003C, iwl9560_2ac_cfg)},
+   {IWL_PCI_DEVICE(0x9DF0, 0x0038, iwl9560_2ac_cfg)},
+   {IWL_PCI_DEVICE(0xA370, 0x0038, iwl9560_2ac_cfg)},
+   {IWL_PCI_DEVICE(0x31DC, 0x0038, iwl9560_2ac_cfg)},
+   {IWL_PCI_DEVICE(0x9DF0, 0x003C, iwl9560_2ac_cfg)},
+   {IWL_PCI_DEVICE(0xA370, 0x003C, iwl9560_2ac_cfg)},
+   {IWL_PCI_DEVICE(0x31DC, 0x003C, iwl9560_2ac_cfg)},
+   {IWL_PCI_DEVICE(0x2526, 0x0034, iwl9560_2ac_cfg)},
 
 /* a000 Series */
{IWL_PCI_DEVICE(0x2720, 0x0A10, iwla000_2ac_cfg_hr_cdb)},
-- 
2.11.0



[PATCH 25/31] iwlwifi: mvm: unconditionally stop device after init

2017-06-28 Thread Luca Coelho
From: Johannes Berg 

In commit b93b1fe3b532 ("iwlwifi: mvm: fix init_dbg flow to work
as expected"), the code was changed to make the stop conditional
on not having failed (and on not having init_dbg), which doesn't
make sense - we should stop the device regardless of failures.

Failure to do so is leading to the device being enabled when it
shouldn't be, and - if it gets re-enabled later - the new context
info code gets confused as paging data wasn't freed.

Remove the invalid error condition again.

Fixes: b93b1fe3b532 ("iwlwifi: mvm: fix init_dbg flow to work as expected")
Signed-off-by: Johannes Berg 
Signed-off-by: Luca Coelho 
---
 drivers/net/wireless/intel/iwlwifi/mvm/ops.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/ops.c 
b/drivers/net/wireless/intel/iwlwifi/mvm/ops.c
index a0907762b0bf..c1ce92f5306d 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/ops.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/ops.c
@@ -741,7 +741,7 @@ iwl_op_mode_mvm_start(struct iwl_trans *trans, const struct 
iwl_cfg *cfg,
mutex_lock(>mutex);
iwl_mvm_ref(mvm, IWL_MVM_REF_INIT_UCODE);
err = iwl_run_init_mvm_ucode(mvm, true);
-   if (!err || !iwlmvm_mod_params.init_dbg)
+   if (!iwlmvm_mod_params.init_dbg)
iwl_mvm_stop_device(mvm);
iwl_mvm_unref(mvm, IWL_MVM_REF_INIT_UCODE);
mutex_unlock(>mutex);
-- 
2.11.0



[PATCH 12/31] iwlwifi: mvm: change sta_id to u8

2017-06-28 Thread Luca Coelho
From: Sharon Dvir 

The sta_id variable is used as an index in an array, should be unsigned.
Found by Klocwork.

Fixes: 9f9af3d7d303 ("iwlwifi: mvm: re-aggregate shared queue after unsharing")
Signed-off-by: Sharon Dvir 
Signed-off-by: Luca Coelho 
---
 drivers/net/wireless/intel/iwlwifi/mvm/sta.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/sta.c 
b/drivers/net/wireless/intel/iwlwifi/mvm/sta.c
index 02f35a929606..9ec427966533 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/sta.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/sta.c
@@ -398,7 +398,7 @@ static int iwl_mvm_get_queue_agg_tids(struct iwl_mvm *mvm, 
int queue)
struct iwl_mvm_sta *mvmsta;
unsigned long tid_bitmap;
unsigned long agg_tids = 0;
-   s8 sta_id;
+   u8 sta_id;
int tid;
 
lockdep_assert_held(>mutex);
@@ -989,7 +989,7 @@ static void iwl_mvm_unshare_queue(struct iwl_mvm *mvm, int 
queue)
 {
struct ieee80211_sta *sta;
struct iwl_mvm_sta *mvmsta;
-   s8 sta_id;
+   u8 sta_id;
int tid = -1;
unsigned long tid_bitmap;
unsigned int wdg_timeout;
-- 
2.11.0



[PATCH 05/31] iwlwifi: mvm: remove various unused command IDs/structs

2017-06-28 Thread Luca Coelho
From: Johannes Berg 

Signed-off-by: Johannes Berg 
Signed-off-by: Luca Coelho 
---
 drivers/net/wireless/intel/iwlwifi/mvm/fw-api.h | 28 -
 drivers/net/wireless/intel/iwlwifi/mvm/ops.c| 11 --
 2 files changed, 39 deletions(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/fw-api.h 
b/drivers/net/wireless/intel/iwlwifi/mvm/fw-api.h
index 612546334545..60f86997f8cf 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/fw-api.h
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/fw-api.h
@@ -295,7 +295,6 @@ enum iwl_legacy_cmds {
HOT_SPOT_CMD = 0x53,
SCAN_OFFLOAD_COMPLETE = 0x6D,
SCAN_OFFLOAD_UPDATE_PROFILES_CMD = 0x6E,
-   SCAN_OFFLOAD_CONFIG_CMD = 0x6f,
MATCH_FOUND_NOTIFICATION = 0xd9,
SCAN_ITERATION_COMPLETE = 0xe7,
 
@@ -329,8 +328,6 @@ enum iwl_legacy_cmds {
 */
NVM_ACCESS_CMD = 0x88,
 
-   SET_CALIB_DEFAULT_CMD = 0x8e,
-
BEACON_NOTIFICATION = 0x90,
/**
 * @BEACON_TEMPLATE_CMD:
@@ -364,8 +361,6 @@ enum iwl_legacy_cmds {
 */
REDUCE_TX_POWER_CMD = 0x9f,
 
-   /* RF-KILL commands and notifications */
-   CARD_STATE_CMD = 0xa0,
CARD_STATE_NOTIFICATION = 0xa1,
 
MISSED_BEACONS_NOTIFICATION = 0xa2,
@@ -411,9 +406,6 @@ enum iwl_legacy_cmds {
 
MARKER_CMD = 0xcb,
 
-   /* BT Coex */
-   BT_COEX_PRIO_TABLE = 0xcc,
-   BT_COEX_PROT_ENV = 0xcd,
/**
 * @BT_PROFILE_NOTIFICATION:  iwl_bt_coex_profile_notif
 */
@@ -422,7 +414,6 @@ enum iwl_legacy_cmds {
 * @BT_CONFIG:  iwl_bt_coex_cmd
 */
BT_CONFIG = 0x9b,
-   BT_COEX_UPDATE_SW_BOOST = 0x5a,
BT_COEX_UPDATE_CORUN_LUT = 0x5b,
BT_COEX_UPDATE_REDUCED_TXP = 0x5c,
/**
@@ -439,11 +430,8 @@ enum iwl_legacy_cmds {
 */
REPLY_BEACON_FILTERING_CMD = 0xd2,
 
-   /* DTS measurements */
-   CMD_DTS_MEASUREMENT_TRIGGER = 0xdc,
DTS_MEASUREMENT_NOTIFICATION = 0xdd,
 
-   REPLY_DEBUG_CMD = 0xf0,
LDBG_CONFIG_CMD = 0xf6,
DEBUG_LOG_MSG = 0xf7,
 
@@ -484,12 +472,9 @@ enum iwl_legacy_cmds {
 * @WOWLAN_GET_STATUSES: response in  iwl_wowlan_status
 */
WOWLAN_GET_STATUSES = 0xe5,
-   WOWLAN_TX_POWER_PER_DB = 0xe6,
 
/* and for NetDetect */
SCAN_OFFLOAD_PROFILES_QUERY_CMD = 0x56,
-   SCAN_OFFLOAD_HOTSPOTS_CONFIG_CMD = 0x58,
-   SCAN_OFFLOAD_HOTSPOTS_QUERY_CMD = 0x59,
 };
 
 /* Please keep this enum *SORTED* by hex value.
@@ -1580,19 +1565,6 @@ struct iwl_mfu_assert_dump_notif {
__le32   data[0];
 } __packed; /*MFU_DUMP_ASSERT_API_S_VER_1*/
 
-/**
- * struct iwl_set_calib_default_cmd - set default value for calibration.
- * ( SET_CALIB_DEFAULT_CMD = 0x8e )
- * @calib_index: the calibration to set value for
- * @length: of data
- * @data: the value to set for the calibration result
- */
-struct iwl_set_calib_default_cmd {
-   __le16 calib_index;
-   __le16 length;
-   u8 data[0];
-} __packed; /* PHY_CALIB_OVERRIDE_VALUES_S */
-
 #define MAX_PORT_ID_NUM2
 #define MAX_MCAST_FILTERING_ADDRESSES 256
 
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/ops.c 
b/drivers/net/wireless/intel/iwlwifi/mvm/ops.c
index 2e4bfe9f07ec..695d1aead89f 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/ops.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/ops.c
@@ -357,9 +357,6 @@ static const struct iwl_hcmd_names iwl_mvm_legacy_names[] = 
{
HCMD_NAME(SCAN_OFFLOAD_ABORT_CMD),
HCMD_NAME(HOT_SPOT_CMD),
HCMD_NAME(SCAN_OFFLOAD_PROFILES_QUERY_CMD),
-   HCMD_NAME(SCAN_OFFLOAD_HOTSPOTS_CONFIG_CMD),
-   HCMD_NAME(SCAN_OFFLOAD_HOTSPOTS_QUERY_CMD),
-   HCMD_NAME(BT_COEX_UPDATE_SW_BOOST),
HCMD_NAME(BT_COEX_UPDATE_CORUN_LUT),
HCMD_NAME(BT_COEX_UPDATE_REDUCED_TXP),
HCMD_NAME(BT_COEX_CI),
@@ -368,13 +365,11 @@ static const struct iwl_hcmd_names iwl_mvm_legacy_names[] 
= {
HCMD_NAME(PHY_DB_CMD),
HCMD_NAME(SCAN_OFFLOAD_COMPLETE),
HCMD_NAME(SCAN_OFFLOAD_UPDATE_PROFILES_CMD),
-   HCMD_NAME(SCAN_OFFLOAD_CONFIG_CMD),
HCMD_NAME(POWER_TABLE_CMD),
HCMD_NAME(PSM_UAPSD_AP_MISBEHAVING_NOTIFICATION),
HCMD_NAME(REPLY_THERMAL_MNG_BACKOFF),
HCMD_NAME(DC2DC_CONFIG_CMD),
HCMD_NAME(NVM_ACCESS_CMD),
-   HCMD_NAME(SET_CALIB_DEFAULT_CMD),
HCMD_NAME(BEACON_NOTIFICATION),
HCMD_NAME(BEACON_TEMPLATE_CMD),
HCMD_NAME(TX_ANT_CONFIGURATION_CMD),
@@ -383,7 +378,6 @@ static const struct iwl_hcmd_names iwl_mvm_legacy_names[] = 
{
HCMD_NAME(STATISTICS_NOTIFICATION),
HCMD_NAME(EOSP_NOTIFICATION),
HCMD_NAME(REDUCE_TX_POWER_CMD),
-   HCMD_NAME(CARD_STATE_CMD),
HCMD_NAME(CARD_STATE_NOTIFICATION),
HCMD_NAME(MISSED_BEACONS_NOTIFICATION),
HCMD_NAME(TDLS_CONFIG_CMD),
@@ -398,8 +392,6 @@ static const struct 

[PATCH 04/31] iwlwifi: mvm: fix various "Excess ... description" kernel-doc warnings

2017-06-28 Thread Luca Coelho
From: Johannes Berg 

Fix various "Excess struct/union/enum/typedef member '...' description
in '...'" warnings from kernel-doc, mostly caused by typos.

Signed-off-by: Johannes Berg 
Signed-off-by: Luca Coelho 
---
 drivers/net/wireless/intel/iwlwifi/mvm/fw-api-d3.h   | 4 ++--
 drivers/net/wireless/intel/iwlwifi/mvm/fw-api-mac.h  | 3 +--
 drivers/net/wireless/intel/iwlwifi/mvm/fw-api-rx.h   | 2 +-
 drivers/net/wireless/intel/iwlwifi/mvm/fw-api-scan.h | 8 
 drivers/net/wireless/intel/iwlwifi/mvm/fw-api-tx.h   | 1 -
 drivers/net/wireless/intel/iwlwifi/mvm/fw-api.h  | 5 ++---
 6 files changed, 10 insertions(+), 13 deletions(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/fw-api-d3.h 
b/drivers/net/wireless/intel/iwlwifi/mvm/fw-api-d3.h
index 3463d1c577e8..2bfe4de6ac5a 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/fw-api-d3.h
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/fw-api-d3.h
@@ -183,7 +183,7 @@ struct iwl_targ_addr {
 /**
  * struct iwl_proto_offload_cmd_v3_small - ARP/NS offload configuration
  * @common: common/IPv4 configuration
- * @target_ipv6_addr: target IPv6 addresses
+ * @targ_addrs: target IPv6 addresses
  * @ns_config: NS offload configurations
  */
 struct iwl_proto_offload_cmd_v3_small {
@@ -196,7 +196,7 @@ struct iwl_proto_offload_cmd_v3_small {
 /**
  * struct iwl_proto_offload_cmd_v3_large - ARP/NS offload configuration
  * @common: common/IPv4 configuration
- * @target_ipv6_addr: target IPv6 addresses
+ * @targ_addrs: target IPv6 addresses
  * @ns_config: NS offload configurations
  */
 struct iwl_proto_offload_cmd_v3_large {
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/fw-api-mac.h 
b/drivers/net/wireless/intel/iwlwifi/mvm/fw-api-mac.h
index 1d970bf0d735..932adaf575eb 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/fw-api-mac.h
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/fw-api-mac.h
@@ -331,7 +331,7 @@ struct iwl_ac_qos {
  * @id_and_color: ID and color of the MAC
  * @action: action to perform, one of FW_CTXT_ACTION_*
  * @mac_type: one of  iwl_mac_types
- * @tsd_id: TSF HW timer, one of  iwl_tsf_id
+ * @tsf_id: TSF HW timer, one of  iwl_tsf_id
  * @node_addr: MAC address
  * @bssid_addr: BSSID
  * @cck_rates: basic rates available for CCK
@@ -342,7 +342,6 @@ struct iwl_ac_qos {
  * @filter_flags: combination of  iwl_mac_filter_flags
  * @qos_flags: from  iwl_mac_qos_flags
  * @ac: one iwl_mac_qos configuration for each AC
- * @mac_specific: one of struct iwl_mac_data_*, according to mac_type
  */
 struct iwl_mac_ctx_cmd {
/* COMMON_INDEX_HDR_API_S_VER_1 */
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/fw-api-rx.h 
b/drivers/net/wireless/intel/iwlwifi/mvm/fw-api-rx.h
index ad7ab6dd86cb..02c321738e1e 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/fw-api-rx.h
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/fw-api-rx.h
@@ -96,7 +96,7 @@ enum iwl_mac_context_info {
  * @beacon_time_stamp: beacon at on-air rise
  * @phy_flags: general phy flags: band, modulation, ...
  * @channel: channel number
- * @non_cfg_phy_buf: for various implementations of non_cfg_phy
+ * @non_cfg_phy: for various implementations of non_cfg_phy
  * @rate_n_flags: RATE_MCS_*
  * @byte_count: frame's byte-count
  * @frame_time: frame's time on the air, based on byte count and frame rate
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/fw-api-scan.h 
b/drivers/net/wireless/intel/iwlwifi/mvm/fw-api-scan.h
index f8e92026bdc6..e752359841b8 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/fw-api-scan.h
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/fw-api-scan.h
@@ -137,7 +137,7 @@ enum iwl_scan_offload_band_selection {
  * struct iwl_scan_offload_profile - SCAN_OFFLOAD_PROFILE_S
  * @ssid_index:index to ssid list in fixed part
  * @unicast_cipher:encryption algorithm to match - bitmap
- * @aut_alg:   authentication algorithm to match - bitmap
+ * @auth_alg:  authentication algorithm to match - bitmap
  * @network_type:  enum iwl_scan_offload_network_type
  * @band_selection:enum iwl_scan_offload_band_selection
  * @client_bitmap: clients waiting for match - enum scan_framework_client
@@ -221,7 +221,7 @@ enum iwl_scan_channel_flags_lmac {
  * struct iwl_scan_channel_cfg_lmac - SCAN_CHANNEL_CFG_S_VER2
  * @flags: bits 1-20: directed scan to i'th ssid
  * other bits  iwl_scan_channel_flags_lmac
- * @channel_number:channel number 1-13 etc
+ * @channel_num:   channel number 1-13 etc
  * @iter_count:scan iteration on this channel
  * @iter_interval: interval in seconds between iterations on one channel
  */
@@ -320,13 +320,13 @@ enum iwl_scan_priority_ext {
 /**
  * struct iwl_scan_req_lmac - SCAN_REQUEST_CMD_API_S_VER_1
  * @reserved1: for alignment and future use
- * @channel_num: num of channels to scan
+ * @n_channels: num of channels to scan
  * @active-dwell: dwell time for active 

[PATCH 03/31] iwlwifi: mvm: remove some CamelCase from firmware API

2017-06-28 Thread Luca Coelho
From: Johannes Berg 

Signed-off-by: Johannes Berg 
Signed-off-by: Luca Coelho 
---
 drivers/net/wireless/intel/iwlwifi/mvm/fw-api-d3.h | 2 +-
 drivers/net/wireless/intel/iwlwifi/mvm/fw-api.h| 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/fw-api-d3.h 
b/drivers/net/wireless/intel/iwlwifi/mvm/fw-api-d3.h
index edde49202786..3463d1c577e8 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/fw-api-d3.h
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/fw-api-d3.h
@@ -164,7 +164,7 @@ struct iwl_proto_offload_cmd_v2 {
u8 solicited_node_ipv6_addr[16];
u8 target_ipv6_addr[IWL_PROTO_OFFLOAD_NUM_IPV6_ADDRS_V2][16];
u8 ndp_mac_addr[ETH_ALEN];
-   u8 numValidIPv6Addresses;
+   u8 num_valid_ipv6_addrs;
u8 reserved2[3];
 } __packed; /* PROT_OFFLOAD_CONFIG_CMD_DB_S_VER_2 */
 
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/fw-api.h 
b/drivers/net/wireless/intel/iwlwifi/mvm/fw-api.h
index b84e8ddbbbc9..7588b93f835a 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/fw-api.h
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/fw-api.h
@@ -1748,8 +1748,8 @@ enum iwl_mvm_marker_id {
  * @metadata: additional meta data that will be written to the unsiffer log
  */
 struct iwl_mvm_marker {
-   u8 dwLen;
-   u8 markerId;
+   u8 dw_len;
+   u8 marker_id;
__le16 reserved;
__le64 timestamp;
__le32 metadata[0];
-- 
2.11.0



[PATCH 07/31] iwlwifi: mvm: add documentation for all command IDs

2017-06-28 Thread Luca Coelho
From: Johannes Berg 

Signed-off-by: Johannes Berg 
Signed-off-by: Luca Coelho 
---
 drivers/net/wireless/intel/iwlwifi/iwl-fw-api.h|  24 ++
 drivers/net/wireless/intel/iwlwifi/iwl-phy-db.c|  18 --
 drivers/net/wireless/intel/iwlwifi/mvm/fw-api-tx.h |   1 +
 drivers/net/wireless/intel/iwlwifi/mvm/fw-api.h| 276 -
 4 files changed, 292 insertions(+), 27 deletions(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-fw-api.h 
b/drivers/net/wireless/intel/iwlwifi/iwl-fw-api.h
index a004409fa984..0e107f916ce3 100644
--- a/drivers/net/wireless/intel/iwlwifi/iwl-fw-api.h
+++ b/drivers/net/wireless/intel/iwlwifi/iwl-fw-api.h
@@ -202,4 +202,28 @@ struct iwl_tx_queue_cfg_rsp {
__le16 reserved;
 } __packed; /* TX_QUEUE_CFG_RSP_API_S_VER_2 */
 
+/**
+ * struct iwl_calib_res_notif_phy_db - Receive phy db chunk after calibrations
+ * @type: type of the result - mostly ignored
+ * @length: length of the data
+ * @data: data, length in @length
+ */
+struct iwl_calib_res_notif_phy_db {
+   __le16 type;
+   __le16 length;
+   u8 data[];
+} __packed;
+
+/**
+ * struct iwl_phy_db_cmd - configure operational ucode
+ * @type: type of the data
+ * @length: length of the data
+ * @data: data, length in @length
+ */
+struct iwl_phy_db_cmd {
+   __le16 type;
+   __le16 length;
+   u8 data[];
+} __packed;
+
 #endif /* __iwl_fw_api_h__*/
diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-phy-db.c 
b/drivers/net/wireless/intel/iwlwifi/iwl-phy-db.c
index 2893826d7d2b..b7cd813ba70f 100644
--- a/drivers/net/wireless/intel/iwlwifi/iwl-phy-db.c
+++ b/drivers/net/wireless/intel/iwlwifi/iwl-phy-db.c
@@ -112,30 +112,12 @@ enum iwl_phy_db_section_type {
 
 #define PHY_DB_CMD 0x6c
 
-/*
- * phy db - configure operational ucode
- */
-struct iwl_phy_db_cmd {
-   __le16 type;
-   __le16 length;
-   u8 data[];
-} __packed;
-
 /* for parsing of tx power channel group data that comes from the firmware*/
 struct iwl_phy_db_chg_txp {
__le32 space;
__le16 max_channel_idx;
 } __packed;
 
-/*
- * phy db - Receive phy db chunk after calibrations
- */
-struct iwl_calib_res_notif_phy_db {
-   __le16 type;
-   __le16 length;
-   u8 data[];
-} __packed;
-
 struct iwl_phy_db *iwl_phy_db_init(struct iwl_trans *trans)
 {
struct iwl_phy_db *phy_db = kzalloc(sizeof(struct iwl_phy_db),
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/fw-api-tx.h 
b/drivers/net/wireless/intel/iwlwifi/mvm/fw-api-tx.h
index 4a6b919f13de..9d2a991221cf 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/fw-api-tx.h
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/fw-api-tx.h
@@ -595,6 +595,7 @@ struct iwl_mvm_tx_resp_v3 {
  * @ra_tid: bits [3:0] = ra, bits [7:4] = tid
  * @frame_ctrl: frame control
  * @tx_queue: TX queue for this response
+ * @reserved2: reserved for padding/alignment
  * @status: for non-agg:  frame status TX_STATUS_*
  * For version 6 TX response isn't received for aggregation at all.
  *
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/fw-api.h 
b/drivers/net/wireless/intel/iwlwifi/mvm/fw-api.h
index 60f86997f8cf..89e5ba3f4e42 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/fw-api.h
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/fw-api.h
@@ -185,7 +185,15 @@ enum iwl_legacy_cmds {
 * uses  iwl_scan_config_v1 or  iwl_scan_config
 */
SCAN_CFG_CMD = 0xc,
+
+   /**
+* @SCAN_REQ_UMAC: uses  iwl_scan_req_umac
+*/
SCAN_REQ_UMAC = 0xd,
+
+   /**
+* @SCAN_ABORT_UMAC: uses  iwl_umac_scan_abort
+*/
SCAN_ABORT_UMAC = 0xe,
 
/**
@@ -193,6 +201,10 @@ enum iwl_legacy_cmds {
 */
SCAN_COMPLETE_UMAC = 0xf,
 
+   /**
+* @BA_WINDOW_STATUS_NOTIFICATION_ID:
+* uses  iwl_ba_window_status_notif
+*/
BA_WINDOW_STATUS_NOTIFICATION_ID = 0x13,
 
/**
@@ -207,12 +219,15 @@ enum iwl_legacy_cmds {
 *  iwl_mvm_add_sta_cmd or  iwl_mvm_add_sta_cmd_v7.
 */
ADD_STA = 0x18,
+
/**
 * @REMOVE_STA:  iwl_mvm_rm_sta_cmd
 */
REMOVE_STA = 0x19,
 
-   /* paging get item */
+   /**
+* @FW_GET_ITEM_CMD: uses  iwl_fw_get_item_cmd
+*/
FW_GET_ITEM_CMD = 0x1a,
 
/**
@@ -242,15 +257,33 @@ enum iwl_legacy_cmds {
 */
SCD_QUEUE_CFG = 0x1d,
 
-   /* global key */
+   /**
+* @WEP_KEY: uses  iwl_mvm_wep_key_cmd
+*/
WEP_KEY = 0x20,
 
-   /* Memory */
+   /**
+* @SHARED_MEM_CFG:
+* retrieve shared memory configuration - response in
+*  iwl_shared_mem_cfg
+*/
SHARED_MEM_CFG = 0x25,
 
-   /* TDLS */
+   /**
+* @TDLS_CHANNEL_SWITCH_CMD: uses  iwl_tdls_channel_switch_cmd
+*/
TDLS_CHANNEL_SWITCH_CMD = 0x27,
+
+   /**
+* @TDLS_CHANNEL_SWITCH_NOTIFICATION:
+

[PATCH 09/31] iwlwifi: dvm: use macros for format strings

2017-06-28 Thread Luca Coelho
From: Johannes Berg 

Some static checkers (e.g. smatch) complain if a non-constant
format string is used, even if that's a static const variable.
Since there's no impact on code generation, just change those
format strings to be macros.

Signed-off-by: Johannes Berg 
Signed-off-by: Luca Coelho 
---
 drivers/net/wireless/intel/iwlwifi/dvm/debugfs.c | 9 -
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/dvm/debugfs.c 
b/drivers/net/wireless/intel/iwlwifi/dvm/debugfs.c
index 376c79337a0e..937be04c6c71 100644
--- a/drivers/net/wireless/intel/iwlwifi/dvm/debugfs.c
+++ b/drivers/net/wireless/intel/iwlwifi/dvm/debugfs.c
@@ -681,11 +681,10 @@ DEBUGFS_READ_FILE_OPS(temperature);
 DEBUGFS_READ_WRITE_FILE_OPS(sleep_level_override);
 DEBUGFS_READ_FILE_OPS(current_sleep_command);
 
-static const char *fmt_value = "  %-30s %10u\n";
-static const char *fmt_hex   = "  %-30s   0x%02X\n";
-static const char *fmt_table = "  %-30s %10u  %10u  %10u  %10u\n";
-static const char *fmt_header =
-   "%-32scurrent  cumulative   delta max\n";
+#define fmt_value  "  %-30s %10u\n"
+#define fmt_hex"  %-30s   0x%02X\n"
+#define fmt_table  "  %-30s %10u  %10u  %10u  %10u\n"
+#define fmt_header "%-32scurrent  cumulative   delta max\n"
 
 static int iwl_statistics_flag(struct iwl_priv *priv, char *buf, int bufsz)
 {
-- 
2.11.0



[PATCH 06/31] iwlwifi: mvm: use __le16 even for reserved fields

2017-06-28 Thread Luca Coelho
From: Johannes Berg 

Signed-off-by: Johannes Berg 
Signed-off-by: Luca Coelho 
---
 drivers/net/wireless/intel/iwlwifi/mvm/fw-api-rx.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/fw-api-rx.h 
b/drivers/net/wireless/intel/iwlwifi/mvm/fw-api-rx.h
index 02c321738e1e..39b6f592a004 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/fw-api-rx.h
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/fw-api-rx.h
@@ -569,7 +569,7 @@ struct iwl_mvm_pm_state_notification {
u8 sta_id;
u8 type;
/* private: */
-   u16 reserved;
+   __le16 reserved;
 } __packed; /* PEER_PM_NTFY_API_S_VER_1 */
 
 #endif /* __fw_api_rx_h__ */
-- 
2.11.0



[PATCH 02/31] iwlwifi: mvm: Add debugfs entry to retrieve SAR geographic profile

2017-06-28 Thread Luca Coelho
From: Haim Dreyfuss 

Add a debugfs entry to get a verbose description of the power settings
used in each band with the currently selected SAR geographic profile.

Signed-off-by: Haim Dreyfuss 
Signed-off-by: Luca Coelho 
---
 drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c | 50 
 1 file changed, 50 insertions(+)

diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c 
b/drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c
index c2a1aeef74ec..c3ab13ee4097 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c
@@ -336,6 +336,49 @@ static ssize_t iwl_dbgfs_nic_temp_read(struct file *file,
return simple_read_from_buffer(user_buf, count, ppos, buf, pos);
 }
 
+#ifdef CONFIG_ACPI
+static ssize_t iwl_dbgfs_sar_geo_profile_read(struct file *file,
+ char __user *user_buf,
+ size_t count, loff_t *ppos)
+{
+   struct iwl_mvm *mvm = file->private_data;
+   char buf[256];
+   int pos = 0;
+   int bufsz = sizeof(buf);
+   int tbl_idx;
+   u8 *value;
+
+   if (!iwl_mvm_firmware_running(mvm))
+   return -EIO;
+
+   mutex_lock(>mutex);
+   tbl_idx = iwl_mvm_get_sar_geo_profile(mvm);
+   if (tbl_idx < 0) {
+   mutex_unlock(>mutex);
+   return tbl_idx;
+   }
+
+   if (!tbl_idx) {
+   pos = scnprintf(buf, bufsz,
+   "SAR geographic profile disabled\n");
+   } else {
+   value = >geo_profiles[tbl_idx - 1].values[0];
+
+   pos += scnprintf(buf + pos, bufsz - pos,
+"Use geographic profile %d\n", tbl_idx);
+   pos += scnprintf(buf + pos, bufsz - pos,
+"2.4GHz:\n\tChain A offset: %hhd dBm\n\tChain 
B offset: %hhd dBm\n\tmax tx power: %hhd dBm\n",
+value[1], value[2], value[0]);
+   pos += scnprintf(buf + pos, bufsz - pos,
+"5.2GHz:\n\tChain A offset: %hhd dBm\n\tChain 
B offset: %hhd dBm\n\tmax tx power: %hhd dBm\n",
+value[4], value[5], value[3]);
+   }
+   mutex_unlock(>mutex);
+
+   return simple_read_from_buffer(user_buf, count, ppos, buf, pos);
+}
+#endif
+
 static ssize_t iwl_dbgfs_stations_read(struct file *file, char __user 
*user_buf,
   size_t count, loff_t *ppos)
 {
@@ -1572,6 +1615,9 @@ MVM_DEBUGFS_READ_WRITE_FILE_OPS(bcast_filters_macs, 256);
 #ifdef CONFIG_PM_SLEEP
 MVM_DEBUGFS_READ_WRITE_FILE_OPS(d3_sram, 8);
 #endif
+#ifdef CONFIG_ACPI
+MVM_DEBUGFS_READ_FILE_OPS(sar_geo_profile);
+#endif
 
 static ssize_t iwl_dbgfs_mem_read(struct file *file, char __user *user_buf,
  size_t count, loff_t *ppos)
@@ -1744,6 +1790,10 @@ int iwl_mvm_dbgfs_register(struct iwl_mvm *mvm, struct 
dentry *dbgfs_dir)
MVM_DEBUGFS_ADD_FILE(cont_recording, mvm->debugfs_dir, S_IWUSR);
MVM_DEBUGFS_ADD_FILE(indirection_tbl, mvm->debugfs_dir, S_IWUSR);
MVM_DEBUGFS_ADD_FILE(inject_packet, mvm->debugfs_dir, S_IWUSR);
+#ifdef CONFIG_ACPI
+   MVM_DEBUGFS_ADD_FILE(sar_geo_profile, dbgfs_dir, S_IRUSR);
+#endif
+
if (!debugfs_create_bool("enable_scan_iteration_notif",
 S_IRUSR | S_IWUSR,
 mvm->debugfs_dir,
-- 
2.11.0



[PATCH 08/31] iwlwifi: mvm: fix a bunch of kernel-doc warnings

2017-06-28 Thread Luca Coelho
From: Johannes Berg 

Fix the kernel-doc, and remove some fields even the firmware doesn't
use in ToF, RX, scan, station and generic FW APIS.

Signed-off-by: Johannes Berg 
Signed-off-by: Luca Coelho 
---
 .../net/wireless/intel/iwlwifi/mvm/fw-api-coex.h   | 11 ++--
 drivers/net/wireless/intel/iwlwifi/mvm/fw-api-d3.h |  5 ++
 .../net/wireless/intel/iwlwifi/mvm/fw-api-mac.h|  2 +
 drivers/net/wireless/intel/iwlwifi/mvm/fw-api-rs.h |  3 ++
 drivers/net/wireless/intel/iwlwifi/mvm/fw-api-rx.h | 33 ++--
 .../net/wireless/intel/iwlwifi/mvm/fw-api-scan.h   | 28 ++
 .../net/wireless/intel/iwlwifi/mvm/fw-api-sta.h| 63 --
 .../net/wireless/intel/iwlwifi/mvm/fw-api-tof.h| 14 +++--
 drivers/net/wireless/intel/iwlwifi/mvm/fw-api.h| 26 ++---
 9 files changed, 127 insertions(+), 58 deletions(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/fw-api-coex.h 
b/drivers/net/wireless/intel/iwlwifi/mvm/fw-api-coex.h
index c432fdb98630..8cd06aaa1f54 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/fw-api-coex.h
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/fw-api-coex.h
@@ -7,6 +7,7 @@
  *
  * Copyright(c) 2013 - 2014 Intel Corporation. All rights reserved.
  * Copyright(c) 2013 - 2014 Intel Mobile Communications GmbH
+ * Copyright(c) 2017Intel Deutschland GmbH
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of version 2 of the GNU General Public License as
@@ -33,6 +34,7 @@
  *
  * Copyright(c) 2013 - 2014 Intel Corporation. All rights reserved.
  * Copyright(c) 2013 - 2014 Intel Mobile Communications GmbH
+ * Copyright(c) 2017Intel Deutschland GmbH
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -132,10 +134,10 @@ struct iwl_bt_coex_reduced_txp_update_cmd {
 
 /**
  * struct iwl_bt_coex_ci_cmd - bt coex channel inhibition command
- * @bt_primary_ci:
- * @primary_ch_phy_id:
- * @bt_secondary_ci:
- * @secondary_ch_phy_id:
+ * @bt_primary_ci: primary channel inhibition bitmap
+ * @primary_ch_phy_id: primary channel PHY ID
+ * @bt_secondary_ci: secondary channel inhibition bitmap
+ * @secondary_ch_phy_id: secondary channel PHY ID
  *
  * Used for BT_COEX_CI command
  */
@@ -238,6 +240,7 @@ enum iwl_bt_ci_compliance {
  * @secondary_ch_lut: LUT used for secondary channel  iwl_bt_coex_lut_type
  * @bt_activity_grading: the activity of BT  iwl_bt_activity_grading
  * @ttc_rrc_status: is TTC or RRC enabled - one bit per PHY
+ * @reserved: reserved
  */
 struct iwl_bt_coex_profile_notif {
__le32 mbox_msg[4];
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/fw-api-d3.h 
b/drivers/net/wireless/intel/iwlwifi/mvm/fw-api-d3.h
index 2bfe4de6ac5a..d4a4c28b7192 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/fw-api-d3.h
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/fw-api-d3.h
@@ -139,6 +139,7 @@ struct iwl_proto_offload_cmd_common {
  * for each target address
  * @target_ipv6_addr: our target addresses
  * @ndp_mac_addr: neighbor solicitation response MAC address
+ * @reserved2: reserved
  */
 struct iwl_proto_offload_cmd_v1 {
struct iwl_proto_offload_cmd_common common;
@@ -157,6 +158,8 @@ struct iwl_proto_offload_cmd_v1 {
  * for each target address
  * @target_ipv6_addr: our target addresses
  * @ndp_mac_addr: neighbor solicitation response MAC address
+ * @num_valid_ipv6_addrs: number of valid IPv6 addresses
+ * @reserved2: reserved
  */
 struct iwl_proto_offload_cmd_v2 {
struct iwl_proto_offload_cmd_common common;
@@ -183,6 +186,7 @@ struct iwl_targ_addr {
 /**
  * struct iwl_proto_offload_cmd_v3_small - ARP/NS offload configuration
  * @common: common/IPv4 configuration
+ * @num_valid_ipv6_addrs: number of valid IPv6 addresses
  * @targ_addrs: target IPv6 addresses
  * @ns_config: NS offload configurations
  */
@@ -196,6 +200,7 @@ struct iwl_proto_offload_cmd_v3_small {
 /**
  * struct iwl_proto_offload_cmd_v3_large - ARP/NS offload configuration
  * @common: common/IPv4 configuration
+ * @num_valid_ipv6_addrs: number of valid IPv6 addresses
  * @targ_addrs: target IPv6 addresses
  * @ns_config: NS offload configurations
  */
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/fw-api-mac.h 
b/drivers/net/wireless/intel/iwlwifi/mvm/fw-api-mac.h
index 932adaf575eb..0c3350ad2f2f 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/fw-api-mac.h
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/fw-api-mac.h
@@ -333,7 +333,9 @@ struct iwl_ac_qos {
  * @mac_type: one of  iwl_mac_types
  * @tsf_id: TSF HW timer, one of  iwl_tsf_id
  * @node_addr: MAC address
+ * @reserved_for_node_addr: reserved
  * @bssid_addr: BSSID
+ * @reserved_for_bssid_addr: reserved
  * @cck_rates: basic rates available for CCK
  * @ofdm_rates: basic rates available for OFDM
  * @protection_flags: combination of  iwl_mac_protection_flags
diff --git 

[PATCH 10/31] iwlwifi: pcie: only apply retention workaround on 9000-series A-step

2017-06-28 Thread Luca Coelho
From: Johannes Berg 

Due to a hardware issue, certain power saving had to be
disabled. However, this issue was fixed in B-step, so the
workaround only needs to apply to A-step.

Signed-off-by: Johannes Berg 
Signed-off-by: Luca Coelho 
---
 drivers/net/wireless/intel/iwlwifi/pcie/rx.c | 19 +--
 1 file changed, 13 insertions(+), 6 deletions(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/rx.c 
b/drivers/net/wireless/intel/iwlwifi/pcie/rx.c
index a5c0f69423d2..cd109740632d 100644
--- a/drivers/net/wireless/intel/iwlwifi/pcie/rx.c
+++ b/drivers/net/wireless/intel/iwlwifi/pcie/rx.c
@@ -761,6 +761,15 @@ static void iwl_pcie_rx_hw_init(struct iwl_trans *trans, 
struct iwl_rxq *rxq)
 
 void iwl_pcie_enable_rx_wake(struct iwl_trans *trans, bool enable)
 {
+   if (trans->cfg->device_family != IWL_DEVICE_FAMILY_9000)
+   return;
+
+   if (CSR_HW_REV_STEP(trans->hw_rev) != SILICON_A_STEP)
+   return;
+
+   if (!trans->cfg->integrated)
+   return;
+
/*
 * Turn on the chicken-bits that cause MAC wakeup for RX-related
 * values.
@@ -768,12 +777,10 @@ void iwl_pcie_enable_rx_wake(struct iwl_trans *trans, 
bool enable)
 * bug where shadow registers are not in the retention list and their
 * value is lost when NIC powers down
 */
-   if (trans->cfg->integrated) {
-   iwl_set_bit(trans, CSR_MAC_SHADOW_REG_CTRL,
-   CSR_MAC_SHADOW_REG_CTRL_RX_WAKE);
-   iwl_set_bit(trans, CSR_MAC_SHADOW_REG_CTL2,
-   CSR_MAC_SHADOW_REG_CTL2_RX_WAKE);
-   }
+   iwl_set_bit(trans, CSR_MAC_SHADOW_REG_CTRL,
+   CSR_MAC_SHADOW_REG_CTRL_RX_WAKE);
+   iwl_set_bit(trans, CSR_MAC_SHADOW_REG_CTL2,
+   CSR_MAC_SHADOW_REG_CTL2_RX_WAKE);
 }
 
 static void iwl_pcie_rx_mq_hw_init(struct iwl_trans *trans)
-- 
2.11.0



[PATCH 01/31] iwlwifi: mvm: refactor geo init

2017-06-28 Thread Luca Coelho
From: Haim Dreyfuss 

We are going to add debugfs entry to retrieve the current geographic
profile being used in the FW. Currently the driver reads those tables
from the BIOS and passes them to the FW.
To prepare for this retrieving we want to store those
tables in the driver.

Signed-off-by: Haim Dreyfuss 
Signed-off-by: Luca Coelho 
---
 .../net/wireless/intel/iwlwifi/mvm/fw-api-power.h  |  9 +++
 drivers/net/wireless/intel/iwlwifi/mvm/fw.c| 64 --
 drivers/net/wireless/intel/iwlwifi/mvm/mvm.h   | 12 +++-
 3 files changed, 67 insertions(+), 18 deletions(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/fw-api-power.h 
b/drivers/net/wireless/intel/iwlwifi/mvm/fw-api-power.h
index 9d87fddd29b6..7da57ef2454e 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/fw-api-power.h
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/fw-api-power.h
@@ -363,6 +363,7 @@ struct iwl_dev_tx_power_cmd {
 } __packed; /* TX_REDUCED_POWER_API_S_VER_4 */
 
 #define IWL_NUM_GEO_PROFILES   3
+#define IWL_GEO_PER_CHAIN_SIZE 3
 
 /**
  * enum iwl_geo_per_chain_offset_operation - type of operation
@@ -402,6 +403,14 @@ struct iwl_geo_tx_power_profiles_cmd {
 } __packed; /* GEO_TX_POWER_LIMIT */
 
 /**
+ * struct iwl_geo_tx_power_profiles_resp -  response to GEO_TX_POWER_LIMIT cmd
+ * @profile_idx: current geo profile in use
+ */
+struct iwl_geo_tx_power_profiles_resp {
+   __le32 profile_idx;
+} __packed; /* GEO_TX_POWER_LIMIT_RESP */
+
+/**
  * struct iwl_beacon_filter_cmd
  * REPLY_BEACON_FILTERING_CMD = 0xd2 (command)
  * @bf_energy_delta: Used for RSSI filtering, if in 'normal' state. Send beacon
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/fw.c 
b/drivers/net/wireless/intel/iwlwifi/mvm/fw.c
index 24cc406d87ef..273e19460016 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/fw.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/fw.c
@@ -1243,15 +1243,15 @@ static int iwl_mvm_sar_get_ewrd_table(struct iwl_mvm 
*mvm)
return ret;
 }
 
-static int iwl_mvm_sar_get_wgds_table(struct iwl_mvm *mvm,
- struct iwl_mvm_geo_table *geo_table)
+static int iwl_mvm_sar_get_wgds_table(struct iwl_mvm *mvm)
 {
union acpi_object *wifi_pkg;
acpi_handle root_handle;
acpi_handle handle;
struct acpi_buffer wgds = {ACPI_ALLOCATE_BUFFER, NULL};
acpi_status status;
-   int i, ret;
+   int i, j, ret;
+   int idx = 1;
 
root_handle = ACPI_HANDLE(mvm->dev);
if (!root_handle) {
@@ -1282,15 +1282,17 @@ static int iwl_mvm_sar_get_wgds_table(struct iwl_mvm 
*mvm,
goto out_free;
}
 
-   for (i = 0; i < ACPI_WGDS_WIFI_DATA_SIZE; i++) {
-   union acpi_object *entry;
+   for (i = 0; i < IWL_NUM_GEO_PROFILES; i++) {
+   for (j = 0; j < IWL_MVM_GEO_TABLE_SIZE; j++) {
+   union acpi_object *entry;
 
-   entry = _pkg->package.elements[i + 1];
-   if ((entry->type != ACPI_TYPE_INTEGER) ||
-   (entry->integer.value > U8_MAX))
-   return -EINVAL;
+   entry = _pkg->package.elements[idx++];
+   if ((entry->type != ACPI_TYPE_INTEGER) ||
+   (entry->integer.value > U8_MAX))
+   return -EINVAL;
 
-   geo_table->values[i] = entry->integer.value;
+   mvm->geo_profiles[i].values[j] = entry->integer.value;
+   }
}
ret = 0;
 out_free:
@@ -1351,16 +1353,47 @@ int iwl_mvm_sar_select_profile(struct iwl_mvm *mvm, int 
prof_a, int prof_b)
return iwl_mvm_send_cmd_pdu(mvm, REDUCE_TX_POWER_CMD, 0, len, );
 }
 
+int iwl_mvm_get_sar_geo_profile(struct iwl_mvm *mvm)
+{
+   struct iwl_geo_tx_power_profiles_resp *resp;
+   int ret;
+
+   struct iwl_geo_tx_power_profiles_cmd geo_cmd = {
+   .ops = cpu_to_le32(IWL_PER_CHAIN_OFFSET_GET_CURRENT_TABLE),
+   };
+   struct iwl_host_cmd cmd = {
+   .id =  WIDE_ID(PHY_OPS_GROUP, GEO_TX_POWER_LIMIT),
+   .len = { sizeof(geo_cmd), },
+   .flags = CMD_WANT_SKB,
+   .data = { _cmd },
+   };
+
+   ret = iwl_mvm_send_cmd(mvm, );
+   if (ret) {
+   IWL_ERR(mvm, "Failed to get geographic profile info %d\n", ret);
+   return ret;
+   }
+
+   resp = (void *)cmd.resp_pkt->data;
+   ret = le32_to_cpu(resp->profile_idx);
+   if (WARN_ON(ret > IWL_NUM_GEO_PROFILES)) {
+   ret = -EIO;
+   IWL_WARN(mvm, "Invalid geographic profile idx (%d)\n", ret);
+   }
+
+   iwl_free_resp();
+   return ret;
+}
+
 static int iwl_mvm_sar_geo_init(struct iwl_mvm *mvm)
 {
-   struct iwl_mvm_geo_table geo_table;
struct iwl_geo_tx_power_profiles_cmd cmd = {
.ops = 

[PATCH 00/31] iwlwifi: updates intended for v4.13 2017-06-28

2017-06-28 Thread Luca Coelho
From: Luca Coelho 

Hi Kalle,

Here is one more batch that I'd like to get into v4.13, hopefully it's
not too late.  I'm also going to send some more tomorrow.  The changes
are:

* Some important fixes for 9000 HW;
* FW API changes for the upcoming -30 ucode release;
* A few new PCI IDs for 9000 series;
* Reorganization of common files;
* Some more fixes and improvements here and there

Thanks!

Cheers,
Luca.


Emmanuel Grumbach (1):
  iwlwifi: mvm: change when the BT_COEX is sent

Haim Dreyfuss (2):
  iwlwifi: mvm: refactor geo init
  iwlwifi: mvm: Add debugfs entry to retrieve SAR geographic profile

Johannes Berg (22):
  iwlwifi: mvm: remove some CamelCase from firmware API
  iwlwifi: mvm: fix various "Excess ... description" kernel-doc warnings
  iwlwifi: mvm: remove various unused command IDs/structs
  iwlwifi: mvm: use __le16 even for reserved fields
  iwlwifi: mvm: add documentation for all command IDs
  iwlwifi: mvm: fix a bunch of kernel-doc warnings
  iwlwifi: dvm: use macros for format strings
  iwlwifi: pcie: only apply retention workaround on 9000-series A-step
  iwlwifi: pcie: fix 9000-series RF-kill interrupt propagation
  iwlwifi: mvm: use proper CDB check in PHY context modify
  iwlwifi: pcie: improve "invalid queue" warning
  iwlwifi: pcie: improve debug in iwl_pcie_rx_handle_rb()
  iwlwifi: unify external & internal modparam names
  iwlwifi: pcie: make ctxt-info free idempotent
  iwlwifi: pcie: warn if paging is already initialized during init
  iwlwifi: mvm: unconditionally stop device after init
  iwlwifi: mvm: fix deduplication start logic
  iwlwifi: mvm: rename iwl_shared_mem_cfg_v1 to the correct _v2
  iwlwifi: create new subdirectory for FW interaction
  iwlwifi: move notification wait into fw/
  iwlwifi: move configuration into sub-directory
  iwlwifi: mvm: remove version 2 of paging command

Liad Kaufman (2):
  iwlwifi: mvm: support aggs of 64 frames in A000 family
  iwlwifi: mvm: support multi tid ba notif

Luca Coelho (1):
  iwlwifi: mvm: simplify CHECK_MLME_TRIGGER macro

Sharon Dvir (1):
  iwlwifi: mvm: change sta_id to u8

Tzipi Peres (2):
  iwlwifi: add the new a000_2ax series
  iwlwifi: add twelve new 9560 series PCI IDs

 drivers/net/wireless/intel/iwlwifi/Makefile|   6 +-
 .../intel/iwlwifi/{iwl-1000.c => cfg/1000.c}   |   0
 .../intel/iwlwifi/{iwl-2000.c => cfg/2000.c}   |   0
 .../intel/iwlwifi/{iwl-5000.c => cfg/5000.c}   |   0
 .../intel/iwlwifi/{iwl-6000.c => cfg/6000.c}   |   0
 .../intel/iwlwifi/{iwl-7000.c => cfg/7000.c}   |   0
 .../intel/iwlwifi/{iwl-8000.c => cfg/8000.c}   |   0
 .../intel/iwlwifi/{iwl-9000.c => cfg/9000.c}   |   0
 .../intel/iwlwifi/{iwl-a000.c => cfg/a000.c}   |  10 +
 drivers/net/wireless/intel/iwlwifi/dvm/debugfs.c   |  15 +-
 drivers/net/wireless/intel/iwlwifi/dvm/dev.h   |   4 +-
 drivers/net/wireless/intel/iwlwifi/dvm/lib.c   |   2 +-
 drivers/net/wireless/intel/iwlwifi/dvm/mac80211.c  |   8 +-
 drivers/net/wireless/intel/iwlwifi/dvm/main.c  |   4 +-
 drivers/net/wireless/intel/iwlwifi/dvm/rx.c|   2 +-
 drivers/net/wireless/intel/iwlwifi/dvm/rxon.c  |   2 +-
 .../intel/iwlwifi/{iwl-fw-api.h => fw/api.h}   |  24 ++
 .../{iwl-fw-error-dump.h => fw/error-dump.h}   |   0
 .../intel/iwlwifi/{iwl-fw-file.h => fw/file.h} |   0
 .../wireless/intel/iwlwifi/{iwl-fw.h => fw/img.h}  |  10 +-
 .../iwlwifi/{iwl-notif-wait.c => fw/notif-wait.c}  |   2 +-
 .../iwlwifi/{iwl-notif-wait.h => fw/notif-wait.h}  |   0
 drivers/net/wireless/intel/iwlwifi/iwl-config.h|   1 +
 drivers/net/wireless/intel/iwlwifi/iwl-csr.h   |   2 +-
 drivers/net/wireless/intel/iwlwifi/iwl-drv.c   |  14 +-
 drivers/net/wireless/intel/iwlwifi/iwl-modparams.h |  16 +-
 drivers/net/wireless/intel/iwlwifi/iwl-phy-db.c|  18 -
 drivers/net/wireless/intel/iwlwifi/iwl-trans.h |   4 +-
 drivers/net/wireless/intel/iwlwifi/mvm/coex.c  |   2 +-
 drivers/net/wireless/intel/iwlwifi/mvm/d3.c|   8 +-
 drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c   |  58 +++-
 .../net/wireless/intel/iwlwifi/mvm/fw-api-coex.h   |  11 +-
 drivers/net/wireless/intel/iwlwifi/mvm/fw-api-d3.h |  11 +-
 .../net/wireless/intel/iwlwifi/mvm/fw-api-mac.h|   5 +-
 .../net/wireless/intel/iwlwifi/mvm/fw-api-power.h  |   9 +
 drivers/net/wireless/intel/iwlwifi/mvm/fw-api-rs.h |   3 +
 drivers/net/wireless/intel/iwlwifi/mvm/fw-api-rx.h |  37 +--
 .../net/wireless/intel/iwlwifi/mvm/fw-api-scan.h   |  36 +-
 .../net/wireless/intel/iwlwifi/mvm/fw-api-sta.h|  63 +++-
 .../net/wireless/intel/iwlwifi/mvm/fw-api-tof.h|  14 +-
 drivers/net/wireless/intel/iwlwifi/mvm/fw-api-tx.h |   6 +-
 drivers/net/wireless/intel/iwlwifi/mvm/fw-api.h| 370 -
 drivers/net/wireless/intel/iwlwifi/mvm/fw-dbg.h|   4 +-
 drivers/net/wireless/intel/iwlwifi/mvm/fw.c| 123 ---
 drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c  |  32 +-
 

brcmfmac: BCM43431 won't get probed on Raspberry Pi Zero W

2017-06-28 Thread Stefan Wahren
Hi,

i'm currently working on Raspberry Pi Zero W for Mainline. Here is my first 
patch series [1].

Unfortunately i didn't get brcmfmac (connected via SDIO) probed with this patch 
series against 4.12.0-rc5-next-20170616+

[8.389167] brcmfmac: F1 signature read @0x1800=0x1541a9a6
[8.735111] brcmfmac: brcmf_c_preinit_dcmds: Firmware version = wl0: May 27 
2016 00:13:38 version 7.45.41.26 (r640327) FWID 01-df77e4a7
[8.786016] brcmfmac: brcmf_sdio_hostmail: Unknown mailbox data content: 
0x40012
[   11.288798] brcmfmac: brcmf_sdio_bus_rxctl: resumed on timeout
[   11.292822] brcmfmac: brcmf_sdio_checkdied: firmware trap in dongle
[   13.848777] brcmfmac: brcmf_sdio_bus_rxctl: resumed on timeout
[   13.852974] brcmfmac: brcmf_sdio_checkdied: firmware trap in dongle
[   16.408762] brcmfmac: brcmf_sdio_bus_rxctl: resumed on timeout
[   16.413004] brcmfmac: brcmf_sdio_checkdied: firmware trap in dongle
[   18.968769] brcmfmac: brcmf_sdio_bus_rxctl: resumed on timeout
[   18.972965] brcmfmac: brcmf_sdio_checkdied: firmware trap in dongle
[   21.528743] brcmfmac: brcmf_sdio_bus_rxctl: resumed on timeout
[   21.532924] brcmfmac: brcmf_sdio_checkdied: firmware trap in dongle
[   24.088745] brcmfmac: brcmf_sdio_bus_rxctl: resumed on timeout
[   24.092948] brcmfmac: brcmf_sdio_checkdied: firmware trap in dongle
[   26.648764] brcmfmac: brcmf_proto_bcdc_query_dcmd: brcmf_proto_bcdc_msg 
failed w/status -110
[   26.648789] brcmfmac: brcmf_cfg80211_attach: Failed to get D11 version (-110)
[   26.648831] brcmfmac: brcmf_bus_started: failed: -12
[   26.648842] brcmfmac: brcmf_sdio_firmware_callback: dongle is not responding

I already tried the additional patches from Gerd Hofmann's repo [2], but this 
didn't improve anything.

Any ideas what could be the problem?

Thanks
Stefan

[1] - 
http://lists.infradead.org/pipermail/linux-rpi-kernel/2017-June/006598.html
[2] - https://www.kraxel.org/cgit/linux/log/?h=bcm2837


Re: [PATCH] mac80211_hwsim: use dyndbg for debug messages

2017-06-28 Thread Joe Perches
On Wed, 2017-06-28 at 21:10 +0200, Lubomir Rintel wrote:
> On Wed, 2017-06-28 at 17:02 +0200, Johannes Berg wrote:
> > On Wed, 2017-06-28 at 15:17 +0200, Lubomir Rintel wrote:
> > > The mac80211_hwsim doesn't offer a way to disable the debugging
> > > output.
> > > Unfortunately, it's pretty chatty, dumping a  lot of stuff into the
> > > message buffer.
> > 
> > Why is this a problem? It's pretty much a testing tool only, and much
> > of the point is to have message about it's internal state?
> 
> I do use it as a development tool. I find it very convenient to always
> have a bunch of libvirt-managed LXC containers, some running hostapd
> instances with various access point configurations and some used for
> NetworkManager development and a mac80211_hwsim radio in each of them.
> 
> An unfortunate side-effect is that my dmesg becomes next to useless due
> to the overwhelming amount of mac80211_hwsim logging.

Perhaps convert some of these to debugfs output?

Otherwise, many or most of these seem to be function
tracing type calls that could or should use ftrace.



Re: [PATCH] mac80211_hwsim: use dyndbg for debug messages

2017-06-28 Thread Lubomir Rintel
On Wed, 2017-06-28 at 17:02 +0200, Johannes Berg wrote:
> On Wed, 2017-06-28 at 15:17 +0200, Lubomir Rintel wrote:
> > The mac80211_hwsim doesn't offer a way to disable the debugging
> > output.
> > Unfortunately, it's pretty chatty, dumping a  lot of stuff into the
> > message buffer.
> 
> Why is this a problem? It's pretty much a testing tool only, and much
> of the point is to have message about it's internal state?

I do use it as a development tool. I find it very convenient to always
have a bunch of libvirt-managed LXC containers, some running hostapd
instances with various access point configurations and some used for
NetworkManager development and a mac80211_hwsim radio in each of them.

An unfortunate side-effect is that my dmesg becomes next to useless due
to the overwhelming amount of mac80211_hwsim logging.

> johannes

Lubo


Re: [v2 01/20] rsi: changes in eeprom read frame

2017-06-28 Thread Kalle Valo
Amitkumar Karwar  writes:

> From: Prameela Rani Garnepudi 
>
> EEPROM read frame is sent during device initialization to read mac address.
> The format of the frame is modified in firmware to include eeprom length
> and offset. This frame does not return firmware version now. Also same
> frame is sent again to read rf type and band information.
>
> Signed-off-by: Prameela Rani Garnepudi 
> Signed-off-by: Amitkumar Karwar 

[...]

> --- a/drivers/net/wireless/rsi/rsi_main.h
> +++ b/drivers/net/wireless/rsi/rsi_main.h
> @@ -37,6 +37,7 @@ enum RSI_FSM_STATES {
>   FSM_COMMON_DEV_PARAMS_SENT,
>   FSM_BOOT_PARAMS_SENT,
>   FSM_EEPROM_READ_MAC_ADDR,
> + FSM_EEPROM_READ_RF_TYPE,
>   FSM_RESET_MAC_SENT,
>   FSM_RADIO_CAPS_SENT,
>   FSM_BB_RF_PROG_SENT,

Shouldn't you also update fsm_state array, just like Colin fixed earlier
this week:

https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/wireless-drivers-next.git/commit/?id=58828680af495bc4863af3a006f2018c71714665

I think a some kind of build time check for this is in order, should be
doable with BUILD_BUG_ON().

-- 
Kalle Valo


Re: [v2 11/20] rsi: management frame descriptor preparation cleanup

2017-06-28 Thread Kalle Valo
Kalle Valo  writes:

> Amitkumar Karwar  writes:
>
>> From: "pavani.muthyala" 
>>
>> Currently this descriptor is prepared with the help of __le16
>> pointer. This patch makes use of a structure to prepare the
>> descriptor in a cleaner way.
>>
>> Signed-off-by: pavani.muthyala 
>> Signed-off-by: Amitkumar Karwar 
>
> Pavani's name is in wrong format both in Format and S-o-b lines. 

Seems to be in every patch from Pavani in this set.

-- 
Kalle Valo


Re: [v2 11/20] rsi: management frame descriptor preparation cleanup

2017-06-28 Thread Kalle Valo
Amitkumar Karwar  writes:

> From: "pavani.muthyala" 
>
> Currently this descriptor is prepared with the help of __le16
> pointer. This patch makes use of a structure to prepare the
> descriptor in a cleaner way.
>
> Signed-off-by: pavani.muthyala 
> Signed-off-by: Amitkumar Karwar 

Pavani's name is in wrong format both in Format and S-o-b lines. 

-- 
Kalle Valo


Re: [v2 07/20] rsi: correct the logic of deriving queue number

2017-06-28 Thread Kalle Valo
Amitkumar Karwar  writes:

> Maximum valid queue number is 0x5. So anding with 0x7 should be
> ok here.
>
> Signed-off-by: Amitkumar Karwar 

The separate From header is missing which you had in v1.

-- 
Kalle Valo


Re: wl18xx: add checks on wl18xx_top_reg_write() return value

2017-06-28 Thread Kalle Valo
"Gustavo A. R. Silva"  wrote:

> Check return value from call to wl18xx_top_reg_write(),
> so in case of error jump to goto label out and return.
> 
> Also, remove unnecessary value check before goto label out.
> 
> Addresses-Coverity-ID: 1226938
> Signed-off-by: Gustavo A. R. Silva 

Patch applied to wireless-drivers-next.git, thanks.

059c98599b1a wl18xx: add checks on wl18xx_top_reg_write() return value

-- 
https://patchwork.kernel.org/patch/9810591/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches



Re: libertas: Fix lbs_prb_rsp_limit_set()

2017-06-28 Thread Kalle Valo
Dan Carpenter  wrote:

> The kstrtoul() test was reversed so this always returned -ENOTSUPP.
> 
> Fixes: 27d7f47756f4 ("net: wireless: replace strict_strtoul() with 
> kstrtoul()")
> Signed-off-by: Dan Carpenter 
> Reviewed-by: James Cameron 
> 
> diff --git a/drivers/net/wireless/marvell/libertas/mesh.c 
> b/drivers/net/wireless/marvell/libertas/mesh.c
> index eeeb892219aa..37ace5cb309d 100644
> --- a/drivers/net/wireless/marvell/libertas/mesh.c
> +++ b/drivers/net/wireless/marvell/libertas/mesh.c
> @@ -233,8 +233,9 @@ static ssize_t lbs_prb_rsp_limit_set(struct device *dev,
>   memset(_access, 0, sizeof(mesh_access));
>   mesh_access.data[0] = cpu_to_le32(CMD_ACT_SET);
>  
> - if (!kstrtoul(buf, 10, _limit))
> - return -ENOTSUPP;
> + ret = kstrtoul(buf, 10, _limit);
> + if (ret)
> + return ret;
>   if (retry_limit > 15)
>   return -ENOTSUPP;

Patch applied to wireless-drivers-next.git, thanks.

69551f5f370c libertas: Fix lbs_prb_rsp_limit_set()

-- 
https://patchwork.kernel.org/patch/9806775/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches



Re: cw1200: add const to hwbus_ops structures

2017-06-28 Thread Kalle Valo
Bhumika Goyal  wrote:

> Declare hwbus_ops structures as const as they are only passed as an
> argument to the function cw1200_core_probe. This argument is of type
> const. So, make these structures const.
> 
> Signed-off-by: Bhumika Goyal 

Patch applied to wireless-drivers-next.git, thanks.

3ac27dd37b40 cw1200: add const to hwbus_ops structures

-- 
https://patchwork.kernel.org/patch/9806289/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches



Re: rsi: add in missing RSI_FSM_STATES into array fsm_state

2017-06-28 Thread Kalle Valo
Colin Ian King  wrote:

> From: Colin Ian King 
> 
> Two recent commits added new RSI_FSM_STATES (namely FSM_FW_NOT_LOADED
> and FSM_COMMON_DEV_PARAMS_SENT) and the corresponding table fsm_state
> was not updated to match. This can lead to an array overrun when
> accessing the latter two states in fsm_state. Fix this by adding in
> the missing states.
> 
> Detected by CoverityScan, CID#1398379 ("Illegal address computation")
> 
> Fixes: 9920322ccd8e ("rsi: add tx frame for common device configuration")
> Fixes: 015e367494c1 ("rsi: Register interrupt handler before firmware load")
> Signed-off-by: Colin Ian King 

Patch applied to wireless-drivers-next.git, thanks.

58828680af49 rsi: add in missing RSI_FSM_STATES into array fsm_state

-- 
https://patchwork.kernel.org/patch/9804857/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches



Re: [1/4] brcmfmac: cleanup kerneldoc for struct brcmf_bus

2017-06-28 Thread Kalle Valo
Arend Van Spriel  wrote:

> A couple of old fields were still described and one field was not
> described.
> 
> Reviewed-by: Hante Meuleman 
> Reviewed-by: Pieter-Paul Giesberts 
> Reviewed-by: Franky Lin 
> Signed-off-by: Arend van Spriel 

4 patches applied to wireless-drivers-next.git, thanks.

ca2e99b2cae9 brcmfmac: cleanup kerneldoc for struct brcmf_bus
a833f3d4de53 brcmfmac: use atomic_t for statistic counter in struct brcmf_bus
270a6c1f65fe brcmfmac: rework headroom check in .start_xmit()
21394d57feba MAINTAINERS: add brcm80211 maintainer info from Cypress

-- 
https://patchwork.kernel.org/patch/9803889/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches



Re: mwifiex: Do not change bss_type in change_virtual_intf

2017-06-28 Thread Kalle Valo
Ganapathi Bhat  wrote:

> When user adds a virtual interface driver will set the
> bss_type to the iface_type given by the user. When
> supplicant is started on the same interface, a call to
> change_virtual_intf will be triggered if if_type is not
> NL80211_IFTYPE_STATION. Here driver should not update
> it's bss_type, because bss_type is intended to indicate
> the original iface_type and changing the same will defeat
> the purpose of creating this interface.
> 
> Signed-off-by: Ganapathi Bhat 

Patch applied to wireless-drivers-next.git, thanks.

4d7ab36f0c47 mwifiex: Do not change bss_type in change_virtual_intf

-- 
https://patchwork.kernel.org/patch/9803591/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches



Re: [v2, 1/8] rtlwifi: Fix a2dp choppy while BT RSSI stays on threshold.

2017-06-28 Thread Kalle Valo
Larry Finger  wrote:

> From: Ping-Ke Shih 
> 
> In this case, BTC asks to enter/leave PS mode frequently to cause A2DP
> choppy.
> 
> Signed-off-by: Ping-Ke Shih 
> Signed-off-by: Larry Finger 
> Cc: Yan-Hsuan Chuang 
> Cc: Birming Chiu 
> Cc: Shaofu 
> Cc: Steven Ting 

8 patches applied to wireless-drivers-next.git, thanks.

135f4fbd75d7 rtlwifi: Fix a2dp choppy while BT RSSI stays on threshold.
a70883920ea1 rtlwifi: Do IQK only once to reduce wifi occupy antenna
1024b31629bd rtlwifi: Modify power mode parameters of 8723be and 8821ae.
838dd0d3ffe6 rtlwifi: Update some cases in btc_get function -- roam, 5G, AP 
mode, and return value.
8488e211d665 rtlwifi: Add return value to btc_set.
f1cb27eda3a6 rtlwifi: Add ap_num field for btcoexist
c76ab8e75442 rtlwifi: Fill ap_num field by driver
76f146b6645b rtlwifi: Add in_4way field for btcoexist

-- 
https://patchwork.kernel.org/patch/9802331/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches



Re: [net-next] qtnfmac: fix uninitialized return code in ret

2017-06-28 Thread Kalle Valo
Colin Ian King  wrote:

> From: Colin Ian King 
> 
> The return value ret is unitialized and garbage is being returned
> for the three different error conditions when setting up the PCIe
> BARs. Fix this by initializing ret to  -ENOMEM to indicate that
> the BARs failed to be setup correctly.
> 
> Detected by CoverityScan, CID#1437563 ("Unitialized scalar variable")
> 
> Signed-off-by: Colin Ian King 
> Reviewed-by: Sergey Matyukevich 

Patch applied to wireless-drivers-next.git, thanks.

3e3d8aa61107 qtnfmac: fix uninitialized return code in ret

-- 
https://patchwork.kernel.org/patch/9801833/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches



Re: ath9k: remove useless variable assignment in ath_mci_intr()

2017-06-28 Thread Kalle Valo
"Gustavo A. R. Silva"  wrote:

> Value assigned to variable offset at line 551 is overwritten at line 562,
> before it can be used. This makes such variable assignment useless.
> 
> Addresses-Coverity-ID: 1226941
> Signed-off-by: Gustavo A. R. Silva 
> Signed-off-by: Kalle Valo 

Patch applied to ath-next branch of ath.git, thanks.

6788a3832c70 ath9k: remove useless variable assignment in ath_mci_intr()

-- 
https://patchwork.kernel.org/patch/9810609/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches



Re: [-next] ath10k: fix a bunch of spelling mistakes in messages

2017-06-28 Thread Kalle Valo
Colin Ian King  wrote:

> Fix the following spelling mistakes in messages:
>   syncronise -> synchronize
>   unusally -> unusually
>   addrress -> address
>   inverval -> interval
> 
> Signed-off-by: Colin Ian King 
> Signed-off-by: Kalle Valo 

Patch applied to ath-next branch of ath.git, thanks.

23de57975f14 ath10k: fix a bunch of spelling mistakes in messages

-- 
https://patchwork.kernel.org/patch/9808405/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches



Re: ath10k: add const to thermal_cooling_device_ops structure

2017-06-28 Thread Kalle Valo
Bhumika Goyal  wrote:

> Declare thermal_cooling_device_ops structure as const as it is only passed
> as an argument to the function thermal_cooling_device_register and this
> argument is of type const. So, declare the structure as const.
> 
> Signed-off-by: Bhumika Goyal 
> Signed-off-by: Kalle Valo 

Patch applied to ath-next branch of ath.git, thanks.

1cdb6c9fd433 ath10k: add const to thermal_cooling_device_ops structure

-- 
https://patchwork.kernel.org/patch/9801291/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches



Re: [1/3] ath9k: fixed an invalid pointer dereference

2017-06-28 Thread Kalle Valo
miaoqing pan  wrote:

> The bug was triggered when do suspend/resuming continuously
> on Dell XPS L322X/0PJHXN version 9333 (2013) with kernel
> 4.12.0-041200rc4-generic. But can't reproduce on DELL
> E5440 + AR9300 PCIE chips.
> 
> The warning is caused by accessing invalid pointer sc->rng_task.
> sc->rng_task is not be cleared after kthread_stop(sc->rng_task)
> be called in ath9k_rng_stop(). Because the kthread is stopped
> before ath9k_rng_kthread() be scheduled.
> 
> So set sc->rng_task to null after kthread_stop(sc->rng_task) to
> resolve this issue.
> 
> WARNING: CPU: 0 PID: 984 at linux/kernel/kthread.c:71 kthread_stop+0xf1/0x100
> CPU: 0 PID: 984 Comm: NetworkManager Not tainted 4.12.0-041200rc4-generic 
> #201706042031
> Hardware name: Dell Inc.  Dell System XPS L322X/0PJHXN, BIOS A09 
> 05/15/2013
> task: 950170fdda00 task.stack: a22c01538000
> RIP: 0010:kthread_stop+0xf1/0x100
> RSP: 0018:a22c0153b5b0 EFLAGS: 00010246
> RAX: a6257800 RBX: 950171b79560 RCX: 
> RDX: 8000 RSI: 7fff RDI: 9500ac9a9680
> RBP: a22c0153b5c8 R08:  R09: 
> R10: a22c0153b648 R11: 9501768004b8 R12: 9500ac9a9680
> R13: 950171b79f70 R14: 950171b78780 R15: 9501749dc018
> FS:  7f0d6bfd5540() GS:95017f20() knlGS:
> CS:  0010 DS:  ES:  CR0: 80050033
> CR2: 7fc190161a08 CR3: 000232906000 CR4: 001406f0
> Call Trace:
>   ath9k_rng_stop+0x1a/0x20 [ath9k]
>   ath9k_stop+0x3b/0x1d0 [ath9k]
>   drv_stop+0x33/0xf0 [mac80211]
>   ieee80211_stop_device+0x43/0x50 [mac80211]
>   ieee80211_do_stop+0x4f2/0x810 [mac80211]
> 
> Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=196043
> Reported-by: Giulio Genovese 
> Tested-by: Giulio Genovese 
> Cc: 
> Signed-off-by: Miaoqing Pan 
> Signed-off-by: Kalle Valo 

3 patches applied to ath-next branch of ath.git, thanks.

07246c115801 ath9k: fix an invalid pointer dereference in ath9k_rng_stop()
473becac4b31 ath9k: avoid potential freezing during random generator read
f23cdfb3fe8f ath9k: Use mutex_lock to avoid potential race in start/stop rng

-- 
https://patchwork.kernel.org/patch/9803211/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches



Re: [1/2] ath9k: fix tx99 use after free

2017-06-28 Thread Kalle Valo
miaoqing pan  wrote:

> One scenario that could lead to UAF is two threads writing
> simultaneously to the "tx99" debug file. One of them would
> set the "start" value to true and follow to ath9k_tx99_init().
> Inside the function it would set the sc->tx99_state to true
> after allocating sc->tx99skb. Then, the other thread would
> execute write_file_tx99() and call ath9k_tx99_deinit().
> sc->tx99_state would be freed. After that, the first thread
> would continue inside ath9k_tx99_init() and call
> r = ath9k_tx99_send(sc, sc->tx99_skb, );
> that would make use of the freed sc->tx99_skb memory.
> 
> Cc: 
> Signed-off-by: Miaoqing Pan 
> Signed-off-by: Kalle Valo 

2 patches applied to ath-next branch of ath.git, thanks.

cf8ce1ea61b7 ath9k: fix tx99 use after free
bde717ab4736 ath9k: fix tx99 bus error

-- 
https://patchwork.kernel.org/patch/9798309/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches



Re: [1/3] ath9k: fixed an invalid pointer dereference

2017-06-28 Thread Kalle Valo
miaoqing pan  wrote:

> The bug was triggered when do suspend/resuming continuously
> on Dell XPS L322X/0PJHXN version 9333 (2013) with kernel
> 4.12.0-041200rc4-generic. But can't reproduce on DELL
> E5440 + AR9300 PCIE chips.
> 
> The warning is caused by accessing invalid pointer sc->rng_task.
> sc->rng_task is not be cleared after kthread_stop(sc->rng_task)
> be called in ath9k_rng_stop(). Because the kthread is stopped
> before ath9k_rng_kthread() be scheduled.
> 
> So set sc->rng_task to null after kthread_stop(sc->rng_task) to
> resolve this issue.
> 
> WARNING: CPU: 0 PID: 984 at linux/kernel/kthread.c:71 kthread_stop+0xf1/0x100
> CPU: 0 PID: 984 Comm: NetworkManager Not tainted 4.12.0-041200rc4-generic 
> #201706042031
> Hardware name: Dell Inc.  Dell System XPS L322X/0PJHXN, BIOS A09 
> 05/15/2013
> task: 950170fdda00 task.stack: a22c01538000
> RIP: 0010:kthread_stop+0xf1/0x100
> RSP: 0018:a22c0153b5b0 EFLAGS: 00010246
> RAX: a6257800 RBX: 950171b79560 RCX: 
> RDX: 8000 RSI: 7fff RDI: 9500ac9a9680
> RBP: a22c0153b5c8 R08:  R09: 
> R10: a22c0153b648 R11: 9501768004b8 R12: 9500ac9a9680
> R13: 950171b79f70 R14: 950171b78780 R15: 9501749dc018
> FS:  7f0d6bfd5540() GS:95017f20() knlGS:
> CS:  0010 DS:  ES:  CR0: 80050033
> CR2: 7fc190161a08 CR3: 000232906000 CR4: 001406f0
> Call Trace:
>   ath9k_rng_stop+0x1a/0x20 [ath9k]
>   ath9k_stop+0x3b/0x1d0 [ath9k]
>   drv_stop+0x33/0xf0 [mac80211]
>   ieee80211_stop_device+0x43/0x50 [mac80211]
>   ieee80211_do_stop+0x4f2/0x810 [mac80211]
> 
> Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=196043
> Reported-by: Giulio Genovese 
> Tested-by: Giulio Genovese 
> Cc: 
> Signed-off-by: Miaoqing Pan 
> Signed-off-by: Kalle Valo 

I Cced stable and improved the title a bit.

-- 
https://patchwork.kernel.org/patch/9803211/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches



Re: ti: wl18xx: add checks on wl18xx_top_reg_write() return value

2017-06-28 Thread Kalle Valo
"Gustavo A. R. Silva"  wrote:

> Check return value from call to wl18xx_top_reg_write(),
> so in case of error jump to goto label out and return.
> 
> Also, remove unnecessary value check before goto label out.
> 
> Addresses-Coverity-ID: 1226938
> Signed-off-by: Gustavo A. R. Silva 

The prefix should be "wl18xx:", I'll fix that.

-- 
https://patchwork.kernel.org/patch/9810591/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches



Re: [PATCH] rsi: add in missing RSI_FSM_STATES into array fsm_state

2017-06-28 Thread Kalle Valo
Colin King  writes:

> From: Colin Ian King 
>
> Two recent commits added new RSI_FSM_STATES (namely FSM_FW_NOT_LOADED
> and FSM_COMMON_DEV_PARAMS_SENT) and the corresponding table fsm_state
> was not updated to match. This can lead to an array overrun when
> accessing the latter two states in fsm_state. Fix this by adding in
> the missing states.
>
> Detected by CoverityScan, CID#1398379 ("Illegal address computation")
>
> Fixes: 9920322ccd8e04 ("rsi: add tx frame for common device configuration")
> Fixes: 015e367494c1d5 ("rsi: Register interrupt handler before firmware load")

This is very much nitpicking, no need to resend because of this, but the
preferred format is to to use 12 chars for the commit id:

Fixes: 9920322ccd8e ("rsi: add tx frame for common device configuration")
Fixes: 015e367494c1 ("rsi: Register interrupt handler before firmware load")

Documentation/process/submitting-patches.rst contains a nice tip how you
can get that automatically with git:

[core]
abbrev = 12
[pretty]
fixes = Fixes: %h (\"%s\")

-- 
Kalle Valo


Re: [PATCH v2] rtlwifi: Replace hardcode value with macro

2017-06-28 Thread Kalle Valo
Souptick Joarder  writes:

> In _rtl_init_mac80211(), hardcoded value for hw->max_listen_interval
> and hw->max_rate_tries are replaced by macro.
>
> Signed-off-by: Souptick Joarder 
> ---
> Changes in v2:
>- Signed-off was missing in previous one.
>
>  drivers/net/wireless/realtek/rtlwifi/base.c | 6 +++---
>  drivers/net/wireless/realtek/rtlwifi/base.h | 2 ++
>  2 files changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/net/wireless/realtek/rtlwifi/base.c 
> b/drivers/net/wireless/realtek/rtlwifi/base.c
> index bdc3791..f45d093 100644
> --- a/drivers/net/wireless/realtek/rtlwifi/base.c
> +++ b/drivers/net/wireless/realtek/rtlwifi/base.c
> @@ -422,9 +422,9 @@ static void _rtl_init_mac80211(struct ieee80211_hw *hw)
>   hw->extra_tx_headroom = RTL_TX_HEADER_SIZE;
>
>   /* TODO: Correct this value for our hw */
> - /* TODO: define these hard code value */
> - hw->max_listen_interval = 10;
> - hw->max_rate_tries = 4;
> + /* defined these hard code values */
> + hw->max_listen_interval = MAX_LISTEN_INTERVAL;
> + hw->max_rate_tries = MAX_RATE_TRIES;

Like Larry said, the comment does not make any sense. Please remove it
and send v3.

-- 
Kalle Valo


Re: [PATCH 3/4] brcmfmac: rework headroom check in .start_xmit()

2017-06-28 Thread Kalle Valo
Arend van Spriel  writes:

> On 27-06-17 16:09, Kalle Valo wrote:
>> Arend van Spriel  writes:
>> 
>>> Since commit 9cc4b7cb86cb ("brcmfmac: Make skb header writable
>>> before use") the headroom usage has been fixed. However, the
>>> driver was keeping statistics that got lost. So reworking the
>>> code so we get those driver statistics back for debugging.
>>>
>>> Cc: James Hughes 
>>> Reviewed-by: Hante Meuleman 
>>> Reviewed-by: Pieter-Paul Giesberts 
>>> Reviewed-by: Franky Lin 
>>> Signed-off-by: Arend van Spriel 
>>> ---
>>>  .../net/wireless/broadcom/brcm80211/brcmfmac/bus.h | 15 --
>>>  .../wireless/broadcom/brcm80211/brcmfmac/core.c| 23 
>>> +++---
>>>  .../wireless/broadcom/brcm80211/brcmfmac/sdio.c| 13 +++-
>>>  3 files changed, 37 insertions(+), 14 deletions(-)
>>>
>>> diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h
>>> b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h
>>> index e1a4d9e..163ddc4 100644
>>> --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h
>>> +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h
>>> @@ -113,6 +113,17 @@ struct brcmf_bus_msgbuf {
>>>  
>>>  
>>>  /**
>>> + * struct brcmf_bus_stats - bus statistic counters.
>>> + *
>>> + * @pktcowed: packets cowed for extra headroom/unorphan.
>>> + * @pktcow_failed: packets dropped due to failed cow-ing.
>>> + */
>>> +struct brcmf_bus_stats {
>>> +   atomic_t pktcowed;
>>> +   atomic_t pktcow_failed;
>>> +};
>> 
>> Same question as in the previous patch. I only see updates for these
>> variables, but nobody reading them?
>
> Hi Kalle,
>
> You are right. My intention was to expose these to debugfs, but clearly
> did not include it in this patch series. So how do you want to handle
> this. Feel free to drop patch 2 and 3. I can resubmit them with
> subsequent patches dealing with exposing it to debugfs if that makes
> more sense.

No need to resend if you are going to add the debugfs interface soon.
But the general rule is that we don't add any dead code to kernel and
there was no explanation in the commit log, that's why I asked.

-- 
Kalle Valo


Re: pull-request: iwlwifi-next 2017-06-28

2017-06-28 Thread Kalle Valo
Luca Coelho  writes:

> Hi Kalle,
>
> Here's my second pull-request intended for v4.13.  Again, this pull-
> request includes the last two patchsets I sent out.  It contains generic
> development work, with improvements, bug fixes and cleanup all around. 
> More details in the tag description.
>
> I have sent this out before, and kbuildbot reported success.
>
> Please let me know if there are any issues.
>
> Cheers,
> Luca.
>
>
> The following changes since commit 52f8c9380f2eb051581628782a4917f2c3f9751f:
>
>   Merge ath-next from 
> git://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git (2017-06-22 
> 16:29:52 +0300)
>
> are available in the git repository at:
>
>   git://git.kernel.org/pub/scm/linux/kernel/git/iwlwifi/iwlwifi-next.git 
> tags/iwlwifi-next-for-kalle-2017-06-28

Pulled, thanks.

-- 
Kalle Valo


[PATCH] mwifiex: fix spelling mistake: "secuirty" -> "security"

2017-06-28 Thread Colin King
From: Colin Ian King 

Trivial fix to spelling mistake in mwifiex_dbg message

Signed-off-by: Colin Ian King 
---
 drivers/net/wireless/marvell/mwifiex/cfg80211.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/marvell/mwifiex/cfg80211.c 
b/drivers/net/wireless/marvell/mwifiex/cfg80211.c
index a850ec0054e2..d8ff823c0818 100644
--- a/drivers/net/wireless/marvell/mwifiex/cfg80211.c
+++ b/drivers/net/wireless/marvell/mwifiex/cfg80211.c
@@ -1981,7 +1981,7 @@ static int mwifiex_cfg80211_start_ap(struct wiphy *wiphy,
 
if (mwifiex_set_secure_params(priv, bss_cfg, params)) {
mwifiex_dbg(priv->adapter, ERROR,
-   "Failed to parse secuirty parameters!\n");
+   "Failed to parse security parameters!\n");
goto out;
}
 
-- 
2.11.0



[PATCH v3 10/10] rtlwifi: btcoex: Use seq_file to dump btcoex status

2017-06-28 Thread Larry Finger
From: Ping-Ke Shih 

If we use seq_file to dump status, then we can use 'cat' to access
debugfs.  Other related changes are
1. implement btc_disp_dbg_msg() to access btcoex's common status.
2. remove obsolete field bt_exist

Signed-off-by: Ping-Ke Shih 
Signed-off-by: Larry Finger 
Cc: Yan-Hsuan Chuang 
Cc: Birming Chiu 
Cc: Shaofu 
Cc: Steven Ting 
---
v2 - remove \r characters as suggested by Joe Perches
v3 - Remove the \r characters missed in v2
---
 .../realtek/rtlwifi/btcoexist/halbtc8192e2ant.c| 202 +++
 .../realtek/rtlwifi/btcoexist/halbtc8192e2ant.h|   3 +-
 .../realtek/rtlwifi/btcoexist/halbtc8723b1ant.c| 269 ++-
 .../realtek/rtlwifi/btcoexist/halbtc8723b1ant.h|   3 +-
 .../realtek/rtlwifi/btcoexist/halbtc8723b2ant.c| 206 +++
 .../realtek/rtlwifi/btcoexist/halbtc8723b2ant.h|   3 +-
 .../realtek/rtlwifi/btcoexist/halbtc8821a1ant.c| 285 +
 .../realtek/rtlwifi/btcoexist/halbtc8821a1ant.h|   3 +-
 .../realtek/rtlwifi/btcoexist/halbtc8821a2ant.c| 177 ++---
 .../realtek/rtlwifi/btcoexist/halbtc8821a2ant.h|   3 +-
 .../realtek/rtlwifi/btcoexist/halbtcoutsrc.c   | 130 +-
 .../realtek/rtlwifi/btcoexist/halbtcoutsrc.h   |  11 +-
 12 files changed, 663 insertions(+), 632 deletions(-)

diff --git a/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8192e2ant.c 
b/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8192e2ant.c
index 44c25724529e..c0a5faa59c57 100644
--- a/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8192e2ant.c
+++ b/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8192e2ant.c
@@ -2704,11 +2704,11 @@ void ex_btc8192e2ant_init_coex_dm(struct btc_coexist 
*btcoexist)
btc8192e2ant_init_coex_dm(btcoexist);
 }
 
-void ex_btc8192e2ant_display_coex_info(struct btc_coexist *btcoexist)
+void ex_btc8192e2ant_display_coex_info(struct btc_coexist *btcoexist,
+  struct seq_file *m)
 {
struct btc_board_info *board_info = >board_info;
struct btc_stack_info *stack_info = >stack_info;
-   struct rtl_priv *rtlpriv = btcoexist->adapter;
u8 u8tmp[4], i, bt_info_ext, ps_tdma_case = 0;
u16 u16tmp[4];
u32 u32tmp[4];
@@ -2719,75 +2719,64 @@ void ex_btc8192e2ant_display_coex_info(struct 
btc_coexist *btcoexist)
u8 wifi_dot11_chnl, wifi_hs_chnl;
u32 fw_ver = 0, bt_patch_ver = 0;
 
-   RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG,
-"\r\n [BT Coexist info]");
+   seq_puts(m, "\n [BT Coexist info]");
 
if (btcoexist->manual_control) {
-   RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG,
-"\r\n ===[Under Manual Control]===");
-   RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG,
-"\r\n ==");
-   }
-
-   if (!board_info->bt_exist) {
-   RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, "\r\n BT not exists 
!!!");
-   return;
+   seq_puts(m, "\n ===[Under Manual Control]===");
+   seq_puts(m, "\n ==");
}
 
-   RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG,
-"\r\n %-35s = %d/ %d ", "Ant PG number/ Ant mechanism:",
+   seq_printf(m, "\n %-35s = %d/ %d ", "Ant PG number/ Ant mechanism:",
   board_info->pg_ant_num, board_info->btdm_ant_num);
 
-   RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, "\r\n %-35s = %s / %d",
-"BT stack/ hci ext ver",
+   seq_printf(m, "\n %-35s = %s / %d", "BT stack/ hci ext ver",
   ((stack_info->profile_notified) ? "Yes" : "No"),
   stack_info->hci_version);
 
btcoexist->btc_get(btcoexist, BTC_GET_U4_BT_PATCH_VER, _patch_ver);
btcoexist->btc_get(btcoexist, BTC_GET_U4_WIFI_FW_VER, _ver);
-   RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG,
-"\r\n %-35s = %d_%d/ 0x%x/ 0x%x(%d)",
-"CoexVer/ FwVer/ PatchVer",
-glcoex_ver_date_8192e_2ant, glcoex_ver_8192e_2ant,
-fw_ver, bt_patch_ver, bt_patch_ver);
+   seq_printf(m, "\n %-35s = %d_%d/ 0x%x/ 0x%x(%d)",
+  "CoexVer/ FwVer/ PatchVer",
+  glcoex_ver_date_8192e_2ant, glcoex_ver_8192e_2ant,
+  fw_ver, bt_patch_ver, bt_patch_ver);
 
btcoexist->btc_get(btcoexist, BTC_GET_BL_HS_OPERATION, _hs_on);
btcoexist->btc_get(btcoexist, BTC_GET_U1_WIFI_DOT11_CHNL,
   _dot11_chnl);
btcoexist->btc_get(btcoexist, BTC_GET_U1_WIFI_HS_CHNL, _hs_chnl);
-   RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, "\r\n %-35s = %d / %d(%d)",
-"Dot11 

[PATCH v3 09/10] rtlwifi: use debugfs to debug.

2017-06-28 Thread Larry Finger
From: Ping-Ke Shih 

Use debugfs to dump register and btcoex status.

Signed-off-by: Ping-Ke Shih 
Signed-off-by: Larry Finger 
Cc: Yan-Hsuan Chuang 
Cc: Birming Chiu 
Cc: Shaofu 
Cc: Steven Ting 
---
v2 - no changes
v3 - no changes
---
 drivers/net/wireless/realtek/rtlwifi/base.c|   6 +
 .../realtek/rtlwifi/btcoexist/halbtcoutsrc.c   |   3 +-
 .../realtek/rtlwifi/btcoexist/halbtcoutsrc.h   |   3 +-
 .../wireless/realtek/rtlwifi/btcoexist/rtl_btc.c   |   6 +
 .../wireless/realtek/rtlwifi/btcoexist/rtl_btc.h   |   1 +
 drivers/net/wireless/realtek/rtlwifi/debug.c   | 439 +
 drivers/net/wireless/realtek/rtlwifi/debug.h   |  12 +
 drivers/net/wireless/realtek/rtlwifi/pci.c |   6 +
 drivers/net/wireless/realtek/rtlwifi/wifi.h|   9 +
 9 files changed, 483 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/realtek/rtlwifi/base.c 
b/drivers/net/wireless/realtek/rtlwifi/base.c
index 464f14450f75..40c6fbc05c14 100644
--- a/drivers/net/wireless/realtek/rtlwifi/base.c
+++ b/drivers/net/wireless/realtek/rtlwifi/base.c
@@ -2453,6 +2453,9 @@ static int __init rtl_core_module_init(void)
if (rtl_rate_control_register())
pr_err("rtl: Unable to register rtl_rc, use default RC !!\n");
 
+   /* add debugfs */
+   rtl_debugfs_add_topdir();
+
/* init some global vars */
INIT_LIST_HEAD(_global_var.glb_priv_list);
spin_lock_init(_global_var.glb_list_lock);
@@ -2464,6 +2467,9 @@ static void __exit rtl_core_module_exit(void)
 {
/*RC*/
rtl_rate_control_unregister();
+
+   /* remove debugfs */
+   rtl_debugfs_remove_topdir();
 }
 
 module_init(rtl_core_module_init);
diff --git a/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.c 
b/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.c
index c1eacd8352a2..e4f0d4710fb4 100644
--- a/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.c
+++ b/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.c
@@ -1504,7 +1504,8 @@ void exhalbtc_set_single_ant_path(u8 single_ant_path)
gl_bt_coexist.board_info.single_ant_path = single_ant_path;
 }
 
-void exhalbtc_display_bt_coex_info(struct btc_coexist *btcoexist)
+void exhalbtc_display_bt_coex_info(struct btc_coexist *btcoexist,
+  struct seq_file *m)
 {
if (!halbtc_is_bt_coexist_available(btcoexist))
return;
diff --git a/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.h 
b/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.h
index f9b87c12db09..53aeb669cc63 100644
--- a/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.h
+++ b/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.h
@@ -626,7 +626,8 @@ void exhalbtc_update_min_bt_rssi(s8 bt_rssi);
 void exhalbtc_set_bt_exist(bool bt_exist);
 void exhalbtc_set_chip_type(u8 chip_type);
 void exhalbtc_set_ant_num(struct rtl_priv *rtlpriv, u8 type, u8 ant_num);
-void exhalbtc_display_bt_coex_info(struct btc_coexist *btcoexist);
+void exhalbtc_display_bt_coex_info(struct btc_coexist *btcoexist,
+  struct seq_file *m);
 void exhalbtc_signal_compensation(struct btc_coexist *btcoexist,
  u8 *rssi_wifi, u8 *rssi_bt);
 void exhalbtc_lps_leave(struct btc_coexist *btcoexist);
diff --git a/drivers/net/wireless/realtek/rtlwifi/btcoexist/rtl_btc.c 
b/drivers/net/wireless/realtek/rtlwifi/btcoexist/rtl_btc.c
index 7d296a401b6f..4d9e33078d4f 100644
--- a/drivers/net/wireless/realtek/rtlwifi/btcoexist/rtl_btc.c
+++ b/drivers/net/wireless/realtek/rtlwifi/btcoexist/rtl_btc.c
@@ -52,8 +52,14 @@ static struct rtl_btc_ops rtl_btc_operation = {
.btc_is_bt_ctrl_lps = rtl_btc_is_bt_ctrl_lps,
.btc_is_bt_lps_on = rtl_btc_is_bt_lps_on,
.btc_get_ampdu_cfg = rtl_btc_get_ampdu_cfg,
+   .btc_display_bt_coex_info = rtl_btc_display_bt_coex_info,
 };
 
+void rtl_btc_display_bt_coex_info(struct rtl_priv *rtlpriv, struct seq_file *m)
+{
+   exhalbtc_display_bt_coex_info(_bt_coexist, m);
+}
+
 void rtl_btc_record_pwr_mode(struct rtl_priv *rtlpriv, u8 *buf, u8 len)
 {
u8 safe_len;
diff --git a/drivers/net/wireless/realtek/rtlwifi/btcoexist/rtl_btc.h 
b/drivers/net/wireless/realtek/rtlwifi/btcoexist/rtl_btc.h
index ac1253c46f44..40f1ce8c8a06 100644
--- a/drivers/net/wireless/realtek/rtlwifi/btcoexist/rtl_btc.h
+++ b/drivers/net/wireless/realtek/rtlwifi/btcoexist/rtl_btc.h
@@ -44,6 +44,7 @@ bool rtl_btc_is_limited_dig(struct rtl_priv *rtlpriv);
 bool rtl_btc_is_disable_edca_turbo(struct rtl_priv *rtlpriv);
 bool rtl_btc_is_bt_disabled(struct rtl_priv *rtlpriv);
 void rtl_btc_special_packet_notify(struct rtl_priv *rtlpriv, u8 pkt_type);
+void rtl_btc_display_bt_coex_info(struct rtl_priv *rtlpriv, struct 

[PATCH v3 04/10] rtlwifi: add amplifier type for 8812ae

2017-06-28 Thread Larry Finger
From: Ping-Ke Shih 

With correct amplifier_type, the phy praser can choose correct parameters.

Signed-off-by: Ping-Ke Shih 
Signed-off-by: Larry Finger 
Cc: Yan-Hsuan Chuang 
Cc: Birming Chiu 
Cc: Shaofu 
Cc: Steven Ting 
---
v2 - no changes
v3 - no changes
---
 .../net/wireless/realtek/rtlwifi/rtl8821ae/hw.c| 41 +-
 1 file changed, 40 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/hw.c 
b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/hw.c
index 2bc6bace069c..8f4abb3d7669 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/hw.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/hw.c
@@ -2966,6 +2966,44 @@ static void _rtl8812ae_read_pa_type(struct ieee80211_hw 
*hw, u8 *hwinfo,
}
 }
 
+static void _rtl8812ae_read_amplifier_type(struct ieee80211_hw *hw, u8 *hwinfo,
+  bool autoload_fail)
+{
+   struct rtl_priv *rtlpriv = rtl_priv(hw);
+   struct rtl_hal *rtlhal = rtl_hal(rtlpriv);
+
+   u8 ext_type_pa_2g_a  = (hwinfo[0xBD] & BIT(2))  >> 2; /* 0xBD[2] */
+   u8 ext_type_pa_2g_b  = (hwinfo[0xBD] & BIT(6))  >> 6; /* 0xBD[6] */
+   u8 ext_type_pa_5g_a  = (hwinfo[0xBF] & BIT(2))  >> 2; /* 0xBF[2] */
+   u8 ext_type_pa_5g_b  = (hwinfo[0xBF] & BIT(6))  >> 6; /* 0xBF[6] */
+   /* 0xBD[1:0] */
+   u8 ext_type_lna_2g_a = (hwinfo[0xBD] & (BIT(1) | BIT(0))) >> 0;
+   /* 0xBD[5:4] */
+   u8 ext_type_lna_2g_b = (hwinfo[0xBD] & (BIT(5) | BIT(4))) >> 4;
+   /* 0xBF[1:0] */
+   u8 ext_type_lna_5g_a = (hwinfo[0xBF] & (BIT(1) | BIT(0))) >> 0;
+   /* 0xBF[5:4] */
+   u8 ext_type_lna_5g_b = (hwinfo[0xBF] & (BIT(5) | BIT(4))) >> 4;
+
+   _rtl8812ae_read_pa_type(hw, hwinfo, autoload_fail);
+
+   /* [2.4G] Path A and B are both extPA */
+   if ((rtlhal->pa_type_2g & (BIT(5) | BIT(4))) == (BIT(5) | BIT(4)))
+   rtlhal->type_gpa  = ext_type_pa_2g_b  << 2 | ext_type_pa_2g_a;
+
+   /* [5G] Path A and B are both extPA */
+   if ((rtlhal->pa_type_5g & (BIT(1) | BIT(0))) == (BIT(1) | BIT(0)))
+   rtlhal->type_apa  = ext_type_pa_5g_b  << 2 | ext_type_pa_5g_a;
+
+   /* [2.4G] Path A and B are both extLNA */
+   if ((rtlhal->lna_type_2g & (BIT(7) | BIT(3))) == (BIT(7) | BIT(3)))
+   rtlhal->type_glna = ext_type_lna_2g_b << 2 | ext_type_lna_2g_a;
+
+   /* [5G] Path A and B are both extLNA */
+   if ((rtlhal->lna_type_5g & (BIT(7) | BIT(3))) == (BIT(7) | BIT(3)))
+   rtlhal->type_alna = ext_type_lna_5g_b << 2 | ext_type_lna_5g_a;
+}
+
 static void _rtl8821ae_read_pa_type(struct ieee80211_hw *hw, u8 *hwinfo,
bool autoload_fail)
 {
@@ -3114,7 +3152,8 @@ static void _rtl8821ae_read_adapter_info(struct 
ieee80211_hw *hw, bool b_pseudo_
   hwinfo);
 
if (rtlhal->hw_type == HARDWARE_TYPE_RTL8812AE) {
-   _rtl8812ae_read_pa_type(hw, hwinfo, 
rtlefuse->autoload_failflag);
+   _rtl8812ae_read_amplifier_type(hw, hwinfo,
+  rtlefuse->autoload_failflag);
_rtl8812ae_read_bt_coexist_info_from_hwpg(hw,
rtlefuse->autoload_failflag, hwinfo);
} else {
-- 
2.12.3



[PATCH v3 08/10] rtlwifi: move IS_HARDWARE_TYPE_xxx checker to wifi.h

2017-06-28 Thread Larry Finger
From: Ping-Ke Shih 

Use rtlpriv instead of rtlhal as argument, so driver and btcoex use
the same definitions.

Signed-off-by: Ping-Ke Shih 
Signed-off-by: Larry Finger 
Cc: Yan-Hsuan Chuang 
Cc: Birming Chiu 
Cc: Shaofu 
Cc: Steven Ting 
---
v2 - no changes
v3 - no changes
---
 .../realtek/rtlwifi/btcoexist/halbt_precomp.h  | 16 -
 .../net/wireless/realtek/rtlwifi/rtl8192cu/mac.c   |  3 +-
 drivers/net/wireless/realtek/rtlwifi/wifi.h| 42 ++
 3 files changed, 19 insertions(+), 42 deletions(-)

diff --git a/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbt_precomp.h 
b/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbt_precomp.h
index 2ac989a4b2bb..02dff4c3f664 100644
--- a/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbt_precomp.h
+++ b/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbt_precomp.h
@@ -43,22 +43,6 @@
 #define RT_SDIO_INTERFACE  3
 #define DEV_BUS_TYPE   RT_PCI_INTERFACE
 
-/* IC type */
-#define RTL_HW_TYPE(adapter)   (rtl_hal((struct rtl_priv *)adapter)->hw_type)
-
-#define IS_NEW_GENERATION_IC(adapter)  \
-   (RTL_HW_TYPE(adapter) >= HARDWARE_TYPE_RTL8192EE)
-#define IS_HARDWARE_TYPE_8812(adapter) \
-   (RTL_HW_TYPE(adapter) == HARDWARE_TYPE_RTL8812AE)
-#define IS_HARDWARE_TYPE_8821(adapter) \
-   (RTL_HW_TYPE(adapter) == HARDWARE_TYPE_RTL8821AE)
-#define IS_HARDWARE_TYPE_8723A(adapter)\
-   (RTL_HW_TYPE(adapter) == HARDWARE_TYPE_RTL8723AE)
-#define IS_HARDWARE_TYPE_8723B(adapter)\
-   (RTL_HW_TYPE(adapter) == HARDWARE_TYPE_RTL8723BE)
-#define IS_HARDWARE_TYPE_8192E(adapter)\
-   (RTL_HW_TYPE(adapter) == HARDWARE_TYPE_RTL8192EE)
-
 #include "halbtc8192e2ant.h"
 #include "halbtc8723b1ant.h"
 #include "halbtc8723b2ant.h"
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/mac.c 
b/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/mac.c
index 1b124eade846..5657b1e34ad0 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/mac.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/mac.c
@@ -352,11 +352,10 @@ u32 rtl92c_get_txdma_status(struct ieee80211_hw *hw)
 void rtl92c_enable_interrupt(struct ieee80211_hw *hw)
 {
struct rtl_priv *rtlpriv = rtl_priv(hw);
-   struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw));
struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw));
struct rtl_usb *rtlusb = rtl_usbdev(rtl_usbpriv(hw));
 
-   if (IS_HARDWARE_TYPE_8192CE(rtlhal)) {
+   if (IS_HARDWARE_TYPE_8192CE(rtlpriv)) {
rtl_write_dword(rtlpriv, REG_HIMR, rtlpci->irq_mask[0] &
0x);
rtl_write_dword(rtlpriv, REG_HIMRE, rtlpci->irq_mask[1] &
diff --git a/drivers/net/wireless/realtek/rtlwifi/wifi.h 
b/drivers/net/wireless/realtek/rtlwifi/wifi.h
index 4c6d01eb065d..f77acd329e0e 100644
--- a/drivers/net/wireless/realtek/rtlwifi/wifi.h
+++ b/drivers/net/wireless/realtek/rtlwifi/wifi.h
@@ -314,35 +314,29 @@ enum hardware_type {
HARDWARE_TYPE_RTL8192EE,
HARDWARE_TYPE_RTL8821AE,
HARDWARE_TYPE_RTL8812AE,
+   HARDWARE_TYPE_RTL8822BE,
 
/* keep it last */
HARDWARE_TYPE_NUM
 };
 
-#define IS_HARDWARE_TYPE_8192SU(rtlhal)\
-   (rtlhal->hw_type == HARDWARE_TYPE_RTL8192SU)
-#define IS_HARDWARE_TYPE_8192SE(rtlhal)\
-   (rtlhal->hw_type == HARDWARE_TYPE_RTL8192SE)
-#define IS_HARDWARE_TYPE_8192CE(rtlhal)\
-   (rtlhal->hw_type == HARDWARE_TYPE_RTL8192CE)
-#define IS_HARDWARE_TYPE_8192CU(rtlhal)\
-   (rtlhal->hw_type == HARDWARE_TYPE_RTL8192CU)
-#define IS_HARDWARE_TYPE_8192DE(rtlhal)\
-   (rtlhal->hw_type == HARDWARE_TYPE_RTL8192DE)
-#define IS_HARDWARE_TYPE_8192DU(rtlhal)\
-   (rtlhal->hw_type == HARDWARE_TYPE_RTL8192DU)
-#define IS_HARDWARE_TYPE_8723E(rtlhal) \
-   (rtlhal->hw_type == HARDWARE_TYPE_RTL8723E)
-#define IS_HARDWARE_TYPE_8723U(rtlhal) \
-   (rtlhal->hw_type == HARDWARE_TYPE_RTL8723U)
-#defineIS_HARDWARE_TYPE_8192S(rtlhal)  \
-(IS_HARDWARE_TYPE_8192SE(rtlhal) || IS_HARDWARE_TYPE_8192SU(rtlhal))
-#defineIS_HARDWARE_TYPE_8192C(rtlhal)  \
-(IS_HARDWARE_TYPE_8192CE(rtlhal) || IS_HARDWARE_TYPE_8192CU(rtlhal))
-#defineIS_HARDWARE_TYPE_8192D(rtlhal)  \
-(IS_HARDWARE_TYPE_8192DE(rtlhal) || IS_HARDWARE_TYPE_8192DU(rtlhal))
-#defineIS_HARDWARE_TYPE_8723(rtlhal)   \
-(IS_HARDWARE_TYPE_8723E(rtlhal) || IS_HARDWARE_TYPE_8723U(rtlhal))
+#define RTL_HW_TYPE(rtlpriv)   (rtl_hal((struct rtl_priv 

[PATCH v3 01/10] rtlwifi: Fill in_4way field by driver

2017-06-28 Thread Larry Finger
From: Ping-Ke Shih 

Because it isn't always correct to use EAPOL to check 4-way,
we add a timer to handle exception.

Signed-off-by: Ping-Ke Shih 
Signed-off-by: Larry Finger 
Cc: Yan-Hsuan Chuang 
Cc: Birming Chiu 
Cc: Shaofu 
Cc: Steven Ting 
---
v2 - no changes
v3 - no changes
---
 drivers/net/wireless/realtek/rtlwifi/base.c | 11 +++
 drivers/net/wireless/realtek/rtlwifi/core.c |  2 ++
 drivers/net/wireless/realtek/rtlwifi/wifi.h |  3 +++
 3 files changed, 16 insertions(+)

diff --git a/drivers/net/wireless/realtek/rtlwifi/base.c 
b/drivers/net/wireless/realtek/rtlwifi/base.c
index bd9ae07647e1..7aa3c39c9c5c 100644
--- a/drivers/net/wireless/realtek/rtlwifi/base.c
+++ b/drivers/net/wireless/realtek/rtlwifi/base.c
@@ -1408,6 +1408,11 @@ u8 rtl_is_special_data(struct ieee80211_hw *hw, struct 
sk_buff *skb, u8 is_tx,
 
return true;
} else if (ETH_P_PAE == ether_type) {
+   /* EAPOL is seens as in-4way */
+   rtlpriv->btcoexist.btc_info.in_4way = true;
+   rtlpriv->btcoexist.btc_info.in_4way_ts = jiffies;
+   rtlpriv->btcoexist.btc_info.in_4way_ts = jiffies;
+
RT_TRACE(rtlpriv, (COMP_SEND | COMP_RECV), DBG_DMESG,
 "802.1X %s EAPOL pkt!!\n", (is_tx) ? "Tx" : "Rx");
 
@@ -1959,6 +1964,12 @@ void rtl_watchdog_wq_callback(void *data)
if (rtlpriv->cfg->ops->get_btc_status())
rtlpriv->btcoexist.btc_ops->btc_periodical(rtlpriv);
 
+   if (rtlpriv->btcoexist.btc_info.in_4way) {
+   if (time_after(jiffies, rtlpriv->btcoexist.btc_info.in_4way_ts +
+  msecs_to_jiffies(IN_4WAY_TIMEOUT_TIME)))
+   rtlpriv->btcoexist.btc_info.in_4way = false;
+   }
+
rtlpriv->link_info.bcn_rx_inperiod = 0;
 
/* <6> scan list */
diff --git a/drivers/net/wireless/realtek/rtlwifi/core.c 
b/drivers/net/wireless/realtek/rtlwifi/core.c
index b0ad061048c5..c53cbf3d52bd 100644
--- a/drivers/net/wireless/realtek/rtlwifi/core.c
+++ b/drivers/net/wireless/realtek/rtlwifi/core.c
@@ -1505,6 +1505,8 @@ static int rtl_op_set_key(struct ieee80211_hw *hw, enum 
set_key_cmd cmd,
u8 mac_addr[ETH_ALEN];
u8 bcast_addr[ETH_ALEN] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
 
+   rtlpriv->btcoexist.btc_info.in_4way = false;
+
if (rtlpriv->cfg->mod_params->sw_crypto || rtlpriv->sec.use_sw_sec) {
RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING,
 "not open hw encryption\n");
diff --git a/drivers/net/wireless/realtek/rtlwifi/wifi.h 
b/drivers/net/wireless/realtek/rtlwifi/wifi.h
index fb1ebb01133f..7ec0d502a0d9 100644
--- a/drivers/net/wireless/realtek/rtlwifi/wifi.h
+++ b/drivers/net/wireless/realtek/rtlwifi/wifi.h
@@ -2477,6 +2477,8 @@ struct rtl_global_var {
spinlock_t glb_list_lock;
 };
 
+#define IN_4WAY_TIMEOUT_TIME   (30 * MSEC_PER_SEC) /* 30 seconds */
+
 struct rtl_btc_info {
u8 bt_type;
u8 btcoexist;
@@ -2485,6 +2487,7 @@ struct rtl_btc_info {
 
u8 ap_num;
bool in_4way;
+   unsigned long in_4way_ts;
 };
 
 struct bt_coexist_info {
-- 
2.12.3



[PATCH v3 03/10] rtlwifi: Add board type for 8723be and 8192ee

2017-06-28 Thread Larry Finger
From: Ping-Ke Shih 

With correct board_type, the phy praser can choose correct parameters.

Signed-off-by: Ping-Ke Shih 
Signed-off-by: Larry Finger 
Cc: Yan-Hsuan Chuang 
Cc: Birming Chiu 
Cc: Shaofu 
Cc: Steven Ting 
---
v2 - no changes
v3 - no changes
---
 drivers/net/wireless/realtek/rtlwifi/rtl8192ee/hw.c | 5 +
 drivers/net/wireless/realtek/rtlwifi/rtl8723be/hw.c | 7 +++
 2 files changed, 12 insertions(+)

diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/hw.c 
b/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/hw.c
index d84ac7adfd82..ef9394be7016 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/hw.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/hw.c
@@ -2133,7 +2133,12 @@ static void _rtl92ee_read_adapter_info(struct 
ieee80211_hw *hw)
if ((*(u8 *)[EEPROM_RF_BOARD_OPTION_92E]) == 0xFF)
rtlefuse->board_type = 0;
 
+   if (rtlpriv->btcoexist.btc_info.btcoexist == 1)
+   rtlefuse->board_type |= BIT(2); /* ODM_BOARD_BT */
+
rtlhal->board_type = rtlefuse->board_type;
+   RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD,
+"board_type = 0x%x\n", rtlefuse->board_type);
/*parse xtal*/
rtlefuse->crystalcap = hwinfo[EEPROM_XTAL_92E];
if (hwinfo[EEPROM_XTAL_92E] == 0xFF)
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8723be/hw.c 
b/drivers/net/wireless/realtek/rtlwifi/rtl8723be/hw.c
index 2a7ad5ffe997..0b9366e7acbd 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8723be/hw.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8723be/hw.c
@@ -2114,6 +2114,13 @@ static void _rtl8723be_read_adapter_info(struct 
ieee80211_hw *hw,
 rtlefuse->autoload_failflag,
 hwinfo);
 
+   if (rtlpriv->btcoexist.btc_info.btcoexist == 1)
+   rtlefuse->board_type |= BIT(2); /* ODM_BOARD_BT */
+
+   rtlhal->board_type = rtlefuse->board_type;
+   RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD,
+"board_type = 0x%x\n", rtlefuse->board_type);
+
rtlhal->package_type = _rtl8723be_read_package_type(hw);
 
/* set channel plan from efuse */
-- 
2.12.3



[PATCH v3 07/10] rtlwifi: Uses addr1 instead DA to determine broadcast and multicast addr.

2017-06-28 Thread Larry Finger
From: Ping-Ke Shih 

We should check addr1 to indicate a packet as broadcast or multicast
in tx desc. An obvious example, a STA transmit an *unicast* ARP packet
where addr1 and DA are the addresses of AP and broadcast respectively.

Signed-off-by: Ping-Ke Shih 
Signed-off-by: Larry Finger 
Cc: Yan-Hsuan Chuang 
Cc: Birming Chiu 
Cc: Shaofu 
Cc: Steven Ting 
---
v2 - no changes
v3 - no changes
---
 drivers/net/wireless/realtek/rtlwifi/base.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/realtek/rtlwifi/base.c 
b/drivers/net/wireless/realtek/rtlwifi/base.c
index 7aa3c39c9c5c..464f14450f75 100644
--- a/drivers/net/wireless/realtek/rtlwifi/base.c
+++ b/drivers/net/wireless/realtek/rtlwifi/base.c
@@ -1166,9 +1166,9 @@ void rtl_get_tcb_desc(struct ieee80211_hw *hw,
}
}
 
-   if (is_multicast_ether_addr(ieee80211_get_DA(hdr)))
+   if (is_multicast_ether_addr(hdr->addr1))
tcb_desc->multicast = 1;
-   else if (is_broadcast_ether_addr(ieee80211_get_DA(hdr)))
+   else if (is_broadcast_ether_addr(hdr->addr1))
tcb_desc->broadcast = 1;
 
_rtl_txrate_selectmode(hw, sta, tcb_desc);
-- 
2.12.3



[PATCH v3 06/10] rtlwifi: Rename rtl_desc92_rate to rtl_desc_rate

2017-06-28 Thread Larry Finger
From: Ping-Ke Shih 

This is a common enumeration, so we use a common name.

Signed-off-by: Ping-Ke Shih 
Signed-off-by: Larry Finger 
Cc: Yan-Hsuan Chuang 
Cc: Birming Chiu 
Cc: Shaofu 
Cc: Steven Ting 
---
v2 - no changes
v3 - no changes
---
 drivers/net/wireless/realtek/rtlwifi/wifi.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/realtek/rtlwifi/wifi.h 
b/drivers/net/wireless/realtek/rtlwifi/wifi.h
index 77c3b186900e..4c6d01eb065d 100644
--- a/drivers/net/wireless/realtek/rtlwifi/wifi.h
+++ b/drivers/net/wireless/realtek/rtlwifi/wifi.h
@@ -592,7 +592,7 @@ enum rtl_hal_state {
_HAL_STATE_START = 1,
 };
 
-enum rtl_desc92_rate {
+enum rtl_desc_rate {
DESC_RATE1M = 0x00,
DESC_RATE2M = 0x01,
DESC_RATE5_5M = 0x02,
-- 
2.12.3



[PATCH v3 02/10] rtlwifi: Add BT_MP_INFO to c2h handler.

2017-06-28 Thread Larry Finger
From: Ping-Ke Shih 

We use H2C to ask BT's status, and C2H will return the status.

Signed-off-by: Ping-Ke Shih 
Signed-off-by: Larry Finger 
Cc: Yan-Hsuan Chuang 
Cc: Birming Chiu 
Cc: Shaofu 
Cc: Steven Ting 
---
v2 - no changes
v3 - no changes
---
 .../realtek/rtlwifi/btcoexist/halbtcoutsrc.c   | 17 -
 .../wireless/realtek/rtlwifi/btcoexist/rtl_btc.c   | 28 ++
 .../wireless/realtek/rtlwifi/btcoexist/rtl_btc.h   |  1 +
 .../net/wireless/realtek/rtlwifi/rtl8192ee/fw.c|  9 +--
 .../net/wireless/realtek/rtlwifi/rtl8723be/fw.c|  9 +--
 .../net/wireless/realtek/rtlwifi/rtl8821ae/fw.c| 13 +++---
 drivers/net/wireless/realtek/rtlwifi/wifi.h|  2 ++
 7 files changed, 71 insertions(+), 8 deletions(-)

diff --git a/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.c 
b/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.c
index e6024b013ca5..c1eacd8352a2 100644
--- a/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.c
+++ b/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.c
@@ -327,7 +327,22 @@ static void halbtc_aggregation_check(struct btc_coexist 
*btcoexist)
 
 static u32 halbtc_get_bt_patch_version(struct btc_coexist *btcoexist)
 {
-   return 0;
+   struct rtl_priv *rtlpriv = btcoexist->adapter;
+   u8 cmd_buffer[4] = {0};
+   u8 oper_ver = 0;
+   u8 req_num = 0x0E;
+
+   if (btcoexist->bt_info.bt_real_fw_ver)
+   goto label_done;
+
+   cmd_buffer[0] |= (oper_ver & 0x0f); /* Set OperVer */
+   cmd_buffer[0] |= ((req_num << 4) & 0xf0);   /* Set ReqNum */
+   cmd_buffer[1] = 0; /* BT_OP_GET_BT_VERSION = 0 */
+   rtlpriv->cfg->ops->fill_h2c_cmd(rtlpriv->mac80211.hw, 0x67, 4,
+   _buffer[0]);
+
+label_done:
+   return btcoexist->bt_info.bt_real_fw_ver;
 }
 
 u32 halbtc_get_wifi_link_status(struct btc_coexist *btcoexist)
diff --git a/drivers/net/wireless/realtek/rtlwifi/btcoexist/rtl_btc.c 
b/drivers/net/wireless/realtek/rtlwifi/btcoexist/rtl_btc.c
index 4366c9817e1e..7d296a401b6f 100644
--- a/drivers/net/wireless/realtek/rtlwifi/btcoexist/rtl_btc.c
+++ b/drivers/net/wireless/realtek/rtlwifi/btcoexist/rtl_btc.c
@@ -41,6 +41,7 @@ static struct rtl_btc_ops rtl_btc_operation = {
.btc_periodical = rtl_btc_periodical,
.btc_halt_notify = rtl_btc_halt_notify,
.btc_btinfo_notify = rtl_btc_btinfo_notify,
+   .btc_btmpinfo_notify = rtl_btc_btmpinfo_notify,
.btc_is_limited_dig = rtl_btc_is_limited_dig,
.btc_is_disable_edca_turbo = rtl_btc_is_disable_edca_turbo,
.btc_is_bt_disabled = rtl_btc_is_bt_disabled,
@@ -165,6 +166,33 @@ void rtl_btc_btinfo_notify(struct rtl_priv *rtlpriv, u8 
*tmp_buf, u8 length)
exhalbtc_bt_info_notify(_bt_coexist, tmp_buf, length);
 }
 
+void rtl_btc_btmpinfo_notify(struct rtl_priv *rtlpriv, u8 *tmp_buf, u8 length)
+{
+   u8 extid, seq, len;
+   u16 bt_real_fw_ver;
+   u8 bt_fw_ver;
+
+   if ((length < 4) || (!tmp_buf))
+   return;
+
+   extid = tmp_buf[0];
+   /* not response from BT FW then exit*/
+   if (extid != 1) /* C2H_TRIG_BY_BT_FW = 1 */
+   return;
+
+   len = tmp_buf[1] >> 4;
+   seq = tmp_buf[2] >> 4;
+
+   /* BT Firmware version response */
+   if (seq == 0x0E) {
+   bt_real_fw_ver = tmp_buf[3] | (tmp_buf[4] << 8);
+   bt_fw_ver = tmp_buf[5];
+
+   gl_bt_coexist.bt_info.bt_real_fw_ver = bt_real_fw_ver;
+   gl_bt_coexist.bt_info.bt_fw_ver = bt_fw_ver;
+   }
+}
+
 bool rtl_btc_is_limited_dig(struct rtl_priv *rtlpriv)
 {
return gl_bt_coexist.bt_info.limited_dig;
diff --git a/drivers/net/wireless/realtek/rtlwifi/btcoexist/rtl_btc.h 
b/drivers/net/wireless/realtek/rtlwifi/btcoexist/rtl_btc.h
index 6fe521cbe7f0..ac1253c46f44 100644
--- a/drivers/net/wireless/realtek/rtlwifi/btcoexist/rtl_btc.h
+++ b/drivers/net/wireless/realtek/rtlwifi/btcoexist/rtl_btc.h
@@ -39,6 +39,7 @@ void rtl_btc_mediastatus_notify(struct rtl_priv *rtlpriv,
 void rtl_btc_periodical(struct rtl_priv *rtlpriv);
 void rtl_btc_halt_notify(void);
 void rtl_btc_btinfo_notify(struct rtl_priv *rtlpriv, u8 *tmpbuf, u8 length);
+void rtl_btc_btmpinfo_notify(struct rtl_priv *rtlpriv, u8 *tmp_buf, u8 length);
 bool rtl_btc_is_limited_dig(struct rtl_priv *rtlpriv);
 bool rtl_btc_is_disable_edca_turbo(struct rtl_priv *rtlpriv);
 bool rtl_btc_is_bt_disabled(struct rtl_priv *rtlpriv);
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/fw.c 
b/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/fw.c
index f4ee7906eb20..31a391e9b830 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/fw.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/fw.c
@@ -888,6 +888,7 @@ void 

[PATCH v3 00/10] Set 3 of changes related to updates of btcoexist

2017-06-28 Thread Larry Finger
To get maximum benefit of the recent changes in btcoexist, changes need
to be made in the drivers for the NIC. This is set 3 of those changes.

v2 - remove \r characters as suggested by Joe Perches
v3 - remove those \r characters missed in v2

Ping-Ke Shih (10):
  rtlwifi: Fill in_4way field by driver
  rtlwifi: Add BT_MP_INFO to c2h handler.
  rtlwifi: Add board type for 8723be and 8192ee
  rtlwifi: add amplifier type for 8812ae
  rtlwifi: Update 8723be new phy parameters and its parser.
  rtlwifi: Rename rtl_desc92_rate to rtl_desc_rate
  rtlwifi: Uses addr1 instead DA to determine broadcast and multicast
addr.
  rtlwifi: move IS_HARDWARE_TYPE_xxx checker to wifi.h
  rtlwifi: use debugfs to debug.
  rtlwifi: btcoex: Use seq_file to dump btcoex status

 drivers/net/wireless/realtek/rtlwifi/base.c|  21 +-
 .../realtek/rtlwifi/btcoexist/halbt_precomp.h  |  16 -
 .../realtek/rtlwifi/btcoexist/halbtc8192e2ant.c| 202 +-
 .../realtek/rtlwifi/btcoexist/halbtc8192e2ant.h|   3 +-
 .../realtek/rtlwifi/btcoexist/halbtc8723b1ant.c| 269 ++---
 .../realtek/rtlwifi/btcoexist/halbtc8723b1ant.h|   3 +-
 .../realtek/rtlwifi/btcoexist/halbtc8723b2ant.c| 206 +-
 .../realtek/rtlwifi/btcoexist/halbtc8723b2ant.h|   3 +-
 .../realtek/rtlwifi/btcoexist/halbtc8821a1ant.c| 285 ++---
 .../realtek/rtlwifi/btcoexist/halbtc8821a1ant.h|   3 +-
 .../realtek/rtlwifi/btcoexist/halbtc8821a2ant.c| 177 -
 .../realtek/rtlwifi/btcoexist/halbtc8821a2ant.h|   3 +-
 .../realtek/rtlwifi/btcoexist/halbtcoutsrc.c   | 150 ++-
 .../realtek/rtlwifi/btcoexist/halbtcoutsrc.h   |  14 +-
 .../wireless/realtek/rtlwifi/btcoexist/rtl_btc.c   |  34 ++
 .../wireless/realtek/rtlwifi/btcoexist/rtl_btc.h   |   2 +
 drivers/net/wireless/realtek/rtlwifi/core.c|   2 +
 drivers/net/wireless/realtek/rtlwifi/debug.c   | 439 +
 drivers/net/wireless/realtek/rtlwifi/debug.h   |  12 +
 drivers/net/wireless/realtek/rtlwifi/pci.c |   6 +
 .../net/wireless/realtek/rtlwifi/rtl8192cu/mac.c   |   3 +-
 .../net/wireless/realtek/rtlwifi/rtl8192ee/fw.c|   9 +-
 .../net/wireless/realtek/rtlwifi/rtl8192ee/hw.c|   5 +
 .../net/wireless/realtek/rtlwifi/rtl8723be/fw.c|   9 +-
 .../net/wireless/realtek/rtlwifi/rtl8723be/hw.c|   7 +
 .../net/wireless/realtek/rtlwifi/rtl8723be/phy.c   | 365 -
 .../net/wireless/realtek/rtlwifi/rtl8723be/table.c | 192 +
 .../net/wireless/realtek/rtlwifi/rtl8723be/table.h |  10 +-
 .../net/wireless/realtek/rtlwifi/rtl8821ae/fw.c|  13 +-
 .../net/wireless/realtek/rtlwifi/rtl8821ae/hw.c|  41 +-
 drivers/net/wireless/realtek/rtlwifi/wifi.h|  58 +--
 31 files changed, 1588 insertions(+), 974 deletions(-)

-- 
2.12.3



[PATCH v3 05/10] rtlwifi: Update 8723be new phy parameters and its parser.

2017-06-28 Thread Larry Finger
From: Ping-Ke Shih 

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

Signed-off-by: Ping-Ke Shih 
Signed-off-by: Larry Finger 
Cc: Yan-Hsuan Chuang 
Cc: Birming Chiu 
Cc: Shaofu 
Cc: Steven Ting 
---
v2 - no changes
v3 - no changes
---
 .../net/wireless/realtek/rtlwifi/rtl8723be/phy.c   | 365 +
 .../net/wireless/realtek/rtlwifi/rtl8723be/table.c | 192 ++-
 .../net/wireless/realtek/rtlwifi/rtl8723be/table.h |  10 +-
 3 files changed, 281 insertions(+), 286 deletions(-)

diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8723be/phy.c 
b/drivers/net/wireless/realtek/rtlwifi/rtl8723be/phy.c
index 9752175cc466..9606641519e7 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8723be/phy.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8723be/phy.c
@@ -152,33 +152,86 @@ bool rtl8723be_phy_rf_config(struct ieee80211_hw *hw)
return rtl8723be_phy_rf6052_config(hw);
 }
 
-static bool _rtl8723be_check_condition(struct ieee80211_hw *hw,
-  const u32  condition)
+static bool _rtl8723be_check_positive(struct ieee80211_hw *hw,
+ const u32 condition1,
+ const u32 condition2)
 {
-   struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw));
-   struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw));
-   u32 _board = rtlefuse->board_type; /*need efuse define*/
-   u32 _interface = rtlhal->interface;
-   u32 _platform = 0x08;/*SupportPlatform */
-   u32 cond = condition;
+   struct rtl_priv *rtlpriv = rtl_priv(hw);
+   struct rtl_hal *rtlhal = rtl_hal(rtlpriv);
+   u32 cut_ver = ((rtlhal->version & CHIP_VER_RTL_MASK)
+   >> CHIP_VER_RTL_SHIFT);
+   u32 intf = (rtlhal->interface == INTF_USB ? BIT(1) : BIT(0));
+
+   u8  board_type = ((rtlhal->board_type & BIT(4)) >> 4) << 0 | /* _GLNA */
+((rtlhal->board_type & BIT(3)) >> 3) << 1 | /* _GPA  */
+((rtlhal->board_type & BIT(7)) >> 7) << 2 | /* _ALNA */
+((rtlhal->board_type & BIT(6)) >> 6) << 3 | /* _APA  */
+((rtlhal->board_type & BIT(2)) >> 2) << 4;  /* _BT   */
+
+   u32 cond1 = condition1, cond2 = condition2;
+   u32 driver1 = cut_ver << 24 |   /* CUT ver */
+ 0 << 20 | /* interface 2/2 */
+ 0x04 << 16 |  /* platform */
+ rtlhal->package_type << 12 |
+ intf << 8 |   /* interface 1/2 */
+ board_type;
+
+   u32 driver2 = rtlhal->type_glna <<  0 |
+ rtlhal->type_gpa  <<  8 |
+ rtlhal->type_alna << 16 |
+ rtlhal->type_apa  << 24;
 
-   if (condition == 0xCDCDCDCD)
-   return true;
+   RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE,
+"===> [8812A] CheckPositive (cond1, cond2) = (0x%X 0x%X)\n",
+cond1, cond2);
+   RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE,
+"===> [8812A] CheckPositive (driver1, driver2) = (0x%X 
0x%X)\n",
+driver1, driver2);
 
-   cond = condition & 0xFF;
-   if ((_board & cond) == 0 && cond != 0x1F)
-   return false;
+   RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE,
+"  (Platform, Interface) = (0x%X, 0x%X)\n", 0x04, intf);
+   RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE,
+"  (Board, Package) = (0x%X, 0x%X)\n",
+rtlhal->board_type, rtlhal->package_type);
 
-   cond = condition & 0xFF00;
-   cond = cond >> 8;
-   if ((_interface & cond) == 0 && cond != 0x07)
-   return false;
+   /*== Value Defined Check ===*/
+   /*QFN Type [15:12] and Cut Version [27:24] need to do value check*/
 
-   cond = condition & 0xFF;
-   cond = cond >> 16;
-   if ((_platform & cond) == 0 && cond != 0x0F)
+   if (((cond1 & 0xF000) != 0) && ((cond1 & 0xF000) !=
+   (driver1 & 0xF000)))
return false;
-   return true;
+   if (((cond1 & 0x0F00) != 0) && ((cond1 & 0x0F00) !=
+   (driver1 & 0x0F00)))
+   return false;
+
+   /*=== Bit Defined Check */
+   /* We don't care [31:28] */
+
+   cond1   &= 0x00FF0FFF;
+   driver1 &= 0x00FF0FFF;
+
+   if ((cond1 & driver1) == cond1) {
+   u32 mask = 0;
+
+   if ((cond1 & 0x0F) == 0) /* BoardType is DONTCARE*/
+   return true;
+
+   if ((cond1 & BIT(0)) != 0) /*GLNA*/
+   mask |= 0x00FF;
+   if ((cond1 

Re: [PATCH] mac80211_hwsim: use dyndbg for debug messages

2017-06-28 Thread Johannes Berg
On Wed, 2017-06-28 at 06:37 -0700, Joe Perches wrote:
> On Wed, 2017-06-28 at 15:17 +0200, Lubomir Rintel wrote:
> > The mac80211_hwsim doesn't offer a way to disable the debugging
> > output.
> > Unfortunately, it's pretty chatty, dumping a  lot of stuff into the
> > message
> > buffer.
> > 
> > This patch changes it to use dyndbg for controlling the debug
> > output.
> > It's disabled by default, but can be enabled by a module parameter
> > (1),
> > at runtime (2) or persisted in modprobe.conf (3).
> > 
> >   (1) modprobe mac80211_hwsim dyndbg=+p
> >   (2) echo "module mac80211_hwsim +p"
> > >/sys/kernel/debug/dynamic_debug/control
> >   (3) echo "options mac80211_hwsim dyndbg=+p"
> > >>/etc/modprobe.d/my.conf
> 
> I wonder about the value at all of the 2 forms:
> 
> wiphy_dbg -> only with #define DEBUG or dynamic_debug
> wiphy_debug   -> always emitted at KERN_DEBUG
> 
> Is there any real value in wiphy_debug?
> 
> Should it just be converted to
> 
> #define wiphy_debug   wiphy_dbg

I don't think it should, there are some messages that we'd probably
just have to give a higher priority if we did this.

johannes


Re: [PATCH] mac80211_hwsim: use dyndbg for debug messages

2017-06-28 Thread Johannes Berg
On Wed, 2017-06-28 at 15:17 +0200, Lubomir Rintel wrote:
> The mac80211_hwsim doesn't offer a way to disable the debugging
> output.
> Unfortunately, it's pretty chatty, dumping a  lot of stuff into the
> message buffer.

Why is this a problem? It's pretty much a testing tool only, and much
of the point is to have message about it's internal state?

johannes


Re: [PATCH] mac80211_hwsim: use dyndbg for debug messages

2017-06-28 Thread Joe Perches
On Wed, 2017-06-28 at 15:17 +0200, Lubomir Rintel wrote:
> The mac80211_hwsim doesn't offer a way to disable the debugging output.
> Unfortunately, it's pretty chatty, dumping a  lot of stuff into the message
> buffer.
> 
> This patch changes it to use dyndbg for controlling the debug output.
> It's disabled by default, but can be enabled by a module parameter (1),
> at runtime (2) or persisted in modprobe.conf (3).
> 
>   (1) modprobe mac80211_hwsim dyndbg=+p
>   (2) echo "module mac80211_hwsim +p" >/sys/kernel/debug/dynamic_debug/control
>   (3) echo "options mac80211_hwsim dyndbg=+p" >>/etc/modprobe.d/my.conf

I wonder about the value at all of the 2 forms:

wiphy_dbg   -> only with #define DEBUG or dynamic_debug
wiphy_debug -> always emitted at KERN_DEBUG

Is there any real value in wiphy_debug?

Should it just be converted to

#define wiphy_debug wiphy_dbg

or maybe a global sed to remove it completely?



[PATCH] mac80211_hwsim: use dyndbg for debug messages

2017-06-28 Thread Lubomir Rintel
The mac80211_hwsim doesn't offer a way to disable the debugging output.
Unfortunately, it's pretty chatty, dumping a  lot of stuff into the message
buffer.

This patch changes it to use dyndbg for controlling the debug output.
It's disabled by default, but can be enabled by a module parameter (1),
at runtime (2) or persisted in modprobe.conf (3).

  (1) modprobe mac80211_hwsim dyndbg=+p
  (2) echo "module mac80211_hwsim +p" >/sys/kernel/debug/dynamic_debug/control
  (3) echo "options mac80211_hwsim dyndbg=+p" >>/etc/modprobe.d/my.conf

Signed-off-by: Lubomir Rintel 
---
 drivers/net/wireless/mac80211_hwsim.c | 96 +--
 1 file changed, 48 insertions(+), 48 deletions(-)

diff --git a/drivers/net/wireless/mac80211_hwsim.c 
b/drivers/net/wireless/mac80211_hwsim.c
index c854a557998b..8ec4835a623e 100644
--- a/drivers/net/wireless/mac80211_hwsim.c
+++ b/drivers/net/wireless/mac80211_hwsim.c
@@ -396,7 +396,7 @@ static int mac80211_hwsim_vendor_cmd_test(struct wiphy 
*wiphy,
if (!tb[QCA_WLAN_VENDOR_ATTR_TEST])
return -EINVAL;
val = nla_get_u32(tb[QCA_WLAN_VENDOR_ATTR_TEST]);
-   wiphy_debug(wiphy, "%s: test=%u\n", __func__, val);
+   wiphy_dbg(wiphy, "%s: test=%u\n", __func__, val);
 
/* Send a vendor event as a test. Note that this would not normally be
 * done within a command handler, but rather, based on some other
@@ -643,7 +643,7 @@ static void hwsim_send_ps_poll(void *dat, u8 *mac, struct 
ieee80211_vif *vif)
if (!vp->assoc)
return;
 
-   wiphy_debug(data->hw->wiphy,
+   wiphy_dbg(data->hw->wiphy,
"%s: send PS-Poll to %pM for aid %d\n",
__func__, vp->bssid, vp->aid);
 
@@ -674,7 +674,7 @@ static void hwsim_send_nullfunc(struct mac80211_hwsim_data 
*data, u8 *mac,
if (!vp->assoc)
return;
 
-   wiphy_debug(data->hw->wiphy,
+   wiphy_dbg(data->hw->wiphy,
"%s: send data::nullfunc to %pM ps=%d\n",
__func__, vp->bssid, ps);
 
@@ -1034,7 +1034,7 @@ static void mac80211_hwsim_tx_frame_nl(struct 
ieee80211_hw *hw,
msg_head = genlmsg_put(skb, 0, 0, _genl_family, 0,
   HWSIM_CMD_FRAME);
if (msg_head == NULL) {
-   printk(KERN_DEBUG "mac80211_hwsim: problem with msg_head\n");
+   pr_debug("mac80211_hwsim: problem with msg_head\n");
goto nla_put_failure;
}
 
@@ -1093,7 +1093,7 @@ static void mac80211_hwsim_tx_frame_nl(struct 
ieee80211_hw *hw,
 nla_put_failure:
nlmsg_free(skb);
 err_free_txskb:
-   printk(KERN_DEBUG "mac80211_hwsim: error occurred in %s\n", __func__);
+   pr_debug("mac80211_hwsim: error occurred in %s\n", __func__);
ieee80211_free_txskb(hw, my_skb);
data->tx_failed++;
 }
@@ -1347,7 +1347,7 @@ static void mac80211_hwsim_tx(struct ieee80211_hw *hw,
}
 
if (data->idle && !data->tmp_chan) {
-   wiphy_debug(hw->wiphy, "Trying to TX when idle - reject\n");
+   wiphy_dbg(hw->wiphy, "Trying to TX when idle - reject\n");
ieee80211_free_txskb(hw, skb);
return;
}
@@ -1410,7 +1410,7 @@ static void mac80211_hwsim_tx(struct ieee80211_hw *hw,
 static int mac80211_hwsim_start(struct ieee80211_hw *hw)
 {
struct mac80211_hwsim_data *data = hw->priv;
-   wiphy_debug(hw->wiphy, "%s\n", __func__);
+   wiphy_dbg(hw->wiphy, "%s\n", __func__);
data->started = true;
return 0;
 }
@@ -1421,14 +1421,14 @@ static void mac80211_hwsim_stop(struct ieee80211_hw *hw)
struct mac80211_hwsim_data *data = hw->priv;
data->started = false;
tasklet_hrtimer_cancel(>beacon_timer);
-   wiphy_debug(hw->wiphy, "%s\n", __func__);
+   wiphy_dbg(hw->wiphy, "%s\n", __func__);
 }
 
 
 static int mac80211_hwsim_add_interface(struct ieee80211_hw *hw,
struct ieee80211_vif *vif)
 {
-   wiphy_debug(hw->wiphy, "%s (type=%d mac_addr=%pM)\n",
+   wiphy_dbg(hw->wiphy, "%s (type=%d mac_addr=%pM)\n",
__func__, ieee80211_vif_type_p2p(vif),
vif->addr);
hwsim_set_magic(vif);
@@ -1449,7 +1449,7 @@ static int mac80211_hwsim_change_interface(struct 
ieee80211_hw *hw,
   bool newp2p)
 {
newtype = ieee80211_iftype_p2p(newtype, newp2p);
-   wiphy_debug(hw->wiphy,
+   wiphy_dbg(hw->wiphy,
"%s (old type=%d, new type=%d, mac_addr=%pM)\n",
__func__, ieee80211_vif_type_p2p(vif),
newtype, vif->addr);
@@ -1467,7 +1467,7 @@ static int mac80211_hwsim_change_interface(struct 
ieee80211_hw *hw,
 static void mac80211_hwsim_remove_interface(
struct ieee80211_hw *hw, struct ieee80211_vif *vif)
 {
-   wiphy_debug(hw->wiphy, "%s (type=%d mac_addr=%pM)\n",
+   

[PATCH] rtlwifi: Remove unused dummy function

2017-06-28 Thread Souptick Joarder
Removing unused dummy function

Signed-off-by: Souptick Joarder 
---
 drivers/net/wireless/realtek/rtlwifi/rtl8192cu/sw.c  |  2 +-
 drivers/net/wireless/realtek/rtlwifi/rtl8192cu/trx.c | 12 
 drivers/net/wireless/realtek/rtlwifi/rtl8192cu/trx.h |  3 ---
 3 files changed, 1 insertion(+), 16 deletions(-)

diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/sw.c 
b/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/sw.c
index 96c923b..62d9214 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/sw.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/sw.c
@@ -173,7 +173,7 @@ static bool rtl92cu_get_btc_status(void)
.rx_urb_num = RTL92C_NUM_RX_URBS,
.rx_max_size = RTL92C_SIZE_MAX_RX_BUFFER,
.usb_rx_hdl = rtl8192cu_rx_hdl,
-   .usb_rx_segregate_hdl = NULL, /* rtl8192c_rx_segregate_hdl; */
+   .usb_rx_segregate_hdl = NULL,
/* tx */
.usb_tx_cleanup = rtl8192c_tx_cleanup,
.usb_tx_post_hdl = rtl8192c_tx_post_hdl,
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/trx.c 
b/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/trx.c
index 41422e4..25a081c 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/trx.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/trx.c
@@ -436,13 +436,6 @@ void  rtl8192cu_rx_hdl(struct ieee80211_hw *hw, struct 
sk_buff * skb)
_rtl_rx_process(hw, skb);
 }

-void rtl8192c_rx_segregate_hdl(
-   struct ieee80211_hw *hw,
-   struct sk_buff *skb,
-   struct sk_buff_head *skb_list)
-{
-}
-
 /*--
  *
  * Tx handler
@@ -675,8 +668,3 @@ void rtl92cu_tx_fill_cmddesc(struct ieee80211_hw *hw,
RT_PRINT_DATA(rtlpriv, COMP_CMD, DBG_LOUD, "H2C Tx Cmd Content",
  pdesc, RTL_TX_DESC_SIZE);
 }
-
-bool rtl92cu_cmd_send_packet(struct ieee80211_hw *hw, struct sk_buff *skb)
-{
-   return true;
-}
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/trx.h 
b/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/trx.h
index 487eec8..15a66c5 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/trx.h
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/trx.h
@@ -385,8 +385,6 @@ bool rtl92cu_rx_query_desc(struct ieee80211_hw *hw,
   struct ieee80211_rx_status *rx_status,
   u8 *p_desc, struct sk_buff *skb);
 void  rtl8192cu_rx_hdl(struct ieee80211_hw *hw, struct sk_buff * skb);
-void rtl8192c_rx_segregate_hdl(struct ieee80211_hw *, struct sk_buff *,
-  struct sk_buff_head *);
 void rtl8192c_tx_cleanup(struct ieee80211_hw *hw, struct sk_buff  *skb);
 int rtl8192c_tx_post_hdl(struct ieee80211_hw *hw, struct urb *urb,
 struct sk_buff *skb);
@@ -404,6 +402,5 @@ void rtl92cu_fill_fake_txdesc(struct ieee80211_hw *hw, u8 * 
pDesc,
 void rtl92cu_tx_fill_cmddesc(struct ieee80211_hw *hw,
 u8 *pdesc, bool b_firstseg,
 bool b_lastseg, struct sk_buff *skb);
-bool rtl92cu_cmd_send_packet(struct ieee80211_hw *hw, struct sk_buff *skb);

 #endif
--
1.9.1



Re: [PATCH] iwlwifi: mvm: fix iwl_mvm_sar_find_wifi_pkg corner case

2017-06-28 Thread Luca Coelho
On Tue, 2017-06-27 at 17:24 +0200, Arnd Bergmann wrote:
> gcc warns about what it thinks is an uninitialized variable
> access:
> 
> drivers/net/wireless/intel/iwlwifi/mvm/fw.c: In function 
> 'iwl_mvm_sar_find_wifi_pkg.isra.14':
> drivers/net/wireless/intel/iwlwifi/mvm/fw.c:1102:5: error: 'wifi_pkg' may be 
> used uninitialized in this function [-Werror=maybe-uninitialized]
> 
> That problem cannot really happen, as we check data->package.count
> to ensure that the loop is entered at least once.
> However, something that can indeed happen is returning an incorrect
> wifi_pkg pointer in case none of the elements are what we are looking
> for.
> 
> This modifies the loop again, to only return a correct object, and
> to shut up that warning.
> 
> Fixes: c386dacb4ed6 ("iwlwifi: mvm: refactor SAR init to prepare for dynamic 
> SAR")
> Signed-off-by: Arnd Bergmann 
> ---

Thanks, Arnd!

I've pushed this to our internal tree and it will eventually reach the
mainline, via our normal upstreaming process.


--
Cheers,
Luca.


Re: [PATCH] iwlwifi: mvm: add const to thermal_cooling_device_ops structure

2017-06-28 Thread Luca Coelho
On Wed, 2017-06-21 at 14:10 +0530, Bhumika Goyal wrote:
> Declare thermal_cooling_device_ops structure as const as it is only passed
> as an argument to the function thermal_cooling_device_register and this
> argument is of type const. So, declare the structure as const.
> 
> Signed-off-by: Bhumika Goyal 
> ---

Thanks, we're reviewing this internally.  It looks fine, but I need to
assess whether this will have any impacts in our backports project
before we can apply it.

--
Cheers,
Luca.


pull-request: iwlwifi-next 2017-06-28

2017-06-28 Thread Luca Coelho
Hi Kalle,

Here's my second pull-request intended for v4.13.  Again, this pull-
request includes the last two patchsets I sent out.  It contains generic
development work, with improvements, bug fixes and cleanup all around. 
More details in the tag description.

I have sent this out before, and kbuildbot reported success.

Please let me know if there are any issues.

Cheers,
Luca.


The following changes since commit 52f8c9380f2eb051581628782a4917f2c3f9751f:

  Merge ath-next from 
git://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git (2017-06-22 
16:29:52 +0300)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/iwlwifi/iwlwifi-next.git 
tags/iwlwifi-next-for-kalle-2017-06-28

for you to fetch changes up to 6d759b02f4121595bf4212662e73c26573dab61a:

  iwlwifi: mvm: support TX on MONITOR iface (2017-06-23 12:27:52 +0300)


More iwlwifi patches for 4.13

* Some changes in suspend/resume handling to support new FWs;
* A bunch of RF-kill related fixes;
* Continued work towards the A000 family;
* Support for a new version of the TX flush FW API;
* Some fixes in monitor interfaces;
* A few fixes in the recovery flows;
* Johannes' documentation fixes and FW API struct cleanups continue;
* Remove some noise from the kernel logs;
* Some other small improvements, fixes and cleanups;


Avraham Stern (1):
  iwlwifi: mvm: set assoc_beacon_arrive_time

Chaya Rachel Ivgi (1):
  iwlwifi: mvm: fix typo in CTDP_CMD_OPERATION_REPORT description

David Spinadel (1):
  iwlwifi: mvm: Enable security on new TX API

Emmanuel Grumbach (6):
  iwlwifi: mvm: avoid unnecessary cache trashing in Tx path
  iwlwifi: mvm: fix the recovery flow while connecting
  iwlwifi: mvm: don't mark TIDs that are not idle wrt BA as inactive
  iwlwifi: add a W/A for a scheduler hardware bug
  iwlwifi: mvm: reset the fw_dump_desc pointer after ASSERT
  iwlwifi: pcie: delete the Tx queue timer earlier upon firmware crash

Gregory Greenman (1):
  iwlwifi: mvm: rs: add logs for the wrong antenna case

Johannes Berg (25):
  iwlwifi: remove resp_pkt NULL checks
  iwlwifi: mvm: remove pointless num_stored condition
  iwlwifi: pcie: fix TVQM queue ID range check
  iwlwifi: mvm: avoid variable shadowing
  iwlwifi: mvm: use scnprintf() instead of snprintf()
  iwlwifi: use bitfield.h for some registers
  iwlwifi: mvm: track and report IBSS manager status to mac80211
  iwlwifi: mvm: make iwl_mvm_update_mcc() easier to follow
  iwlwifi: pcie: pull out common rfkill IRQ handling code
  iwlwifi: pcie: add fake RF-kill to debugfs
  iwlwifi: mvm: don't warn in queue sync on RF-kill
  iwlwifi: pcie: don't report RF-kill enabled while shutting down
  iwlwifi: pcie: remove pointless debugfs parsing for csr file
  iwlwifi: mvm: document status bits
  iwlwifi: pcie: use kstrtou32_from_user()
  iwlwifi: mvm: better link scan notification results length
  iwlwifi: simplify data tracepoint
  iwlwifi: fix TX tracing for non-linear SKBs
  iwlwifi: pcie: fix command completion name debug
  iwlwifi: mvm: docs: fix enum link, provide TX response link
  iwlwifi: mvm: disentangle union in TX status struct
  iwlwifi: mvm: add documentation for enum iwl_debug_cmds
  iwlwifi: document transmit buffer bits better
  iwlwifi: pcie: make iwl_pcie_apm_stop_master() return void
  iwlwifi: pcie: work around suspend/resume issue

Liad Kaufman (5):
  iwlwifi: mvm: remove txq EMPTYING_DELBA state for DQA
  iwlwifi: mvm: disable dbg data collect when fw isn't alive
  iwlwifi: mvm: support aggregations on A000 HW
  iwlwifi: mvm: fix fw monitor 7000 HW recollecting
  iwlwifi: mvm: support TX on MONITOR iface

Luca Coelho (9):
  iwlwifi: mvm: make D0I3_END_CMD sync during system resume
  iwlwifi: mvm: support D0I3_END_CMD at the start of resume
  iwlwifi: remove useless iwl_free_nvm_data() function
  iwlwifi: mvm: fix nvm_data leak
  iwlwifi: pcie: don't disable bh when handling FW errors
  iwlwifi: mvm: reset the HW before dumping if HW error is detected
  iwlwifi: mvm: document assoc_beacon_arrive_time
  iwlwifi: mvm: print base HW address during init
  iwlwifi: pcie: reduce unwanted noise in the logs

Mordechai Goodstein (2):
  iwlwifi: mvm: change the firmware name loading
  iwlwifi: mvm: support new flush API

 drivers/net/wireless/intel/iwlwifi/dvm/main.c |   4 +-
 drivers/net/wireless/intel/iwlwifi/iwl-a000.c |   2 +-
 drivers/net/wireless/intel/iwlwifi/iwl-config.h   |   1 +
 drivers/net/wireless/intel/iwlwifi/iwl-csr.h  |   4 ++
 drivers/net/wireless/intel/iwlwifi/iwl-devtrace-data.h|  11 ++--
 drivers/net/wireless/intel/iwlwifi/iwl-devtrace-iwlwifi.h |  19 ---
 

brcmfmac4356-pci device not seeing 2.4Ghz channel 12 and 13

2017-06-28 Thread Hans de Goede

Hi,

I noticed today that my GPD Win (x86 clamshell mini laptop)
which uses a brcmfmac4356-pci wifi does not see an APs which
is using channel 13.

I've tried updating brcmfmac4356-pci.txt changing "ccode=US"
to "ccode=EU" and then rebooted, but that does not help.

I believe that the Linux wifi stack is supposed to automatically
figure out the country settings based on AP provided info ?

But that does not seem to be working here ? Any hints on howto
debug this further would be appreciated.

Regards,

Hans


[PATCH] rtlwifi: remove dummy function call

2017-06-28 Thread Souptick Joarder
_rtl92cu_init_usb_aggregation() can be removed as it is dummy one

Signed-off-by: Souptick Joarder 
---
 drivers/net/wireless/realtek/rtlwifi/rtl8192cu/hw.c | 5 -
 1 file changed, 5 deletions(-)

diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/hw.c 
b/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/hw.c
index 107c34e..ef8bd71 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/hw.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/hw.c
@@ -777,10 +777,6 @@ static void _rtl92cu_init_queue_priority(struct 
ieee80211_hw *hw,
   queue_sel);
 }

-static void _rtl92cu_init_usb_aggregation(struct ieee80211_hw *hw)
-{
-}
-
 static void _rtl92cu_init_wmac_setting(struct ieee80211_hw *hw)
 {
u16 value16;
@@ -863,7 +859,6 @@ static int _rtl92cu_init_mac(struct ieee80211_hw *hw)
rtl92c_init_edca(hw);
rtl92c_init_rate_fallback(hw);
rtl92c_init_retry_function(hw);
-   _rtl92cu_init_usb_aggregation(hw);
rtlpriv->cfg->ops->set_bw_mode(hw, NL80211_CHAN_HT20);
rtl92c_set_min_space(hw, IS_92C_SERIAL(rtlhal->version));
_rtl92cu_init_beacon_parameters(hw);
--
1.9.1



Re: [PATCH 05/14] mwifiex: re-register wiphy across reset

2017-06-28 Thread Johannes Berg
On Tue, 2017-06-27 at 13:48 -0700, Brian Norris wrote:

> > There isn't really a good way to do this. You can, of course, call
> > wiphy_unregister(), but if you could do that you'd already have the
> > problem solved, I think?
> 
> That's probably along the right track. There are still some things
> we'd need to do properly before that though, and this is where all
> the problems are so far. (Also, this is what Kalle was already
> objecting to; he didn't think we should be unregistering/recreating
> the wiphy, but I think he ended up softening on that a bit.)
> 
> For one, I still expect I should be removing the wireless dev's
> before unregistering the wihpy, no? Otherwise, there will be existing
> wdevs backed by an unregistered wiphy?

Yeah, that's true - though once you get rid of those they can't be
accessed any more.

> And that gets to the heart of another bug: deleting interfaces (e.g.,
> "iw dev foo del") races with a lot of stuff -- like see
> 
> mwifiex_process_sta_event() ->
>   EVENT_EXT_SCAN_REPORT ->
> netif_running(priv->netdev)
> 
> Because mwifiex_del_virtual_intf() doesn't stop any outstanding
> commands, we can be both deleting the netdev and processing scans for
> it.

Huh, well, I guess you need some kind of locking here anyway, since the
user can always do things like deleting the interface while a scan is
running?

> > > Also, IIUC, we need to wait for all control paths to complete (or
> > > cancel) before we can free up the associated resources; so just
> > > marking "unavailable" isn't enough.
> > 
> > Yeah, I suppose so. Though if you just do all the freeing after
> > wiphy_unregister() it'll do that for you?
> 
> Yes, I think so. Then part of the problem is probably that some of
> the current "cancel command" logic is tied up with the "free command
> structures" logic. So we're freeing some stuff too early.
> 
> Anyway, those sorts of bugs aside, IIUC the full sequence for
> teardown should probably be something like:
> 
> 1. Stop TX queues
> 2. Cancel outstanding commands (let them fail or finish, etc.) -- but
>    DON'T free their backing resources yet
> 3. Remove wdevs
> 4. wiphy_unregister()
> 5. Free up resources
> 
> Current problems are at least:
> 
> * we don't do step 4 in the right place (if at all; see this patch)
> * step 2 mixes in "free"ing resources too early

So I'm not sure what you mean by splitting in 2/5 - this seems
reasonable, but I don't understand why something like a scan request
wouldn't be freed while you cancel it in 2? In fact, you really have to
free it before you remove the corresponding wdev, or cfg80211 will
complain?

johannes


Re: [PATCH v4] NFC: trf7970a: Correct register settings for 27MHz clock

2017-06-28 Thread Samuel Ortiz
Hi Geoff,

On Thu, Apr 27, 2017 at 05:28:46PM -0400, Geoff Lansberry wrote:
> In prior commits the selected clock frequency does not propagate
> correctly to what is written to the TRF7970A_MODULATOR_SYS_CLK_CTRL
> register.
> 
> Signed-off-by: Geoff Lansberry 
> ---
>  drivers/nfc/trf7970a.c | 7 +++
>  1 file changed, 7 insertions(+)
Applied to nfc-next, thanks.

Cheers,
Samuel.


Re: [PATCH 05/14] mwifiex: re-register wiphy across reset

2017-06-28 Thread Johannes Berg
Hi Brian,

> Wow, that's not exactly simple code; I expect it could be pretty
> difficult to get that right today on mwifiex. 

Yeah, I have no doubt. You'd probably have to track a lot of state that
you just pass down to the firmware too, and possibly can't even track
some state that the firmware derives itself (like for example PNs for
keys)

> The current approach
> actually should be *easier* (for the kernel side) to avoid bugs, as
> it should be basically the same thing as 'rmmod'. Nonetheless, there
> are plenty of bugs.

:-)

johannes


[PATCH] mwifiex: don not update MCS set from hostapd

2017-06-28 Thread Ganapathi Bhat
We should not copy the MCS set from hostapd RX-STBC. We
have to just use the MCS set supported by the hardware.
This fixes an issue, where mwifiex is advertising wrong
MCS sets in beacons.

Fixes: 474a41e94 ("mwifiex: update MCS set as per RX-STBC bit from hostapd")
Signed-off-by: Ganapathi Bhat 
---
 drivers/net/wireless/marvell/mwifiex/fw.h  |  5 -
 drivers/net/wireless/marvell/mwifiex/uap_cmd.c | 22 --
 2 files changed, 27 deletions(-)

diff --git a/drivers/net/wireless/marvell/mwifiex/fw.h 
b/drivers/net/wireless/marvell/mwifiex/fw.h
index 4a848e8..07d3a0a 100644
--- a/drivers/net/wireless/marvell/mwifiex/fw.h
+++ b/drivers/net/wireless/marvell/mwifiex/fw.h
@@ -247,11 +247,6 @@ enum MWIFIEX_802_11_PRIVACY_FILTER {
 
 #define MWIFIEX_DEF_AMPDU  IEEE80211_HT_AMPDU_PARM_FACTOR
 
-#define GET_RXSTBC(x) (x & IEEE80211_HT_CAP_RX_STBC)
-#define MWIFIEX_RX_STBC1   0x0100
-#define MWIFIEX_RX_STBC12  0x0200
-#define MWIFIEX_RX_STBC123 0x0300
-
 /* dev_cap bitmap
  * BIT
  * 0-16reserved
diff --git a/drivers/net/wireless/marvell/mwifiex/uap_cmd.c 
b/drivers/net/wireless/marvell/mwifiex/uap_cmd.c
index 35d8636..477c29c 100644
--- a/drivers/net/wireless/marvell/mwifiex/uap_cmd.c
+++ b/drivers/net/wireless/marvell/mwifiex/uap_cmd.c
@@ -160,7 +160,6 @@ int mwifiex_set_secure_params(struct mwifiex_private *priv,
  struct cfg80211_ap_settings *params)
 {
const u8 *ht_ie;
-   u16 cap_info;
 
if (!ISSUPP_11NENABLED(priv->adapter->fw_cap_info))
return;
@@ -170,27 +169,6 @@ int mwifiex_set_secure_params(struct mwifiex_private *priv,
if (ht_ie) {
memcpy(_cfg->ht_cap, ht_ie + 2,
   sizeof(struct ieee80211_ht_cap));
-   cap_info = le16_to_cpu(bss_cfg->ht_cap.cap_info);
-   memset(_cfg->ht_cap.mcs, 0,
-  priv->adapter->number_of_antenna);
-   switch (GET_RXSTBC(cap_info)) {
-   case MWIFIEX_RX_STBC1:
-   /* HT_CAP 1X1 mode */
-   bss_cfg->ht_cap.mcs.rx_mask[0] = 0xff;
-   break;
-   case MWIFIEX_RX_STBC12: /* fall through */
-   case MWIFIEX_RX_STBC123:
-   /* HT_CAP 2X2 mode */
-   bss_cfg->ht_cap.mcs.rx_mask[0] = 0xff;
-   bss_cfg->ht_cap.mcs.rx_mask[1] = 0xff;
-   break;
-   default:
-   mwifiex_dbg(priv->adapter, WARN,
-   "Unsupported RX-STBC, default to 2x2\n");
-   bss_cfg->ht_cap.mcs.rx_mask[0] = 0xff;
-   bss_cfg->ht_cap.mcs.rx_mask[1] = 0xff;
-   break;
-   }
priv->ap_11n_enabled = 1;
} else {
memset(_cfg->ht_cap, 0, sizeof(struct ieee80211_ht_cap));
-- 
1.9.1



Re: [PATCH 00/17] rsi: station enhancements

2017-06-28 Thread Amitkumar Karwar
On Tue, Jun 27, 2017 at 7:56 PM, Kalle Valo  wrote:
> Amitkumar Karwar  writes:
>
>> We have internal management frames(commands) sent to firmware for
>> various configurations. This patch defines some common structures
>> which can be shared by those frames. Key handling and regulatory
>> enhancements are also includesd. With this patch series included,
>> station can connect to security enabled AP and send/receive data.
>
> Are you saying that before rsi driver was not able to connect a security
> enabled AP? Just trying to understand the status.

Right. It wasn't able to connect security enabled AP.
The key handling enhancements in this patch series made it work.

>
>> Prameela Rani Garnepudi (17):
>>   rsi: add common structures needed for command packets
>>   rsi: immediate wakeup bit and priority for TX command packets
>>   rsi: Update in tx command frame radio capabilities
>>   rsi: remove unnecessary check for 802.11 management packet
>>   rsi: Update peer notify command frame
>>   rsi: Update aggregation parameters command frame
>>   rsi: Update baseband RF programming frame
>>   rsi: update set_channel command frame
>>   rsi: update vap capabilities command frame
>>   rsi: update set_key command frame
>>   rsi: set_key enhancements
>>   rsi: update autorate request command frame
>>   rsi: block/unblock data queues as per connection status
>>   rsi: update tx command frame block/unblock data
>>   rsi: Remove internal header from Tx status skb
>>   rsi: Send rx filter frame to device when interface is down
>>   rsi: regulatory enhancements
>
> Also in the future please try to keep the size of patchsets in
> reasonable sizes. Something like max 10-12 patches per set is usually
> ok, dependinging on the size of patches of course. But anything more
> than that and the review becomes too annoying.

Sure. I will keep this in mind.

Regards,
Amitkumar Karwar