iwlwifi: mvm: fix the net-detect SSIDs report order
authorLuciano Coelho <luciano.coelho@intel.com>
Wed, 6 May 2015 07:45:42 +0000 (10:45 +0300)
committerEmmanuel Grumbach <emmanuel.grumbach@intel.com>
Thu, 28 May 2015 10:35:18 +0000 (13:35 +0300)
After the scan refactor, the order of the SSIDs passed to the firmware
in all scans (including net-detect) are inverted.  This was causing
the reporting code to use the wrong SSIDs.  To fix this, invert the
array index when accessing the saved match SSIDs to report the
wake-up.

Signed-off-by: Luciano Coelho <luciano.coelho@intel.com>
Reviewed-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
drivers/net/wireless/iwlwifi/mvm/d3.c

index d30f168dcafe3cc44deedab0afc3e11529eb0110..408b0ce42ddec375448f2c8d4b40aa29d17eedb5 100644 (file)
@@ -1785,7 +1785,7 @@ static void iwl_mvm_query_netdetect_reasons(struct iwl_mvm *mvm,
        for_each_set_bit(i, &matched_profiles, mvm->n_nd_match_sets) {
                struct iwl_scan_offload_profile_match *fw_match;
                struct cfg80211_wowlan_nd_match *match;
-               int n_channels = 0;
+               int idx, n_channels = 0;
 
                fw_match = &query.matches[i];
 
@@ -1800,8 +1800,12 @@ static void iwl_mvm_query_netdetect_reasons(struct iwl_mvm *mvm,
 
                net_detect->matches[net_detect->n_matches++] = match;
 
-               match->ssid.ssid_len = mvm->nd_match_sets[i].ssid.ssid_len;
-               memcpy(match->ssid.ssid, mvm->nd_match_sets[i].ssid.ssid,
+               /* We inverted the order of the SSIDs in the scan
+                * request, so invert the index here.
+                */
+               idx = mvm->n_nd_match_sets - i - 1;
+               match->ssid.ssid_len = mvm->nd_match_sets[idx].ssid.ssid_len;
+               memcpy(match->ssid.ssid, mvm->nd_match_sets[idx].ssid.ssid,
                       match->ssid.ssid_len);
 
                if (mvm->n_nd_channels < n_channels)