All of lore.kernel.org
 help / color / mirror / Atom feed
* pull request: iwlwifi-next 2016-01-07
@ 2016-01-07 12:46 Grumbach, Emmanuel
  2016-01-07 12:47 ` [PATCH 01/21] iwlwifi: dvm: fix WoWLAN Emmanuel Grumbach
                   ` (21 more replies)
  0 siblings, 22 replies; 28+ messages in thread
From: Grumbach, Emmanuel @ 2016-01-07 12:46 UTC (permalink / raw)
  To: Kalle Valo; +Cc: linux-wireless

Hi Kalle,

Here is the last round of patches for 4.5. Most of them are small and / or fixes.
Let me know if you have issues.
FYI - I scripted a few checks so that I hope that the internal tags that leaked
in the previous pull request won't leak any more.

The following changes since commit e5d15cb530082cc13a6c9457eddd6f75b0f4de65:

  iwlwifi: bail out in case of bad trans state (2015-12-21 19:35:41 +0200)

are available in the git repository at:

  https://git.kernel.org/pub/scm/linux/kernel/git/iwlwifi/iwlwifi-next.git tags/iwlwifi-next-for-kalle-2016-01-07

for you to fetch changes up to ccecff64ac4ee0d2f610e6606d2dfb17a38436f6:

  iwlwifi: pcie: properly configure the debug buffer size for 8000 (2016-01-07 14:39:58 +0200)

----------------------------------------------------------------
* bug fixes and improvements for firmware debug system (Golan and myself)
* fixes for D0i3 (Eliad)
* prevent muliple stations with the same MAC address
* advertise support for Rx A-MSDU in A-MPDU
* scan related fixes
* support -20.ucode
* fix WoWLAN for iwldvm
* preparations towards multiple Rx queues
* platform power improvements for GO mode when no clients are associated

----------------------------------------------------------------
Ayala Beker (1):
      iwlwifi: mvm: don't ask beacons when P2P GO vif and no assoc sta

David Spinadel (1):
      iwlwifi: mvm: fix extended dwell time

Eliad Peller (1):
      iwlwifi: mvm: initialize gtkdata->mvm correctly

Emmanuel Grumbach (10):
      iwlwifi: dvm: fix WoWLAN
      iwlwifi: mvm: let the firmware choose the antenna for beacons
      iwlwifi: mvm: reset mvm->scan_type when firmware is started
      iwlwifi: set max firmware version of 7265 to 17
      iwlwifi: mvm: bump max API to 20
      iwlwifi: mvm: dump the radio registers when the firmware crashes
      iwlwifi: mvm: remove useless WARN_ON and rely on cfg80211's combination
      iwlwifi: mvm: constify the parameters of a few functions in fw-dbg.c
      iwlwifi: mvm: fix memory leaks in error paths upon fw error dump
      iwlwifi: pcie: properly configure the debug buffer size for 8000

Golan Ben-Ami (1):
      iwlwifi: mvm: add a non-trigger window to fw dbg triggers

Johannes Berg (4):
      iwlwifi: mvm: support A-MSDU in A-MPDU
      iwlwifi: mvm: prevent multiple stations with the same address
      iwlwifi: mvm: check PN for CCMP/GCMP in the driver
      iwlwifi: mvm: check minimum temperature notification length

Matti Gottlieb (1):
      iwlwifi: mvm: change mcc update API

Oren Givon (2):
      iwlwifi: update and fix 7265 series PCI IDs
      iwlwifi: nvm: fix loading default NVM file

 drivers/net/wireless/intel/iwlwifi/dvm/lib.c           |   4 ++++
 drivers/net/wireless/intel/iwlwifi/iwl-7000.c          |   4 ++--
 drivers/net/wireless/intel/iwlwifi/iwl-8000.c          |   2 +-
 drivers/net/wireless/intel/iwlwifi/iwl-9000.c          |   2 +-
 drivers/net/wireless/intel/iwlwifi/iwl-fw-error-dump.h |   2 ++
 drivers/net/wireless/intel/iwlwifi/iwl-fw-file.h       |  12 +++++++++++-
 drivers/net/wireless/intel/iwlwifi/iwl-prph.h          |   6 ++++++
 drivers/net/wireless/intel/iwlwifi/iwl-trans.h         |   4 ++--
 drivers/net/wireless/intel/iwlwifi/mvm/d3.c            | 115 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--------------------
 drivers/net/wireless/intel/iwlwifi/mvm/fw-api.h        |  60 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++---
 drivers/net/wireless/intel/iwlwifi/mvm/fw-dbg.c        |  62 ++++++++++++++++++++++++++++++++++++++++++++++++--------------
 drivers/net/wireless/intel/iwlwifi/mvm/fw-dbg.h        |  30 +++++++++++++++++++++++++++---
 drivers/net/wireless/intel/iwlwifi/mvm/fw.c            |   1 +
 drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c      |  53 +++++++++++++++++++++++++----------------------------
 drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c      |  49 ++++++++++++++++++++++++++++++++++++++++++++++++-
 drivers/net/wireless/intel/iwlwifi/mvm/mvm.h           |   9 ++++++---
 drivers/net/wireless/intel/iwlwifi/mvm/nvm.c           |  55 +++++++++++++++++++++++++++++++++++++++++--------------
 drivers/net/wireless/intel/iwlwifi/mvm/power.c         |   2 --
 drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c          | 106 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-------------
 drivers/net/wireless/intel/iwlwifi/mvm/scan.c          |  13 +++++++------
 drivers/net/wireless/intel/iwlwifi/mvm/sta.h           |  12 ++++++++++++
 drivers/net/wireless/intel/iwlwifi/mvm/tt.c            |   2 +-
 drivers/net/wireless/intel/iwlwifi/pcie/drv.c          |   5 +++--
 drivers/net/wireless/intel/iwlwifi/pcie/trans.c        |  17 +++++++++++++----
 24 files changed, 506 insertions(+), 121 deletions(-)


^ permalink raw reply	[flat|nested] 28+ messages in thread

* [PATCH 01/21] iwlwifi: dvm: fix WoWLAN
  2016-01-07 12:46 pull request: iwlwifi-next 2016-01-07 Grumbach, Emmanuel
@ 2016-01-07 12:47 ` Emmanuel Grumbach
  2016-01-07 21:15   ` Kalle Valo
  2016-01-07 12:47 ` [PATCH 02/21] iwlwifi: update and fix 7265 series PCI IDs Emmanuel Grumbach
                   ` (20 subsequent siblings)
  21 siblings, 1 reply; 28+ messages in thread
From: Emmanuel Grumbach @ 2016-01-07 12:47 UTC (permalink / raw)
  To: linux-wireless; +Cc: Emmanuel Grumbach, stable

My commit below introduced a mutex in the transport to
prevent concurrent operations. To do so, it added a flag
(is_down) to make sure the transport is in the right state.
This uncoverred an bug that didn't cause any harm until
now: iwldvm calls stop_device and then starts the firmware
without calling start_hw in between. While this flow is
fine from the device configuration point of view (register,
etc...), it is now forbidden by the new is_down flag.
This led to this error to appear:
iwlwifi 0000:05:00.0: Can't start_fw since the HW hasn't been started
and the suspend would fail.

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

CC: <stable@vger.kernel.org> [4.3+]
Reported-by: Bogdan Bogush <bogdan.s.bogush@gmail.com>
Fixes=fa9f3281cbb1 ("iwlwifi: pcie: lock start_hw / start_fw / stop_device")
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
---
 drivers/net/wireless/intel/iwlwifi/dvm/lib.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/net/wireless/intel/iwlwifi/dvm/lib.c b/drivers/net/wireless/intel/iwlwifi/dvm/lib.c
index bee1c03..fd409ad 100644
--- a/drivers/net/wireless/intel/iwlwifi/dvm/lib.c
+++ b/drivers/net/wireless/intel/iwlwifi/dvm/lib.c
@@ -1154,6 +1154,9 @@ int iwlagn_suspend(struct iwl_priv *priv, struct cfg80211_wowlan *wowlan)
 
 	priv->ucode_loaded = false;
 	iwl_trans_stop_device(priv->trans);
+	ret = iwl_trans_start_hw(priv->trans);
+	if (ret)
+		goto out;
 
 	priv->wowlan = true;
 
@@ -1247,6 +1250,7 @@ int iwlagn_suspend(struct iwl_priv *priv, struct cfg80211_wowlan *wowlan)
 
 	ret = iwlagn_send_patterns(priv, wowlan);
  out:
+	iwl_trans_stop_device(priv->trans);
 	kfree(key_data.rsc_tsc);
 	return ret;
 }
-- 
2.5.0


^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [PATCH 02/21] iwlwifi: update and fix 7265 series PCI IDs
  2016-01-07 12:46 pull request: iwlwifi-next 2016-01-07 Grumbach, Emmanuel
  2016-01-07 12:47 ` [PATCH 01/21] iwlwifi: dvm: fix WoWLAN Emmanuel Grumbach
@ 2016-01-07 12:47 ` Emmanuel Grumbach
  2016-01-07 12:47 ` [PATCH 03/21] iwlwifi: mvm: let the firmware choose the antenna for beacons Emmanuel Grumbach
                   ` (19 subsequent siblings)
  21 siblings, 0 replies; 28+ messages in thread
From: Emmanuel Grumbach @ 2016-01-07 12:47 UTC (permalink / raw)
  To: linux-wireless; +Cc: Oren Givon, stable, Emmanuel Grumbach

From: Oren Givon <oren.givon@intel.com>

Update and fix some 7265 PCI IDs entries.

CC: <stable@vger.kernel.org> [3.13+]
Signed-off-by: Oren Givon <oren.givon@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
---
 drivers/net/wireless/intel/iwlwifi/pcie/drv.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/drv.c b/drivers/net/wireless/intel/iwlwifi/pcie/drv.c
