Skip to contentSkip to conversation

pull request: iwlwifi-next 2014-10-29

PATCH New Emmanuel Grumbach 2 participants 27 messages Oct 29, 2014 – Oct 30, 2014 Networking drivers (wireless)

lore
Share & tools
lore
#0 lore raw

Hi John,

Here is a pull request for 3.19. More details below.

Thanks!

The following changes since commit 35a9ad8af0bb0fa3525e6d0d20e32551d226f38e:

Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next
(2014-10-08 21:40:54 -0400)

are available in the git repository at:

git://git.kernel.org/pub/scm/linux/kernel/git/iwlwifi/iwlwifi-next.git
tags/iwlwifi-next-for-john-2014-10-29

for you to fetch changes up to d9e4d61c5b900f6938b4aa49f25a0db37aeb23b6:

iwlwifi: mvm: unref SCAN ref on scan completion (2014-10-29 13:14:41 +0200)

----------------------------------------------------------------
The big new thing here is netdetect which allows the firmware to wake up the platform when a specific network is detected. Along with that I have fixes for d3 operation. The usual amount of rate scaling stuff - we now support STBC. The other commit that stands out is Johannes's work on devcoredump. He basically starts to use the standard infrastructure he built.

----------------------------------------------------------------
Arik Nemtsov (1):
iwlwifi: mvm: remove mvm argument from get_queues_mask

David Spinadel (1):
iwlwifi: mvm: fix scan condition iterator

Eliad Peller (1):
iwlwifi: mvm: unref SCAN ref on scan completion

Emmanuel Grumbach (12):
iwlwifi: configure the LTR
iwlwifi: mvm: BT Coex - update the MPLUT Boost register value
iwlwifi: mvm: BT coex - fix BT prio for probe requests
iwlwifi: dvm: drop non VO frames when flushing
Revert "iwlwifi: mvm: treat EAPOLs like mgmt frames wrt rate"
iwlwifi: pcie: fix polling in various places
Merge remote-tracking branch 'iwlwifi-fixes/master' into iwlwifi-next
iwlwifi: mvm: remove unneeded NULL pointer check
iwlwifi: pcie: warn if extern fw_debug buffer failed
iwlwifi: pcie: fix recovery from ARC reset in WoWLAN
iwlwifi: mvm: BT Coex - move BT_ANTENNA_COUPLING_THRESHOLD to constants
iwlwifi: mvm: BT Coex - make the multiprio lut a constant

Eran Harary (1):
iwlwifi: always run the secured flow for family 8000

Eyal Shapira (3):
iwlwifi: rs: option to easily disable Tx MIMO
iwlwifi: enable STBC support for 8000 chips
iwlwifi: mvm: rs: add Tx STBC support

Gregory Greenman (1):
iwlwifi: allow to restrict Tx aggregation size per-device

Haim Dreyfuss (1):
iwlwifi: mvm: Add tx power condition to bss_info_changed_ap_ibss

Joe Perches (1):
iwlwifi: dvm: Fix probable mask then right shift defect

Johannes Berg (3):
iwlwifi: mvm: improve MCS rate warning
iwlwifi: mvm: flush queues without mutex held
iwlwifi: mvm: port to devcoredump framework

Liad Kaufman (1):
iwlwifi: 8000: fix string given to MODULE_FIRMWARE

Luciano Coelho (7):
iwlwifi: mvm: hold the rtnl when resuming from a d3 test
iwlwifi: mvm: split wowlan handling out of the main suspend function
iwlwifi: mvm: move the check if associated outside of the
iterator for wowlan
iwlwifi: mvm: spin off a function to start scan offload
iwlwifi: mvm: add debugfs entry to configure netdetect SSIDs
iwlwifi: mvm: change the iwl_mvm_d3_iface_iterator into a generic function
iwlwifi: mvm: remove unnecessary includes in tt.c

Matti Gottlieb (1):
iwlwifi: mvm: ROC - bug fixes around time events and locking

Max Stepanov (1):
iwlwifi: mvm: add MVM_FW_BCAST_FILTER_PASS_ALL option

 drivers/net/wireless/iwlwifi/Kconfig            |   1 +
 drivers/net/wireless/iwlwifi/dvm/lib.c          |   4 +-
 drivers/net/wireless/iwlwifi/dvm/mac80211.c     |  24 ++++----
 drivers/net/wireless/iwlwifi/iwl-8000.c         |   4 +-
 drivers/net/wireless/iwlwifi/iwl-config.h       |  12 ++++
 drivers/net/wireless/iwlwifi/iwl-drv.c          |   3 -
 drivers/net/wireless/iwlwifi/iwl-fw.h           |   1 -
 drivers/net/wireless/iwlwifi/iwl-trans.h        |   6 +-
 drivers/net/wireless/iwlwifi/mvm/coex.c         |  13 +----
 drivers/net/wireless/iwlwifi/mvm/coex_legacy.c  |  14 ++---
 drivers/net/wireless/iwlwifi/mvm/constants.h    |   5 ++
 drivers/net/wireless/iwlwifi/mvm/d3.c           | 318
++++++++++++++++++++++++++++++++++++++++++++++++++++-------------------------------------------------
 drivers/net/wireless/iwlwifi/mvm/debugfs.c      | 201
+++++++++++++++++++++++++++++++++++++++-------------------------
 drivers/net/wireless/iwlwifi/mvm/fw-api-power.h |  35 +++++++++++-
 drivers/net/wireless/iwlwifi/mvm/fw-api.h       |   1 +
 drivers/net/wireless/iwlwifi/mvm/fw.c           |   9 +++
 drivers/net/wireless/iwlwifi/mvm/mac-ctxt.c     |   5 +-
 drivers/net/wireless/iwlwifi/mvm/mac80211.c     | 132
++++++++++++++++++++++++++++--------------
 drivers/net/wireless/iwlwifi/mvm/mvm.h          |  14 ++++-
 drivers/net/wireless/iwlwifi/mvm/ops.c          |  16 ++++--
 drivers/net/wireless/iwlwifi/mvm/rs.c           |  80
++++++++++++++++++++++----
 drivers/net/wireless/iwlwifi/mvm/rs.h           |   2 +
 drivers/net/wireless/iwlwifi/mvm/scan.c         |  38 +++++++++++-
 drivers/net/wireless/iwlwifi/mvm/sta.c          |   2 +-
 drivers/net/wireless/iwlwifi/mvm/time-event.c   |   2 +-
 drivers/net/wireless/iwlwifi/mvm/tt.c           |   4 --
 drivers/net/wireless/iwlwifi/mvm/tx.c           |  14 ++---
 drivers/net/wireless/iwlwifi/mvm/utils.c        |  37 ++++++++++++
 drivers/net/wireless/iwlwifi/pcie/trans.c       |  53 ++++++++---------
 29 files changed, 664 insertions(+), 386 deletions(-)
#1 lore raw

PATCH 1/25 iwlwifi: rs: option to easily disable Tx MIMO

From: Eyal Shapira <[email protected]>

The current TLC isn't optimized for low latency and some devices have issues with MIMO. This kind of combo creates latency issues. Allow to temporarily disable MIMO for tests in order to solve the latency issues without the added complexity of MIMO.

---
 drivers/net/wireless/iwlwifi/mvm/constants.h | 1 +
 drivers/net/wireless/iwlwifi/mvm/rs.c        | 3 +++
 2 files changed, 4 insertions(+)
drivers/net/wireless/iwlwifi/mvm/constants.h +1 -0
index d4dfbe4..dfec5b5 100644
@@ -95,5 +95,6 @@
 #define IWL_MVM_FW_MCAST_FILTER_PASS_ALL	0
 #define IWL_MVM_QUOTA_THRESHOLD			8
 #define IWL_MVM_RS_RSSI_BASED_INIT_RATE         0
+#define IWL_MVM_RS_DISABLE_MIMO			0
 
 #endif /* __MVM_CONSTANTS_H */
drivers/net/wireless/iwlwifi/mvm/rs.c +3 -0
index 18a5399..0d836fe 100644
@@ -2684,6 +2684,9 @@ void iwl_mvm_rs_rate_init(struct iwl_mvm *mvm, struct ieee80211_sta *sta,
 			lq_sta->ldpc = true;
 	}
 
+	if (IWL_MVM_RS_DISABLE_MIMO)
+		lq_sta->active_mimo2_rate = 0;
+
 	lq_sta->max_legacy_rate_idx = find_last_bit(&lq_sta->active_legacy_rate,
 						    BITS_PER_LONG);
 	lq_sta->max_siso_rate_idx = find_last_bit(&lq_sta->active_siso_rate,
Signature · 1 line
1.9.1
#2 lore raw

PATCH 2/25 iwlwifi: mvm: remove unneeded NULL pointer check

In reply to Emmanuel Grumbach

From: Emmanuel Grumbach <[email protected]>

mac80211 will never call rate_control_tx_status with a NULL pointer for sta. Remove the superfluous check. This check misled smatch.

---
 drivers/net/wireless/iwlwifi/mvm/rs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/iwlwifi/mvm/rs.c +1 -1
index 0d836fe..66e971a 100644
@@ -1225,7 +1225,7 @@ void iwl_mvm_rs_tx_status(struct iwl_mvm *mvm, struct ieee80211_sta *sta,
 	IWL_DEBUG_RATE(mvm, "reduced txpower: %d\n", reduced_txp);
 done:
 	/* See if there's a better rate or modulation mode to try. */
-	if (sta && sta->supp_rates[info->band])
+	if (sta->supp_rates[info->band])
 		rs_rate_scale_perform(mvm, sta, lq_sta, tid);
 }
 
Signature · 1 line
1.9.1
#3 lore raw

PATCH 3/25 iwlwifi: mvm: hold the rtnl when resuming from a d3 test

In reply to Emmanuel Grumbach

From: Luciano Coelho <[email protected]>

We use ieee80211_iter_keys() which requires the rtnl to be held. If we don't lock the rtnl, like we do when we suspend during a d3 test, we get the following splat:

RTNL: assertion failed at net/mac80211/key.c (566)

 CPU: 1 PID: 26529 Comm: cat Tainted: G        W  O 3.10.29-dev #1
 Hardware name: Dell Inc. Latitude E6430/0CPWYR, BIOS A09 12/13/2012
  e7b15008 e7b15008 e68adc1c c168aa62 e68adc54 f91f20b6 f923700c f9236fd8
  00000236 00000000 ece23874 00000000 f94941e0 00000000 e43b8e48 e7b15008
  00000000 e8b69e78 e68adcc0 f9493ab9 e68adc68 00000000 e43b8e48 e7b15008
 Call Trace:
  [<c168aa62>] dump_stack+0x16/0x18
  [<f91f20b6>] ieee80211_iter_keys+0x166/0x170 [mac80211]
  [<f94941e0>] ? iwl_mvm_query_wakeup_reasons+0x5f0/0x5f0 [iwlmvm]
  [<f9493ab9>] iwl_mvm_setup_connection_keep.isra.5+0x99/0x1d0 [iwlmvm]
  [<f9165e28>] ? cfg80211_report_wowlan_wakeup+0x308/0x510 [cfg80211]
  [<f9493fe5>] iwl_mvm_query_wakeup_reasons+0x3f5/0x5f0 [iwlmvm]
  [<c116125a>] ? init_object+0x3a/0x70
  [<f8a5b8ee>] ? iwl_trans_pcie_d3_resume+0x1be/0x3a0 [iwlwifi]
  [<f94956da>] __iwl_mvm_resume+0x14a/0x180 [iwlmvm]
  [<f9495736>] iwl_mvm_d3_test_release+0x26/0xc0 [iwlmvm]
  [<c117a64d>] __fput+0xad/0x210
  [<c117a7bd>] ____fput+0xd/0x10
  [<c10601a1>] task_work_run+0x81/0xb0
  [<c1040fa5>] do_exit+0x255/0xac0
  [<c104e511>] ? dequeue_signal+0x31/0x1a0
  [<c1041888>] do_group_exit+0x38/0xa0
  [<c10a6cfb>] ? trace_hardirqs_on+0xb/0x10
  [<c1051c31>] get_signal_to_deliver+0x1e1/0x8e0
  [<c104bd52>] ? try_to_del_timer_sync+0x42/0x60
  [<c104bd70>] ? try_to_del_timer_sync+0x60/0x60
  [<c168dc82>] ? schedule_timeout+0x102/0x2a0
  [<c10011ba>] do_signal+0x3a/0x8e0
  [<c104b190>] ? __internal_add_timer+0xb0/0xb0
  [<c168de7a>] ? schedule_timeout_interruptible+0x1a/0x20
  [<c104ce39>] ? msleep_interruptible+0x39/0x40
  [<f94939a9>] ? iwl_mvm_d3_test_read+0x49/0x70 [iwlmvm]
  [<c11797fc>] ? vfs_read+0x8c/0x160
  [<c11243af>] ? SyS_fadvise64_64+0x15f/0x2b0
  [<f9493960>] ? iwl_mvm_wowlan_program_keys+0x4a0/0x4a0 [iwlmvm]
  [<c1179a57>] ? SyS_read+0x57/0xa0
  [<c1001acf>] do_notify_resume+0x6f/0xa0
  [<c1692500>] work_notifysig+0x29/0x31

Fix this by hold the rtnl lock when calling __iwl_mvm_resume() in the d3 test wake up path.

---
 drivers/net/wireless/iwlwifi/mvm/d3.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/net/wireless/iwlwifi/mvm/d3.c +2 -0
index c17be0f..5b26922 100644
@@ -1741,7 +1741,9 @@ static int iwl_mvm_d3_test_release(struct inode *inode, struct file *file)
 	int remaining_time = 10;
 
 	mvm->d3_test_active = false;
+	rtnl_lock();
 	__iwl_mvm_resume(mvm, true);
+	rtnl_unlock();
 	iwl_abort_notification_waits(&mvm->notif_wait);
 	ieee80211_restart_hw(mvm->hw);
 
Signature · 1 line
1.9.1
#4 lore raw

PATCH 4/25 iwlwifi: mvm: split wowlan handling out of the main suspend function

In reply to Emmanuel Grumbach

From: Luciano Coelho <[email protected]>

Take the WoWLAN handling code out of the main suspend function, dividing it into three parts: get_config (which is used before the firmware is switched), switch_to_d3 (which handles the rebooting of the hardware with the D3 firmware) and config (which configures the D3 firmware for WoWLAN operation). This is necessary to prepare for the net-detect implementation, which will use only the switch_to_d3 part of this flow.

---
 drivers/net/wireless/iwlwifi/mvm/d3.c | 266 +++++++++++++++++++---------------
 1 file changed, 151 insertions(+), 115 deletions(-)
drivers/net/wireless/iwlwifi/mvm/d3.c +151 -115
index 5b26922..b8e8a97 100644
@@ -783,6 +783,35 @@ void iwl_mvm_set_last_nonqos_seq(struct iwl_mvm *mvm, struct ieee80211_vif *vif)
 		IWL_ERR(mvm, "failed to set non-QoS seqno\n");
 }
 
