linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
To: linux-wireless@vger.kernel.org
Cc: Luca Coelho <luciano.coelho@intel.com>,
	Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Subject: [PATCH 06/43] iwlwifi: mvm: handle pass all scan reporting
Date: Wed,  2 Mar 2016 09:56:07 +0200	[thread overview]
Message-ID: <1456905404-14435-6-git-send-email-emmanuel.grumbach@intel.com> (raw)
In-Reply-To: <0BA3FCBA62E2DC44AF3030971E174FB32EA50146@hasmsx107.ger.corp.intel.com>

From: Luca Coelho <luciano.coelho@intel.com>

The firmware doesn't send match found notifications when no matchsets
are passed.  This makes sense because if there are no matchsets,
nothing can be matched.  But the nl80211 API should report when there
are results available, even if no matchsets were passed.

To handle this, we can use the firmware's ITERATION_COMPLETE
reporting, which will send us notifications every time it completed a
scheduled scan iteration.  Then we can set a flag when we received
beacons and use that to report that results are available.

Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
---
 drivers/net/wireless/intel/iwlwifi/mvm/mvm.h  |  7 ++++++
 drivers/net/wireless/intel/iwlwifi/mvm/rx.c   |  6 +++++
 drivers/net/wireless/intel/iwlwifi/mvm/scan.c | 36 +++++++++++++++++++++++----
 3 files changed, 44 insertions(+), 5 deletions(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h b/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
index d867cb4..bb811a2 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
@@ -493,6 +493,12 @@ enum iwl_mvm_scan_type {
 	IWL_SCAN_TYPE_FRAGMENTED,
 };
 
+enum iwl_mvm_sched_scan_pass_all_states {
+	SCHED_SCAN_PASS_ALL_DISABLED,
+	SCHED_SCAN_PASS_ALL_ENABLED,
+	SCHED_SCAN_PASS_ALL_FOUND,
+};
+
 /**
  * struct iwl_nvm_section - describes an NVM section in memory.
  *
@@ -687,6 +693,7 @@ struct iwl_mvm {
 	void *scan_cmd;
 	struct iwl_mcast_filter_cmd *mcast_filter_cmd;
 	enum iwl_mvm_scan_type scan_type;
+	enum iwl_mvm_sched_scan_pass_all_states sched_scan_pass_all;
 
 	/* max number of simultaneous scans the FW supports */
 	unsigned int max_scans;
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/rx.c b/drivers/net/wireless/intel/iwlwifi/mvm/rx.c
index 145ec68..055a8b0 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/rx.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/rx.c
@@ -448,6 +448,12 @@ void iwl_mvm_rx_rx_mpdu(struct iwl_mvm *mvm, struct napi_struct *napi,
 	iwl_mvm_update_frame_stats(mvm, rate_n_flags,
 				   rx_status->flag & RX_FLAG_AMPDU_DETAILS);
 #endif
+
+	if (unlikely((ieee80211_is_beacon(hdr->frame_control) ||
+		      ieee80211_is_probe_resp(hdr->frame_control)) &&
+		     mvm->sched_scan_pass_all == SCHED_SCAN_PASS_ALL_ENABLED))
+		mvm->sched_scan_pass_all = SCHED_SCAN_PASS_ALL_FOUND;
+
 	iwl_mvm_pass_packet_to_mac80211(mvm, napi, skb, hdr, len, ampdu_status,
 					crypt_len, rxb);
 }
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/scan.c b/drivers/net/wireless/intel/iwlwifi/mvm/scan.c
index aa6d807..09eb72c 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/scan.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/scan.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
@@ -297,6 +299,12 @@ void iwl_mvm_rx_lmac_scan_iter_complete_notif(struct iwl_mvm *mvm,
 		       iwl_mvm_dump_channel_list(notif->results,
 						 notif->scanned_channels, buf,
 						 sizeof(buf)));
+
+	if (mvm->sched_scan_pass_all == SCHED_SCAN_PASS_ALL_FOUND) {
+		IWL_DEBUG_SCAN(mvm, "Pass all scheduled scan results found\n");
+		ieee80211_sched_scan_results(mvm->hw);
+		mvm->sched_scan_pass_all = SCHED_SCAN_PASS_ALL_ENABLED;
+	}
 }
 
 void iwl_mvm_rx_scan_match_found(struct iwl_mvm *mvm,
@@ -380,6 +388,7 @@ void iwl_mvm_rx_lmac_scan_complete_notif(struct iwl_mvm *mvm,
 
 		mvm->scan_status &= ~IWL_MVM_SCAN_SCHED;
 		ieee80211_sched_scan_stopped(mvm->hw);
+		mvm->sched_scan_pass_all = SCHED_SCAN_PASS_ALL_DISABLED;
 	} else if (mvm->scan_status & IWL_MVM_SCAN_REGULAR) {
 		IWL_DEBUG_SCAN(mvm, "Regular scan %s, EBS status %s (FW)\n",
 			       aborted ? "aborted" : "completed",
@@ -533,10 +542,13 @@ static bool iwl_mvm_scan_pass_all(struct iwl_mvm *mvm,
 		IWL_DEBUG_SCAN(mvm,
 			       "Sending scheduled scan with filtering, n_match_sets %d\n",
 			       req->n_match_sets);
+		mvm->sched_scan_pass_all = SCHED_SCAN_PASS_ALL_DISABLED;
 		return false;
 	}
 
 	IWL_DEBUG_SCAN(mvm, "Sending Scheduled scan without filtering\n");
+
+	mvm->sched_scan_pass_all = SCHED_SCAN_PASS_ALL_ENABLED;
 	return true;
 }
 
@@ -788,6 +800,9 @@ static int iwl_mvm_scan_lmac_flags(struct iwl_mvm *mvm,
 		flags |= IWL_MVM_LMAC_SCAN_FLAG_ITER_COMPLETE;
 #endif
 
+	if (mvm->sched_scan_pass_all == SCHED_SCAN_PASS_ALL_ENABLED)
+		flags |= IWL_MVM_LMAC_SCAN_FLAG_ITER_COMPLETE;
+
 	if (iwl_mvm_is_regular_scan(params) &&
 	    vif->type != NL80211_IFTYPE_P2P_DEVICE &&
 	    params->type != IWL_SCAN_TYPE_FRAGMENTED)
@@ -1074,6 +1089,9 @@ static u32 iwl_mvm_scan_umac_flags(struct iwl_mvm *mvm,
 		flags |= IWL_UMAC_SCAN_GEN_FLAGS_ITER_COMPLETE;
 #endif
 
+	if (mvm->sched_scan_pass_all == SCHED_SCAN_PASS_ALL_ENABLED)
+		flags |= IWL_UMAC_SCAN_GEN_FLAGS_ITER_COMPLETE;
+
 	if (iwl_mvm_is_regular_scan(params) &&
 	    vif->type != NL80211_IFTYPE_P2P_DEVICE &&
 	    params->type != IWL_SCAN_TYPE_FRAGMENTED)
@@ -1301,10 +1319,6 @@ int iwl_mvm_sched_scan_start(struct iwl_mvm *mvm,
 		return -EBUSY;
 	}
 
-	/* we don't support "match all" in the firmware */
-	if (!req->n_match_sets)
-		return -EOPNOTSUPP;
-
 	ret = iwl_mvm_check_running_scans(mvm, type);
 	if (ret)
 		return ret;
@@ -1400,6 +1414,7 @@ void iwl_mvm_rx_umac_scan_complete_notif(struct iwl_mvm *mvm,
 		iwl_mvm_unref(mvm, IWL_MVM_REF_SCAN);
 	} else if (mvm->scan_uid_status[uid] == IWL_MVM_SCAN_SCHED) {
 		ieee80211_sched_scan_stopped(mvm->hw);
+		mvm->sched_scan_pass_all = SCHED_SCAN_PASS_ALL_DISABLED;
 	}
 
 	mvm->scan_status &= ~mvm->scan_uid_status[uid];
@@ -1434,6 +1449,12 @@ void iwl_mvm_rx_umac_scan_iter_complete_notif(struct iwl_mvm *mvm,
 		       iwl_mvm_dump_channel_list(notif->results,
 						 notif->scanned_channels, buf,
 						 sizeof(buf)));
+
+	if (mvm->sched_scan_pass_all == SCHED_SCAN_PASS_ALL_FOUND) {
+		IWL_DEBUG_SCAN(mvm, "Pass all scheduled scan results found\n");
+		ieee80211_sched_scan_results(mvm->hw);
+		mvm->sched_scan_pass_all = SCHED_SCAN_PASS_ALL_ENABLED;
+	}
 }
 
 static int iwl_mvm_umac_scan_abort(struct iwl_mvm *mvm, int type)
@@ -1528,6 +1549,7 @@ void iwl_mvm_report_scan_aborted(struct iwl_mvm *mvm)
 		uid = iwl_mvm_scan_uid_by_status(mvm, IWL_MVM_SCAN_SCHED);
 		if (uid >= 0 && !mvm->restart_fw) {
 			ieee80211_sched_scan_stopped(mvm->hw);
+			mvm->sched_scan_pass_all = SCHED_SCAN_PASS_ALL_DISABLED;
 			mvm->scan_uid_status[uid] = 0;
 		}
 
@@ -1549,8 +1571,11 @@ void iwl_mvm_report_scan_aborted(struct iwl_mvm *mvm)
 		 * restart_hw, so do not report if FW is about to be
 		 * restarted.
 		 */
-		if ((mvm->scan_status & IWL_MVM_SCAN_SCHED) && !mvm->restart_fw)
+		if ((mvm->scan_status & IWL_MVM_SCAN_SCHED) &&
+		    !mvm->restart_fw) {
 			ieee80211_sched_scan_stopped(mvm->hw);
+			mvm->sched_scan_pass_all = SCHED_SCAN_PASS_ALL_DISABLED;
+		}
 	}
 }
 
@@ -1586,6 +1611,7 @@ out:
 			ieee80211_scan_completed(mvm->hw, true);
 	} else if (notify) {
 		ieee80211_sched_scan_stopped(mvm->hw);
+		mvm->sched_scan_pass_all = SCHED_SCAN_PASS_ALL_DISABLED;
 	}
 
 	return ret;
