iwlwifi: mvm: Set RRM_ENABLED bit in scan commands
authorAndrei Otcheretianski <andrei.otcheretianski@intel.com>
Wed, 9 Jul 2014 15:59:14 +0000 (18:59 +0300)
committerEmmanuel Grumbach <emmanuel.grumbach@intel.com>
Tue, 16 Sep 2014 09:57:50 +0000 (12:57 +0300)
Set RRM_ENABLED (bit 6) flag in scan commands. When this flag is set
the fw will add WFA vendor-specific TPC report and DS parameter set
IEs into probe requests.
This bit is set for SCAN_OFFLOAD_REQUEST_CMD(0x51).

Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
Reviewed-by: Assaf Krauss <assaf.krauss@intel.com>
Reviewed-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
drivers/net/wireless/iwlwifi/iwl-fw.h
drivers/net/wireless/iwlwifi/mvm/fw-api-scan.h
drivers/net/wireless/iwlwifi/mvm/mac80211.c
drivers/net/wireless/iwlwifi/mvm/scan.c

index 081a93d..e337546 100644 (file)
@@ -148,11 +148,17 @@ enum iwl_ucode_tlv_api {
  * @IWL_UCODE_TLV_CAPA_TXPOWER_INSERTION_SUPPORT: supports insertion of current
  *     tx power value into TPC Report action frame and Link Measurement Report
  *     action frame
+ * @IWL_UCODE_TLV_CAPA_DS_PARAM_SET_IE_SUPPORT: supports adding DS params
+ *     element in probe requests.
+ * @IWL_UCODE_TLV_CAPA_WFA_TPC_REP_IE_SUPPORT: supports adding TPC Report IE in
+ *     probe requests.
  * @IWL_UCODE_TLV_CAPA_QUIET_PERIOD_SUPPORT: supports Quiet Period requests
  */
 enum iwl_ucode_tlv_capa {
        IWL_UCODE_TLV_CAPA_D0I3_SUPPORT                 = BIT(0),
        IWL_UCODE_TLV_CAPA_TXPOWER_INSERTION_SUPPORT    = BIT(8),
+       IWL_UCODE_TLV_CAPA_DS_PARAM_SET_IE_SUPPORT      = BIT(9),
+       IWL_UCODE_TLV_CAPA_WFA_TPC_REP_IE_SUPPORT       = BIT(10),
        IWL_UCODE_TLV_CAPA_QUIET_PERIOD_SUPPORT         = BIT(11),
 };
 
index 8f22166..1354c68 100644 (file)
@@ -670,6 +670,8 @@ struct iwl_scan_channel_opt {
  * @IWL_MVM_LMAC_SCAN_FLAG_ITER_COMPLETE: send iteration complete notification
  * @IWL_MVM_LMAC_SCAN_FLAG_MULTIPLE_SSIDS multiple SSID matching
  * @IWL_MVM_LMAC_SCAN_FLAG_FRAGMENTED: all passive scans will be fragmented
+ * @IWL_MVM_LMAC_SCAN_FLAGS_RRM_ENABLED: insert WFA vendor-specific TPC report
+ *     and DS parameter set IEs into probe requests.
  */
 enum iwl_mvm_lmac_scan_flags {
        IWL_MVM_LMAC_SCAN_FLAG_PASS_ALL         = BIT(0),
@@ -678,6 +680,7 @@ enum iwl_mvm_lmac_scan_flags {
        IWL_MVM_LMAC_SCAN_FLAG_ITER_COMPLETE    = BIT(3),
        IWL_MVM_LMAC_SCAN_FLAG_MULTIPLE_SSIDS   = BIT(4),
        IWL_MVM_LMAC_SCAN_FLAG_FRAGMENTED       = BIT(5),
+       IWL_MVM_LMAC_SCAN_FLAGS_RRM_ENABLED     = BIT(6),
 };
 
 enum iwl_scan_priority {
index 5a169ab..bd12f8e 100644 (file)
@@ -419,6 +419,15 @@ int iwl_mvm_mac_setup_register(struct iwl_mvm *mvm)
            IWL_UCODE_TLV_CAPA_QUIET_PERIOD_SUPPORT)
                hw->wiphy->features |= NL80211_FEATURE_QUIET;
 
+       if (mvm->fw->ucode_capa.capa[0] &
+           IWL_UCODE_TLV_CAPA_DS_PARAM_SET_IE_SUPPORT)
+               hw->wiphy->features |=
+                       NL80211_FEATURE_DS_PARAM_SET_IE_IN_PROBES;
+
+       if (mvm->fw->ucode_capa.capa[0] &
+           IWL_UCODE_TLV_CAPA_WFA_TPC_REP_IE_SUPPORT)
+               hw->wiphy->features |= NL80211_FEATURE_WFA_TPC_IE_IN_PROBES;
+
        mvm->rts_threshold = IEEE80211_MAX_RTS_THRESHOLD;
 
        /* currently FW API supports only one optional cipher scheme */
index 09545f2..076fe1b 100644 (file)
@@ -339,6 +339,13 @@ not_bound:
        }
 }
 
+static inline bool iwl_mvm_rrm_scan_needed(struct iwl_mvm *mvm)
+{
+       /* require rrm scan whenever the fw supports it */
+       return mvm->fw->ucode_capa.capa[0] &
+              IWL_UCODE_TLV_CAPA_DS_PARAM_SET_IE_SUPPORT;
+}
+
 int iwl_mvm_scan_request(struct iwl_mvm *mvm,
                         struct ieee80211_vif *vif,
                         struct cfg80211_scan_request *req)
@@ -1153,6 +1160,10 @@ iwl_mvm_build_generic_unified_scan_cmd(struct iwl_mvm *mvm,
                                    IWL_SCAN_CHANNEL_FLAG_EBS_ACCURATE |
                                    IWL_SCAN_CHANNEL_FLAG_CACHE_ADD);
        }
+
+       if (iwl_mvm_rrm_scan_needed(mvm))
+               cmd->scan_flags |=
+                       cpu_to_le32(IWL_MVM_LMAC_SCAN_FLAGS_RRM_ENABLED);
 }
 
 int iwl_mvm_unified_scan_lmac(struct iwl_mvm *mvm,
@@ -1208,7 +1219,7 @@ int iwl_mvm_unified_scan_lmac(struct iwl_mvm *mvm,
        if (req->req.n_ssids == 0)
                flags |= IWL_MVM_LMAC_SCAN_FLAG_PASSIVE;
 
-       cmd->scan_flags = cpu_to_le32(flags);
+       cmd->scan_flags |= cpu_to_le32(flags);
 
        cmd->flags = iwl_mvm_scan_rxon_flags(req->req.channels[0]->band);
        cmd->filter_flags = cpu_to_le32(MAC_FILTER_ACCEPT_GRP |
@@ -1305,7 +1316,7 @@ int iwl_mvm_unified_sched_scan_lmac(struct iwl_mvm *mvm,
        if (req->n_ssids == 0)
                flags |= IWL_MVM_LMAC_SCAN_FLAG_PASSIVE;
 
-       cmd->scan_flags = cpu_to_le32(flags);
+       cmd->scan_flags |= cpu_to_le32(flags);
 
        cmd->flags = iwl_mvm_scan_rxon_flags(req->channels[0]->band);
        cmd->filter_flags = cpu_to_le32(MAC_FILTER_ACCEPT_GRP |