+static int iwl_mvm_switch_to_d3(struct iwl_mvm *mvm)
+{
+	iwl_mvm_cancel_scan(mvm);
+
+	iwl_trans_stop_device(mvm->trans);
+
+	/*
+	 * Set the HW restart bit -- this is mostly true as we're
+	 * going to load new firmware and reprogram that, though
+	 * the reprogramming is going to be manual to avoid adding
+	 * all the MACs that aren't support.
+	 * We don't have to clear up everything though because the
+	 * reprogramming is manual. When we resume, we'll actually
+	 * go through a proper restart sequence again to switch
+	 * back to the runtime firmware image.
+	 */
+	set_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status);
+
+	/* We reprogram keys and shouldn't allocate new key indices */
+	memset(mvm->fw_key_table, 0, sizeof(mvm->fw_key_table));
+
+	mvm->ptk_ivlen = 0;
+	mvm->ptk_icvlen = 0;
+	mvm->ptk_ivlen = 0;
+	mvm->ptk_icvlen = 0;
+
+	return iwl_mvm_load_d3_fw(mvm);
+}
+
 static int
 iwl_mvm_send_wowlan_config_cmd(struct iwl_mvm *mvm,
 			       const struct iwl_wowlan_config_cmd_v3 *cmd)
@@ -797,116 +826,52 @@ iwl_mvm_send_wowlan_config_cmd(struct iwl_mvm *mvm,
 				    cmd_len, cmd);
 }
 
-static int __iwl_mvm_suspend(struct ieee80211_hw *hw,
-			     struct cfg80211_wowlan *wowlan,
-			     bool test)
+static int
+iwl_mvm_get_wowlan_config(struct iwl_mvm *mvm,
+			  struct cfg80211_wowlan *wowlan,
+			  struct iwl_wowlan_config_cmd_v3 *wowlan_config_cmd,
+			  struct ieee80211_vif *vif, struct iwl_mvm_vif *mvmvif,
+			  struct ieee80211_sta *ap_sta)
 {
-	struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
-	struct iwl_d3_iter_data suspend_iter_data = {
-		.mvm = mvm,
-	};
-	struct ieee80211_vif *vif;
-	struct iwl_mvm_vif *mvmvif;
-	struct ieee80211_sta *ap_sta;
-	struct iwl_mvm_sta *mvm_ap_sta;
-	struct iwl_wowlan_config_cmd_v3 wowlan_config_cmd = {};
-	struct iwl_wowlan_kek_kck_material_cmd kek_kck_cmd = {};
-	struct iwl_wowlan_tkip_params_cmd tkip_cmd = {};
-	struct iwl_d3_manager_config d3_cfg_cmd_data = {
-		/*
-		 * Program the minimum sleep time to 10 seconds, as many
-		 * platforms have issues processing a wakeup signal while
-		 * still being in the process of suspending.
-		 */
-		.min_sleep_time = cpu_to_le32(10 * 1000 * 1000),
-	};
-	struct iwl_host_cmd d3_cfg_cmd = {
-		.id = D3_CONFIG_CMD,
-		.flags = CMD_WANT_SKB,
-		.data[0] = &d3_cfg_cmd_data,
-		.len[0] = sizeof(d3_cfg_cmd_data),
-	};
-	struct wowlan_key_data key_data = {
-		.use_rsc_tsc = false,
-		.tkip = &tkip_cmd,
-		.use_tkip = false,
-	};
 	int ret;
-	int len __maybe_unused;
-
-	if (!wowlan) {
-		/*
-		 * mac80211 shouldn't get here, but for D3 test
-		 * it doesn't warrant a warning
-		 */
-		WARN_ON(!test);
-		return -EINVAL;
-	}
-
-	key_data.rsc_tsc = kzalloc(sizeof(*key_data.rsc_tsc), GFP_KERNEL);
-	if (!key_data.rsc_tsc)
-		return -ENOMEM;
-
-	mutex_lock(&mvm->mutex);
-
-	/* see if there's only a single BSS vif and it's associated */
-	ieee80211_iterate_active_interfaces_atomic(
-		mvm->hw, IEEE80211_IFACE_ITER_NORMAL,
-		iwl_mvm_d3_iface_iterator, &suspend_iter_data);
+	struct iwl_mvm_sta *mvm_ap_sta = (struct iwl_mvm_sta *)ap_sta->drv_priv;
 
-	if (suspend_iter_data.error || !suspend_iter_data.vif) {
-		ret = 1;
-		goto out_noreset;
-	}
-
-	vif = suspend_iter_data.vif;
-	mvmvif = iwl_mvm_vif_from_mac80211(vif);
-
-	ap_sta = rcu_dereference_protected(
-			mvm->fw_id_to_mac_id[mvmvif->ap_sta_id],
-			lockdep_is_held(&mvm->mutex));
-	if (IS_ERR_OR_NULL(ap_sta)) {
-		ret = -EINVAL;
-		goto out_noreset;
-	}
+	/* TODO: wowlan_config_cmd->common.wowlan_ba_teardown_tids */
 
-	mvm_ap_sta = (struct iwl_mvm_sta *)ap_sta->drv_priv;
-
-	/* TODO: wowlan_config_cmd.common.wowlan_ba_teardown_tids */
-
-	wowlan_config_cmd.common.is_11n_connection =
+	wowlan_config_cmd->common.is_11n_connection =
 					ap_sta->ht_cap.ht_supported;
 
 	/* Query the last used seqno and set it */
 	ret = iwl_mvm_get_last_nonqos_seq(mvm, vif);
 	if (ret < 0)
-		goto out_noreset;
-	wowlan_config_cmd.common.non_qos_seq = cpu_to_le16(ret);
+		return ret;
+
+	wowlan_config_cmd->common.non_qos_seq = cpu_to_le16(ret);
 
-	iwl_mvm_set_wowlan_qos_seq(mvm_ap_sta, &wowlan_config_cmd.common);
+	iwl_mvm_set_wowlan_qos_seq(mvm_ap_sta, &wowlan_config_cmd->common);
 
 	if (wowlan->disconnect)
-		wowlan_config_cmd.common.wakeup_filter |=
+		wowlan_config_cmd->common.wakeup_filter |=
 			cpu_to_le32(IWL_WOWLAN_WAKEUP_BEACON_MISS |
 				    IWL_WOWLAN_WAKEUP_LINK_CHANGE);
 	if (wowlan->magic_pkt)
-		wowlan_config_cmd.common.wakeup_filter |=
+		wowlan_config_cmd->common.wakeup_filter |=
 			cpu_to_le32(IWL_WOWLAN_WAKEUP_MAGIC_PACKET);
 	if (wowlan->gtk_rekey_failure)
-		wowlan_config_cmd.common.wakeup_filter |=
+		wowlan_config_cmd->common.wakeup_filter |=
 			cpu_to_le32(IWL_WOWLAN_WAKEUP_GTK_REKEY_FAIL);
 	if (wowlan->eap_identity_req)
-		wowlan_config_cmd.common.wakeup_filter |=
+		wowlan_config_cmd->common.wakeup_filter |=
 			cpu_to_le32(IWL_WOWLAN_WAKEUP_EAP_IDENT_REQ);
 	if (wowlan->four_way_handshake)
-		wowlan_config_cmd.common.wakeup_filter |=
+		wowlan_config_cmd->common.wakeup_filter |=
 			cpu_to_le32(IWL_WOWLAN_WAKEUP_4WAY_HANDSHAKE);
 	if (wowlan->n_patterns)
-		wowlan_config_cmd.common.wakeup_filter |=
+		wowlan_config_cmd->common.wakeup_filter |=
 			cpu_to_le32(IWL_WOWLAN_WAKEUP_PATTERN_MATCH);
 
 	if (wowlan->rfkill_release)
-		wowlan_config_cmd.common.wakeup_filter |=
+		wowlan_config_cmd->common.wakeup_filter |=
 			cpu_to_le32(IWL_WOWLAN_WAKEUP_RF_KILL_DEASSERT);
 
 	if (wowlan->tcp) {
@@ -914,44 +879,39 @@ static int __iwl_mvm_suspend(struct ieee80211_hw *hw,
 		 * Set the "link change" (really "link lost") flag as well
 		 * since that implies losing the TCP connection.
 		 */
-		wowlan_config_cmd.common.wakeup_filter |=
+		wowlan_config_cmd->common.wakeup_filter |=
 			cpu_to_le32(IWL_WOWLAN_WAKEUP_REMOTE_LINK_LOSS |
 				    IWL_WOWLAN_WAKEUP_REMOTE_SIGNATURE_TABLE |
 				    IWL_WOWLAN_WAKEUP_REMOTE_WAKEUP_PACKET |
 				    IWL_WOWLAN_WAKEUP_LINK_CHANGE);
 	}
 
-	iwl_mvm_cancel_scan(mvm);
-
-	iwl_trans_stop_device(mvm->trans);
-
-	/*
-	 * Set the HW restart bit -- this is mostly true as we're
-	 * going to load new firmware and reprogram that, though
-	 * the reprogramming is going to be manual to avoid adding
-	 * all the MACs that aren't support.
-	 * We don't have to clear up everything though because the
-	 * reprogramming is manual. When we resume, we'll actually
-	 * go through a proper restart sequence again to switch
-	 * back to the runtime firmware image.
-	 */
-	set_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status);
-
-	/* We reprogram keys and shouldn't allocate new key indices */
-	memset(mvm->fw_key_table, 0, sizeof(mvm->fw_key_table));
-
-	mvm->ptk_ivlen = 0;
-	mvm->ptk_icvlen = 0;
-	mvm->ptk_ivlen = 0;
-	mvm->ptk_icvlen = 0;
+	return 0;
+}
 