index af10651..6261a68 100644
--- a/drivers/net/wireless/intel/iwlwifi/pcie/drv.c
+++ b/drivers/net/wireless/intel/iwlwifi/pcie/drv.c
@@ -388,6 +388,7 @@ static const struct pci_device_id iwl_hw_card_ids[] = {
 	{IWL_PCI_DEVICE(0x095B, 0x5310, iwl7265_2ac_cfg)},
 	{IWL_PCI_DEVICE(0x095B, 0x5302, iwl7265_n_cfg)},
 	{IWL_PCI_DEVICE(0x095B, 0x5210, iwl7265_2ac_cfg)},
+	{IWL_PCI_DEVICE(0x095A, 0x5C10, iwl7265_2ac_cfg)},
 	{IWL_PCI_DEVICE(0x095A, 0x5012, iwl7265_2ac_cfg)},
 	{IWL_PCI_DEVICE(0x095A, 0x5412, iwl7265_2ac_cfg)},
 	{IWL_PCI_DEVICE(0x095A, 0x5410, iwl7265_2ac_cfg)},
@@ -405,10 +406,10 @@ static const struct pci_device_id iwl_hw_card_ids[] = {
 	{IWL_PCI_DEVICE(0x095A, 0x900A, iwl7265_2ac_cfg)},
 	{IWL_PCI_DEVICE(0x095A, 0x9110, iwl7265_2ac_cfg)},
 	{IWL_PCI_DEVICE(0x095A, 0x9112, iwl7265_2ac_cfg)},
-	{IWL_PCI_DEVICE(0x095A, 0x9210, iwl7265_2ac_cfg)},
+	{IWL_PCI_DEVICE(0x095B, 0x9210, iwl7265_2ac_cfg)},
 	{IWL_PCI_DEVICE(0x095B, 0x9200, iwl7265_2ac_cfg)},
 	{IWL_PCI_DEVICE(0x095A, 0x9510, iwl7265_2ac_cfg)},
-	{IWL_PCI_DEVICE(0x095A, 0x9310, iwl7265_2ac_cfg)},
+	{IWL_PCI_DEVICE(0x095B, 0x9310, iwl7265_2ac_cfg)},
 	{IWL_PCI_DEVICE(0x095A, 0x9410, iwl7265_2ac_cfg)},
 	{IWL_PCI_DEVICE(0x095A, 0x5020, iwl7265_2n_cfg)},
 	{IWL_PCI_DEVICE(0x095A, 0x502A, iwl7265_2n_cfg)},
-- 
2.5.0


^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [PATCH 03/21] iwlwifi: mvm: let the firmware choose the antenna for beacons
  2016-01-07 12:46 pull request: iwlwifi-next 2016-01-07 Grumbach, Emmanuel
  2016-01-07 12:47 ` [PATCH 01/21] iwlwifi: dvm: fix WoWLAN Emmanuel Grumbach
  2016-01-07 12:47 ` [PATCH 02/21] iwlwifi: update and fix 7265 series PCI IDs Emmanuel Grumbach
@ 2016-01-07 12:47 ` Emmanuel Grumbach
  2016-01-07 12:47 ` [PATCH 04/21] iwlwifi: mvm: change mcc update API Emmanuel Grumbach
                   ` (18 subsequent siblings)
  21 siblings, 0 replies; 28+ messages in thread
From: Emmanuel Grumbach @ 2016-01-07 12:47 UTC (permalink / raw)
  To: linux-wireless; +Cc: Emmanuel Grumbach

The firmware knows better what antenna to choose.
Old firmware still need the setting, so use a flag to know
if the driver should choose the antenna or if the firmware
can do it iself.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
---
 drivers/net/wireless/intel/iwlwifi/iwl-fw-file.h  | 3 +++
 drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c | 9 ++++++---
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-fw-file.h b/drivers/net/wireless/intel/iwlwifi/iwl-fw-file.h
index d2294ad6..9f24f99 100644
--- a/drivers/net/wireless/intel/iwlwifi/iwl-fw-file.h
+++ b/drivers/net/wireless/intel/iwlwifi/iwl-fw-file.h
@@ -309,6 +309,8 @@ typedef unsigned int __bitwise__ iwl_ucode_tlv_capa_t;
  * @IWL_UCODE_TLV_CAPA_EXTENDED_DTS_MEASURE: extended DTS measurement
  * @IWL_UCODE_TLV_CAPA_SHORT_PM_TIMEOUTS: supports short PM timeouts
  * @IWL_UCODE_TLV_CAPA_BT_MPLUT_SUPPORT: supports bt-coex Multi-priority LUT
+ * @IWL_UCODE_TLV_CAPA_BEACON_ANT_SELECTION: firmware will decide on what
+ *	antenna the beacon should be transmitted
  *
  * @NUM_IWL_UCODE_TLV_CAPA: number of bits used
  */
@@ -336,6 +338,7 @@ enum iwl_ucode_tlv_capa {
 	IWL_UCODE_TLV_CAPA_EXTENDED_DTS_MEASURE		= (__force iwl_ucode_tlv_capa_t)64,
 	IWL_UCODE_TLV_CAPA_SHORT_PM_TIMEOUTS		= (__force iwl_ucode_tlv_capa_t)65,
 	IWL_UCODE_TLV_CAPA_BT_MPLUT_SUPPORT		= (__force iwl_ucode_tlv_capa_t)67,
+	IWL_UCODE_TLV_CAPA_BEACON_ANT_SELECTION		= (__force iwl_ucode_tlv_capa_t)71,
 
 	NUM_IWL_UCODE_TLV_CAPA
 #ifdef __CHECKER__
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c b/drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c
index 5e3a758..448b9c9 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c
@@ -1012,9 +1012,12 @@ static int iwl_mvm_mac_ctxt_send_beacon(struct iwl_mvm *mvm,
 						TX_CMD_FLG_BT_PRIO_POS;
 	beacon_cmd.tx.tx_flags = cpu_to_le32(tx_flags);
 
-	mvm->mgmt_last_antenna_idx =
-		iwl_mvm_next_antenna(mvm, iwl_mvm_get_valid_tx_ant(mvm),
-				     mvm->mgmt_last_antenna_idx);
+	if (!fw_has_capa(&mvm->fw->ucode_capa,
+			 IWL_UCODE_TLV_CAPA_BEACON_ANT_SELECTION)) {
+		mvm->mgmt_last_antenna_idx =
+			iwl_mvm_next_antenna(mvm, iwl_mvm_get_valid_tx_ant(mvm),
+					     mvm->mgmt_last_antenna_idx);
+	}
 
 	beacon_cmd.tx.rate_n_flags =
 		cpu_to_le32(BIT(mvm->mgmt_last_antenna_idx) <<
-- 
2.5.0


^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [PATCH 04/21] iwlwifi: mvm: change mcc update API
  2016-01-07 12:46 pull request: iwlwifi-next 2016-01-07 Grumbach, Emmanuel
                   ` (2 preceding siblings ...)
  2016-01-07 12:47 ` [PATCH 03/21] iwlwifi: mvm: let the firmware choose the antenna for beacons Emmanuel Grumbach
@ 2016-01-07 12:47 ` Emmanuel Grumbach
  2016-01-07 12:47 ` [PATCH 05/21] iwlwifi: mvm: reset mvm->scan_type when firmware is started Emmanuel Grumbach
                   ` (17 subsequent siblings)
  21 siblings, 0 replies; 28+ messages in thread
From: Emmanuel Grumbach @ 2016-01-07 12:47 UTC (permalink / raw)
  To: linux-wireless; +Cc: Matti Gottlieb, Emmanuel Grumbach

From: Matti Gottlieb <matti.gottlieb@intel.com>

New functionality for testing that is not relevant for
this driver has been added. This required an API change.

Add new cmd & response versions for the MCC update cmd & response.
Add new TLV indicating that the FW is using the new API.

Signed-off-by: Matti Gottlieb <matti.gottlieb@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
---
 drivers/net/wireless/intel/iwlwifi/iwl-fw-file.h |  4 ++
 drivers/net/wireless/intel/iwlwifi/mvm/fw-api.h  | 60 ++++++++++++++++++++++--
 drivers/net/wireless/intel/iwlwifi/mvm/nvm.c     | 52 +++++++++++++++-----
 3 files changed, 100 insertions(+), 16 deletions(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-fw-file.h b/drivers/net/wireless/intel/iwlwifi/iwl-fw-file.h
index 9f24f99..8d37e33 100644
--- a/drivers/net/wireless/intel/iwlwifi/iwl-fw-file.h
+++ b/drivers/net/wireless/intel/iwlwifi/iwl-fw-file.h
@@ -7,6 +7,7 @@
  *
  * Copyright(c) 2008 - 2014 Intel Corporation. All rights reserved.
  * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
+ * Copyright(c) 2016        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
@@ -33,6 +34,7 @@
  *
  * Copyright(c) 2005 - 2014 Intel Corporation. All rights reserved.
  * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
+ * Copyright(c) 2016        Intel Deutschland GmbH
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -311,6 +313,7 @@ typedef unsigned int __bitwise__ iwl_ucode_tlv_capa_t;
  * @IWL_UCODE_TLV_CAPA_BT_MPLUT_SUPPORT: supports bt-coex Multi-priority LUT
  * @IWL_UCODE_TLV_CAPA_BEACON_ANT_SELECTION: firmware will decide on what
  *	antenna the beacon should be transmitted
+ * @IWL_UCODE_TLV_CAPA_LAR_SUPPORT_V2: support LAR API V2
  *
  * @NUM_IWL_UCODE_TLV_CAPA: number of bits used
  */
@@ -339,6 +342,7 @@ enum iwl_ucode_tlv_capa {
 	IWL_UCODE_TLV_CAPA_SHORT_PM_TIMEOUTS		= (__force iwl_ucode_tlv_capa_t)65,
 	IWL_UCODE_TLV_CAPA_BT_MPLUT_SUPPORT		= (__force iwl_ucode_tlv_capa_t)67,
 	IWL_UCODE_TLV_CAPA_BEACON_ANT_SELECTION		= (__force iwl_ucode_tlv_capa_t)71,
+	IWL_UCODE_TLV_CAPA_LAR_SUPPORT_V2		= (__force iwl_ucode_tlv_capa_t)73,
 
 	NUM_IWL_UCODE_TLV_CAPA
 #ifdef __CHECKER__
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/fw-api.h b/drivers/net/wireless/intel/iwlwifi/mvm/fw-api.h
index 995898c..82049bb 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/fw-api.h
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/fw-api.h
@@ -7,6 +7,7 @@
  *
  * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
  * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
+ * Copyright(c) 2016        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
@@ -33,6 +34,7 @@
  *
  * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
  * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
+ * Copyright(c) 2016        Intel Deutschland GmbH
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -1452,6 +1454,22 @@ struct iwl_sf_cfg_cmd {
  ***********************************/
 
 /**
+ * struct iwl_mcc_update_cmd_v1 - Request the device to update geographic
+ * regulatory profile according to the given MCC (Mobile Country Code).
+ * The MCC is two letter-code, ascii upper case[A-Z] or '00' for world domain.
+ * 'ZZ' MCC will be used to switch to NVM default profile; in this case, the
+ * MCC in the cmd response will be the relevant MCC in the NVM.
+ * @mcc: given mobile country code
+ * @source_id: the source from where we got the MCC, see iwl_mcc_source
+ * @reserved: reserved for alignment
+ */
+struct iwl_mcc_update_cmd_v1 {
+	__le16 mcc;
+	u8 source_id;
+	u8 reserved;
+} __packed; /* LAR_UPDATE_MCC_CMD_API_S_VER_1 */
+
+/**
  * struct iwl_mcc_update_cmd - Request the device to update geographic
  * regulatory profile according to the given MCC (Mobile Country Code).
  * The MCC is two letter-code, ascii upper case[A-Z] or '00' for world domain.
@@ -1460,12 +1478,39 @@ struct iwl_sf_cfg_cmd {
  * @mcc: given mobile country code
  * @source_id: the source from where we got the MCC, see iwl_mcc_source
  * @reserved: reserved for alignment
+ * @key: integrity key for MCC API OEM testing
+ * @reserved2: reserved
  */
 struct iwl_mcc_update_cmd {
 	__le16 mcc;
 	u8 source_id;
 	u8 reserved;
-} __packed; /* LAR_UPDATE_MCC_CMD_API_S */
+	__le32 key;
+	__le32 reserved2[5];
+} __packed; /* LAR_UPDATE_MCC_CMD_API_S_VER_2 */
+
+/**
+ * iwl_mcc_update_resp_v1  - response to MCC_UPDATE_CMD.
+ * Contains the new channel control profile map, if changed, and the new MCC
+ * (mobile country code).
+ * The new MCC may be different than what was requested in MCC_UPDATE_CMD.
+ * @status: see &enum iwl_mcc_update_status
+ * @mcc: the new applied MCC
+ * @cap: capabilities for all channels which matches the MCC
+ * @source_id: the MCC source, see iwl_mcc_source
+ * @n_channels: number of channels in @channels_data (may be 14, 39, 50 or 51
+ *		channels, depending on platform)
+ * @channels: channel control data map, DWORD for each channel. Only the first
+ *	16bits are used.
+ */
+struct iwl_mcc_update_resp_v1  {
+	__le32 status;
+	__le16 mcc;
+	u8 cap;
+	u8 source_id;
+	__le32 n_channels;
+	__le32 channels[0];
+} __packed; /* LAR_UPDATE_MCC_CMD_RESP_S_VER_1 */
 
 /**
  * iwl_mcc_update_resp - response to MCC_UPDATE_CMD.
@@ -1476,6 +1521,8 @@ struct iwl_mcc_update_cmd {
  * @mcc: the new applied MCC
  * @cap: capabilities for all channels which matches the MCC
  * @source_id: the MCC source, see iwl_mcc_source
+ * @time: time elapsed from the MCC test start (in 30 seconds TU)
+ * @reserved: reserved.
  * @n_channels: number of channels in @channels_data (may be 14, 39, 50 or 51
  *		channels, depending on platform)
  * @channels: channel control data map, DWORD for each channel. Only the first
@@ -1486,9 +1533,11 @@ struct iwl_mcc_update_resp {
 	__le16 mcc;
 	u8 cap;
 	u8 source_id;
+	__le16 time;
+	__le16 reserved;
 	__le32 n_channels;
 	__le32 channels[0];
-} __packed; /* LAR_UPDATE_MCC_CMD_RESP_S */
+} __packed; /* LAR_UPDATE_MCC_CMD_RESP_S_VER_2 */
 
 /**
  * struct iwl_mcc_chub_notif - chub notifies of mcc change
@@ -1518,6 +1567,9 @@ enum iwl_mcc_update_status {
 	MCC_RESP_NVM_DISABLED,
 	MCC_RESP_ILLEGAL,
 	MCC_RESP_LOW_PRIORITY,
+	MCC_RESP_TEST_MODE_ACTIVE,
+	MCC_RESP_TEST_MODE_NOT_ACTIVE,
+	MCC_RESP_TEST_MODE_DENIAL_OF_SERVICE,
 };
 
 enum iwl_mcc_source {
@@ -1530,7 +1582,9 @@ enum iwl_mcc_source {
 	MCC_SOURCE_RESERVED = 6,
 	MCC_SOURCE_DEFAULT = 7,
 	MCC_SOURCE_UNINITIALIZED = 8,
-	MCC_SOURCE_GET_CURRENT = 0x10
+	MCC_SOURCE_MCC_API = 9,
+	MCC_SOURCE_GET_CURRENT = 0x10,
+	MCC_SOURCE_GETTING_MCC_TEST_MODE = 0x11,
 };
 
 /* DTS measurements */
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/nvm.c b/drivers/net/wireless/intel/iwlwifi/mvm/nvm.c
index d8dcb67..e4fe8a6 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/nvm.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/nvm.c
@@ -7,6 +7,7 @@
  *
  * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
  * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
+ * Copyright(c) 2016        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
@@ -33,6 +34,7 @@
  *
  * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
  * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
+ * Copyright(c) 2016        Intel Deutschland GmbH
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -670,6 +672,7 @@ iwl_mvm_update_mcc(struct iwl_mvm *mvm, const char *alpha2,
 		.source_id = (u8)src_id,
 	};
 	struct iwl_mcc_update_resp *mcc_resp, *resp_cp = NULL;
+	struct iwl_mcc_update_resp_v1 *mcc_resp_v1 = NULL;
 	struct iwl_rx_packet *pkt;
 	struct iwl_host_cmd cmd = {
 		.id = MCC_UPDATE_CMD,
@@ -681,11 +684,15 @@ iwl_mvm_update_mcc(struct iwl_mvm *mvm, const char *alpha2,
 	u32 status;
 	int resp_len, n_channels;
 	u16 mcc;
+	bool resp_v2 = fw_has_capa(&mvm->fw->ucode_capa,
+				   IWL_UCODE_TLV_CAPA_LAR_SUPPORT_V2);
 
 	if (WARN_ON_ONCE(!iwl_mvm_is_lar_supported(mvm)))
 		return ERR_PTR(-EOPNOTSUPP);
 
 	cmd.len[0] = sizeof(struct iwl_mcc_update_cmd);
+	if (!resp_v2)
+		cmd.len[0] = sizeof(struct iwl_mcc_update_cmd_v1);
 
 	IWL_DEBUG_LAR(mvm, "send MCC update to FW with '%c%c' src = %d\n",
 		      alpha2[0], alpha2[1], src_id);
@@ -697,31 +704,50 @@ iwl_mvm_update_mcc(struct iwl_mvm *mvm, const char *alpha2,
 	pkt = cmd.resp_pkt;
 
 	/* Extract MCC response */
-	mcc_resp = (void *)pkt->data;
-	status = le32_to_cpu(mcc_resp->status);
+	if (resp_v2) {
+		mcc_resp = (void *)pkt->data;
+		n_channels =  __le32_to_cpu(mcc_resp->n_channels);
+	} else {
+		mcc_resp_v1 = (void *)pkt->data;
+		n_channels =  __le32_to_cpu(mcc_resp_v1->n_channels);
+	}
 
-	mcc = le16_to_cpu(mcc_resp->mcc);
+	resp_len = sizeof(struct iwl_mcc_update_resp) + n_channels *
+		sizeof(__le32);
+
+	resp_cp = kzalloc(resp_len, GFP_KERNEL);
+	if (!resp_cp) {
+		ret = -ENOMEM;
+		goto exit;
+	}
+
+	if (resp_v2) {
+		memcpy(resp_cp, mcc_resp, resp_len);
+	} else {
+		resp_cp->status = mcc_resp_v1->status;
+		resp_cp->mcc = mcc_resp_v1->mcc;
+		resp_cp->cap = mcc_resp_v1->cap;
+		resp_cp->source_id = mcc_resp_v1->source_id;
+		resp_cp->n_channels = mcc_resp_v1->n_channels;
+		memcpy(resp_cp->channels, mcc_resp_v1->channels,
+		       n_channels * sizeof(__le32));
+	}
+
+	status = le32_to_cpu(resp_cp->status);
+
+	mcc = le16_to_cpu(resp_cp->mcc);
 
 	/* W/A for a FW/NVM issue - returns 0x00 for the world domain */
 	if (mcc == 0) {
 		mcc = 0x3030;  /* "00" - world */
-		mcc_resp->mcc = cpu_to_le16(mcc);
+		resp_cp->mcc = cpu_to_le16(mcc);
 	}
 
-	n_channels =  __le32_to_cpu(mcc_resp->n_channels);
 	IWL_DEBUG_LAR(mvm,
 		      "MCC response status: 0x%x. new MCC: 0x%x ('%c%c') change: %d n_chans: %d\n",
 		      status, mcc, mcc >> 8, mcc & 0xff,
 		      !!(status == MCC_RESP_NEW_CHAN_PROFILE), n_channels);
 
-	resp_len = sizeof(*mcc_resp) + n_channels * sizeof(__le32);
-	resp_cp = kmemdup(mcc_resp, resp_len, GFP_KERNEL);
-	if (!resp_cp) {
-		ret = -ENOMEM;
-		goto exit;
-	}
-
-	ret = 0;
 exit:
 	iwl_free_resp(&cmd);
 	if (ret)
-- 
2.5.0


^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [PATCH 05/21] iwlwifi: mvm: reset mvm->scan_type when firmware is started
  2016-01-07 12:46 pull request: iwlwifi-next 2016-01-07 Grumbach, Emmanuel
                   ` (3 preceding siblings ...)
  2016-01-07 12:47 ` [PATCH 04/21] iwlwifi: mvm: change mcc update API Emmanuel Grumbach
@ 2016-01-07 12:47 ` Emmanuel Grumbach
  2016-01-07 12:47 ` [PATCH 06/21] iwlwifi: set max firmware version of 7265 to 17 Emmanuel Grumbach
                   ` (16 subsequent siblings)
  21 siblings, 0 replies; 28+ messages in thread
From: Emmanuel Grumbach @ 2016-01-07 12:47 UTC (permalink / raw)
  To: linux-wireless; +Cc: Emmanuel Grumbach

If we don't reset the scan type when the firmware is
started, we will think the firmware is still configured
after the interface has been brought down. When we will
bring it up again, we will not configure the scan type
in firmware and it will crash with the following assert:

0x0000100A | ADVANCED_SYSASSERT

Fixes: 355346ba3050 ("iwlwifi: mvm: configure scheduled scan according to traffic conditions")
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
---
 drivers/net/wireless/intel/iwlwifi/mvm/fw.c       | 1 +
 drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c | 1 -
 2 files changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/fw.c b/drivers/net/wireless/intel/iwlwifi/mvm/fw.c
index e6e8088..4ed5180 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/fw.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/fw.c
@@ -943,6 +943,7 @@ int iwl_mvm_up(struct iwl_mvm *mvm)
 	}
 
 	if (fw_has_capa(&mvm->fw->ucode_capa, IWL_UCODE_TLV_CAPA_UMAC_SCAN)) {
+		mvm->scan_type = IWL_SCAN_TYPE_NOT_SET;
 		ret = iwl_mvm_config_scan(mvm);
 		if (ret)
 			goto error;
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
index 296b9c5..2d65040 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
@@ -1002,7 +1002,6 @@ static void iwl_mvm_restart_cleanup(struct iwl_mvm *mvm)
 	mvm->vif_count = 0;
 	mvm->rx_ba_sessions = 0;
 	mvm->fw_dbg_conf = FW_DBG_INVALID;
-	mvm->scan_type = IWL_SCAN_TYPE_NOT_SET;
 
 	/* keep statistics ticking */
 	iwl_mvm_accu_radio_stats(mvm);
-- 
2.5.0


^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [PATCH 06/21] iwlwifi: set max firmware version of 7265 to 17
  2016-01-07 12:46 pull request: iwlwifi-next 2016-01-07 Grumbach, Emmanuel
                   ` (4 preceding siblings ...)
  2016-01-07 12:47 ` [PATCH 05/21] iwlwifi: mvm: reset mvm->scan_type when firmware is started Emmanuel Grumbach
@ 2016-01-07 12:47 ` Emmanuel Grumbach
  2016-01-07 12:47 ` [PATCH 07/21] iwlwifi: mvm: bump max API to 20 Emmanuel Grumbach
                   ` (15 subsequent siblings)
  21 siblings, 0 replies; 28+ messages in thread
From: Emmanuel Grumbach @ 2016-01-07 12:47 UTC (permalink / raw)
  To: linux-wireless; +Cc: Emmanuel Grumbach

Just like 7260, 7265 will not have firmware releases newer
than iwlwifi-7265-17.ucode. 7265D is still supported in
latest firmware releases.

Fixes: 628a2918afe4 ("iwlwifi: separate firmware version for 7260 devices")
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
---
 drivers/net/wireless/intel/iwlwifi/iwl-7000.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-7000.c b/drivers/net/wireless/intel/iwlwifi/iwl-7000.c
index fd9064b..d15117c 100644
--- a/drivers/net/wireless/intel/iwlwifi/iwl-7000.c
+++ b/drivers/net/wireless/intel/iwlwifi/iwl-7000.c
@@ -72,7 +72,7 @@
 
 /* Highest firmware API version supported */
 #define IWL7260_UCODE_API_MAX	17
-#define IWL7265_UCODE_API_MAX	19
+#define IWL7265_UCODE_API_MAX	17
 #define IWL7265D_UCODE_API_MAX	19
 
 /* Oldest version we won't warn about */
-- 
2.5.0


^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [PATCH 07/21] iwlwifi: mvm: bump max API to 20
  2016-01-07 12:46 pull request: iwlwifi-next 2016-01-07 Grumbach, Emmanuel
                   ` (5 preceding siblings ...)
  2016-01-07 12:47 ` [PATCH 06/21] iwlwifi: set max firmware version of 7265 to 17 Emmanuel Grumbach
@ 2016-01-07 12:47 ` Emmanuel Grumbach
  2016-01-07 12:47 ` [PATCH 08/21] iwlwifi: nvm: fix loading default NVM file Emmanuel Grumbach
                   ` (14 subsequent siblings)
  21 siblings, 0 replies; 28+ messages in thread
From: Emmanuel Grumbach @ 2016-01-07 12:47 UTC (permalink / raw)
  To: linux-wireless; +Cc: Emmanuel Grumbach

7265D and up are now able to handle -20.ucode.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
---
 drivers/net/wireless/intel/iwlwifi/iwl-7000.c | 2 +-
 drivers/net/wireless/intel/iwlwifi/iwl-8000.c | 2 +-
 drivers/net/wireless/intel/iwlwifi/iwl-9000.c | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-7000.c b/drivers/net/wireless/intel/iwlwifi/iwl-7000.c
index d15117c..e60cf14 100644
--- a/drivers/net/wireless/intel/iwlwifi/iwl-7000.c
+++ b/drivers/net/wireless/intel/iwlwifi/iwl-7000.c
@@ -73,7 +73,7 @@
 /* Highest firmware API version supported */
 #define IWL7260_UCODE_API_MAX	17
 #define IWL7265_UCODE_API_MAX	17
-#define IWL7265D_UCODE_API_MAX	19
+#define IWL7265D_UCODE_API_MAX	20
 
 /* Oldest version we won't warn about */
 #define IWL7260_UCODE_API_OK	13
diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-8000.c b/drivers/net/wireless/intel/iwlwifi/iwl-8000.c
index dee4458..c84a029 100644
--- a/drivers/net/wireless/intel/iwlwifi/iwl-8000.c
+++ b/drivers/net/wireless/intel/iwlwifi/iwl-8000.c
@@ -69,7 +69,7 @@
 #include "iwl-agn-hw.h"
 
 /* Highest firmware API version supported */
-#define IWL8000_UCODE_API_MAX	19
+#define IWL8000_UCODE_API_MAX	20
 
 /* Oldest version we won't warn about */
 #define IWL8000_UCODE_API_OK	13
diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-9000.c b/drivers/net/wireless/intel/iwlwifi/iwl-9000.c
index 0d2aa1d..ecbf482 100644
--- a/drivers/net/wireless/intel/iwlwifi/iwl-9000.c
+++ b/drivers/net/wireless/intel/iwlwifi/iwl-9000.c
@@ -55,7 +55,7 @@
 #include "iwl-agn-hw.h"
 
 /* Highest firmware API version supported */
-#define IWL9000_UCODE_API_MAX	16
+#define IWL9000_UCODE_API_MAX	20
 
 /* Oldest version we won't warn about */
 #define IWL9000_UCODE_API_OK	13
-- 
2.5.0


^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [PATCH 08/21] iwlwifi: nvm: fix loading default NVM file
  2016-01-07 12:46 pull request: iwlwifi-next 2016-01-07 Grumbach, Emmanuel
                   ` (6 preceding siblings ...)
  2016-01-07 12:47 ` [PATCH 07/21] iwlwifi: mvm: bump max API to 20 Emmanuel Grumbach
@ 2016-01-07 12:47 ` Emmanuel Grumbach
  2016-01-07 12:47 ` [PATCH 09/21] iwlwifi: mvm: fix extended dwell time Emmanuel Grumbach
                   ` (13 subsequent siblings)
  21 siblings, 0 replies; 28+ messages in thread
From: Emmanuel Grumbach @ 2016-01-07 12:47 UTC (permalink / raw)
  To: linux-wireless; +Cc: Oren Givon, Emmanuel Grumbach

From: Oren Givon <oren.givon@intel.com>

Fix loading the default NVM file, in the case where the
requested NVM file isn't found in the file system.

Signed-off-by: Oren Givon <oren.givon@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
---
 drivers/net/wireless/intel/iwlwifi/mvm/nvm.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/nvm.c b/drivers/net/wireless/intel/iwlwifi/mvm/nvm.c
index e4fe8a6..7a3da2d 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/nvm.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/nvm.c
@@ -642,7 +642,8 @@ int iwl_nvm_init(struct iwl_mvm *mvm, bool read_nvm_from_nic)
 			else
 				mvm->nvm_file_name = nvm_file_C;
 
-			if (ret == -EFAULT && mvm->nvm_file_name) {
+			if ((ret == -EFAULT || ret == -ENOENT) &&
+			    mvm->nvm_file_name) {
 				/* in case nvm file was failed try again */
 				ret = iwl_mvm_read_external_nvm(mvm);
 				if (ret)
-- 
2.5.0


^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [PATCH 09/21] iwlwifi: mvm: fix extended dwell time
  2016-01-07 12:46 pull request: iwlwifi-next 2016-01-07 Grumbach, Emmanuel
                   ` (7 preceding siblings ...)
  2016-01-07 12:47 ` [PATCH 08/21] iwlwifi: nvm: fix loading default NVM file Emmanuel Grumbach
@ 2016-01-07 12:47 ` Emmanuel Grumbach
  2016-01-07 12:47 ` [PATCH 10/21] iwlwifi: mvm: dump the radio registers when the firmware crashes Emmanuel Grumbach
                   ` (12 subsequent siblings)
  21 siblings, 0 replies; 28+ messages in thread
From: Emmanuel Grumbach @ 2016-01-07 12:47 UTC (permalink / raw)
  To: linux-wireless; +Cc: David Spinadel, Emmanuel Grumbach

From: David Spinadel <david.spinadel@intel.com>

FW adds 10 msec for every dwell time in low band, so we need
to set 10 msec less.
Don't use extended dwell time when fragmented scan is needed
because FW adds 3 msec per probe and it can easily exceed
max out of channel time.

Fixes: c3e230b167a9 ("iwlwifi: mvm: add extended dwell time")
Signed-off-by: David Spinadel <david.spinadel@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
---
 drivers/net/wireless/intel/iwlwifi/mvm/scan.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/scan.c b/drivers/net/wireless/intel/iwlwifi/mvm/scan.c
index bee3201..9a15642 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/scan.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/scan.c
@@ -92,7 +92,7 @@ static struct iwl_mvm_scan_timing_params scan_timing[] = {
 		.dwell_active = 10,
 		.dwell_passive = 110,
 		.dwell_fragmented = 44,
-		.dwell_extended = 100,
+		.dwell_extended = 90,
 		.suspend_time = 0,
 		.max_out_time = 0,
 	},
@@ -100,7 +100,7 @@ static struct iwl_mvm_scan_timing_params scan_timing[] = {
 		.dwell_active = 10,
 		.dwell_passive = 110,
 		.dwell_fragmented = 44,
-		.dwell_extended = 100,
+		.dwell_extended = 90,
 		.suspend_time = 30,
 		.max_out_time = 120,
 	},
@@ -108,7 +108,7 @@ static struct iwl_mvm_scan_timing_params scan_timing[] = {
 		.dwell_active = 10,
 		.dwell_passive = 110,
 		.dwell_fragmented = 44,
-		.dwell_extended = 100,
+		.dwell_extended = 90,
 		.suspend_time = 120,
 		.max_out_time = 120,
 	},
@@ -116,7 +116,6 @@ static struct iwl_mvm_scan_timing_params scan_timing[] = {
 		.dwell_active = 10,
 		.dwell_passive = 110,
 		.dwell_fragmented = 44,
-		.dwell_extended = 44,
 		.suspend_time = 95,
 		.max_out_time = 44,
 	},
@@ -790,7 +789,8 @@ static int iwl_mvm_scan_lmac_flags(struct iwl_mvm *mvm,
 #endif
 
 	if (iwl_mvm_is_regular_scan(params) &&
-	    vif->type != NL80211_IFTYPE_P2P_DEVICE)
+	    vif->type != NL80211_IFTYPE_P2P_DEVICE &&
+	    params->type != IWL_SCAN_TYPE_FRAGMENTED)
 		flags |= IWL_MVM_LMAC_SCAN_FLAG_EXTENDED_DWELL;
 
 	return flags;
@@ -1072,7 +1072,8 @@ static u32 iwl_mvm_scan_umac_flags(struct iwl_mvm *mvm,
 #endif
 
 	if (iwl_mvm_is_regular_scan(params) &&
-	    vif->type != NL80211_IFTYPE_P2P_DEVICE)
+	    vif->type != NL80211_IFTYPE_P2P_DEVICE &&
+	    params->type != IWL_SCAN_TYPE_FRAGMENTED)
 		flags |= IWL_UMAC_SCAN_GEN_FLAGS_EXTENDED_DWELL;
 
 	return flags;
-- 
2.5.0


^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [PATCH 10/21] iwlwifi: mvm: dump the radio registers when the firmware crashes
  2016-01-07 12:46 pull request: iwlwifi-next 2016-01-07 Grumbach, Emmanuel
                   ` (8 preceding siblings ...)
  2016-01-07 12:47 ` [PATCH 09/21] iwlwifi: mvm: fix extended dwell time Emmanuel Grumbach
@ 2016-01-07 12:47 ` Emmanuel Grumbach
  2016-01-07 12:47 ` [PATCH 11/21] iwlwifi: mvm: add a non-trigger window to fw dbg triggers Emmanuel Grumbach
                   ` (11 subsequent siblings)
  21 siblings, 0 replies; 28+ messages in thread
From: Emmanuel Grumbach @ 2016-01-07 12:47 UTC (permalink / raw)
  To: linux-wireless; +Cc: Emmanuel Grumbach

Dumping the content of the radio registers greatly helps
to debug PHY issues, which can lead to TFD queue hang.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
---
 .../net/wireless/intel/iwlwifi/iwl-fw-error-dump.h |  2 ++
 drivers/net/wireless/intel/iwlwifi/iwl-prph.h      |  6 ++++
 drivers/net/wireless/intel/iwlwifi/mvm/fw-dbg.c    | 40 ++++++++++++++++++++--
 3 files changed, 46 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-fw-error-dump.h b/drivers/net/wireless/intel/iwlwifi/iwl-fw-error-dump.h
index f08a131..a5aaf68 100644
--- a/drivers/net/wireless/intel/iwlwifi/iwl-fw-error-dump.h
+++ b/drivers/net/wireless/intel/iwlwifi/iwl-fw-error-dump.h
@@ -88,6 +88,7 @@
  *	&struct iwl_fw_error_dump_rb
  * @IWL_FW_ERROR_PAGING: UMAC's image memory segments which were
  *	paged to the DRAM.
+ * @IWL_FW_ERROR_DUMP_RADIO_REG: Dump the radio registers.
  */
 enum iwl_fw_error_dump_type {
 	/* 0 is deprecated */
@@ -103,6 +104,7 @@ enum iwl_fw_error_dump_type {
 	IWL_FW_ERROR_DUMP_ERROR_INFO = 10,
 	IWL_FW_ERROR_DUMP_RB = 11,
 	IWL_FW_ERROR_DUMP_PAGING = 12,
+	IWL_FW_ERROR_DUMP_RADIO_REG = 13,
 
 	IWL_FW_ERROR_DUMP_MAX,
 };
diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-prph.h b/drivers/net/wireless/intel/iwlwifi/iwl-prph.h
index 9da7dc4..5bde23a 100644
--- a/drivers/net/wireless/intel/iwlwifi/iwl-prph.h
+++ b/drivers/net/wireless/intel/iwlwifi/iwl-prph.h
@@ -345,6 +345,12 @@ enum secure_load_status_reg {
 #define TXF_READ_MODIFY_DATA		(0xa00448)
 #define TXF_READ_MODIFY_ADDR		(0xa0044c)
 
+/* Radio registers access */
+#define RSP_RADIO_CMD			(0xa02804)
+#define RSP_RADIO_RDDAT			(0xa02814)
+#define RADIO_RSP_ADDR_POS		(6)
+#define RADIO_RSP_RD_CMD		(3)
+
 /* FW monitor */
 #define MON_BUFF_SAMPLE_CTL		(0xa03c00)
 #define MON_BUFF_BASE_ADDR		(0xa03c3c)
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/fw-dbg.c b/drivers/net/wireless/intel/iwlwifi/mvm/fw-dbg.c
index f406c76..59450f1 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/fw-dbg.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/fw-dbg.c
@@ -113,6 +113,35 @@ static void iwl_mvm_free_coredump(const void *data)
 	kfree(fw_error_dump);
 }
 
+#define RADIO_REG_MAX_READ 0x2ad
+static void iwl_mvm_read_radio_reg(struct iwl_mvm *mvm,
+				   struct iwl_fw_error_dump_data **dump_data)
+{
+	u8 *pos = (void *)(*dump_data)->data;
+	unsigned long flags;
+	int i;
+
+	if (!iwl_trans_grab_nic_access(mvm->trans, &flags))
+		return;
+
+	(*dump_data)->type = cpu_to_le32(IWL_FW_ERROR_DUMP_RADIO_REG);
+	(*dump_data)->len = cpu_to_le32(RADIO_REG_MAX_READ);
+
+	for (i = 0; i < RADIO_REG_MAX_READ; i++) {
+		u32 rd_cmd = RADIO_RSP_RD_CMD;
+
+		rd_cmd |= i << RADIO_RSP_ADDR_POS;
+		iwl_write_prph_no_grab(mvm->trans, RSP_RADIO_CMD, rd_cmd);
+		*pos =  (u8)iwl_read_prph_no_grab(mvm->trans, RSP_RADIO_RDDAT);
+
+		pos++;
+	}
+
+	*dump_data = iwl_fw_error_next_data(*dump_data);
+
+	iwl_trans_release_nic_access(mvm->trans, &flags);
+}
+
 static void iwl_mvm_dump_fifos(struct iwl_mvm *mvm,
 			       struct iwl_fw_error_dump_data **dump_data)
 {
@@ -401,7 +430,7 @@ void iwl_mvm_fw_error_dump(struct iwl_mvm *mvm)
 	struct iwl_fw_error_dump_trigger_desc *dump_trig;
 	struct iwl_mvm_dump_ptrs *fw_error_dump;
 	u32 sram_len, sram_ofs;
-	u32 file_len, fifo_data_len = 0, prph_len = 0;
+	u32 file_len, fifo_data_len = 0, prph_len = 0, radio_len = 0;
 	u32 smem_len = mvm->cfg->smem_len;
 	u32 sram2_len = mvm->cfg->dccm2_len;
 	bool monitor_dump_only = false;
@@ -472,6 +501,9 @@ void iwl_mvm_fw_error_dump(struct iwl_mvm *mvm)
 				sizeof(struct iwl_fw_error_dump_prph) +
 				num_bytes_in_chunk;
 		}
+
+		if (mvm->cfg->device_family == IWL_DEVICE_FAMILY_7000)
+			radio_len = sizeof(*dump_data) + RADIO_REG_MAX_READ;
 	}
 
 	file_len = sizeof(*dump_file) +
@@ -479,6 +511,7 @@ void iwl_mvm_fw_error_dump(struct iwl_mvm *mvm)
 		   sram_len + sizeof(*dump_mem) +
 		   fifo_data_len +
 		   prph_len +
+		   radio_len +
 		   sizeof(*dump_info);
 
 	/* Make room for the SMEM, if it exists */
@@ -543,8 +576,11 @@ void iwl_mvm_fw_error_dump(struct iwl_mvm *mvm)
 
 	dump_data = iwl_fw_error_next_data(dump_data);
 	/* We only dump the FIFOs if the FW is in error state */
-	if (test_bit(STATUS_FW_ERROR, &mvm->trans->status))
+	if (test_bit(STATUS_FW_ERROR, &mvm->trans->status)) {
 		iwl_mvm_dump_fifos(mvm, &dump_data);
+		if (radio_len)
+			iwl_mvm_read_radio_reg(mvm, &dump_data);
+	}
 
 	if (mvm->fw_dump_desc) {
 		dump_data->type = cpu_to_le32(IWL_FW_ERROR_DUMP_ERROR_INFO);
-- 
2.5.0


^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [PATCH 11/21] iwlwifi: mvm: add a non-trigger window to fw dbg triggers
  2016-01-07 12:46 pull request: iwlwifi-next 2016-01-07 Grumbach, Emmanuel
                   ` (9 preceding siblings ...)
  2016-01-07 12:47 ` [PATCH 10/21] iwlwifi: mvm: dump the radio registers when the firmware crashes Emmanuel Grumbach
@ 2016-01-07 12:47 ` Emmanuel Grumbach
  2016-01-07 12:47 ` [PATCH 12/21] iwlwifi: mvm: support A-MSDU in A-MPDU Emmanuel Grumbach
                   ` (10 subsequent siblings)
  21 siblings, 0 replies; 28+ messages in thread
From: Emmanuel Grumbach @ 2016-01-07 12:47 UTC (permalink / raw)
  To: linux-wireless; +Cc: Golan Ben-Ami, Emmanuel Grumbach

From: Golan Ben-Ami <golan.ben.ami@intel.com>

Allow the user to configure a non-trigger session - a window
between triggers in which the driver won't collect fw debug data.
This can be useful when the frequent collection of fw data
has an impact on the performance, such as debugging
tx flows.

Signed-off-by: Golan Ben-Ami <golan.ben.ami@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
---
 drivers/net/wireless/intel/iwlwifi/iwl-fw-file.h |  5 ++++-
 drivers/net/wireless/intel/iwlwifi/mvm/fw-dbg.h  | 24 ++++++++++++++++++++++++
 drivers/net/wireless/intel/iwlwifi/mvm/mvm.h     |  3 +++
 3 files changed, 31 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-fw-file.h b/drivers/net/wireless/intel/iwlwifi/iwl-fw-file.h
index 8d37e33..84f8aeb 100644
--- a/drivers/net/wireless/intel/iwlwifi/iwl-fw-file.h
+++ b/drivers/net/wireless/intel/iwlwifi/iwl-fw-file.h
@@ -557,6 +557,8 @@ enum iwl_fw_dbg_trigger_vif_type {
  * @start_conf_id: if mode is %IWL_FW_DBG_TRIGGER_START, this defines what
  *	configuration should be applied when the triggers kicks in.
  * @occurrences: number of occurrences. 0 means the trigger will never fire.
+ * @trig_dis_ms: the time, in milliseconds, after an occurrence of this
+ *	trigger in which another occurrence should be ignored.
  */
 struct iwl_fw_dbg_trigger_tlv {
 	__le32 id;
@@ -566,7 +568,8 @@ struct iwl_fw_dbg_trigger_tlv {
 	u8 mode;
 	u8 start_conf_id;
 	__le16 occurrences;
-	__le32 reserved[2];
+	__le16 trig_dis_ms;
+	__le16 reserved[3];
 
 	u8 data[0];
 } __packed;
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/fw-dbg.h b/drivers/net/wireless/intel/iwlwifi/mvm/fw-dbg.h
index 461acdf..08148b2 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/fw-dbg.h
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/fw-dbg.h
@@ -118,6 +118,24 @@ iwl_fw_dbg_trigger_stop_conf_match(struct iwl_mvm *mvm,
 }
 
 static inline bool
+iwl_fw_dbg_no_trig_window(struct iwl_mvm *mvm,
+			  struct iwl_fw_dbg_trigger_tlv *trig)
+{
+	unsigned long wind_jiff =
+		msecs_to_jiffies(le16_to_cpu(trig->trig_dis_ms));
+	u32 id = le32_to_cpu(trig->id);
+
+	/* If this is the first event checked, jump to update start ts */
+	if (mvm->fw_dbg_non_collect_ts_start[id] &&
+	    (time_after(mvm->fw_dbg_non_collect_ts_start[id] + wind_jiff,
+			jiffies)))
+		return true;
+
+	mvm->fw_dbg_non_collect_ts_start[id] = jiffies;
+	return false;
+}
+
+static inline bool
 iwl_fw_dbg_trigger_check_stop(struct iwl_mvm *mvm,
 			      struct ieee80211_vif *vif,
 			      struct iwl_fw_dbg_trigger_tlv *trig)
@@ -125,6 +143,12 @@ iwl_fw_dbg_trigger_check_stop(struct iwl_mvm *mvm,
 	if (vif && !iwl_fw_dbg_trigger_vif_match(trig, vif))
 		return false;
 
+	if (iwl_fw_dbg_no_trig_window(mvm, trig)) {
+		IWL_WARN(mvm, "Trigger %d occurred while no-collect window.\n",
+			 trig->id);
+		return false;
+	}
+
 	return iwl_fw_dbg_trigger_stop_conf_match(mvm, trig);
 }
 
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h b/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
index 287c162..7517dc13 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
@@ -658,6 +658,9 @@ struct iwl_mvm {
 	/* max number of simultaneous scans the FW supports */
 	unsigned int max_scans;
 
+	/* ts of the beginning of a non-collect fw dbg data period */
+	unsigned long fw_dbg_non_collect_ts_start[FW_DBG_TRIGGER_MAX - 1];
+
 	/* UMAC scan tracking */
 	u32 scan_uid_status[IWL_MVM_MAX_UMAC_SCANS];
 
-- 
2.5.0


^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [PATCH 12/21] iwlwifi: mvm: support A-MSDU in A-MPDU
  2016-01-07 12:46 pull request: iwlwifi-next 2016-01-07 Grumbach, Emmanuel
                   ` (10 preceding siblings ...)
  2016-01-07 12:47 ` [PATCH 11/21] iwlwifi: mvm: add a non-trigger window to fw dbg triggers Emmanuel Grumbach
@ 2016-01-07 12:47 ` Emmanuel Grumbach
  2016-01-07 12:47 ` [PATCH 13/21] iwlwifi: mvm: remove useless WARN_ON and rely on cfg80211's combination Emmanuel Grumbach
                   ` (9 subsequent siblings)
  21 siblings, 0 replies; 28+ messages in thread
From: Emmanuel Grumbach @ 2016-01-07 12:47 UTC (permalink / raw)
  To: linux-wireless; +Cc: Johannes Berg, Emmanuel Grumbach

From: Johannes Berg <johannes.berg@intel.com>

Since A-MPDU deaggregation is done in hardware, and A-MSDU deaggregation
is done in software, there's no reason not to support A-MSDU in A-MPDU;
set the flag to support it.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
---
 drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
index 2d65040..8539dfe 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
@@ -438,6 +438,7 @@ int iwl_mvm_mac_setup_register(struct iwl_mvm *mvm)
 	ieee80211_hw_set(hw, CHANCTX_STA_CSA);
 	ieee80211_hw_set(hw, SUPPORT_FAST_XMIT);
 	ieee80211_hw_set(hw, SUPPORTS_CLONED_SKBS);
+	ieee80211_hw_set(hw, SUPPORTS_AMSDU_IN_AMPDU);
 
 	if (mvm->trans->max_skb_frags)
 		hw->netdev_features = NETIF_F_HIGHDMA | NETIF_F_SG;
-- 
2.5.0


^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [PATCH 13/21] iwlwifi: mvm: remove useless WARN_ON and rely on cfg80211's combination
  2016-01-07 12:46 pull request: iwlwifi-next 2016-01-07 Grumbach, Emmanuel
                   ` (11 preceding siblings ...)
  2016-01-07 12:47 ` [PATCH 12/21] iwlwifi: mvm: support A-MSDU in A-MPDU Emmanuel Grumbach
@ 2016-01-07 12:47 ` Emmanuel Grumbach
  2016-01-07 12:47 ` [PATCH 14/21] iwlwifi: mvm: prevent multiple stations with the same address Emmanuel Grumbach
                   ` (8 subsequent siblings)
  21 siblings, 0 replies; 28+ messages in thread
From: Emmanuel Grumbach @ 2016-01-07 12:47 UTC (permalink / raw)
  To: linux-wireless; +Cc: Emmanuel Grumbach

We advertise one STATION vif only, so this just can't
happen. Remove this useless WARN_ON.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
---
 drivers/net/wireless/intel/iwlwifi/mvm/power.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/power.c b/drivers/net/wireless/intel/iwlwifi/mvm/power.c
index 87a9f24..9de159f 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/power.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/power.c
@@ -613,8 +613,6 @@ static void iwl_mvm_power_get_vifs_iterator(void *_data, u8 *mac,
 		break;
 
 	case NL80211_IFTYPE_STATION:
-		/* only a single MAC of the same type */
-		WARN_ON(power_iterator->bss_vif);
 		power_iterator->bss_vif = vif;
 		if (mvmvif->phy_ctxt)
 			if (mvmvif->phy_ctxt->id < MAX_PHYS)
-- 
2.5.0


^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [PATCH 14/21] iwlwifi: mvm: prevent multiple stations with the same address
  2016-01-07 12:46 pull request: iwlwifi-next 2016-01-07 Grumbach, Emmanuel
                   ` (12 preceding siblings ...)
  2016-01-07 12:47 ` [PATCH 13/21] iwlwifi: mvm: remove useless WARN_ON and rely on cfg80211's combination Emmanuel Grumbach
@ 2016-01-07 12:47 ` Emmanuel Grumbach
  2016-01-07 12:47 ` [PATCH 15/21] iwlwifi: mvm: don't ask beacons when P2P GO vif and no assoc sta Emmanuel Grumbach
                   ` (7 subsequent siblings)
  21 siblings, 0 replies; 28+ messages in thread
From: Emmanuel Grumbach @ 2016-01-07 12:47 UTC (permalink / raw)
  To: linux-wireless; +Cc: Johannes Berg, Emmanuel Grumbach

From: Johannes Berg <johannes.berg@intel.com>

As the device (and parts of the driver) cannot deal with having the
same MAC address for two stations (on two virtual interfaces), add
some explicit code to prevent this case.

Note that in practice this cannot happen since the device doesn't
support operating with two AP/GO interfaces at the same time either,
and other scenarios for this are, while not impossible, not going to
happen in practice.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
---
 drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
index 8539dfe..40b5c53 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
@@ -439,6 +439,7 @@ int iwl_mvm_mac_setup_register(struct iwl_mvm *mvm)
 	ieee80211_hw_set(hw, SUPPORT_FAST_XMIT);
 	ieee80211_hw_set(hw, SUPPORTS_CLONED_SKBS);
 	ieee80211_hw_set(hw, SUPPORTS_AMSDU_IN_AMPDU);
+	ieee80211_hw_set(hw, NEEDS_UNIQUE_STA_ADDR);
 
 	if (mvm->trans->max_skb_frags)
 		hw->netdev_features = NETIF_F_HIGHDMA | NETIF_F_SG;
-- 
2.5.0


^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [PATCH 15/21] iwlwifi: mvm: don't ask beacons when P2P GO vif and no assoc sta
  2016-01-07 12:46 pull request: iwlwifi-next 2016-01-07 Grumbach, Emmanuel
                   ` (13 preceding siblings ...)
  2016-01-07 12:47 ` [PATCH 14/21] iwlwifi: mvm: prevent multiple stations with the same address Emmanuel Grumbach
@ 2016-01-07 12:47 ` Emmanuel Grumbach
  2016-01-07 12:47 ` [PATCH 16/21] iwlwifi: mvm: check PN for CCMP/GCMP in the driver Emmanuel Grumbach
                   ` (6 subsequent siblings)
  21 siblings, 0 replies; 28+ messages in thread
From: Emmanuel Grumbach @ 2016-01-07 12:47 UTC (permalink / raw)
  To: linux-wireless; +Cc: Ayala Beker, Emmanuel Grumbach

From: Ayala Beker <ayala.beker@intel.com>

The commit below called iwl_mvm_mac_ctxt_changed() to handle
a case that the vif is a P2P GO.
However iwl_mvm_mac_ctxt_cmd_go() ignores the number of
associated stations and asks the FW to pass beacons anyways.

Fix this by checking ap_assoc_sta_count parameter, in iwl_mvm_mac_ctxt_cmd_go()
as well, and ask the FW to pass beacons only when there's
at least one associated station.

Signed-off-by: Ayala Beker <ayala.beker@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
---
 drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c | 44 ++++++++++-------------
 1 file changed, 19 insertions(+), 25 deletions(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c b/drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c
index 448b9c9..bf1e5eb 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c
@@ -717,6 +717,8 @@ static void iwl_mvm_mac_ctxt_cmd_common(struct iwl_mvm *mvm,
 		cpu_to_le32(vif->bss_conf.use_short_slot ?
 			    MAC_FLG_SHORT_SLOT : 0);
 
+	cmd->filter_flags = cpu_to_le32(MAC_FILTER_ACCEPT_GRP);
+
 	for (i = 0; i < IEEE80211_NUM_ACS; i++) {
 		u8 txf = iwl_mvm_ac_to_tx_fifo[i];
 
@@ -730,11 +732,26 @@ static void iwl_mvm_mac_ctxt_cmd_common(struct iwl_mvm *mvm,
 		cmd->ac[txf].fifos_mask = BIT(txf);
 	}
 
-	/* in AP mode, the MCAST FIFO takes the EDCA params from VO */
-	if (vif->type == NL80211_IFTYPE_AP)
+	if (vif->type == NL80211_IFTYPE_AP) {
+		/* in AP mode, the MCAST FIFO takes the EDCA params from VO */
 		cmd->ac[IWL_MVM_TX_FIFO_VO].fifos_mask |=
 			BIT(IWL_MVM_TX_FIFO_MCAST);
 
+		/*
+		 * in AP mode, pass probe requests and beacons from other APs
+		 * (needed for ht protection); when there're no any associated
+		 * station don't ask FW to pass beacons to prevent unnecessary
+		 * wake-ups.
+		 */
+		cmd->filter_flags |= cpu_to_le32(MAC_FILTER_IN_PROBE_REQUEST);
+		if (mvmvif->ap_assoc_sta_count) {
+			cmd->filter_flags |= cpu_to_le32(MAC_FILTER_IN_BEACON);
+			IWL_DEBUG_HC(mvm, "Asking FW to pass beacons\n");
+		} else {
+			IWL_DEBUG_HC(mvm, "No need to receive beacons\n");
+		}
+	}
+
 	if (vif->bss_conf.qos)
 		cmd->qos_flags |= cpu_to_le32(MAC_QOS_FLG_UPDATE_EDCA);
 
@@ -748,8 +765,6 @@ static void iwl_mvm_mac_ctxt_cmd_common(struct iwl_mvm *mvm,
 		cmd->qos_flags |= cpu_to_le32(MAC_QOS_FLG_TGN);
 	if (ht_enabled)
 		iwl_mvm_mac_ctxt_set_ht_flags(mvm, vif, cmd);
-
-	cmd->filter_flags = cpu_to_le32(MAC_FILTER_ACCEPT_GRP);
 }
 
 static int iwl_mvm_mac_ctxt_send_cmd(struct iwl_mvm *mvm,
@@ -1156,7 +1171,6 @@ static int iwl_mvm_mac_ctxt_cmd_ap(struct iwl_mvm *mvm,
 				   struct ieee80211_vif *vif,
 				   u32 action)
 {
-	struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
 	struct iwl_mac_ctx_cmd cmd = {};
 
 	WARN_ON(vif->type != NL80211_IFTYPE_AP || vif->p2p);
@@ -1164,19 +1178,6 @@ static int iwl_mvm_mac_ctxt_cmd_ap(struct iwl_mvm *mvm,
 	/* Fill the common data for all mac context types */
 	iwl_mvm_mac_ctxt_cmd_common(mvm, vif, &cmd, NULL, action);
 
-	/*
-	 * pass probe requests and beacons from other APs (needed
-	 * for ht protection); when there're no any associated station
-	 * don't ask FW to pass beacons to prevent unnecessary wake-ups.
-	 */
-	cmd.filter_flags |= cpu_to_le32(MAC_FILTER_IN_PROBE_REQUEST);
-	if (mvmvif->ap_assoc_sta_count) {
-		cmd.filter_flags |= cpu_to_le32(MAC_FILTER_IN_BEACON);
-		IWL_DEBUG_HC(mvm, "Asking FW to pass beacons\n");
-	} else {
-		IWL_DEBUG_HC(mvm, "No need to receive beacons\n");
-	}
-
 	/* Fill the data specific for ap mode */
 	iwl_mvm_mac_ctxt_cmd_fill_ap(mvm, vif, &cmd.ap,
 				     action == FW_CTXT_ACTION_ADD);
@@ -1196,13 +1197,6 @@ static int iwl_mvm_mac_ctxt_cmd_go(struct iwl_mvm *mvm,
 	/* Fill the common data for all mac context types */
 	iwl_mvm_mac_ctxt_cmd_common(mvm, vif, &cmd, NULL, action);
 
-	/*
-	 * pass probe requests and beacons from other APs (needed
-	 * for ht protection)
-	 */
-	cmd.filter_flags |= cpu_to_le32(MAC_FILTER_IN_PROBE_REQUEST |
-					MAC_FILTER_IN_BEACON);
-
 	/* Fill the data specific for GO mode */
 	iwl_mvm_mac_ctxt_cmd_fill_ap(mvm, vif, &cmd.go.ap,
 				     action == FW_CTXT_ACTION_ADD);
-- 
2.5.0


^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [PATCH 16/21] iwlwifi: mvm: check PN for CCMP/GCMP in the driver
  2016-01-07 12:46 pull request: iwlwifi-next 2016-01-07 Grumbach, Emmanuel
                   ` (14 preceding siblings ...)
  2016-01-07 12:47 ` [PATCH 15/21] iwlwifi: mvm: don't ask beacons when P2P GO vif and no assoc sta Emmanuel Grumbach
@ 2016-01-07 12:47 ` Emmanuel Grumbach
  2016-01-07 12:47 ` [PATCH 17/21] iwlwifi: mvm: initialize gtkdata->mvm correctly Emmanuel Grumbach
                   ` (5 subsequent siblings)
  21 siblings, 0 replies; 28+ messages in thread
From: Emmanuel Grumbach @ 2016-01-07 12:47 UTC (permalink / raw)
  To: linux-wireless; +Cc: Johannes Berg, Sara Sharon, Emmanuel Grumbach

From: Johannes Berg <johannes.berg@intel.com>

As we're working on multi-queue RX, we want to parallelise checking
the PN in order to avoid having to serialise the RX processing.

It may seem that doing parallel PN checking is insecure, but it turns
out to be OK because queue assignment is done based on the data in the
frame (IP/TCP) and thus cannot be manipulated by an attacker, since
the data is encrypted and must first have been decrypted successfully.

There are some corner cases, in particular when the peer starts using
fragmentation which redirects the packet to the default queue. However
this redirection is remembered (for the STA, per TID) and thus cannot
be exploited by an attacker either.

Leave checking on the default queue (queue 0) to mac80211, since we
get fragmented packets there and those are subject to stricter checks
during reassembly.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
---
 drivers/net/wireless/intel/iwlwifi/mvm/d3.c       | 114 ++++++++++++++++++----
 drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c |  46 +++++++++
 drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c     | 106 +++++++++++++++++---
 drivers/net/wireless/intel/iwlwifi/mvm/sta.h      |  12 +++
 4 files changed, 245 insertions(+), 33 deletions(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/d3.c b/drivers/net/wireless/intel/iwlwifi/mvm/d3.c
index 6ac4072..2cd9052 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/d3.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/d3.c
@@ -137,6 +137,28 @@ static void iwl_mvm_convert_p1k(u16 *p1k, __le16 *out)
 		out[i] = cpu_to_le16(p1k[i]);
 }
 
+static const u8 *iwl_mvm_find_max_pn(struct ieee80211_key_conf *key,
+				     struct iwl_mvm_key_pn *ptk_pn,
+				     struct ieee80211_key_seq *seq,
+				     int tid, int queues)
+{
+	const u8 *ret = seq->ccmp.pn;
+	int i;
+
+	/* get the PN from mac80211, used on the default queue */
+	ieee80211_get_key_rx_seq(key, tid, seq);
+
+	/* and use the internal data for the other queues */
+	for (i = 1; i < queues; i++) {
+		const u8 *tmp = ptk_pn->q[i].pn[tid];
+
+		if (memcmp(ret, tmp, IEEE80211_CCMP_PN_LEN) <= 0)
+			ret = tmp;
+	}
+
+	return ret;
+}
+
 struct wowlan_key_data {
 	struct iwl_wowlan_rsc_tsc_params_cmd *rsc_tsc;
 	struct iwl_wowlan_tkip_params_cmd *tkip;
@@ -294,18 +316,42 @@ static void iwl_mvm_wowlan_program_keys(struct ieee80211_hw *hw,
 
 		/*
 		 * For non-QoS this relies on the fact that both the uCode and
-		 * mac80211 use TID 0 for checking the IV in the frames.
+		 * mac80211/our RX code use TID 0 for checking the PN.
 		 */
-		for (i = 0; i < IWL_NUM_RSC; i++) {
-			u8 *pn = seq.ccmp.pn;
+		if (sta && iwl_mvm_has_new_rx_api(mvm)) {
+			struct iwl_mvm_sta *mvmsta;
+			struct iwl_mvm_key_pn *ptk_pn;
+			const u8 *pn;
+
+			mvmsta = iwl_mvm_sta_from_mac80211(sta);
+			ptk_pn = rcu_dereference_protected(
+						mvmsta->ptk_pn[key->keyidx],
+						lockdep_is_held(&mvm->mutex));
+			if (WARN_ON(!ptk_pn))
+				break;
 
-			ieee80211_get_key_rx_seq(key, i, &seq);
-			aes_sc[i].pn = cpu_to_le64((u64)pn[5] |
-						   ((u64)pn[4] << 8) |
-						   ((u64)pn[3] << 16) |
-						   ((u64)pn[2] << 24) |
-						   ((u64)pn[1] << 32) |
-						   ((u64)pn[0] << 40));
+			for (i = 0; i < IWL_MAX_TID_COUNT; i++) {
+				pn = iwl_mvm_find_max_pn(key, ptk_pn, &seq, i,
+						mvm->trans->num_rx_queues);
+				aes_sc[i].pn = cpu_to_le64((u64)pn[5] |
+							   ((u64)pn[4] << 8) |
+							   ((u64)pn[3] << 16) |
+							   ((u64)pn[2] << 24) |
+							   ((u64)pn[1] << 32) |
+							   ((u64)pn[0] << 40));
+			}
+		} else {
+			for (i = 0; i < IWL_NUM_RSC; i++) {
+				u8 *pn = seq.ccmp.pn;
+
+				ieee80211_get_key_rx_seq(key, i, &seq);
+				aes_sc[i].pn = cpu_to_le64((u64)pn[5] |
+							   ((u64)pn[4] << 8) |
+							   ((u64)pn[3] << 16) |
+							   ((u64)pn[2] << 24) |
+							   ((u64)pn[1] << 32) |
+							   ((u64)pn[0] << 40));
+			}
 		}
 		data->use_rsc_tsc = true;
 		break;
@@ -1426,18 +1472,42 @@ static void iwl_mvm_tkip_sc_to_seq(struct tkip_sc *sc,
 	seq->tkip.iv16 = le16_to_cpu(sc->iv16);
 }
 
-static void iwl_mvm_set_aes_rx_seq(struct aes_sc *scs,
+static void iwl_mvm_set_aes_rx_seq(struct iwl_mvm *mvm, struct aes_sc *scs,
+				   struct ieee80211_sta *sta,
 				   struct ieee80211_key_conf *key)
 {
 	int tid;
 
 	BUILD_BUG_ON(IWL_NUM_RSC != IEEE80211_NUM_TIDS);
 
-	for (tid = 0; tid < IWL_NUM_RSC; tid++) {
-		struct ieee80211_key_seq seq = {};
+	if (sta && iwl_mvm_has_new_rx_api(mvm)) {
+		struct iwl_mvm_sta *mvmsta;
+		struct iwl_mvm_key_pn *ptk_pn;
 
-		iwl_mvm_aes_sc_to_seq(&scs[tid], &seq);
-		ieee80211_set_key_rx_seq(key, tid, &seq);
+		mvmsta = iwl_mvm_sta_from_mac80211(sta);
+
+		ptk_pn = rcu_dereference_protected(mvmsta->ptk_pn[key->keyidx],
+						   lockdep_is_held(&mvm->mutex));
+		if (WARN_ON(!ptk_pn))
+			return;
+
+		for (tid = 0; tid < IWL_MAX_TID_COUNT; tid++) {
+			struct ieee80211_key_seq seq = {};
+			int i;
+
+			iwl_mvm_aes_sc_to_seq(&scs[tid], &seq);
+			ieee80211_set_key_rx_seq(key, tid, &seq);
+			for (i = 1; i < mvm->trans->num_rx_queues; i++)
+				memcpy(ptk_pn->q[i].pn[tid],
+				       seq.ccmp.pn, IEEE80211_CCMP_PN_LEN);
+		}
+	} else {
+		for (tid = 0; tid < IWL_NUM_RSC; tid++) {
+			struct ieee80211_key_seq seq = {};
+
+			iwl_mvm_aes_sc_to_seq(&scs[tid], &seq);
+			ieee80211_set_key_rx_seq(key, tid, &seq);
+		}
 	}
 }
 
@@ -1456,14 +1526,15 @@ static void iwl_mvm_set_tkip_rx_seq(struct tkip_sc *scs,
 	}
 }
 
-static void iwl_mvm_set_key_rx_seq(struct ieee80211_key_conf *key,
+static void iwl_mvm_set_key_rx_seq(struct iwl_mvm *mvm,
+				   struct ieee80211_key_conf *key,
 				   struct iwl_wowlan_status *status)
 {
 	union iwl_all_tsc_rsc *rsc = &status->gtk.rsc.all_tsc_rsc;
 
 	switch (key->cipher) {
 	case WLAN_CIPHER_SUITE_CCMP:
-		iwl_mvm_set_aes_rx_seq(rsc->aes.multicast_rsc, key);
+		iwl_mvm_set_aes_rx_seq(mvm, rsc->aes.multicast_rsc, NULL, key);
 		break;
 	case WLAN_CIPHER_SUITE_TKIP:
 		iwl_mvm_set_tkip_rx_seq(rsc->tkip.multicast_rsc, key);
@@ -1474,6 +1545,7 @@ static void iwl_mvm_set_key_rx_seq(struct ieee80211_key_conf *key,
 }
 
 struct iwl_mvm_d3_gtk_iter_data {
+	struct iwl_mvm *mvm;
 	struct iwl_wowlan_status *status;
 	void *last_gtk;
 	u32 cipher;
@@ -1522,7 +1594,8 @@ static void iwl_mvm_d3_update_keys(struct ieee80211_hw *hw,
 
 		switch (key->cipher) {
 		case WLAN_CIPHER_SUITE_CCMP:
-			iwl_mvm_set_aes_rx_seq(sc->aes.unicast_rsc, key);
+			iwl_mvm_set_aes_rx_seq(data->mvm, sc->aes.unicast_rsc,
+					       sta, key);
 			atomic64_set(&key->tx_pn, le64_to_cpu(sc->aes.tsc.pn));
 			break;
 		case WLAN_CIPHER_SUITE_TKIP:
@@ -1545,7 +1618,7 @@ static void iwl_mvm_d3_update_keys(struct ieee80211_hw *hw,
 	if (data->status->num_of_gtk_rekeys)
 		ieee80211_remove_key(key);
 	else if (data->last_gtk == key)
-		iwl_mvm_set_key_rx_seq(key, data->status);
+		iwl_mvm_set_key_rx_seq(data->mvm, key, data->status);
 }
 
 static bool iwl_mvm_setup_connection_keep(struct iwl_mvm *mvm,
@@ -1554,6 +1627,7 @@ static bool iwl_mvm_setup_connection_keep(struct iwl_mvm *mvm,
 {
 	struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
 	struct iwl_mvm_d3_gtk_iter_data gtkdata = {
+		.mvm = mvm,
 		.status = status,
 	};
 	u32 disconnection_reasons =
@@ -1615,7 +1689,7 @@ static bool iwl_mvm_setup_connection_keep(struct iwl_mvm *mvm,
 		key = ieee80211_gtk_rekey_add(vif, &conf.conf);
 		if (IS_ERR(key))
 			return false;
-		iwl_mvm_set_key_rx_seq(key, status);
+		iwl_mvm_set_key_rx_seq(mvm, key, status);
 	}
 
 	if (status->num_of_gtk_rekeys) {
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
index 40b5c53..d70a171 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
@@ -2568,6 +2568,9 @@ static int iwl_mvm_mac_set_key(struct ieee80211_hw *hw,
 			       struct ieee80211_key_conf *key)
 {
 	struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
+	struct iwl_mvm_sta *mvmsta;
+	struct iwl_mvm_key_pn *ptk_pn;
+	int keyidx = key->keyidx;
 	int ret;
 	u8 key_offset;
 
@@ -2635,6 +2638,36 @@ static int iwl_mvm_mac_set_key(struct ieee80211_hw *hw,
 			break;
 		}
 
+		if (!test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status) &&
+		    sta && iwl_mvm_has_new_rx_api(mvm) &&
+		    key->flags & IEEE80211_KEY_FLAG_PAIRWISE &&
+		    (key->cipher == WLAN_CIPHER_SUITE_CCMP ||
+		     key->cipher == WLAN_CIPHER_SUITE_GCMP)) {
+			struct ieee80211_key_seq seq;
+			int tid, q;
+
+			mvmsta = iwl_mvm_sta_from_mac80211(sta);
+			WARN_ON(rcu_access_pointer(mvmsta->ptk_pn[keyidx]));
+			ptk_pn = kzalloc(sizeof(*ptk_pn) +
+					 mvm->trans->num_rx_queues *
+						sizeof(ptk_pn->q[0]),
+					 GFP_KERNEL);
+			if (!ptk_pn) {
+				ret = -ENOMEM;
+				break;
+			}
+
+			for (tid = 0; tid < IWL_MAX_TID_COUNT; tid++) {
+				ieee80211_get_key_rx_seq(key, tid, &seq);
+				for (q = 0; q < mvm->trans->num_rx_queues; q++)
+					memcpy(ptk_pn->q[q].pn[tid],
+					       seq.ccmp.pn,
+					       IEEE80211_CCMP_PN_LEN);
+			}
+
+			rcu_assign_pointer(mvmsta->ptk_pn[keyidx], ptk_pn);
+		}
+
 		/* in HW restart reuse the index, otherwise request a new one */
 		if (test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status))
 			key_offset = key->hw_key_idx;
@@ -2660,6 +2693,19 @@ static int iwl_mvm_mac_set_key(struct ieee80211_hw *hw,
 			break;
 		}
 
+		if (sta && iwl_mvm_has_new_rx_api(mvm) &&
+		    key->flags & IEEE80211_KEY_FLAG_PAIRWISE &&
+		    (key->cipher == WLAN_CIPHER_SUITE_CCMP ||
+		     key->cipher == WLAN_CIPHER_SUITE_GCMP)) {
+			mvmsta = iwl_mvm_sta_from_mac80211(sta);
+			ptk_pn = rcu_dereference_protected(
+						mvmsta->ptk_pn[keyidx],
+						lockdep_is_held(&mvm->mutex));
+			RCU_INIT_POINTER(mvmsta->ptk_pn[keyidx], NULL);
+			if (ptk_pn)
+				kfree_rcu(ptk_pn, rcu_head);
+		}
+
 		IWL_DEBUG_MAC80211(mvm, "disable hwcrypto key\n");
 		ret = iwl_mvm_remove_sta_key(mvm, vif, sta, key);
 		break;
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c b/drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c
index e2a872d..0c073e0 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c
@@ -78,12 +78,83 @@ void iwl_mvm_rx_phy_cmd_mq(struct iwl_mvm *mvm, struct iwl_rx_cmd_buffer *rxb)
 #endif
 }
 
-static void iwl_mvm_pass_packet_to_mac80211(struct iwl_mvm *mvm,
-					    struct napi_struct *napi,
-					    struct sk_buff *skb,
-					    struct ieee80211_hdr *hdr, u16 len,
-					    u32 ampdu_status, u8 crypt_len,
-					    struct iwl_rx_cmd_buffer *rxb)
+static inline int iwl_mvm_check_pn(struct iwl_mvm *mvm, struct sk_buff *skb,
+				   int queue, struct ieee80211_sta *sta)
+{
+	struct iwl_mvm_sta *mvmsta;
+	struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
+	struct ieee80211_rx_status *stats = IEEE80211_SKB_RXCB(skb);
+	struct iwl_mvm_key_pn *ptk_pn;
+	u8 tid, keyidx;
+	u8 pn[IEEE80211_CCMP_PN_LEN];
+	u8 *extiv;
+
+	/* do PN checking */
+
+	/* multicast and non-data only arrives on default queue */
+	if (!ieee80211_is_data(hdr->frame_control) ||
+	    is_multicast_ether_addr(hdr->addr1))
+		return 0;
+
+	/* do not check PN for open AP */
+	if (!(stats->flag & RX_FLAG_DECRYPTED))
+		return 0;
+
+	/*
+	 * avoid checking for default queue - we don't want to replicate
+	 * all the logic that's necessary for checking the PN on fragmented
+	 * frames, leave that to mac80211
+	 */
+	if (queue == 0)
+		return 0;
+
+	/* if we are here - this for sure is either CCMP or GCMP */
+	if (IS_ERR_OR_NULL(sta)) {
+		IWL_ERR(mvm,
+			"expected hw-decrypted unicast frame for station\n");
+		return -1;
+	}
+
+	mvmsta = iwl_mvm_sta_from_mac80211(sta);
+
+	extiv = (u8 *)hdr + ieee80211_hdrlen(hdr->frame_control);
+	keyidx = extiv[3] >> 6;
+
+	ptk_pn = rcu_dereference(mvmsta->ptk_pn[keyidx]);
+	if (!ptk_pn)
+		return -1;
+
+	if (ieee80211_is_data_qos(hdr->frame_control))
+		tid = *ieee80211_get_qos_ctl(hdr) & IEEE80211_QOS_CTL_TID_MASK;
+	else
+		tid = 0;
+
+	/* we don't use HCCA/802.11 QoS TSPECs, so drop such frames */
+	if (tid >= IWL_MAX_TID_COUNT)
+		return -1;
+
+	/* load pn */
+	pn[0] = extiv[7];
+	pn[1] = extiv[6];
+	pn[2] = extiv[5];
+	pn[3] = extiv[4];
+	pn[4] = extiv[1];
+	pn[5] = extiv[0];
+
+	if (memcmp(pn, ptk_pn->q[queue].pn[tid],
+		   IEEE80211_CCMP_PN_LEN) <= 0)
+		return -1;
+
+	memcpy(ptk_pn->q[queue].pn[tid], pn, IEEE80211_CCMP_PN_LEN);
+	stats->flag |= RX_FLAG_PN_VALIDATED;
+
+	return 0;
+}
+
+/* iwl_mvm_create_skb Adds the rxb to a new skb */
+static void iwl_mvm_create_skb(struct sk_buff *skb, struct ieee80211_hdr *hdr,
+			       u16 len, u8 crypt_len,
+			       struct iwl_rx_cmd_buffer *rxb)
 {
 	unsigned int hdrlen, fraglen;
 
@@ -112,8 +183,18 @@ static void iwl_mvm_pass_packet_to_mac80211(struct iwl_mvm *mvm,
 		skb_add_rx_frag(skb, 0, rxb_steal_page(rxb), offset,
 				fraglen, rxb->truesize);
 	}
+}
 
-	ieee80211_rx_napi(mvm->hw, skb, napi);
+/* iwl_mvm_pass_packet_to_mac80211 - passes the packet for mac80211 */
+static void iwl_mvm_pass_packet_to_mac80211(struct iwl_mvm *mvm,
+					    struct napi_struct *napi,
+					    struct sk_buff *skb, int queue,
+					    struct ieee80211_sta *sta)
+{
+	if (iwl_mvm_check_pn(mvm, skb, queue, sta))
+		kfree_skb(skb);
+	else
+		ieee80211_rx_napi(mvm->hw, skb, napi);
 }
 
 static void iwl_mvm_get_signal_strength(struct iwl_mvm *mvm,
@@ -141,7 +222,7 @@ static void iwl_mvm_get_signal_strength(struct iwl_mvm *mvm,
 	rx_status->chain_signal[2] = energy_c;
 }
 
-static u32 iwl_mvm_rx_crypto(struct iwl_mvm *mvm, struct ieee80211_hdr *hdr,
+static int iwl_mvm_rx_crypto(struct iwl_mvm *mvm, struct ieee80211_hdr *hdr,
 			     struct ieee80211_rx_status *stats,
 			     struct iwl_rx_mpdu_desc *desc, int queue,
 			     u8 *crypt_len)
@@ -158,6 +239,7 @@ static u32 iwl_mvm_rx_crypto(struct iwl_mvm *mvm, struct ieee80211_hdr *hdr,
 	switch (status & IWL_RX_MPDU_STATUS_SEC_MASK) {
 	case IWL_RX_MPDU_STATUS_SEC_CCM:
 	case IWL_RX_MPDU_STATUS_SEC_GCM:
+		BUILD_BUG_ON(IEEE80211_CCMP_PN_LEN != IEEE80211_GCMP_PN_LEN);
 		/* alg is CCM: check MIC only */
 		if (!(status & IWL_RX_MPDU_STATUS_MIC_OK))
 			return -1;
@@ -217,7 +299,6 @@ void iwl_mvm_rx_mpdu_mq(struct iwl_mvm *mvm, struct napi_struct *napi,
 	u32 rate_n_flags = le32_to_cpu(desc->rate_n_flags);
 	struct ieee80211_sta *sta = NULL;
 	struct sk_buff *skb;
-	u32 ampdu_status;
 	u8 crypt_len = 0;
 
 	/* Dont use dev_alloc_skb(), we'll have enough headroom once
@@ -311,8 +392,6 @@ void iwl_mvm_rx_mpdu_mq(struct iwl_mvm *mvm, struct napi_struct *napi,
 			iwl_mvm_rx_csum(sta, skb, desc);
 	}
 
-	rcu_read_unlock();
-
 	/*
 	 * TODO: PHY info.
 	 * Verify we don't have the information in the MPDU descriptor and
@@ -367,8 +446,9 @@ void iwl_mvm_rx_mpdu_mq(struct iwl_mvm *mvm, struct napi_struct *napi,
 	/* TODO: PHY info - update ampdu queue statistics (for debugfs) */
 	/* TODO: PHY info - gscan */
 
-	iwl_mvm_pass_packet_to_mac80211(mvm, napi, skb, hdr, len, ampdu_status,
-					crypt_len, rxb);
+	iwl_mvm_create_skb(skb, hdr, len, crypt_len, rxb);
+	iwl_mvm_pass_packet_to_mac80211(mvm, napi, skb, queue, sta);
+	rcu_read_unlock();
 }
 
 void iwl_mvm_rx_frame_release(struct iwl_mvm *mvm,
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/sta.h b/drivers/net/wireless/intel/iwlwifi/mvm/sta.h
index badf17c..39fdf52 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/sta.h
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/sta.h
@@ -7,6 +7,7 @@
  *
  * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
  * Copyright(c) 2013 - 2014 Intel Mobile Communications GmbH
+ * Copyright(c) 2015        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
@@ -33,6 +34,7 @@
  *
  * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
  * Copyright(c) 2013 - 2014 Intel Mobile Communications GmbH
+ * Copyright(c) 2015        Intel Deutschland GmbH
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -284,6 +286,13 @@ static inline u16 iwl_mvm_tid_queued(struct iwl_mvm_tid_data *tid_data)
 				tid_data->next_reclaimed);
 }
 
+struct iwl_mvm_key_pn {
+	struct rcu_head rcu_head;
+	struct {
+		u8 pn[IWL_MAX_TID_COUNT][IEEE80211_CCMP_PN_LEN];
+	} ____cacheline_aligned_in_smp q[];
+};
+
 /**
  * struct iwl_mvm_sta - representation of a station in the driver
  * @sta_id: the index of the station in the fw (will be replaced by id_n_color)
@@ -308,6 +317,7 @@ static inline u16 iwl_mvm_tid_queued(struct iwl_mvm_tid_data *tid_data)
  *	gets empty before all the frames were sent, which can happen when
  *	we are sending frames from an AMPDU queue and there was a hole in
  *	the BA window. To be used for UAPSD only.
+ * @ptk_pn: per-queue PTK PN data structures
  *
  * When mac80211 creates a station it reserves some space (hw->sta_data_size)
  * in the structure for use by driver. This structure is placed in that
@@ -328,6 +338,8 @@ struct iwl_mvm_sta {
 	struct iwl_lq_sta lq_sta;
 	struct ieee80211_vif *vif;
 
+	struct iwl_mvm_key_pn __rcu *ptk_pn[4];
+
 	/* Temporary, until the new TLC will control the Tx protection */
 	s8 tx_protection;
 	bool tt_tx_protection;
-- 
2.5.0


^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [PATCH 17/21] iwlwifi: mvm: initialize gtkdata->mvm correctly
  2016-01-07 12:46 pull request: iwlwifi-next 2016-01-07 Grumbach, Emmanuel
                   ` (15 preceding siblings ...)
  2016-01-07 12:47 ` [PATCH 16/21] iwlwifi: mvm: check PN for CCMP/GCMP in the driver Emmanuel Grumbach
@ 2016-01-07 12:47 ` Emmanuel Grumbach
  2016-01-07 12:47 ` [PATCH 18/21] iwlwifi: mvm: check minimum temperature notification length Emmanuel Grumbach
                   ` (4 subsequent siblings)
  21 siblings, 0 replies; 28+ messages in thread
From: Emmanuel Grumbach @ 2016-01-07 12:47 UTC (permalink / raw)
  To: linux-wireless; +Cc: Eliad Peller, Eliad Peller, Emmanuel Grumbach

From: Eliad Peller <eliad@wizery.com>

gtkdata->mvm wasn't set in iwl_mvm_d0i3_update_keys,
resulting in kernel panic in some flows (when mvm
is actually used...)

Fixes: a3f7ba5c8825 ("iwlwifi: update key params on d0i3 entrance/exit")
Signed-off-by: Eliad Peller <eliadx.peller@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
---
 drivers/net/wireless/intel/iwlwifi/mvm/d3.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/d3.c b/drivers/net/wireless/intel/iwlwifi/mvm/d3.c
index 2cd9052..d3e21d9 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/d3.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/d3.c
@@ -1843,6 +1843,7 @@ void iwl_mvm_d0i3_update_keys(struct iwl_mvm *mvm,
 			      struct iwl_wowlan_status *status)
 {
 	struct iwl_mvm_d3_gtk_iter_data gtkdata = {
+		.mvm = mvm,
 		.status = status,
 	};
 
-- 
2.5.0


^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [PATCH 18/21] iwlwifi: mvm: check minimum temperature notification length
  2016-01-07 12:46 pull request: iwlwifi-next 2016-01-07 Grumbach, Emmanuel
                   ` (16 preceding siblings ...)
  2016-01-07 12:47 ` [PATCH 17/21] iwlwifi: mvm: initialize gtkdata->mvm correctly Emmanuel Grumbach
@ 2016-01-07 12:47 ` Emmanuel Grumbach
  2016-01-07 12:47 ` [PATCH 19/21] iwlwifi: mvm: constify the parameters of a few functions in fw-dbg.c Emmanuel Grumbach
                   ` (3 subsequent siblings)
  21 siblings, 0 replies; 28+ messages in thread
From: Emmanuel Grumbach @ 2016-01-07 12:47 UTC (permalink / raw)
  To: linux-wireless; +Cc: Johannes Berg, Emmanuel Grumbach

From: Johannes Berg <johannes.berg@intel.com>

This notification will be extended with extra data, so just
check that it has a minimum length, not the exact length;
we might later add handling for the extra fields added and
have more code to handle both versions.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
---
 drivers/net/wireless/intel/iwlwifi/mvm/tt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/tt.c b/drivers/net/wireless/intel/iwlwifi/mvm/tt.c
index 473975c..fb76004 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/tt.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/tt.c
@@ -120,7 +120,7 @@ static int iwl_mvm_temp_notif_parse(struct iwl_mvm *mvm,
 	int len = iwl_rx_packet_payload_len(pkt);
 	int temp;
 
-	if (WARN_ON_ONCE(len != sizeof(*notif))) {
+	if (WARN_ON_ONCE(len < sizeof(*notif))) {
 		IWL_ERR(mvm, "Invalid DTS_MEASUREMENT_NOTIFICATION\n");
 		return -EINVAL;
 	}
-- 
2.5.0


^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [PATCH 19/21] iwlwifi: mvm: constify the parameters of a few functions in fw-dbg.c
  2016-01-07 12:46 pull request: iwlwifi-next 2016-01-07 Grumbach, Emmanuel
                   ` (17 preceding siblings ...)
  2016-01-07 12:47 ` [PATCH 18/21] iwlwifi: mvm: check minimum temperature notification length Emmanuel Grumbach
@ 2016-01-07 12:47 ` Emmanuel Grumbach
  2016-01-07 12:47 ` [PATCH 20/21] iwlwifi: mvm: fix memory leaks in error paths upon fw error dump Emmanuel Grumbach
                   ` (2 subsequent siblings)
  21 siblings, 0 replies; 28+ messages in thread
From: Emmanuel Grumbach @ 2016-01-07 12:47 UTC (permalink / raw)
  To: linux-wireless; +Cc: Emmanuel Grumbach

The debug functions of fw-dbg.c don't really need to modify
the trigger and the description they receive as a parameter.
Constify the pointers.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
---
 drivers/net/wireless/intel/iwlwifi/iwl-trans.h  | 4 ++--
 drivers/net/wireless/intel/iwlwifi/mvm/fw-dbg.c | 8 ++++----
 drivers/net/wireless/intel/iwlwifi/mvm/fw-dbg.h | 6 +++---
 drivers/net/wireless/intel/iwlwifi/mvm/mvm.h    | 6 +++---
 drivers/net/wireless/intel/iwlwifi/pcie/trans.c | 2 +-
 5 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-trans.h b/drivers/net/wireless/intel/iwlwifi/iwl-trans.h
index 81b7cb7..82fb3a9 100644
--- a/drivers/net/wireless/intel/iwlwifi/iwl-trans.h
+++ b/drivers/net/wireless/intel/iwlwifi/iwl-trans.h
@@ -663,7 +663,7 @@ struct iwl_trans_ops {
 	void (*resume)(struct iwl_trans *trans);
 
 	struct iwl_trans_dump_data *(*dump_data)(struct iwl_trans *trans,
-						 struct iwl_fw_dbg_trigger_tlv
+						 const struct iwl_fw_dbg_trigger_tlv
 						 *trigger);
 };
 
@@ -966,7 +966,7 @@ static inline void iwl_trans_resume(struct iwl_trans *trans)
 
 static inline struct iwl_trans_dump_data *
 iwl_trans_dump_data(struct iwl_trans *trans,
-		    struct iwl_fw_dbg_trigger_tlv *trigger)
+		    const struct iwl_fw_dbg_trigger_tlv *trigger)
 {
 	if (!trans->ops->dump_data)
 		return NULL;
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/fw-dbg.c b/drivers/net/wireless/intel/iwlwifi/mvm/fw-dbg.c
index 59450f1..b3bc212 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/fw-dbg.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/fw-dbg.c
@@ -681,15 +681,15 @@ dump_trans_data:
 	clear_bit(IWL_MVM_STATUS_DUMPING_FW_LOG, &mvm->status);
 }
 
-struct iwl_mvm_dump_desc iwl_mvm_dump_desc_assert = {
+const struct iwl_mvm_dump_desc iwl_mvm_dump_desc_assert = {
 	.trig_desc = {
 		.type = cpu_to_le32(FW_DBG_TRIGGER_FW_ASSERT),
 	},
 };
 
 int iwl_mvm_fw_dbg_collect_desc(struct iwl_mvm *mvm,
-				struct iwl_mvm_dump_desc *desc,
-				struct iwl_fw_dbg_trigger_tlv *trigger)
+				const struct iwl_mvm_dump_desc *desc,
+				const struct iwl_fw_dbg_trigger_tlv *trigger)
 {
 	unsigned int delay = 0;
 
@@ -715,7 +715,7 @@ int iwl_mvm_fw_dbg_collect_desc(struct iwl_mvm *mvm,
 
 int iwl_mvm_fw_dbg_collect(struct iwl_mvm *mvm, enum iwl_fw_dbg_trigger trig,
 			   const char *str, size_t len,
-			   struct iwl_fw_dbg_trigger_tlv *trigger)
+			   const struct iwl_fw_dbg_trigger_tlv *trigger)
 {
 	struct iwl_mvm_dump_desc *desc;
 
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/fw-dbg.h b/drivers/net/wireless/intel/iwlwifi/mvm/fw-dbg.h
index 08148b2..f7dff76 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/fw-dbg.h
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/fw-dbg.h
@@ -72,11 +72,11 @@
 void iwl_mvm_fw_error_dump(struct iwl_mvm *mvm);
 void iwl_mvm_free_fw_dump_desc(struct iwl_mvm *mvm);
 int iwl_mvm_fw_dbg_collect_desc(struct iwl_mvm *mvm,
-				struct iwl_mvm_dump_desc *desc,
-				struct iwl_fw_dbg_trigger_tlv *trigger);
+				const struct iwl_mvm_dump_desc *desc,
+				const struct iwl_fw_dbg_trigger_tlv *trigger);
 int iwl_mvm_fw_dbg_collect(struct iwl_mvm *mvm, enum iwl_fw_dbg_trigger trig,
 			   const char *str, size_t len,
-			   struct iwl_fw_dbg_trigger_tlv *trigger);
+			   const struct iwl_fw_dbg_trigger_tlv *trigger);
 int iwl_mvm_fw_dbg_collect_trig(struct iwl_mvm *mvm,
 				struct iwl_fw_dbg_trigger_tlv *trigger,
 				const char *fmt, ...) __printf(3, 4);
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h b/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
index 7517dc13..5f3ac8c 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
@@ -157,7 +157,7 @@ struct iwl_mvm_dump_desc {
 	struct iwl_fw_error_dump_trigger_desc trig_desc;
 };
 
-extern struct iwl_mvm_dump_desc iwl_mvm_dump_desc_assert;
+extern const struct iwl_mvm_dump_desc iwl_mvm_dump_desc_assert;
 
 struct iwl_mvm_phy_ctxt {
 	u16 id;
@@ -732,8 +732,8 @@ struct iwl_mvm {
 	s8 restart_fw;
 	u8 fw_dbg_conf;
 	struct delayed_work fw_dump_wk;
-	struct iwl_mvm_dump_desc *fw_dump_desc;
-	struct iwl_fw_dbg_trigger_tlv *fw_dump_trig;
+	const struct iwl_mvm_dump_desc *fw_dump_desc;
+	const struct iwl_fw_dbg_trigger_tlv *fw_dump_trig;
 
 #ifdef CONFIG_IWLWIFI_LEDS
 	struct led_classdev led;
diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/trans.c b/drivers/net/wireless/intel/iwlwifi/pcie/trans.c
index d44e7af..3a43109 100644
--- a/drivers/net/wireless/intel/iwlwifi/pcie/trans.c
+++ b/drivers/net/wireless/intel/iwlwifi/pcie/trans.c
@@ -2364,7 +2364,7 @@ iwl_trans_pcie_dump_monitor(struct iwl_trans *trans,
 
 static struct iwl_trans_dump_data
 *iwl_trans_pcie_dump_data(struct iwl_trans *trans,
-			  struct iwl_fw_dbg_trigger_tlv *trigger)
+			  const struct iwl_fw_dbg_trigger_tlv *trigger)
 {
 	struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
 	struct iwl_fw_error_dump_data *data;
-- 
2.5.0


^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [PATCH 20/21] iwlwifi: mvm: fix memory leaks in error paths upon fw error dump
  2016-01-07 12:46 pull request: iwlwifi-next 2016-01-07 Grumbach, Emmanuel
                   ` (18 preceding siblings ...)
  2016-01-07 12:47 ` [PATCH 19/21] iwlwifi: mvm: constify the parameters of a few functions in fw-dbg.c Emmanuel Grumbach
@ 2016-01-07 12:47 ` Emmanuel Grumbach
  2016-01-07 12:47 ` [PATCH 21/21] iwlwifi: pcie: properly configure the debug buffer size for 8000 Emmanuel Grumbach
  2016-01-07 17:05 ` pull request: iwlwifi-next 2016-01-07 Grumbach, Emmanuel
  21 siblings, 0 replies; 28+ messages in thread
From: Emmanuel Grumbach @ 2016-01-07 12:47 UTC (permalink / raw)
  To: linux-wireless; +Cc: Emmanuel Grumbach

When iwl_mvm_fw_error_dump fails, it needs to clear the
state in mvm, which includes:
	* clear IWL_MVM_STATUS_DUMPING_FW_LOG
	* set mvm->fw_dump_trig to NULL
	* free the description

While at it, remove a NULL check in
iwl_mvm_free_fw_dump_desc since kfree is NULL safe.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
---
 drivers/net/wireless/intel/iwlwifi/mvm/fw-dbg.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/fw-dbg.c b/drivers/net/wireless/intel/iwlwifi/mvm/fw-dbg.c
index b3bc212..0813f81 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/fw-dbg.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/fw-dbg.c
@@ -270,8 +270,7 @@ static void iwl_mvm_dump_fifos(struct iwl_mvm *mvm,
 
 void iwl_mvm_free_fw_dump_desc(struct iwl_mvm *mvm)
 {
-	if (mvm->fw_dump_desc == &iwl_mvm_dump_desc_assert ||
-	    !mvm->fw_dump_desc)
+	if (mvm->fw_dump_desc == &iwl_mvm_dump_desc_assert)
 		return;
 
 	kfree(mvm->fw_dump_desc);
@@ -441,7 +440,7 @@ void iwl_mvm_fw_error_dump(struct iwl_mvm *mvm)
 	/* there's no point in fw dump if the bus is dead */
 	if (test_bit(STATUS_TRANS_DEAD, &mvm->trans->status)) {
 		IWL_ERR(mvm, "Skip fw error dump since bus is dead\n");
-		return;
+		goto out;
 	}
 
 	if (mvm->fw_dump_trig &&
@@ -450,7 +449,7 @@ void iwl_mvm_fw_error_dump(struct iwl_mvm *mvm)
 
 	fw_error_dump = kzalloc(sizeof(*fw_error_dump), GFP_KERNEL);
 	if (!fw_error_dump)
-		return;
+		goto out;
 
 	/* SRAM - include stack CCM if driver knows the values for it */
 	if (!mvm->cfg->dccm_offset || !mvm->cfg->dccm_len) {
@@ -550,8 +549,7 @@ void iwl_mvm_fw_error_dump(struct iwl_mvm *mvm)
 	dump_file = vzalloc(file_len);
 	if (!dump_file) {
 		kfree(fw_error_dump);
-		iwl_mvm_free_fw_dump_desc(mvm);
-		return;
+		goto out;
 	}
 
 	fw_error_dump->op_mode_ptr = dump_file;
@@ -590,8 +588,6 @@ void iwl_mvm_fw_error_dump(struct iwl_mvm *mvm)
 		memcpy(dump_trig, &mvm->fw_dump_desc->trig_desc,
 		       sizeof(*dump_trig) + mvm->fw_dump_desc->len);
 
-		/* now we can free this copy */
-		iwl_mvm_free_fw_dump_desc(mvm);
 		dump_data = iwl_fw_error_next_data(dump_data);
 	}
 
@@ -677,6 +673,8 @@ dump_trans_data:
 	dev_coredumpm(mvm->trans->dev, THIS_MODULE, fw_error_dump, 0,
 		      GFP_KERNEL, iwl_mvm_read_coredump, iwl_mvm_free_coredump);
 
+out:
+	iwl_mvm_free_fw_dump_desc(mvm);
 	mvm->fw_dump_trig = NULL;
 	clear_bit(IWL_MVM_STATUS_DUMPING_FW_LOG, &mvm->status);
 }
-- 
2.5.0


^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [PATCH 21/21] iwlwifi: pcie: properly configure the debug buffer size for 8000
  2016-01-07 12:46 pull request: iwlwifi-next 2016-01-07 Grumbach, Emmanuel
                   ` (19 preceding siblings ...)
  2016-01-07 12:47 ` [PATCH 20/21] iwlwifi: mvm: fix memory leaks in error paths upon fw error dump Emmanuel Grumbach
@ 2016-01-07 12:47 ` Emmanuel Grumbach
  2016-01-07 17:05 ` pull request: iwlwifi-next 2016-01-07 Grumbach, Emmanuel
  21 siblings, 0 replies; 28+ messages in thread
From: Emmanuel Grumbach @ 2016-01-07 12:47 UTC (permalink / raw)
  To: linux-wireless; +Cc: Emmanuel Grumbach, stable

8000 device family has a new debug engine that needs to be
configured differently than 7000's.
The debug engine's DMA works in chunks of memory and the
size of the buffer really means the start of the last
chunk. Since one chunk is 256-byte long, we should
configure the device to write to buffer_size - 256.
This fixes a situation were the device would write to
memory it is not allowed to access.

CC: <stable@vger.kernel.org> [4.1+]
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
---
 drivers/net/wireless/intel/iwlwifi/pcie/trans.c | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/trans.c b/drivers/net/wireless/intel/iwlwifi/pcie/trans.c
index 3a43109..d60a467 100644
--- a/drivers/net/wireless/intel/iwlwifi/pcie/trans.c
+++ b/drivers/net/wireless/intel/iwlwifi/pcie/trans.c
@@ -7,6 +7,7 @@
  *
  * Copyright(c) 2007 - 2015 Intel Corporation. All rights reserved.
  * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
+ * Copyright(c) 2016 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
@@ -33,6 +34,7 @@
  *
  * Copyright(c) 2005 - 2015 Intel Corporation. All rights reserved.
  * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
+ * Copyright(c) 2016 Intel Deutschland GmbH
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -924,9 +926,16 @@ monitor:
 	if (dest->monitor_mode == EXTERNAL_MODE && trans_pcie->fw_mon_size) {
 		iwl_write_prph(trans, le32_to_cpu(dest->base_reg),
 			       trans_pcie->fw_mon_phys >> dest->base_shift);
-		iwl_write_prph(trans, le32_to_cpu(dest->end_reg),
-			       (trans_pcie->fw_mon_phys +
-				trans_pcie->fw_mon_size) >> dest->end_shift);
+		if (trans->cfg->device_family == IWL_DEVICE_FAMILY_8000)
+			iwl_write_prph(trans, le32_to_cpu(dest->end_reg),
+				       (trans_pcie->fw_mon_phys +
+					trans_pcie->fw_mon_size - 256) >>
+						dest->end_shift);
+		else
+			iwl_write_prph(trans, le32_to_cpu(dest->end_reg),
+				       (trans_pcie->fw_mon_phys +
+					trans_pcie->fw_mon_size) >>
+						dest->end_shift);
 	}
 }
 
-- 
2.5.0


^ permalink raw reply related	[flat|nested] 28+ messages in thread

* Re: pull request: iwlwifi-next 2016-01-07
  2016-01-07 12:46 pull request: iwlwifi-next 2016-01-07 Grumbach, Emmanuel
                   ` (20 preceding siblings ...)
  2016-01-07 12:47 ` [PATCH 21/21] iwlwifi: pcie: properly configure the debug buffer size for 8000 Emmanuel Grumbach
@ 2016-01-07 17:05 ` Grumbach, Emmanuel
  2016-01-07 21:08   ` Kalle Valo
  21 siblings, 1 reply; 28+ messages in thread
From: Grumbach, Emmanuel @ 2016-01-07 17:05 UTC (permalink / raw)
  To: Kalle Valo; +Cc: linux-wireless

Me again,

On 01/07/2016 02:46 PM, Grumbach, Emmanuel wrote:
> Hi Kalle,
>
> Here is the last round of patches for 4.5. Most of them are small and / or fixes.
> Let me know if you have issues.
> FYI - I scripted a few checks so that I hope that the internal tags that leaked
> in the previous pull request won't leak any more.
>
> The following changes since commit e5d15cb530082cc13a6c9457eddd6f75b0f4de65:

I had to edit one commit. I re-pushed to the same tag and added another
_2 tag if you prefer to be sure.

>   iwlwifi: bail out in case of bad trans state (2015-12-21 19:35:41 +0200)
>
> are available in the git repository at:
>
>   https://git.kernel.org/pub/scm/linux/kernel/git/iwlwifi/iwlwifi-next.git tags/iwlwifi-next-for-kalle-2016-01-07
>
> for you to fetch changes up to ccecff64ac4ee0d2f610e6606d2dfb17a38436f6:
>
>   iwlwifi: pcie: properly configure the debug buffer size for 8000 (2016-01-07 14:39:58 +0200)
>
> ----------------------------------------------------------------
> * bug fixes and improvements for firmware debug system (Golan and myself)
> * fixes for D0i3 (Eliad)
> * prevent muliple stations with the same MAC address
> * advertise support for Rx A-MSDU in A-MPDU
> * scan related fixes
> * support -20.ucode
> * fix WoWLAN for iwldvm
> * preparations towards multiple Rx queues
> * platform power improvements for GO mode when no clients are associated
>
> ----------------------------------------------------------------
> Ayala Beker (1):
>       iwlwifi: mvm: don't ask beacons when P2P GO vif and no assoc sta
>
> David Spinadel (1):
>       iwlwifi: mvm: fix extended dwell time
>
> Eliad Peller (1):
>       iwlwifi: mvm: initialize gtkdata->mvm correctly
>
> Emmanuel Grumbach (10):
>       iwlwifi: dvm: fix WoWLAN
>       iwlwifi: mvm: let the firmware choose the antenna for beacons
>       iwlwifi: mvm: reset mvm->scan_type when firmware is started
>       iwlwifi: set max firmware version of 7265 to 17
>       iwlwifi: mvm: bump max API to 20
>       iwlwifi: mvm: dump the radio registers when the firmware crashes
>       iwlwifi: mvm: remove useless WARN_ON and rely on cfg80211's combination
>       iwlwifi: mvm: constify the parameters of a few functions in fw-dbg.c
>       iwlwifi: mvm: fix memory leaks in error paths upon fw error dump
>       iwlwifi: pcie: properly configure the debug buffer size for 8000
>
> Golan Ben-Ami (1):
>       iwlwifi: mvm: add a non-trigger window to fw dbg triggers
>
> Johannes Berg (4):
>       iwlwifi: mvm: support A-MSDU in A-MPDU
>       iwlwifi: mvm: prevent multiple stations with the same address
>       iwlwifi: mvm: check PN for CCMP/GCMP in the driver
>       iwlwifi: mvm: check minimum temperature notification length
>
> Matti Gottlieb (1):
>       iwlwifi: mvm: change mcc update API
>
> Oren Givon (2):
>       iwlwifi: update and fix 7265 series PCI IDs
>       iwlwifi: nvm: fix loading default NVM file
>
>  drivers/net/wireless/intel/iwlwifi/dvm/lib.c           |   4 ++++
>  drivers/net/wireless/intel/iwlwifi/iwl-7000.c          |   4 ++--
>  drivers/net/wireless/intel/iwlwifi/iwl-8000.c          |   2 +-
>  drivers/net/wireless/intel/iwlwifi/iwl-9000.c          |   2 +-
>  drivers/net/wireless/intel/iwlwifi/iwl-fw-error-dump.h |   2 ++
>  drivers/net/wireless/intel/iwlwifi/iwl-fw-file.h       |  12 +++++++++++-
>  drivers/net/wireless/intel/iwlwifi/iwl-prph.h          |   6 ++++++
>  drivers/net/wireless/intel/iwlwifi/iwl-trans.h         |   4 ++--
>  drivers/net/wireless/intel/iwlwifi/mvm/d3.c            | 115 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--------------------
>  drivers/net/wireless/intel/iwlwifi/mvm/fw-api.h        |  60 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++---
>  drivers/net/wireless/intel/iwlwifi/mvm/fw-dbg.c        |  62 ++++++++++++++++++++++++++++++++++++++++++++++++--------------
>  drivers/net/wireless/intel/iwlwifi/mvm/fw-dbg.h        |  30 +++++++++++++++++++++++++++---
>  drivers/net/wireless/intel/iwlwifi/mvm/fw.c            |   1 +
>  drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c      |  53 +++++++++++++++++++++++++----------------------------
>  drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c      |  49 ++++++++++++++++++++++++++++++++++++++++++++++++-
>  drivers/net/wireless/intel/iwlwifi/mvm/mvm.h           |   9 ++++++---
>  drivers/net/wireless/intel/iwlwifi/mvm/nvm.c           |  55 +++++++++++++++++++++++++++++++++++++++++--------------
>  drivers/net/wireless/intel/iwlwifi/mvm/power.c         |   2 --
>  drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c          | 106 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-------------
>  drivers/net/wireless/intel/iwlwifi/mvm/scan.c          |  13 +++++++------
>  drivers/net/wireless/intel/iwlwifi/mvm/sta.h           |  12 ++++++++++++
>  drivers/net/wireless/intel/iwlwifi/mvm/tt.c            |   2 +-
>  drivers/net/wireless/intel/iwlwifi/pcie/drv.c          |   5 +++--
>  drivers/net/wireless/intel/iwlwifi/pcie/trans.c        |  17 +++++++++++++----
>  24 files changed, 506 insertions(+), 121 deletions(-)
>
>


^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: pull request: iwlwifi-next 2016-01-07
  2016-01-07 17:05 ` pull request: iwlwifi-next 2016-01-07 Grumbach, Emmanuel
@ 2016-01-07 21:08   ` Kalle Valo
  2016-01-08  8:12     ` Grumbach, Emmanuel
  0 siblings, 1 reply; 28+ messages in thread
From: Kalle Valo @ 2016-01-07 21:08 UTC (permalink / raw)
  To: Grumbach, Emmanuel; +Cc: linux-wireless

"Grumbach, Emmanuel" <emmanuel.grumbach@intel.com> writes:

> Me again,
>
> On 01/07/2016 02:46 PM, Grumbach, Emmanuel wrote:
>> Hi Kalle,
>>
>> Here is the last round of patches for 4.5. Most of them are small and / or fixes.
>> Let me know if you have issues.
>> FYI - I scripted a few checks so that I hope that the internal tags that leaked
>> in the previous pull request won't leak any more.
>>
>> The following changes since commit e5d15cb530082cc13a6c9457eddd6f75b0f4de65:
>
> I had to edit one commit. I re-pushed to the same tag and added another
> _2 tag if you prefer to be sure.

Heh, you sent this just in the last minute (if Linus releases 4.4 this
weekend as planned). I pulled iwlwifi-next-for-kalle-2016-01-07_2 now,
thanks.

BTW, I would prefer that you don't change the tag after you have sent a
pull request for it, instead just create a new tag and leave the old one
intact. This way it's easy for me to check what has changed etc.

-- 
Kalle Valo

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH 01/21] iwlwifi: dvm: fix WoWLAN
  2016-01-07 12:47 ` [PATCH 01/21] iwlwifi: dvm: fix WoWLAN Emmanuel Grumbach
@ 2016-01-07 21:15   ` Kalle Valo
  2016-01-08  8:08     ` Grumbach, Emmanuel
  0 siblings, 1 reply; 28+ messages in thread
From: Kalle Valo @ 2016-01-07 21:15 UTC (permalink / raw)
  To: Emmanuel Grumbach; +Cc: linux-wireless, stable

Emmanuel Grumbach <emmanuel.grumbach@intel.com> writes:

> My commit below introduced a mutex in the transport to
> prevent concurrent operations. To do so, it added a flag
> (is_down) to make sure the transport is in the right state.
> This uncoverred an bug that didn't cause any harm until
> now: iwldvm calls stop_device and then starts the firmware
> without calling start_hw in between. While this flow is
> fine from the device configuration point of view (register,
> etc...), it is now forbidden by the new is_down flag.
> This led to this error to appear:
> iwlwifi 0000:05:00.0: Can't start_fw since the HW hasn't been started
> and the suspend would fail.
>
> This fixes:
> https://bugzilla.kernel.org/show_bug.cgi?id=109591
>
> CC: <stable@vger.kernel.org> [4.3+]
> Reported-by: Bogdan Bogush <bogdan.s.bogush@gmail.com>
> Fixes=fa9f3281cbb1 ("iwlwifi: pcie: lock start_hw / start_fw / stop_device")

No need to change this anymore, but this should be:

Fixes: fa9f3281cbb1 ("iwlwifi: pcie: lock start_hw / start_fw / stop_device")

-- 
Kalle Valo

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH 01/21] iwlwifi: dvm: fix WoWLAN
  2016-01-07 21:15   ` Kalle Valo
@ 2016-01-08  8:08     ` Grumbach, Emmanuel
  0 siblings, 0 replies; 28+ messages in thread
From: Grumbach, Emmanuel @ 2016-01-08  8:08 UTC (permalink / raw)
  To: Kalle Valo; +Cc: linux-wireless, stable



On 01/07/2016 11:15 PM, Kalle Valo wrote:
> Emmanuel Grumbach <emmanuel.grumbach@intel.com> writes:
>
>> My commit below introduced a mutex in the transport to
>> prevent concurrent operations. To do so, it added a flag
>> (is_down) to make sure the transport is in the right state.
>> This uncoverred an bug that didn't cause any harm until
>> now: iwldvm calls stop_device and then starts the firmware
>> without calling start_hw in between. While this flow is
>> fine from the device configuration point of view (register,
>> etc...), it is now forbidden by the new is_down flag.
>> This led to this error to appear:
>> iwlwifi 0000:05:00.0: Can't start_fw since the HW hasn't been started
>> and the suspend would fail.
>>
>> This fixes:
>> https://bugzilla.kernel.org/show_bug.cgi?id=109591
>>
>> CC: <stable@vger.kernel.org> [4.3+]
>> Reported-by: Bogdan Bogush <bogdan.s.bogush@gmail.com>
>> Fixes=fa9f3281cbb1 ("iwlwifi: pcie: lock start_hw / start_fw / stop_device")
> No need to change this anymore, but this should be:
>
> Fixes: fa9f3281cbb1 ("iwlwifi: pcie: lock start_hw / start_fw / stop_device")
>
Added to my "do_no_screw_up_before_upstreaming.sh" script.

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: pull request: iwlwifi-next 2016-01-07
  2016-01-07 21:08   ` Kalle Valo
@ 2016-01-08  8:12     ` Grumbach, Emmanuel
  2016-01-08  8:42       ` Kalle Valo
  0 siblings, 1 reply; 28+ messages in thread
From: Grumbach, Emmanuel @ 2016-01-08  8:12 UTC (permalink / raw)
  To: Kalle Valo; +Cc: linux-wireless



On 01/07/2016 11:08 PM, Kalle Valo wrote:
> "Grumbach, Emmanuel" <emmanuel.grumbach@intel.com> writes:
>
>> Me again,
>>
>> On 01/07/2016 02:46 PM, Grumbach, Emmanuel wrote:
>>> Hi Kalle,
>>>
>>> Here is the last round of patches for 4.5. Most of them are small and / or fixes.
>>> Let me know if you have issues.
>>> FYI - I scripted a few checks so that I hope that the internal tags that leaked
>>> in the previous pull request won't leak any more.
>>>
>>> The following changes since commit e5d15cb530082cc13a6c9457eddd6f75b0f4de65:
>> I had to edit one commit. I re-pushed to the same tag and added another
>> _2 tag if you prefer to be sure.
> Heh, you sent this just in the last minute (if Linus releases 4.4 this
> weekend as planned). I pulled iwlwifi-next-for-kalle-2016-01-07_2 now,
> thanks.

Right, OTOH, most of the patches here are really fixes.

> BTW, I would prefer that you don't change the tag after you have sent a
> pull request for it, instead just create a new tag and leave the old one
> intact. This way it's easy for me to check what has changed etc.
>


FWIW:

$ git diff ccecff6..iwlwifi-next-for-kalle-2016-01-07_2
diff --git a/drivers/net/wireless/intel/iwlwifi/dvm/lib.c
b/drivers/net/wireless/intel/iwlwifi/dvm/lib.c
index fd409ad..4841be2 100644
--- a/drivers/net/wireless/intel/iwlwifi/dvm/lib.c
+++ b/drivers/net/wireless/intel/iwlwifi/dvm/lib.c
@@ -1250,7 +1250,6 @@ int iwlagn_suspend(struct iwl_priv *priv, struct
cfg80211_wowlan *wowlan)
 
        ret = iwlagn_send_patterns(priv, wowlan);
  out:
-       iwl_trans_stop_device(priv->trans);
        kfree(key_data.rsc_tsc);
        return ret;
 }


^ permalink raw reply related	[flat|nested] 28+ messages in thread

* Re: pull request: iwlwifi-next 2016-01-07
  2016-01-08  8:12     ` Grumbach, Emmanuel
@ 2016-01-08  8:42       ` Kalle Valo
  0 siblings, 0 replies; 28+ messages in thread
From: Kalle Valo @ 2016-01-08  8:42 UTC (permalink / raw)
  To: Grumbach, Emmanuel; +Cc: linux-wireless

"Grumbach, Emmanuel" <emmanuel.grumbach@intel.com> writes:

> On 01/07/2016 11:08 PM, Kalle Valo wrote:
>> "Grumbach, Emmanuel" <emmanuel.grumbach@intel.com> writes:
>>
>>> Me again,
>>>
>>> On 01/07/2016 02:46 PM, Grumbach, Emmanuel wrote:
>>>> Hi Kalle,
>>>>
>>>> Here is the last round of patches for 4.5. Most of them are small and / or fixes.
>>>> Let me know if you have issues.
>>>> FYI - I scripted a few checks so that I hope that the internal tags that leaked
>>>> in the previous pull request won't leak any more.
>>>>
>>>> The following changes since commit e5d15cb530082cc13a6c9457eddd6f75b0f4de65:
>>> I had to edit one commit. I re-pushed to the same tag and added another
>>> _2 tag if you prefer to be sure.
>> Heh, you sent this just in the last minute (if Linus releases 4.4 this
>> weekend as planned). I pulled iwlwifi-next-for-kalle-2016-01-07_2 now,
>> thanks.
>
> Right, OTOH, most of the patches here are really fixes.

Sure. I meant about sending these patches via wireless-drivers-next
which I'm just about to close. I'll "open" both wireless-drivers trees
again once -rc1 is released.

-- 
Kalle Valo

^ permalink raw reply	[flat|nested] 28+ messages in thread

end of thread, other threads:[~2016-01-08  8:42 UTC | newest]

Thread overview: 28+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-07 12:46 pull request: iwlwifi-next 2016-01-07 Grumbach, Emmanuel
2016-01-07 12:47 ` [PATCH 01/21] iwlwifi: dvm: fix WoWLAN Emmanuel Grumbach
2016-01-07 21:15   ` Kalle Valo
2016-01-08  8:08     ` Grumbach, Emmanuel
2016-01-07 12:47 ` [PATCH 02/21] iwlwifi: update and fix 7265 series PCI IDs Emmanuel Grumbach
2016-01-07 12:47 ` [PATCH 03/21] iwlwifi: mvm: let the firmware choose the antenna for beacons Emmanuel Grumbach
2016-01-07 12:47 ` [PATCH 04/21] iwlwifi: mvm: change mcc update API Emmanuel Grumbach
2016-01-07 12:47 ` [PATCH 05/21] iwlwifi: mvm: reset mvm->scan_type when firmware is started Emmanuel Grumbach
2016-01-07 12:47 ` [PATCH 06/21] iwlwifi: set max firmware version of 7265 to 17 Emmanuel Grumbach
2016-01-07 12:47 ` [PATCH 07/21] iwlwifi: mvm: bump max API to 20 Emmanuel Grumbach
2016-01-07 12:47 ` [PATCH 08/21] iwlwifi: nvm: fix loading default NVM file Emmanuel Grumbach
2016-01-07 12:47 ` [PATCH 09/21] iwlwifi: mvm: fix extended dwell time Emmanuel Grumbach
2016-01-07 12:47 ` [PATCH 10/21] iwlwifi: mvm: dump the radio registers when the firmware crashes Emmanuel Grumbach
2016-01-07 12:47 ` [PATCH 11/21] iwlwifi: mvm: add a non-trigger window to fw dbg triggers Emmanuel Grumbach
2016-01-07 12:47 ` [PATCH 12/21] iwlwifi: mvm: support A-MSDU in A-MPDU Emmanuel Grumbach
2016-01-07 12:47 ` [PATCH 13/21] iwlwifi: mvm: remove useless WARN_ON and rely on cfg80211's combination Emmanuel Grumbach
2016-01-07 12:47 ` [PATCH 14/21] iwlwifi: mvm: prevent multiple stations with the same address Emmanuel Grumbach
2016-01-07 12:47 ` [PATCH 15/21] iwlwifi: mvm: don't ask beacons when P2P GO vif and no assoc sta Emmanuel Grumbach
2016-01-07 12:47 ` [PATCH 16/21] iwlwifi: mvm: check PN for CCMP/GCMP in the driver Emmanuel Grumbach
2016-01-07 12:47 ` [PATCH 17/21] iwlwifi: mvm: initialize gtkdata->mvm correctly Emmanuel Grumbach
2016-01-07 12:47 ` [PATCH 18/21] iwlwifi: mvm: check minimum temperature notification length Emmanuel Grumbach
2016-01-07 12:47 ` [PATCH 19/21] iwlwifi: mvm: constify the parameters of a few functions in fw-dbg.c Emmanuel Grumbach
2016-01-07 12:47 ` [PATCH 20/21] iwlwifi: mvm: fix memory leaks in error paths upon fw error dump Emmanuel Grumbach
2016-01-07 12:47 ` [PATCH 21/21] iwlwifi: pcie: properly configure the debug buffer size for 8000 Emmanuel Grumbach
2016-01-07 17:05 ` pull request: iwlwifi-next 2016-01-07 Grumbach, Emmanuel
2016-01-07 21:08   ` Kalle Valo
2016-01-08  8:12     ` Grumbach, Emmanuel
2016-01-08  8:42       ` Kalle Valo

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.