-- 
2.5.0


  parent reply	other threads:[~2016-03-02  7:56 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-02  7:51 pull request: iwlwifi-next 2016-03-02 Grumbach, Emmanuel
2016-03-02  7:56 ` [PATCH 01/43] iwlwifi: mvm: add CT-KILL notification Emmanuel Grumbach
2016-03-02  7:56 ` [PATCH 02/43] iwlwifi: mvm: add registration to thermal zone Emmanuel Grumbach
2016-03-04 18:39   ` Bjørn Mork
2016-03-04 18:53     ` Bjørn Mork
2016-03-04 19:57       ` Coelho, Luciano
2016-03-04 20:22         ` Bjørn Mork
2016-03-04 20:30           ` Coelho, Luciano
2016-03-04 19:52     ` Coelho, Luciano
2016-03-02  7:56 ` [PATCH 03/43] iwlwifi: mvm: add registration to cooling device Emmanuel Grumbach
2016-03-02  7:56 ` [PATCH 04/43] iwlwifi: mvm: set the correct descriptor size for tracing Emmanuel Grumbach
2016-03-02  7:56 ` [PATCH 05/43] iwlwifi: mvm: fix RSS key sizing Emmanuel Grumbach
2016-03-02  7:56 ` Emmanuel Grumbach [this message]
2016-03-02  7:56 ` [PATCH 07/43] iwlwifi: mvm: rs: fix a theoretical access to uninitialized array elements Emmanuel Grumbach
2016-03-02  7:56 ` [PATCH 08/43] iwlwifi: mvm: bump firmware API to 21 Emmanuel Grumbach
2016-03-02  7:56 ` [PATCH 09/43] iwlwifi: pcie: aggregate Flow Handler configuration writes Emmanuel Grumbach
2016-03-02  7:56 ` [PATCH 10/43] iwlwifi: pcie: Add new configuration to enable MSIX Emmanuel Grumbach
2016-03-02  7:56 ` [PATCH 11/43] iwlwifi: pcie: fix identation in trans.c Emmanuel Grumbach
2016-03-02  7:56 ` [PATCH 12/43] iwlwifi: mvm: enable VHT MU-MIMO for supported hardware Emmanuel Grumbach
2016-03-02  7:56 ` [PATCH 13/43] iwlwifi: mvm: update firmware of VHT MU-MIMO groups status on restart Emmanuel Grumbach
2016-03-02  7:56 ` [PATCH 14/43] iwlwifi: mvm: send large SKBs to the transport Emmanuel Grumbach
2016-03-02  7:56 ` [PATCH 15/43] iwlwifi: mvm: add Tx A-MSDU inside A-MPDU Emmanuel Grumbach
2016-03-02  7:56 ` [PATCH 16/43] iwlwifi: mvm: allow to limit the A-MSDU from debugfs Emmanuel Grumbach
2016-03-02  7:56 ` [PATCH 17/43] iwlwifi: mvm: don't enable A-MSDU when the rates are too low Emmanuel Grumbach
2016-03-02  7:56 ` [PATCH 18/43] iwlwifi: mvm: don't send an A-MSDU that is larger than the TXF Emmanuel Grumbach
2016-03-02  7:56 ` [PATCH 19/43] iwlwifi: support tracing wide commands Emmanuel Grumbach
2016-03-02  7:56 ` [PATCH 20/43] iwlwifi: mvm: update rx_status with mactime flag Emmanuel Grumbach
2016-03-02  7:56 ` [PATCH 21/43] iwlwifi: mvm: support filtered frames notification Emmanuel Grumbach
2016-03-02  7:56 ` [PATCH 22/43] iwlwifi: pcie: configure more RFH settings Emmanuel Grumbach
2016-03-02  7:56 ` [PATCH 23/43] iwlwifi: pcie: add pm_prepare and pm_complete ops Emmanuel Grumbach
2016-03-02  7:56 ` [PATCH 24/43] iwlwifi: pcie: prevent skbs shadowing in iwl_trans_pcie_reclaim Emmanuel Grumbach
2016-03-02  7:56 ` [PATCH 25/43] iwlwifi: mvm: add duplicate packet detection per rx queue Emmanuel Grumbach
2016-03-02  7:56 ` [PATCH 26/43] iwlwifi: mvm: add RSS queues notification infrastructure Emmanuel Grumbach
2016-03-02  7:56 ` [PATCH 27/43] iwlwifi: mvm: remove unused field in iwl_mvm_tid_data Emmanuel Grumbach
2016-03-02  7:56 ` [PATCH 28/43] iwlwifi: mvm: support VHT MU-MIMO notification Emmanuel Grumbach
2016-03-02  7:56 ` [PATCH 29/43] iwlwifi: mvm: various trivial cleanups Emmanuel Grumbach
2016-03-02  7:56 ` [PATCH 30/43] iwlwifi: mvm: Set global RRM capability Emmanuel Grumbach
2016-03-02  7:56 ` [PATCH 31/43] iwlwifi: mvm: forbid U-APSD for P2P Client if the firmware doesn't support it Emmanuel Grumbach
2016-03-02  7:56 ` [PATCH 32/43] iwlwifi: mvm: Send power command on BSS_CHANGED_BEACON_INFO if needed Emmanuel Grumbach
2016-03-02  7:56 ` [PATCH 33/43] iwlwifi: mvm: take care of padded packets Emmanuel Grumbach
2016-03-02  7:56 ` [PATCH 34/43] iwlwifi: mvm: kill iwl_mvm_enable_agg_txq Emmanuel Grumbach
2016-03-02  7:56 ` [PATCH 35/43] iwlwifi: mvm: Disable beacon storing in D3 when WOWLAN configured Emmanuel Grumbach
2016-03-02  7:56 ` [PATCH 36/43] iwlwifi: support ucode with d0 unified image - regular and usniffer Emmanuel Grumbach
2016-03-02  7:56 ` [PATCH 37/43] iwlwifi: mvm: update ucode status before stopping device Emmanuel Grumbach
2016-03-02  7:56 ` [PATCH 38/43] iwlwifi: pcie: detect and workaround invalid write ptr behavior Emmanuel Grumbach
2016-03-02  7:56 ` [PATCH 39/43] iwlwifi: mvm: disable DQA support Emmanuel Grumbach
2016-03-02  7:56 ` [PATCH 40/43] iwlwifi: mvm: only release the trans ref if d0i3 is supported in fw Emmanuel Grumbach
2016-03-02  7:56 ` [PATCH 41/43] iwlwifi: add disable_11ac module param Emmanuel Grumbach
2016-03-02  7:56 ` [PATCH 42/43] iwlwifi: mvm: take the transport ref back when leaving Emmanuel Grumbach
2016-03-02  7:56 ` [PATCH 43/43] iwlwifi: mvm: support sw queue start/stop from mvm Emmanuel Grumbach
2016-03-07 13:50 ` pull request: iwlwifi-next 2016-03-02 Kalle Valo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1456905404-14435-6-git-send-email-emmanuel.grumbach@intel.com \
    --to=emmanuel.grumbach@intel.com \
    --cc=linux-wireless@vger.kernel.org \
    --cc=luciano.coelho@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).