-	ret = iwl_mvm_load_d3_fw(mvm);
-	if (ret)
-		goto out;
+static int
+iwl_mvm_wowlan_config(struct iwl_mvm *mvm,
+		      struct cfg80211_wowlan *wowlan,
+		      struct iwl_wowlan_config_cmd_v3 *wowlan_config_cmd,
+		      struct ieee80211_vif *vif, struct iwl_mvm_vif *mvmvif,
+		      struct ieee80211_sta *ap_sta)
+{
+	struct iwl_wowlan_kek_kck_material_cmd kek_kck_cmd = {};
+	struct iwl_wowlan_tkip_params_cmd tkip_cmd = {};
+	struct wowlan_key_data key_data = {
+		.use_rsc_tsc = false,
+		.tkip = &tkip_cmd,
+		.use_tkip = false,
+	};
+	int ret;
 
 	ret = iwl_mvm_d3_reprogram(mvm, vif, ap_sta);
 	if (ret)
-		goto out;
+		return ret;
+
+	key_data.rsc_tsc = kzalloc(sizeof(*key_data.rsc_tsc), GFP_KERNEL);
+	if (!key_data.rsc_tsc)
+		return -ENOMEM;
 
 	if (!iwlwifi_mod_params.sw_crypto) {
 		/*
@@ -1010,7 +970,7 @@ static int __iwl_mvm_suspend(struct ieee80211_hw *hw,
 		}
 	}
 
-	ret = iwl_mvm_send_wowlan_config_cmd(mvm, &wowlan_config_cmd);
+	ret = iwl_mvm_send_wowlan_config_cmd(mvm, wowlan_config_cmd);
 	if (ret)
 		goto out;
 
@@ -1023,6 +983,84 @@ static int __iwl_mvm_suspend(struct ieee80211_hw *hw,
 		goto out;
 
 	ret = iwl_mvm_send_remote_wake_cfg(mvm, vif, wowlan->tcp);
+
+out:
+	kfree(key_data.rsc_tsc);
+	return ret;
+}
+
+static int __iwl_mvm_suspend(struct ieee80211_hw *hw,
+			     struct cfg80211_wowlan *wowlan,
+			     bool test)
+{
+	struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
+	struct iwl_d3_iter_data suspend_iter_data = {
+		.mvm = mvm,
+	};
+	struct ieee80211_vif *vif = NULL;
+	struct iwl_mvm_vif *mvmvif = NULL;
+	struct ieee80211_sta *ap_sta = NULL;
+	struct iwl_wowlan_config_cmd_v3 wowlan_config_cmd = {};
+	struct iwl_d3_manager_config d3_cfg_cmd_data = {
+		/*
+		 * Program the minimum sleep time to 10 seconds, as many
+		 * platforms have issues processing a wakeup signal while
+		 * still being in the process of suspending.
+		 */
+		.min_sleep_time = cpu_to_le32(10 * 1000 * 1000),
+	};
+	struct iwl_host_cmd d3_cfg_cmd = {
+		.id = D3_CONFIG_CMD,
+		.flags = CMD_WANT_SKB,
+		.data[0] = &d3_cfg_cmd_data,
+		.len[0] = sizeof(d3_cfg_cmd_data),
+	};
+	int ret;
+	int len __maybe_unused;
+
+	if (!wowlan) {
+		/*
+		 * mac80211 shouldn't get here, but for D3 test
+		 * it doesn't warrant a warning
+		 */
+		WARN_ON(!test);
+		return -EINVAL;
+	}
+
+	mutex_lock(&mvm->mutex);
+
+	/* see if there's only a single BSS vif and it's associated */
+	ieee80211_iterate_active_interfaces_atomic(
+		mvm->hw, IEEE80211_IFACE_ITER_NORMAL,
+		iwl_mvm_d3_iface_iterator, &suspend_iter_data);
+
+	if (suspend_iter_data.error || !suspend_iter_data.vif) {
+		ret = 1;
+		goto out_noreset;
+	}
+
+	vif = suspend_iter_data.vif;
+	mvmvif = iwl_mvm_vif_from_mac80211(vif);
+
+	ap_sta = rcu_dereference_protected(
+		mvm->fw_id_to_mac_id[mvmvif->ap_sta_id],
+		lockdep_is_held(&mvm->mutex));
+	if (IS_ERR_OR_NULL(ap_sta)) {
+		ret = -EINVAL;
+		goto out_noreset;
+	}
+
+	ret = iwl_mvm_get_wowlan_config(mvm, wowlan, &wowlan_config_cmd, vif,
+					mvmvif, ap_sta);
+	if (ret)
+		goto out_noreset;
+
+	ret = iwl_mvm_switch_to_d3(mvm);
+	if (ret)
+		goto out;
+
+	ret = iwl_mvm_wowlan_config(mvm, wowlan, &wowlan_config_cmd,
+				    vif, mvmvif, ap_sta);
 	if (ret)
 		goto out;
 
@@ -1060,8 +1098,6 @@ static int __iwl_mvm_suspend(struct ieee80211_hw *hw,
 	if (ret < 0)
 		ieee80211_restart_hw(mvm->hw);
  out_noreset:
-	kfree(key_data.rsc_tsc);
-
 	mutex_unlock(&mvm->mutex);
 
 	return ret;
Signature · 1 line
1.9.1
#5 lore raw

PATCH 5/25 iwlwifi: mvm: move the check if associated outside of the iterator for wowlan

In reply to Emmanuel Grumbach

From: Luciano Coelho <[email protected]>

Instead of checking if we are associated when suspending with wowlan enabled in the interface iterator, allow it to return an unassociated vif and move the check to the main suspend function. This will be needed by netdetect, since it should also work when we are not associated but the vif is active.

---
 drivers/net/wireless/iwlwifi/mvm/d3.c | 48 ++++++++++++++++++-----------------
 1 file changed, 25 insertions(+), 23 deletions(-)
drivers/net/wireless/iwlwifi/mvm/d3.c +25 -23
index b8e8a97..7a66a09 100644
@@ -611,14 +611,10 @@ static void iwl_mvm_d3_iface_iterator(void *_data, u8 *mac,
 				      struct ieee80211_vif *vif)
 {
 	struct iwl_d3_iter_data *data = _data;
-	struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
 
 	if (vif->type != NL80211_IFTYPE_STATION || vif->p2p)
 		return;
 
-	if (mvmvif->ap_sta_id == IWL_MVM_STATION_COUNT)
-		return;
-
 	if (data->vif) {
 		IWL_ERR(data->mvm, "More than one managed interface active!\n");
 		data->error = true;
@@ -1029,7 +1025,7 @@ static int __iwl_mvm_suspend(struct ieee80211_hw *hw,
 
 	mutex_lock(&mvm->mutex);
 
-	/* see if there's only a single BSS vif and it's associated */
+	/* see if there's only a single BSS vif */
 	ieee80211_iterate_active_interfaces_atomic(
 		mvm->hw, IEEE80211_IFACE_ITER_NORMAL,
 		iwl_mvm_d3_iface_iterator, &suspend_iter_data);
@@ -1042,27 +1038,33 @@ static int __iwl_mvm_suspend(struct ieee80211_hw *hw,
 	vif = suspend_iter_data.vif;
 	mvmvif = iwl_mvm_vif_from_mac80211(vif);
 
-	ap_sta = rcu_dereference_protected(
-		mvm->fw_id_to_mac_id[mvmvif->ap_sta_id],
-		lockdep_is_held(&mvm->mutex));
-	if (IS_ERR_OR_NULL(ap_sta)) {
-		ret = -EINVAL;
-		goto out_noreset;
-	}
+	/* if we're associated, this is wowlan */
+	if (mvmvif->ap_sta_id != IWL_MVM_STATION_COUNT) {
+		ap_sta = rcu_dereference_protected(
+			mvm->fw_id_to_mac_id[mvmvif->ap_sta_id],
+			lockdep_is_held(&mvm->mutex));
+		if (IS_ERR_OR_NULL(ap_sta)) {
+			ret = -EINVAL;
+			goto out_noreset;
+		}
 
-	ret = iwl_mvm_get_wowlan_config(mvm, wowlan, &wowlan_config_cmd, vif,
-					mvmvif, ap_sta);
-	if (ret)
-		goto out_noreset;
+		ret = iwl_mvm_get_wowlan_config(mvm, wowlan, &wowlan_config_cmd,
+						vif, mvmvif, ap_sta);
+		if (ret)
+			goto out_noreset;
 
-	ret = iwl_mvm_switch_to_d3(mvm);
-	if (ret)
-		goto out;
+		ret = iwl_mvm_switch_to_d3(mvm);
+		if (ret)
+			goto out;
 
-	ret = iwl_mvm_wowlan_config(mvm, wowlan, &wowlan_config_cmd,
-				    vif, mvmvif, ap_sta);
-	if (ret)
-		goto out;
+		ret = iwl_mvm_wowlan_config(mvm, wowlan, &wowlan_config_cmd,
+					    vif, mvmvif, ap_sta);
+		if (ret)
+			goto out;
+	} else {
+		ret = 1;
+		goto out_noreset;
+	}
 
 	ret = iwl_mvm_power_update_device(mvm);
 	if (ret)
Signature · 1 line
1.9.1
#6 lore raw

PATCH 6/25 iwlwifi: mvm: spin off a function to start scan offload

In reply to Emmanuel Grumbach

From: Luciano Coelho <[email protected]>

The net-detect feature will require a scan offload to be started in the same way it is done now for scheduled scan. Spin a new function off of the sched_scan_start op code for reuse. Additionally, restructure the function a bit for more readability.

---
 drivers/net/wireless/iwlwifi/mvm/mac80211.c | 20 ++------------------
 drivers/net/wireless/iwlwifi/mvm/mvm.h      |  4 ++++
 drivers/net/wireless/iwlwifi/mvm/scan.c     | 25 +++++++++++++++++++++++++
 3 files changed, 31 insertions(+), 18 deletions(-)
drivers/net/wireless/iwlwifi/mvm/mac80211.c +2 -18
index 585fe5b..b17877c 100644
@@ -2170,25 +2170,9 @@ static int iwl_mvm_mac_sched_scan_start(struct ieee80211_hw *hw,
 
 	mvm->scan_status = IWL_MVM_SCAN_SCHED;
 
-	if (!(mvm->fw->ucode_capa.api[0] & IWL_UCODE_TLV_API_LMAC_SCAN)) {
-		ret = iwl_mvm_config_sched_scan(mvm, vif, req, ies);
-		if (ret)
-			goto err;
-	}
-
-	ret = iwl_mvm_config_sched_scan_profiles(mvm, req);
+	ret = iwl_mvm_scan_offload_start(mvm, vif, req, ies);
 	if (ret)
-		goto err;
-
-	if (mvm->fw->ucode_capa.api[0] & IWL_UCODE_TLV_API_LMAC_SCAN)
-		ret = iwl_mvm_unified_sched_scan_lmac(mvm, vif, req, ies);
-	else
-		ret = iwl_mvm_sched_scan_start(mvm, req);
-
-	if (!ret)
-		goto out;
-err:
-	mvm->scan_status = IWL_MVM_SCAN_NONE;
+		mvm->scan_status = IWL_MVM_SCAN_NONE;
 out:
 	mutex_unlock(&mvm->mutex);
 	return ret;
drivers/net/wireless/iwlwifi/mvm/mvm.h +4 -0
index b153ced..14ec678 100644
@@ -949,6 +949,10 @@ int iwl_mvm_config_sched_scan_profiles(struct iwl_mvm *mvm,
 				       struct cfg80211_sched_scan_request *req);
 int iwl_mvm_sched_scan_start(struct iwl_mvm *mvm,
 			     struct cfg80211_sched_scan_request *req);
+int iwl_mvm_scan_offload_start(struct iwl_mvm *mvm,
+			       struct ieee80211_vif *vif,
+			       struct cfg80211_sched_scan_request *req,
+			       struct ieee80211_scan_ies *ies);
 int iwl_mvm_scan_offload_stop(struct iwl_mvm *mvm, bool notify);
 int iwl_mvm_rx_scan_offload_results(struct iwl_mvm *mvm,
 				    struct iwl_rx_cmd_buffer *rxb,
drivers/net/wireless/iwlwifi/mvm/scan.c +25 -0
index b280d5d..64c02a2 100644
@@ -1007,6 +1007,31 @@ int iwl_mvm_sched_scan_start(struct iwl_mvm *mvm,
 				    sizeof(scan_req), &scan_req);
 }
 
+int iwl_mvm_scan_offload_start(struct iwl_mvm *mvm,
+			       struct ieee80211_vif *vif,
+			       struct cfg80211_sched_scan_request *req,
+			       struct ieee80211_scan_ies *ies)
+{
+	int ret;
+
+	if ((mvm->fw->ucode_capa.api[0] & IWL_UCODE_TLV_API_LMAC_SCAN)) {
+		ret = iwl_mvm_config_sched_scan_profiles(mvm, req);
+		if (ret)
+			return ret;
+		ret = iwl_mvm_unified_sched_scan_lmac(mvm, vif, req, ies);
+	} else {
+		ret = iwl_mvm_config_sched_scan(mvm, vif, req, ies);
+		if (ret)
+			return ret;
+		ret = iwl_mvm_config_sched_scan_profiles(mvm, req);
+		if (ret)
+			return ret;
+		ret = iwl_mvm_sched_scan_start(mvm, req);
+	}
+
+	return ret;
+}
+
 static int iwl_mvm_send_scan_offload_abort(struct iwl_mvm *mvm)
 {
 	int ret;
Signature · 1 line
1.9.1
#7 lore raw

PATCH 7/25 iwlwifi: mvm: add debugfs entry to configure netdetect SSIDs

In reply to Emmanuel Grumbach

From: Luciano Coelho <[email protected]>

Before we get all the chain (ie. mac80211, cfg80211, nl80211 and userspace) changed to support net-detect, we can use this debugfs entry for easy testing and as a proof of concept.

---
 drivers/net/wireless/iwlwifi/mvm/d3.c      |   9 +++
 drivers/net/wireless/iwlwifi/mvm/debugfs.c | 122 +++++++++++++++++++++++++++++
 drivers/net/wireless/iwlwifi/mvm/mvm.h     |   4 +
 drivers/net/wireless/iwlwifi/mvm/ops.c     |   7 ++
 4 files changed, 142 insertions(+)
drivers/net/wireless/iwlwifi/mvm/d3.c +9 -0
index 7a66a09..0b3295e 100644
@@ -1061,6 +1061,15 @@ static int __iwl_mvm_suspend(struct ieee80211_hw *hw,
 					    vif, mvmvif, ap_sta);
 		if (ret)
 			goto out;
+	} else if (mvm->nd_config) {
+		ret = iwl_mvm_switch_to_d3(mvm);
+		if (ret)
+			goto out;
+
+		ret = iwl_mvm_scan_offload_start(mvm, vif, mvm->nd_config,
+						 mvm->nd_ies);
+		if (ret)
+			goto out;
 	} else {
 		ret = 1;
 		goto out_noreset;
drivers/net/wireless/iwlwifi/mvm/debugfs.c +122 -0

140 lines not on this page · raw message

drivers/net/wireless/iwlwifi/mvm/mvm.h +4 -0
index 14ec678..60aee62 100644
@@ -659,6 +659,10 @@ struct iwl_mvm {
 #ifdef CONFIG_PM_SLEEP
 	struct wiphy_wowlan_support wowlan;
 	int gtk_ivlen, gtk_icvlen, ptk_ivlen, ptk_icvlen;
+
+	/* sched scan settings for net detect */
+	struct cfg80211_sched_scan_request *nd_config;
+	struct ieee80211_scan_ies *nd_ies;
 #ifdef CONFIG_IWLWIFI_DEBUGFS
 	u32 d3_wake_sysassert; /* must be u32 for debugfs_create_bool */
 	bool d3_test_active;
drivers/net/wireless/iwlwifi/mvm/ops.c +7 -0
index 48cb25a..047d83d 100644
@@ -594,6 +594,13 @@ static void iwl_op_mode_mvm_stop(struct iwl_op_mode *op_mode)
 
 #if defined(CONFIG_PM_SLEEP) && defined(CONFIG_IWLWIFI_DEBUGFS)
 	kfree(mvm->d3_resume_sram);
+	if (mvm->nd_config) {
+		kfree(mvm->nd_config->match_sets);
+		kfree(mvm->nd_config);
+		mvm->nd_config = NULL;
+		kfree(mvm->nd_ies);
+		mvm->nd_ies = NULL;
+	}
 #endif
 
 	iwl_trans_op_mode_leave(mvm->trans);
Signature · 1 line
1.9.1
#8 lore raw

PATCH 8/25 iwlwifi: mvm: change the iwl_mvm_d3_iface_iterator into a generic function

In reply to Emmanuel Grumbach

From: Luciano Coelho <[email protected]>

Getting the BSS station vif is something that may be needed by other parts of the code. So, instead of having an iterator specifically for d3, change it into a generic one in utils.c. Additionally, add a iwl_mvm_get_bss_vif() function to make it easier to retrieving it.

---
 drivers/net/wireless/iwlwifi/mvm/d3.c    | 47 +++-----------------------------
 drivers/net/wireless/iwlwifi/mvm/mvm.h   |  2 ++
 drivers/net/wireless/iwlwifi/mvm/utils.c | 37 +++++++++++++++++++++++++
 3 files changed, 43 insertions(+), 43 deletions(-)
drivers/net/wireless/iwlwifi/mvm/d3.c +4 -43
index 0b3295e..3bbb511 100644
@@ -601,29 +601,6 @@ static int iwl_mvm_send_remote_wake_cfg(struct iwl_mvm *mvm,
 	return ret;
 }
 
-struct iwl_d3_iter_data {
-	struct iwl_mvm *mvm;
-	struct ieee80211_vif *vif;
-	bool error;
-};
-
-static void iwl_mvm_d3_iface_iterator(void *_data, u8 *mac,
-				      struct ieee80211_vif *vif)
-{
-	struct iwl_d3_iter_data *data = _data;
-
-	if (vif->type != NL80211_IFTYPE_STATION || vif->p2p)
-		return;
-
-	if (data->vif) {
-		IWL_ERR(data->mvm, "More than one managed interface active!\n");
-		data->error = true;
-		return;
-	}
-
-	data->vif = vif;
-}
-
 static int iwl_mvm_d3_reprogram(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
 				struct ieee80211_sta *ap_sta)
 {
@@ -990,9 +967,6 @@ static int __iwl_mvm_suspend(struct ieee80211_hw *hw,
 			     bool test)
 {
 	struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
-	struct iwl_d3_iter_data suspend_iter_data = {
-		.mvm = mvm,
-	};
 	struct ieee80211_vif *vif = NULL;
 	struct iwl_mvm_vif *mvmvif = NULL;
 	struct ieee80211_sta *ap_sta = NULL;
@@ -1025,17 +999,12 @@ static int __iwl_mvm_suspend(struct ieee80211_hw *hw,
 
 	mutex_lock(&mvm->mutex);
 
-	/* see if there's only a single BSS vif */
-	ieee80211_iterate_active_interfaces_atomic(
-		mvm->hw, IEEE80211_IFACE_ITER_NORMAL,
-		iwl_mvm_d3_iface_iterator, &suspend_iter_data);
-
-	if (suspend_iter_data.error || !suspend_iter_data.vif) {
+	vif = iwl_mvm_get_bss_vif(mvm);
+	if (IS_ERR_OR_NULL(vif)) {
 		ret = 1;
 		goto out_noreset;
 	}
 
-	vif = suspend_iter_data.vif;
 	mvmvif = iwl_mvm_vif_from_mac80211(vif);
 
 	/* if we're associated, this is wowlan */
@@ -1639,9 +1608,6 @@ static void iwl_mvm_d3_disconnect_iter(void *data, u8 *mac,
 
 static int __iwl_mvm_resume(struct iwl_mvm *mvm, bool test)
 {
-	struct iwl_d3_iter_data resume_iter_data = {
-		.mvm = mvm,
-	};
 	struct ieee80211_vif *vif = NULL;
 	int ret;
 	enum iwl_d3_status d3_status;
@@ -1650,15 +1616,10 @@ static int __iwl_mvm_resume(struct iwl_mvm *mvm, bool test)
 	mutex_lock(&mvm->mutex);
 
 	/* get the BSS vif pointer again */
-	ieee80211_iterate_active_interfaces_atomic(
-		mvm->hw, IEEE80211_IFACE_ITER_NORMAL,
-		iwl_mvm_d3_iface_iterator, &resume_iter_data);
-
-	if (WARN_ON(resume_iter_data.error || !resume_iter_data.vif))
+	vif = iwl_mvm_get_bss_vif(mvm);
+	if (IS_ERR_OR_NULL(vif))
 		goto out_unlock;
 
-	vif = resume_iter_data.vif;
-
 	ret = iwl_trans_d3_resume(mvm->trans, &d3_status, test);
 	if (ret)
 		goto out_unlock;
drivers/net/wireless/iwlwifi/mvm/mvm.h +2 -0
index 60aee62..aec9f57 100644
@@ -1214,6 +1214,8 @@ void iwl_mvm_recalc_tdls_state(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
 void iwl_mvm_mac_mgd_protect_tdls_discover(struct ieee80211_hw *hw,
 					   struct ieee80211_vif *vif);
 
+struct ieee80211_vif *iwl_mvm_get_bss_vif(struct iwl_mvm *mvm);
+
 void iwl_mvm_nic_restart(struct iwl_mvm *mvm, bool fw_error);
 #ifdef CONFIG_IWLWIFI_DEBUGFS
 void iwl_mvm_fw_error_dump(struct iwl_mvm *mvm);
drivers/net/wireless/iwlwifi/mvm/utils.c +37 -0
index 8021f6e..e56e77e 100644
@@ -734,3 +734,40 @@ bool iwl_mvm_is_idle(struct iwl_mvm *mvm)
 
 	return idle;
 }
+
+struct iwl_bss_iter_data {
+	struct ieee80211_vif *vif;
+	bool error;
+};
+
+static void iwl_mvm_bss_iface_iterator(void *_data, u8 *mac,
+				       struct ieee80211_vif *vif)
+{
+	struct iwl_bss_iter_data *data = _data;
+
+	if (vif->type != NL80211_IFTYPE_STATION || vif->p2p)
+		return;
+
+	if (data->vif) {
+		data->error = true;
+		return;
+	}
+
+	data->vif = vif;
+}
+
+struct ieee80211_vif *iwl_mvm_get_bss_vif(struct iwl_mvm *mvm)
+{
+	struct iwl_bss_iter_data bss_iter_data = {};
+
+	ieee80211_iterate_active_interfaces_atomic(
+		mvm->hw, IEEE80211_IFACE_ITER_NORMAL,
+		iwl_mvm_bss_iface_iterator, &bss_iter_data);
+
+	if (bss_iter_data.error) {
+		IWL_ERR(mvm, "More than one managed interface active!\n");
+		return ERR_PTR(-EINVAL);
+	}
+
+	return bss_iter_data.vif;
+}
Signature · 1 line
1.9.1
#9 lore raw

PATCH 9/25 iwlwifi: allow to restrict Tx aggregation size per-device

In reply to Emmanuel Grumbach

From: Gregory Greenman <[email protected]>

A few slave bus devices show better performance when we reduce the size of the Tx A-MPDU.

---
 drivers/net/wireless/iwlwifi/iwl-config.h | 2 ++
 drivers/net/wireless/iwlwifi/mvm/ops.c    | 3 +++
 2 files changed, 5 insertions(+)
drivers/net/wireless/iwlwifi/iwl-config.h +2 -0
index 2ef83a3..76d363d 100644
@@ -246,6 +246,7 @@ struct iwl_pwr_tx_backoff {
  * @nvm_hw_section_num: the ID of the HW NVM section
  * @pwr_tx_backoffs: translation table between power limits and backoffs
  * @max_rx_agg_size: max RX aggregation size of the ADDBA request/response
+ * @max_tx_agg_size: max TX aggregation size of the ADDBA request/response
  *
  * We enable the driver to be backward compatible wrt. hardware features.
  * API differences in uCode shouldn't be handled here but through TLVs
@@ -285,6 +286,7 @@ struct iwl_cfg {
 	const char *default_nvm_file;
 	unsigned int max_rx_agg_size;
 	bool disable_dummy_notification;
+	unsigned int max_tx_agg_size;
 };
 
 /*
drivers/net/wireless/iwlwifi/mvm/ops.c +3 -0
index 047d83d..91b28e8 100644
@@ -403,6 +403,9 @@ iwl_op_mode_mvm_start(struct iwl_trans *trans, const struct iwl_cfg *cfg,
 	if (cfg->max_rx_agg_size)
 		hw->max_rx_aggregation_subframes = cfg->max_rx_agg_size;
 
+	if (cfg->max_tx_agg_size)
+		hw->max_tx_aggregation_subframes = cfg->max_tx_agg_size;
+
 	op_mode = hw->priv;
 	op_mode->ops = &iwl_mvm_ops;
 
Signature · 1 line
1.9.1
#10 lore raw

PATCH 10/25 iwlwifi: pcie: warn if extern fw_debug buffer failed

In reply to Emmanuel Grumbach

From: Emmanuel Grumbach <[email protected]>

Otherwise we have no way to know that the buffer hasn't been allocated.

---
 drivers/net/wireless/iwlwifi/pcie/trans.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/iwlwifi/pcie/trans.c +1 -1
index 3781b02..5c9064f 100644
@@ -133,7 +133,7 @@ static void iwl_pcie_alloc_fw_monitor(struct iwl_trans *trans)
 		break;
 	}
 
-	if (!page)
+	if (WARN_ON_ONCE(!page))
 		return;
 
 	trans_pcie->fw_mon_page = page;
Signature · 1 line
1.9.1
#11 lore raw

PATCH 11/25 iwlwifi: pcie: fix recovery from ARC reset in WoWLAN

In reply to Emmanuel Grumbach

From: Emmanuel Grumbach <[email protected]>

When the ARC is reset when we exit from Sx in case we had WoWLAN running, we can't access the prph before we reset the NIC.

---
 drivers/net/wireless/iwlwifi/pcie/trans.c | 17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)
drivers/net/wireless/iwlwifi/pcie/trans.c +8 -9
index 5c9064f..aea0fe9 100644
@@ -1023,14 +1023,6 @@ static int iwl_trans_pcie_d3_resume(struct iwl_trans *trans,
 		return 0;
 	}
 
-	iwl_pcie_set_pwr(trans, false);
-
-	val = iwl_read32(trans, CSR_RESET);
-	if (val & CSR_RESET_REG_FLAG_NEVO_RESET) {
-		*status = IWL_D3_STATUS_RESET;
-		return 0;
-	}
-
 	/*
 	 * Also enables interrupts - none will happen as the device doesn't
 	 * know we're waking it up, only when the opmode actually tells it
@@ -1050,6 +1042,8 @@ static int iwl_trans_pcie_d3_resume(struct iwl_trans *trans,
 		return ret;
 	}
 
+	iwl_pcie_set_pwr(trans, false);
+
 	iwl_trans_pcie_tx_reset(trans);
 
 	ret = iwl_pcie_rx_init(trans);
@@ -1058,7 +1052,12 @@ static int iwl_trans_pcie_d3_resume(struct iwl_trans *trans,
 		return ret;
 	}
 
-	*status = IWL_D3_STATUS_ALIVE;
+	val = iwl_read32(trans, CSR_RESET);
+	if (val & CSR_RESET_REG_FLAG_NEVO_RESET)
+		*status = IWL_D3_STATUS_RESET;
+	else
+		*status = IWL_D3_STATUS_ALIVE;
+
 	return 0;
 }
 
Signature · 1 line
1.9.1
#12 lore raw

PATCH 12/25 iwlwifi: always run the secured flow for family 8000

In reply to Emmanuel Grumbach

From: Eran Harary <[email protected]>

In the new format the "CSS section" has the same TLV type as the "mem section". So we need to run the secured flow for all the 8000 products.

---
 drivers/net/wireless/iwlwifi/iwl-config.h | 10 ++++++++++
 drivers/net/wireless/iwlwifi/iwl-drv.c    |  3 ---
 drivers/net/wireless/iwlwifi/iwl-fw.h     |  1 -
 drivers/net/wireless/iwlwifi/pcie/trans.c | 10 ++++------
 4 files changed, 14 insertions(+), 10 deletions(-)
drivers/net/wireless/iwlwifi/iwl-config.h +10 -0
index 76d363d..f8aa9cf 100644
@@ -87,6 +87,16 @@ enum iwl_device_family {
 	IWL_DEVICE_FAMILY_8000,
 };
 
+static inline bool iwl_has_secure_boot(u32 hw_rev,
+				       enum iwl_device_family family)
+{
+	/* return 1 only for family 8000 B0 */
+	if ((family == IWL_DEVICE_FAMILY_8000) && (hw_rev & 0xC))
+		return 1;
+
+	return 0;
+}
+
 /*
  * LED mode
  *    IWL_LED_DEFAULT:  use device default
drivers/net/wireless/iwlwifi/iwl-drv.c +0 -3
index 0f1084f..d9fa8e0 100644
@@ -807,19 +807,16 @@ static int iwl_parse_tlv_firmware(struct iwl_drv *drv,
 			iwl_store_ucode_sec(pieces, tlv_data, IWL_UCODE_REGULAR,
 					    tlv_len);
 			drv->fw.mvm_fw = true;
-			drv->fw.img[IWL_UCODE_REGULAR].is_secure = true;
 			break;
 		case IWL_UCODE_TLV_SECURE_SEC_INIT:
 			iwl_store_ucode_sec(pieces, tlv_data, IWL_UCODE_INIT,
 					    tlv_len);
 			drv->fw.mvm_fw = true;
-			drv->fw.img[IWL_UCODE_INIT].is_secure = true;
 			break;
 		case IWL_UCODE_TLV_SECURE_SEC_WOWLAN:
 			iwl_store_ucode_sec(pieces, tlv_data, IWL_UCODE_WOWLAN,
 					    tlv_len);
 			drv->fw.mvm_fw = true;
-			drv->fw.img[IWL_UCODE_WOWLAN].is_secure = true;
 			break;
 		case IWL_UCODE_TLV_NUM_OF_CPU:
 			if (tlv_len != sizeof(u32))
drivers/net/wireless/iwlwifi/iwl-fw.h +0 -1
index 4f6e668..6f7ae5f 100644
@@ -227,7 +227,6 @@ struct fw_desc {
 
 struct fw_img {
 	struct fw_desc sec[IWL_UCODE_SECTION_MAX];
-	bool is_secure;
 	bool is_dual_cpus;
 };
 
drivers/net/wireless/iwlwifi/pcie/trans.c +4 -6
index aea0fe9..8027138 100644
@@ -747,14 +747,11 @@ static int iwl_pcie_load_given_ucode(struct iwl_trans *trans,
 	int first_ucode_section;
 
 	IWL_DEBUG_FW(trans,
-		     "working with %s image\n",
-		     image->is_secure ? "Secured" : "Non Secured");
-	IWL_DEBUG_FW(trans,
 		     "working with %s CPU\n",
 		     image->is_dual_cpus ? "Dual" : "Single");
 
 	/* configure the ucode to be ready to get the secured image */
-	if (image->is_secure) {
+	if (iwl_has_secure_boot(trans->hw_rev, trans->cfg->device_family)) {
 		/* set secure boot inspector addresses */
 		iwl_write_prph(trans,
 			       LMPM_SECURE_INSPECTOR_CODE_ADDR,
@@ -790,7 +787,8 @@ static int iwl_pcie_load_given_ucode(struct iwl_trans *trans,
 			       LMPM_SECURE_CPU2_HDR_MEM_SPACE);
 
 		/* load to FW the binary sections of CPU2 */
-		if (image->is_secure)
+		if (iwl_has_secure_boot(trans->hw_rev,
+					trans->cfg->device_family))
 			ret = iwl_pcie_load_cpu_secured_sections(
 							trans, image, 2,
 							&first_ucode_section);
@@ -821,7 +819,7 @@ static int iwl_pcie_load_given_ucode(struct iwl_trans *trans,
 	else
 		iwl_write32(trans, CSR_RESET, 0);
 
-	if (image->is_secure) {
+	if (iwl_has_secure_boot(trans->hw_rev, trans->cfg->device_family)) {
 		/* wait for image verification to complete  */
 		ret = iwl_poll_prph_bit(trans,
 					LMPM_SECURE_BOOT_CPU1_STATUS_ADDR,
Signature · 1 line
1.9.1
#13 lore raw

PATCH 13/25 iwlwifi: mvm: BT Coex - move BT_ANTENNA_COUPLING_THRESHOLD to constants

In reply to Emmanuel Grumbach

From: Emmanuel Grumbach <[email protected]>

This is were it really needs to be.

---
 drivers/net/wireless/iwlwifi/mvm/coex.c        | 4 +---
 drivers/net/wireless/iwlwifi/mvm/coex_legacy.c | 5 ++---
 drivers/net/wireless/iwlwifi/mvm/constants.h   | 1 +
 3 files changed, 4 insertions(+), 6 deletions(-)
drivers/net/wireless/iwlwifi/mvm/coex.c +1 -3
index da2ffb7..515f9cb 100644
@@ -72,8 +72,6 @@
 #include "mvm.h"
 #include "iwl-debug.h"
 
-#define BT_ANTENNA_COUPLING_THRESHOLD		(30)
-
 const u32 iwl_bt_ctl_kill_msk[BT_KILL_MSK_MAX] = {
 	[BT_KILL_MSK_DEFAULT] = 0xfffffc00,
 	[BT_KILL_MSK_NEVER] = 0xffffffff,
@@ -605,7 +603,7 @@ int iwl_send_bt_init_conf(struct iwl_mvm *mvm)
 
 	bt_cmd->max_kill = cpu_to_le32(5);
 	bt_cmd->bt4_antenna_isolation_thr =
-				cpu_to_le32(BT_ANTENNA_COUPLING_THRESHOLD);
+		cpu_to_le32(IWL_MVM_BT_COEX_ANTENNA_COUPLING_THRS);
 	bt_cmd->bt4_tx_tx_delta_freq_thr = cpu_to_le32(15);
 	bt_cmd->bt4_tx_rx_max_freq0 = cpu_to_le32(15);
 	bt_cmd->override_primary_lut = cpu_to_le32(BT_COEX_INVALID_LUT);
drivers/net/wireless/iwlwifi/mvm/coex_legacy.c +2 -3
index 8a1d2f3..3f3b8ee 100644
@@ -102,8 +102,6 @@ static const u8 iwl_bt_prio_tbl[BT_COEX_PRIO_TBL_EVT_MAX] = {
 
 #undef EVENT_PRIO_ANT
 
-#define BT_ANTENNA_COUPLING_THRESHOLD		(30)
-
 static int iwl_send_bt_prio_tbl(struct iwl_mvm *mvm)
 {
 	if (unlikely(mvm->bt_force_ant_mode != BT_FORCE_ANT_DIS))
@@ -593,7 +591,8 @@ int iwl_send_bt_init_conf_old(struct iwl_mvm *mvm)
 	}
 
 	bt_cmd->max_kill = 5;
-	bt_cmd->bt4_antenna_isolation_thr = BT_ANTENNA_COUPLING_THRESHOLD;
+	bt_cmd->bt4_antenna_isolation_thr =
+		IWL_MVM_BT_COEX_ANTENNA_COUPLING_THRS;
 	bt_cmd->bt4_antenna_isolation = iwlwifi_mod_params.ant_coupling;
 	bt_cmd->bt4_tx_tx_delta_freq_thr = 15;
 	bt_cmd->bt4_tx_rx_max_freq0 = 15;
drivers/net/wireless/iwlwifi/mvm/constants.h +1 -0
index dfec5b5..f288783 100644
@@ -96,5 +96,6 @@
 #define IWL_MVM_QUOTA_THRESHOLD			8
 #define IWL_MVM_RS_RSSI_BASED_INIT_RATE         0
 #define IWL_MVM_RS_DISABLE_MIMO			0
+#define IWL_MVM_BT_COEX_ANTENNA_COUPLING_THRS	30
 
 #endif /* __MVM_CONSTANTS_H */
Signature · 1 line
1.9.1
#14 lore raw

PATCH 14/25 iwlwifi: mvm: add MVM_FW_BCAST_FILTER_PASS_ALL option

In reply to Emmanuel Grumbach

From: Max Stepanov <[email protected]>

The MVM_FW_BCAST_FILTER_PASS_ALL option defined in iwl-dbg-cfg.ini configuration file allows to enable/disable FW broadcast filtering.

If MVM_FW_BCAST_FILTER_PASS_ALL is not defined in iwl-dbg-cfg.ini or its value is 0, the mvm broadcast filtering is enabled.

Setting MVM_FW_BCAST_FILTER_PASS_ALL=1 in iwl-dbg-cfg.ini blocks sending of BCAST_FILTER_CMD to FW.

---
 drivers/net/wireless/iwlwifi/mvm/constants.h | 3 ++-
 drivers/net/wireless/iwlwifi/mvm/mac80211.c  | 3 +++
 2 files changed, 5 insertions(+), 1 deletion(-)
drivers/net/wireless/iwlwifi/mvm/constants.h +2 -1
index f288783..a2b473d 100644
@@ -92,10 +92,11 @@
 #define IWL_MVM_BT_COEX_SYNC2SCO		1
 #define IWL_MVM_BT_COEX_CORUNNING		0
 #define IWL_MVM_BT_COEX_MPLUT			1
+#define IWL_MVM_BT_COEX_ANTENNA_COUPLING_THRS	30
 #define IWL_MVM_FW_MCAST_FILTER_PASS_ALL	0
+#define IWL_MVM_FW_BCAST_FILTER_PASS_ALL	0
 #define IWL_MVM_QUOTA_THRESHOLD			8
 #define IWL_MVM_RS_RSSI_BASED_INIT_RATE         0
 #define IWL_MVM_RS_DISABLE_MIMO			0
-#define IWL_MVM_BT_COEX_ANTENNA_COUPLING_THRS	30
 
 #endif /* __MVM_CONSTANTS_H */
drivers/net/wireless/iwlwifi/mvm/mac80211.c +3 -0
index b17877c..9fc843e 100644
@@ -1382,6 +1382,9 @@ bool iwl_mvm_bcast_filter_build_cmd(struct iwl_mvm *mvm,
 		.cmd = cmd,
 	};
 
+	if (IWL_MVM_FW_BCAST_FILTER_PASS_ALL)
+		return false;
+
 	memset(cmd, 0, sizeof(*cmd));
 	cmd->max_bcast_filters = ARRAY_SIZE(cmd->filters);
 	cmd->max_macs = ARRAY_SIZE(cmd->macs);
Signature · 1 line
1.9.1
#15 lore raw

PATCH 15/25 iwlwifi: mvm: remove mvm argument from get_queues_mask

In reply to Emmanuel Grumbach

From: Arik Nemtsov <[email protected]>

It is unused and won't be available in some future invocations of the function.

---
 drivers/net/wireless/iwlwifi/mvm/mac-ctxt.c | 5 ++---
 drivers/net/wireless/iwlwifi/mvm/mac80211.c | 2 +-
 drivers/net/wireless/iwlwifi/mvm/mvm.h      | 3 +--
 drivers/net/wireless/iwlwifi/mvm/sta.c      | 2 +-
 4 files changed, 5 insertions(+), 7 deletions(-)
drivers/net/wireless/iwlwifi/mvm/mac-ctxt.c +2 -3
index 0c5c0b0..b8ab4a1 100644
@@ -197,8 +197,7 @@ static void iwl_mvm_mac_tsf_id_iter(void *_data, u8 *mac,
 /*
  * Get the mask of the queues used by the vif
  */
-u32 iwl_mvm_mac_get_queues_mask(struct iwl_mvm *mvm,
-				struct ieee80211_vif *vif)
+u32 iwl_mvm_mac_get_queues_mask(struct ieee80211_vif *vif)
 {
 	u32 qmask = 0, ac;
 
@@ -227,7 +226,7 @@ static void iwl_mvm_mac_iface_iterator(void *_data, u8 *mac,
 	}
 
 	/* Mark the queues used by the vif */
-	data->used_hw_queues |= iwl_mvm_mac_get_queues_mask(data->mvm, vif);
+	data->used_hw_queues |= iwl_mvm_mac_get_queues_mask(vif);
 
 	/* Mark MAC IDs as used by clearing the available bit, and
 	 * (below) mark TSFs as used if their existing use is not
drivers/net/wireless/iwlwifi/mvm/mac80211.c +1 -1
index 9fc843e..c087bf6 100644
@@ -1086,7 +1086,7 @@ static int iwl_mvm_mac_add_interface(struct ieee80211_hw *hw,
 static void iwl_mvm_prepare_mac_removal(struct iwl_mvm *mvm,
 					struct ieee80211_vif *vif)
 {
-	u32 tfd_msk = iwl_mvm_mac_get_queues_mask(mvm, vif);
+	u32 tfd_msk = iwl_mvm_mac_get_queues_mask(vif);
 
 	if (tfd_msk) {
 		mutex_lock(&mvm->mutex);
drivers/net/wireless/iwlwifi/mvm/mvm.h +1 -2
index aec9f57..d14dc06 100644
@@ -909,8 +909,7 @@ int iwl_mvm_mac_ctxt_add(struct iwl_mvm *mvm, struct ieee80211_vif *vif);
 int iwl_mvm_mac_ctxt_changed(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
 			     bool force_assoc_off, const u8 *bssid_override);
 int iwl_mvm_mac_ctxt_remove(struct iwl_mvm *mvm, struct ieee80211_vif *vif);
-u32 iwl_mvm_mac_get_queues_mask(struct iwl_mvm *mvm,
-				struct ieee80211_vif *vif);
+u32 iwl_mvm_mac_get_queues_mask(struct ieee80211_vif *vif);
 int iwl_mvm_mac_ctxt_beacon_changed(struct iwl_mvm *mvm,
 				    struct ieee80211_vif *vif);
 int iwl_mvm_rx_beacon_notif(struct iwl_mvm *mvm,
drivers/net/wireless/iwlwifi/mvm/sta.c +1 -1
index 1731c20..dd0dc5b 100644
@@ -609,7 +609,7 @@ int iwl_mvm_alloc_bcast_sta(struct iwl_mvm *mvm, struct ieee80211_vif *vif)
 
 	lockdep_assert_held(&mvm->mutex);
 
-	qmask = iwl_mvm_mac_get_queues_mask(mvm, vif);
+	qmask = iwl_mvm_mac_get_queues_mask(vif);
 
 	/*
 	 * The firmware defines the TFD queue mask to only be relevant
Signature · 1 line
1.9.1
#16 lore raw

PATCH 16/25 iwlwifi: mvm: BT Coex - make the multiprio lut a constant

In reply to Emmanuel Grumbach

From: Emmanuel Grumbach <[email protected]>

This makes it easier to tune the values during the testing.

---
 drivers/net/wireless/iwlwifi/mvm/coex.c        | 9 ++-------
 drivers/net/wireless/iwlwifi/mvm/coex_legacy.c | 9 ++-------
 drivers/net/wireless/iwlwifi/mvm/constants.h   | 2 ++
 3 files changed, 6 insertions(+), 14 deletions(-)
drivers/net/wireless/iwlwifi/mvm/coex.c +2 -7
index 515f9cb..508c813 100644
@@ -300,11 +300,6 @@ static const __le64 iwl_ci_mask[][3] = {
 	},
 };
 
-static const __le32 iwl_bt_mprio_lut[BT_COEX_MULTI_PRIO_LUT_SIZE] = {
-	cpu_to_le32(0x2e402280),
-	cpu_to_le32(0x7711a751),
-};
-
 struct corunning_block_luts {
 	u8 range;
 	__le32 lut20[BT_COEX_CORUN_LUT_SIZE];
@@ -636,8 +631,8 @@ int iwl_send_bt_init_conf(struct iwl_mvm *mvm)
 
 	memcpy(&bt_cmd->mplut_prio_boost, iwl_bt_prio_boost,
 	       sizeof(iwl_bt_prio_boost));
-	memcpy(&bt_cmd->multiprio_lut, iwl_bt_mprio_lut,
-	       sizeof(iwl_bt_mprio_lut));
+	bt_cmd->multiprio_lut[0] = cpu_to_le32(IWL_MVM_BT_COEX_MPLUT_REG0);
+	bt_cmd->multiprio_lut[1] = cpu_to_le32(IWL_MVM_BT_COEX_MPLUT_REG1);
 
 send_cmd:
 	memset(&mvm->last_bt_notif, 0, sizeof(mvm->last_bt_notif));
drivers/net/wireless/iwlwifi/mvm/coex_legacy.c +2 -7
index 3f3b8ee..b571e1b 100644
@@ -288,11 +288,6 @@ static const __le64 iwl_ci_mask[][3] = {
 	},
 };
 
-static const __le32 iwl_bt_mprio_lut[BT_COEX_MULTI_PRIO_LUT_SIZE] = {
-	cpu_to_le32(0x2e402280),
-	cpu_to_le32(0x7711a751),
-};
-
 struct corunning_block_luts {
 	u8 range;
 	__le32 lut20[BT_COEX_CORUN_LUT_SIZE];
@@ -648,8 +643,8 @@ int iwl_send_bt_init_conf_old(struct iwl_mvm *mvm)
 
 	memcpy(&bt_cmd->bt_prio_boost, iwl_bt_prio_boost,
 	       sizeof(iwl_bt_prio_boost));
-	memcpy(&bt_cmd->bt4_multiprio_lut, iwl_bt_mprio_lut,
-	       sizeof(iwl_bt_mprio_lut));
+	bt_cmd->bt4_multiprio_lut[0] = cpu_to_le32(IWL_MVM_BT_COEX_MPLUT_REG0);
+	bt_cmd->bt4_multiprio_lut[1] = cpu_to_le32(IWL_MVM_BT_COEX_MPLUT_REG1);
 
 send_cmd:
 	memset(&mvm->last_bt_notif_old, 0, sizeof(mvm->last_bt_notif_old));
drivers/net/wireless/iwlwifi/mvm/constants.h +2 -0
index a2b473d..5c1ea80 100644
@@ -92,6 +92,8 @@
 #define IWL_MVM_BT_COEX_SYNC2SCO		1
 #define IWL_MVM_BT_COEX_CORUNNING		0
 #define IWL_MVM_BT_COEX_MPLUT			1
+#define IWL_MVM_BT_COEX_MPLUT_REG0		0x2e402280
+#define IWL_MVM_BT_COEX_MPLUT_REG1		0x7711a751
 #define IWL_MVM_BT_COEX_ANTENNA_COUPLING_THRS	30
 #define IWL_MVM_FW_MCAST_FILTER_PASS_ALL	0
 #define IWL_MVM_FW_BCAST_FILTER_PASS_ALL	0
Signature · 1 line
1.9.1
#17 lore raw

PATCH 17/25 iwlwifi: mvm: improve MCS rate warning

In reply to Emmanuel Grumbach

From: Johannes Berg <[email protected]>

The warning gives no information about the frame, and presents the flags so that one might think they're the frame. Clarify and add more information.

---
 drivers/net/wireless/iwlwifi/mvm/tx.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/net/wireless/iwlwifi/mvm/tx.c +4 -2
index c6a517c..8d84873 100644
@@ -189,8 +189,10 @@ static void iwl_mvm_set_tx_cmd_rate(struct iwl_mvm *mvm,
 
 	/* HT rate doesn't make sense for a non data frame */
 	WARN_ONCE(info->control.rates[0].flags & IEEE80211_TX_RC_MCS,
-		  "Got an HT rate for a non data frame 0x%x\n",
-		  info->control.rates[0].flags);
+		  "Got an HT rate (flags:0x%x/mcs:%d) for a non data frame (fc:0x%x)\n",
+		  info->control.rates[0].flags,
+		  info->control.rates[0].idx,
+		  le16_to_cpu(fc));
 
 	rate_idx = info->control.rates[0].idx;
 	/* if the rate isn't a well known legacy rate, take the lowest one */
Signature · 1 line
1.9.1
#18 lore raw

PATCH 18/25 iwlwifi: mvm: flush queues without mutex held

In reply to Emmanuel Grumbach

From: Johannes Berg <[email protected]>

For WMM-AC we may have to be changing QoS parameters while the queues are being flushed. This is not relevant in the "drop" case, but matters when we wait for the device to finish the transmissions.

To allow this, do the actual waiting without holding the mutex.

---
 drivers/net/wireless/iwlwifi/mvm/mac80211.c | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)
drivers/net/wireless/iwlwifi/mvm/mac80211.c +12 -6
index c087bf6..14be108 100644
@@ -2997,18 +2997,24 @@ static void iwl_mvm_mac_flush(struct ieee80211_hw *hw,
 	mvmvif = iwl_mvm_vif_from_mac80211(vif);
 	mvmsta = iwl_mvm_sta_from_staid_protected(mvm, mvmvif->ap_sta_id);
 
-	if (WARN_ON_ONCE(!mvmsta))
-		goto done;
+	if (WARN_ON_ONCE(!mvmsta)) {
+		mutex_unlock(&mvm->mutex);
+		return;
+	}
 
 	if (drop) {
 		if (iwl_mvm_flush_tx_path(mvm, mvmsta->tfd_queue_msk, true))
 			IWL_ERR(mvm, "flush request fail\n");
+		mutex_unlock(&mvm->mutex);
 	} else {
-		iwl_trans_wait_tx_queue_empty(mvm->trans,
-					      mvmsta->tfd_queue_msk);
+		u32 tfd_queue_msk = mvmsta->tfd_queue_msk;
+		mutex_unlock(&mvm->mutex);
+
+		/* this can take a while, and we may need/want other operations
+		 * to succeed while doing this, so do it without the mutex held
+		 */
+		iwl_trans_wait_tx_queue_empty(mvm->trans, tfd_queue_msk);
 	}
-done:
-	mutex_unlock(&mvm->mutex);
 }
 
 const struct ieee80211_ops iwl_mvm_hw_ops = {
Signature · 1 line
1.9.1
#19 lore raw

PATCH 19/25 iwlwifi: mvm: remove unnecessary includes in tt.c

In reply to Emmanuel Grumbach

From: Luciano Coelho <[email protected]>

We used to need to include some headers in order to read the registers and do all the calculations by ourselves, but this is not done anymore (i.e. we let the firmware do this for us), so we don't need to include those headers anymore.

---
 drivers/net/wireless/iwlwifi/mvm/tt.c | 4 ----
 1 file changed, 4 deletions(-)
drivers/net/wireless/iwlwifi/mvm/tt.c +0 -4
index acca44a..d4f2c29 100644
@@ -64,10 +64,6 @@
  *****************************************************************************/
 
 #include "mvm.h"
-#include "iwl-config.h"
-#include "iwl-io.h"
-#include "iwl-csr.h"
-#include "iwl-prph.h"
 
 #define IWL_MVM_TEMP_NOTIF_WAIT_TIMEOUT	HZ
 
Signature · 1 line
1.9.1
#20 lore raw

PATCH 20/25 iwlwifi: dvm: Fix probable mask then right shift defect

In reply to Emmanuel Grumbach

From: Joe Perches <[email protected]>

Precedence of & and >> is not the same and is not left to right. shift has higher precedence and should be done after the mask.

Add parentheses around the mask.

---
 drivers/net/wireless/iwlwifi/dvm/lib.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/wireless/iwlwifi/dvm/lib.c +2 -2
index 2191621..02e4ede 100644
@@ -418,8 +418,8 @@ void iwlagn_bt_adjust_rssi_monitor(struct iwl_priv *priv, bool rssi_ena)
 
 static bool iwlagn_bt_traffic_is_sco(struct iwl_bt_uart_msg *uart_msg)
 {
-	return BT_UART_MSG_FRAME3SCOESCO_MSK & uart_msg->frame3 >>
-			BT_UART_MSG_FRAME3SCOESCO_POS;
+	return (BT_UART_MSG_FRAME3SCOESCO_MSK & uart_msg->frame3) >>
+		BT_UART_MSG_FRAME3SCOESCO_POS;
 }
 
 static void iwlagn_bt_traffic_change_work(struct work_struct *work)
Signature · 1 line
1.9.1
#21 lore raw

PATCH 21/25 iwlwifi: enable STBC support for 8000 chips

In reply to Emmanuel Grumbach

From: Eyal Shapira <[email protected]>

These chips support STBC in both Tx and Rx.
Given that we've added STBC Tx support enable it.

---
 drivers/net/wireless/iwlwifi/iwl-8000.c | 1 +
 1 file changed, 1 insertion(+)
drivers/net/wireless/iwlwifi/iwl-8000.c +1 -0
index d2b7234..896ea90 100644
@@ -104,6 +104,7 @@ static const struct iwl_base_params iwl8000_base_params = {
 };
 
 static const struct iwl_ht_params iwl8000_ht_params = {
+	.stbc = true,
 	.ldpc = true,
 	.ht40_bands = BIT(IEEE80211_BAND_2GHZ) | BIT(IEEE80211_BAND_5GHZ),
 };
Signature · 1 line
1.9.1
#22 lore raw

PATCH 22/25 iwlwifi: mvm: port to devcoredump framework

In reply to Emmanuel Grumbach

From: Johannes Berg <[email protected]>

iwlwifi features a debug mechanism that allows to dump binary data which is helpful to debug the firmware. Until now, this data was made available for the userspace through debugfs. For this exact purpose, devcoredump was created. Move to the new infrastructure.

---
 drivers/net/wireless/iwlwifi/Kconfig        |  1 +
 drivers/net/wireless/iwlwifi/iwl-trans.h    |  4 --
 drivers/net/wireless/iwlwifi/mvm/debugfs.c  | 79 -----------------------------
 drivers/net/wireless/iwlwifi/mvm/mac80211.c | 57 +++++++++++++++++----
 drivers/net/wireless/iwlwifi/mvm/mvm.h      |  1 -
 drivers/net/wireless/iwlwifi/mvm/ops.c      |  5 --
 drivers/net/wireless/iwlwifi/pcie/trans.c   |  2 -
 7 files changed, 48 insertions(+), 101 deletions(-)
drivers/net/wireless/iwlwifi/Kconfig +1 -0
index 267e48a..139de90 100644
@@ -59,6 +59,7 @@ config IWLDVM
 
 config IWLMVM
 	tristate "Intel Wireless WiFi MVM Firmware support"
+	select BACKPORT_WANT_DEV_COREDUMP
 	help
 	  This is the driver that supports the MVM firmware which is
 	  currently only available for 7260 and 3160 devices.
drivers/net/wireless/iwlwifi/iwl-trans.h +0 -4
index d8fc548..0768f83e 100644
@@ -535,9 +535,7 @@ struct iwl_trans_ops {
 	void (*ref)(struct iwl_trans *trans);
 	void (*unref)(struct iwl_trans *trans);
 
-#ifdef CONFIG_IWLWIFI_DEBUGFS
 	struct iwl_trans_dump_data *(*dump_data)(struct iwl_trans *trans);
-#endif
 };
 
 /**
@@ -704,7 +702,6 @@ static inline void iwl_trans_unref(struct iwl_trans *trans)
 		trans->ops->unref(trans);
 }
 
-#ifdef CONFIG_IWLWIFI_DEBUGFS
 static inline struct iwl_trans_dump_data *
 iwl_trans_dump_data(struct iwl_trans *trans)
 {
@@ -712,7 +709,6 @@ iwl_trans_dump_data(struct iwl_trans *trans)
 		return NULL;
 	return trans->ops->dump_data(trans);
 }
-#endif
 
 static inline int iwl_trans_send_cmd(struct iwl_trans *trans,
 				     struct iwl_host_cmd *cmd)
drivers/net/wireless/iwlwifi/mvm/debugfs.c +0 -79

97 lines not on this page · raw message

drivers/net/wireless/iwlwifi/mvm/mac80211.c +47 -10

85 lines not on this page · raw message

drivers/net/wireless/iwlwifi/mvm/mvm.h +0 -1
index d14dc06..c2a2bba 100644
@@ -648,7 +648,6 @@ struct iwl_mvm {
 	/* -1 for always, 0 for never, >0 for that many times */
 	s8 restart_fw;
 	struct work_struct fw_error_dump_wk;
-	struct iwl_mvm_dump_ptrs *fw_error_dump;
 
 #ifdef CONFIG_IWLWIFI_LEDS
 	struct led_classdev led;
drivers/net/wireless/iwlwifi/mvm/ops.c +0 -5
index 91b28e8..bd52ecfa 100644
@@ -587,11 +587,6 @@ static void iwl_op_mode_mvm_stop(struct iwl_op_mode *op_mode)
 	ieee80211_unregister_hw(mvm->hw);
 
 	kfree(mvm->scan_cmd);
-	if (mvm->fw_error_dump) {
-		vfree(mvm->fw_error_dump->op_mode_ptr);
-		vfree(mvm->fw_error_dump->trans_ptr);
-		kfree(mvm->fw_error_dump);
-	}
 	kfree(mvm->mcast_filter_cmd);
 	mvm->mcast_filter_cmd = NULL;
 
drivers/net/wireless/iwlwifi/pcie/trans.c +0 -2
index 8027138..0cc1140 100644
@@ -2085,9 +2085,7 @@ static const struct iwl_trans_ops trans_ops_pcie = {
 	.release_nic_access = iwl_trans_pcie_release_nic_access,
 	.set_bits_mask = iwl_trans_pcie_set_bits_mask,
 
-#ifdef CONFIG_IWLWIFI_DEBUGFS
 	.dump_data = iwl_trans_pcie_dump_data,
-#endif
 };
 
 struct iwl_trans *iwl_trans_pcie_alloc(struct pci_dev *pdev,
Signature · 1 line
1.9.1
#23 lore raw

PATCH 23/25 iwlwifi: mvm: fix scan condition iterator

In reply to Emmanuel Grumbach

From: David Spinadel <[email protected]>

Scan condition iterator assumes that an interface is associated if phy_ctxt is assigned, but this isn't the sutuation in P2P device. OTOH P2P device is never associated so we can simply ignore it.

---
 drivers/net/wireless/iwlwifi/mvm/scan.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/wireless/iwlwifi/mvm/scan.c +2 -1
index 64c02a2..042fcdc 100644
@@ -270,7 +270,8 @@ static void iwl_mvm_scan_condition_iterator(void *data, u8 *mac,
 	struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
 	bool *global_bound = data;
 
-	if (mvmvif->phy_ctxt && mvmvif->phy_ctxt->id < MAX_PHYS)
+	if (vif->type != NL80211_IFTYPE_P2P_DEVICE && mvmvif->phy_ctxt &&
+	    mvmvif->phy_ctxt->id < MAX_PHYS)
 		*global_bound = true;
 }
 
Signature · 1 line
1.9.1
#24 lore raw

PATCH 24/25 iwlwifi: mvm: rs: add Tx STBC support

In reply to Emmanuel Grumbach

From: Eyal Shapira <[email protected]>

STBC is enabled on HT/VHT SISO rates in case we don't care about power consumption and it won't hurt BT.
This is done only in case the peer and our chip support STBC of course.
While at it fixed a bug which was causing bw and ldpc flags to be set incorrectly in the rate scale table in case we are switching to a legacy Tx column. This had no real impact.

---
 drivers/net/wireless/iwlwifi/mvm/rs.c | 75 ++++++++++++++++++++++++++++++-----
 drivers/net/wireless/iwlwifi/mvm/rs.h |  2 +
 2 files changed, 68 insertions(+), 9 deletions(-)
drivers/net/wireless/iwlwifi/mvm/rs.c +66 -9
index 66e971a..ce88484 100644
@@ -505,10 +505,11 @@ static const char *rs_pretty_lq_type(enum iwl_table_type type)
 static inline void rs_dump_rate(struct iwl_mvm *mvm, const struct rs_rate *rate,
 				const char *prefix)
 {
-	IWL_DEBUG_RATE(mvm, "%s: (%s: %d) ANT: %s BW: %d SGI: %d LDPC: %d\n",
+	IWL_DEBUG_RATE(mvm,
+		       "%s: (%s: %d) ANT: %s BW: %d SGI: %d LDPC: %d STBC %d\n",
 		       prefix, rs_pretty_lq_type(rate->type),
 		       rate->index, rs_pretty_ant(rate->ant),
-		       rate->bw, rate->sgi, rate->ldpc);
+		       rate->bw, rate->sgi, rate->ldpc, rate->stbc);
 }
 
 static void rs_rate_scale_clear_window(struct iwl_rate_scale_data *window)
@@ -741,6 +742,12 @@ static u32 ucode_rate_from_rs_rate(struct iwl_mvm *mvm,
 		IWL_ERR(mvm, "Invalid rate->type %d\n", rate->type);
 	}
 
+	if (is_siso(rate) && rate->stbc) {
+		/* To enable STBC we need to set both a flag and ANT_AB */
+		ucode_rate |= RATE_MCS_ANT_AB_MSK;
+		ucode_rate |= RATE_MCS_VHT_STBC_MSK;
+	}
+
 	ucode_rate |= rate->bw;
 	if (rate->sgi)
 		ucode_rate |= RATE_MCS_SGI_MSK;
@@ -785,6 +792,8 @@ static int rs_rate_from_ucode_rate(const u32 ucode_rate,
 		rate->sgi = true;
 	if (ucode_rate & RATE_MCS_LDPC_MSK)
 		rate->ldpc = true;
+	if (ucode_rate & RATE_MCS_VHT_STBC_MSK)
+		rate->stbc = true;
 
 	rate->bw = ucode_rate & RATE_MCS_CHAN_WIDTH_MSK;
 
@@ -794,7 +803,7 @@ static int rs_rate_from_ucode_rate(const u32 ucode_rate,
 
 		if (nss == 1) {
 			rate->type = LQ_HT_SISO;
-			WARN_ON_ONCE(num_of_ant != 1);
+			WARN_ON_ONCE(!rate->stbc && num_of_ant != 1);
 		} else if (nss == 2) {
 			rate->type = LQ_HT_MIMO2;
 			WARN_ON_ONCE(num_of_ant != 2);
@@ -992,7 +1001,15 @@ static void rs_get_lower_rate_down_column(struct iwl_lq_sta *lq_sta,
 static inline bool rs_rate_match(struct rs_rate *a,
 				 struct rs_rate *b)
 {
-	return (a->type == b->type) && (a->ant == b->ant) && (a->sgi == b->sgi);
+	bool ant_match;
+
+	if (a->stbc)
+		ant_match = (b->ant == ANT_A || b->ant == ANT_B);
+	else
+		ant_match = (a->ant == b->ant);
+
+	return (a->type == b->type) && (a->bw == b->bw) && (a->sgi == b->sgi)
+		&& ant_match;
 }
 
 static u32 rs_ch_width_from_mac_flags(enum mac80211_rate_control_flags flags)
@@ -1623,6 +1640,8 @@ static int rs_switch_to_column(struct iwl_mvm *mvm,
 		else
 			rate->type = LQ_LEGACY_G;
 
+		rate->bw = RATE_MCS_CHAN_WIDTH_20;
+		rate->ldpc = false;
 		rate_mask = lq_sta->active_legacy_rate;
 	} else if (column->mode == RS_SISO) {
 		rate->type = lq_sta->is_vht ? LQ_VHT_SISO : LQ_HT_SISO;
@@ -1634,8 +1653,11 @@ static int rs_switch_to_column(struct iwl_mvm *mvm,
 		WARN_ON_ONCE("Bad column mode");
 	}
 
-	rate->bw = rs_bw_from_sta_bw(sta);
-	rate->ldpc = lq_sta->ldpc;
+	if (column->mode != RS_LEGACY) {
+		rate->bw = rs_bw_from_sta_bw(sta);
+		rate->ldpc = lq_sta->ldpc;
+	}
+
 	search_tbl->column = col_id;
 	rs_set_expected_tpt_table(lq_sta, search_tbl);
 
@@ -1754,6 +1776,29 @@ out:
 	return action;
 }
 
+static bool rs_stbc_allow(struct iwl_mvm *mvm, struct ieee80211_sta *sta,
+			  struct iwl_lq_sta *lq_sta)
+{
+	struct iwl_mvm_sta *mvmsta = iwl_mvm_sta_from_mac80211(sta);
+	struct ieee80211_vif *vif = mvmsta->vif;
+	bool sta_ps_disabled = (vif->type == NL80211_IFTYPE_STATION &&
+				!vif->bss_conf.ps);
+
+	/* Our chip supports Tx STBC and the peer is an HT/VHT STA which
+	 * supports STBC of at least 1*SS
+	 */
+	if (!lq_sta->stbc)
+		return false;
+
+	if (!mvm->ps_disabled && !sta_ps_disabled)
+		return false;
+
+	if (!iwl_mvm_bt_coex_is_mimo_allowed(mvm, sta))
+		return false;
+
+	return true;
+}
+
 static void rs_get_adjacent_txp(struct iwl_mvm *mvm, int index,
 				int *weaker, int *stronger)
 {
@@ -2675,6 +2720,11 @@ void iwl_mvm_rs_rate_init(struct iwl_mvm *mvm, struct ieee80211_sta *sta,
 		if (mvm->cfg->ht_params->ldpc &&
 		    (ht_cap->cap & IEEE80211_HT_CAP_LDPC_CODING))
 			lq_sta->ldpc = true;
+
+		if (mvm->cfg->ht_params->stbc &&
+		    (num_of_ant(mvm->fw->valid_tx_ant) > 1) &&
+		    (ht_cap->cap & IEEE80211_HT_CAP_RX_STBC))
+			lq_sta->stbc = true;
 	} else {
 		rs_vht_set_enabled_rates(sta, vht_cap, lq_sta);
 		lq_sta->is_vht = true;
@@ -2682,6 +2732,11 @@ void iwl_mvm_rs_rate_init(struct iwl_mvm *mvm, struct ieee80211_sta *sta,
 		if (mvm->cfg->ht_params->ldpc &&
 		    (vht_cap->cap & IEEE80211_VHT_CAP_RXLDPC))
 			lq_sta->ldpc = true;
+
+		if (mvm->cfg->ht_params->stbc &&
+		    (num_of_ant(mvm->fw->valid_tx_ant) > 1) &&
+		    (vht_cap->cap & IEEE80211_VHT_CAP_RXSTBC_MASK))
+			lq_sta->stbc = true;
 	}
 
 	if (IWL_MVM_RS_DISABLE_MIMO)
@@ -2695,11 +2750,11 @@ void iwl_mvm_rs_rate_init(struct iwl_mvm *mvm, struct ieee80211_sta *sta,
 						   BITS_PER_LONG);
 
 	IWL_DEBUG_RATE(mvm,
-		       "RATE MASK: LEGACY=%lX SISO=%lX MIMO2=%lX VHT=%d LDPC=%d\n",
+		       "RATE MASK: LEGACY=%lX SISO=%lX MIMO2=%lX VHT=%d LDPC=%d STBC%d\n",
 		       lq_sta->active_legacy_rate,
 		       lq_sta->active_siso_rate,
 		       lq_sta->active_mimo2_rate,
-		       lq_sta->is_vht, lq_sta->ldpc);
+		       lq_sta->is_vht, lq_sta->ldpc, lq_sta->stbc);
 	IWL_DEBUG_RATE(mvm, "MAX RATE: LEGACY=%d SISO=%d MIMO2=%d\n",
 		       lq_sta->max_legacy_rate_idx,
 		       lq_sta->max_siso_rate_idx,
@@ -2823,6 +2878,7 @@ static void rs_fill_rates_for_column(struct iwl_mvm *mvm,
  * rate[15] 0x800D Legacy | ANT: B Rate: 6 Mbps
  */
 static void rs_build_rates_table(struct iwl_mvm *mvm,
+				 struct ieee80211_sta *sta,
 				 struct iwl_lq_sta *lq_sta,
 				 const struct rs_rate *initial_rate)
 {
@@ -2835,6 +2891,7 @@ static void rs_build_rates_table(struct iwl_mvm *mvm,
 	memcpy(&rate, initial_rate, sizeof(rate));
 
 	valid_tx_ant = mvm->fw->valid_tx_ant;
+	rate.stbc = rs_stbc_allow(mvm, sta, lq_sta);
 
 	if (is_siso(&rate)) {
 		num_rates = RS_INITIAL_SISO_NUM_RATES;
@@ -2906,7 +2963,7 @@ static void rs_fill_lq_cmd(struct iwl_mvm *mvm,
 	if (WARN_ON_ONCE(!sta || !initial_rate))
 		return;
 
-	rs_build_rates_table(mvm, lq_sta, initial_rate);
+	rs_build_rates_table(mvm, sta, lq_sta, initial_rate);
 
 	if (num_of_ant(initial_rate->ant) == 1)
 		lq_cmd->single_stream_ant_msk = initial_rate->ant;
drivers/net/wireless/iwlwifi/mvm/rs.h +2 -0
index eb34c12..defd70a 100644
@@ -208,6 +208,7 @@ struct rs_rate {
 	u32 bw;
 	bool sgi;
 	bool ldpc;
+	bool stbc;
 };
 
 
@@ -331,6 +332,7 @@ struct iwl_lq_sta {
 	u64 last_tx;
 	bool is_vht;
 	bool ldpc;              /* LDPC Rx is supported by the STA */
+	bool stbc;              /* Tx STBC is supported by chip and Rx by STA */
 	enum ieee80211_band band;
 
 	/* The following are bitmaps of rates; IWL_RATE_6M_MASK, etc. */
Signature · 1 line
1.9.1
#25 lore raw

PATCH 25/25 iwlwifi: mvm: unref SCAN ref on scan completion

In reply to Emmanuel Grumbach

From: Eliad Peller <[email protected]>

The scan reference wasn't released in case of offloaded scan, causing the refcount to go wrong and prevent the device from going into d0i3.

---
 drivers/net/wireless/iwlwifi/mvm/scan.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/net/wireless/iwlwifi/mvm/scan.c +6 -1
index 042fcdc..5cd59a4 100644
@@ -673,6 +673,7 @@ int iwl_mvm_rx_scan_offload_complete_notif(struct iwl_mvm *mvm,
 		mvm->scan_status = IWL_MVM_SCAN_NONE;
 		ieee80211_scan_completed(mvm->hw,
 					 status == IWL_SCAN_OFFLOAD_ABORTED);
+		iwl_mvm_unref(mvm, IWL_MVM_REF_SCAN);
 	}
 
 	mvm->last_ebs_successful = !ebs_status;
@@ -1107,8 +1108,12 @@ int iwl_mvm_scan_offload_stop(struct iwl_mvm *mvm, bool notify)
 	/*
 	 * Clear the scan status so the next scan requests will succeed. This
 	 * also ensures the Rx handler doesn't do anything, as the scan was
-	 * stopped from above.
+	 * stopped from above. Since the rx handler won't do anything now,
+	 * we have to release the scan reference here.
 	 */
+	if (mvm->scan_status == IWL_MVM_SCAN_OS)
+		iwl_mvm_unref(mvm, IWL_MVM_REF_SCAN);
+
 	mvm->scan_status = IWL_MVM_SCAN_NONE;
 
 	if (notify) {
Signature · 1 line
1.9.1
#26 lore raw
In reply to Emmanuel Grumbach
Quoted 21 lines · Emmanuel Grumbach

Hi John,

Here is a pull request for 3.19. More details below.

Thanks!

The following changes since commit 35a9ad8af0bb0fa3525e6d0d20e32551d226f38e:

Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next
(2014-10-08 21:40:54 -0400)

are available in the git repository at:

git://git.kernel.org/pub/scm/linux/kernel/git/iwlwifi/iwlwifi-next.git
tags/iwlwifi-next-for-john-2014-10-29

for you to fetch changes up to d9e4d61c5b900f6938b4aa49f25a0db37aeb23b6:

iwlwifi: mvm: unref SCAN ref on scan completion (2014-10-29 13:14:41 +0200)

Quoted 8 lines

----------------------------------------------------------------
The big new thing here is netdetect which allows the firmware to wake up the platform when a specific network is detected. Along with that I have fixes for d3 operation. The usual amount of rate scaling stuff - we now support STBC. The other commit that stands out is Johannes's work on devcoredump. He basically starts to use the standard infrastructure he built.

Pulling now...

Signature · 2 lines
John W. Linville		Someday the world will need a hero, and you
[email protected]			might be all we have.  Be ready.