iwlwifi: mvm: differentiate net-detect from sched scan
[firefly-linux-kernel-4.4.55.git] / drivers / net / wireless / iwlwifi / mvm / mvm.h
index 4b5c8f66df8baa865c7f6d0f8f3f885c9193ceef..a8f51a824a7532bd7f378b5b9a4300442bbbacda 100644 (file)
@@ -6,7 +6,7 @@
  * GPL LICENSE SUMMARY
  *
  * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
- * Copyright(c) 2013 - 2014 Intel Mobile Communications GmbH
+ * Copyright(c) 2013 - 2015 Intel Mobile Communications 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
@@ -32,7 +32,7 @@
  * BSD LICENSE
  *
  * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
- * Copyright(c) 2013 - 2014 Intel Mobile Communications GmbH
+ * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -349,11 +349,12 @@ struct iwl_mvm_vif_bf_data {
  * @bcast_sta: station used for broadcast packets. Used by the following
  *  vifs: P2P_DEVICE, GO and AP.
  * @beacon_skb: the skb used to hold the AP/GO beacon template
- * @smps_requests: the SMPS requests of differents parts of the driver,
+ * @smps_requests: the SMPS requests of different parts of the driver,
  *     combined on update to yield the overall request to mac80211.
  * @beacon_stats: beacon statistics, containing the # of received beacons,
  *     # of received beacons accumulated over FW restart, and the current
  *     average signal of beacons retrieved from the firmware
+ * @csa_failed: CSA failed to schedule time event, report an error later
  */
 struct iwl_mvm_vif {
        struct iwl_mvm *mvm;
@@ -433,6 +434,7 @@ struct iwl_mvm_vif {
 
        /* Indicates that CSA countdown may be started */
        bool csa_countdown;
+       bool csa_failed;
 };
 
 static inline struct iwl_mvm_vif *
@@ -444,9 +446,23 @@ iwl_mvm_vif_from_mac80211(struct ieee80211_vif *vif)
 extern const u8 tid_to_mac80211_ac[];
 
 enum iwl_scan_status {
-       IWL_MVM_SCAN_NONE,
-       IWL_MVM_SCAN_OS,
-       IWL_MVM_SCAN_SCHED,
+       IWL_MVM_SCAN_REGULAR            = BIT(0),
+       IWL_MVM_SCAN_SCHED              = BIT(1),
+       IWL_MVM_SCAN_NETDETECT          = BIT(2),
+
+       IWL_MVM_SCAN_STOPPING_REGULAR   = BIT(8),
+       IWL_MVM_SCAN_STOPPING_SCHED     = BIT(9),
+       IWL_MVM_SCAN_STOPPING_NETDETECT = BIT(10),
+
+       IWL_MVM_SCAN_REGULAR_MASK       = IWL_MVM_SCAN_REGULAR |
+                                         IWL_MVM_SCAN_STOPPING_REGULAR,
+       IWL_MVM_SCAN_SCHED_MASK         = IWL_MVM_SCAN_SCHED |
+                                         IWL_MVM_SCAN_STOPPING_SCHED,
+       IWL_MVM_SCAN_NETDETECT_MASK     = IWL_MVM_SCAN_NETDETECT |
+                                         IWL_MVM_SCAN_STOPPING_NETDETECT,
+
+       IWL_MVM_SCAN_STOPPING_MASK      = 0xff00,
+       IWL_MVM_SCAN_MASK               = 0x00ff,
 };
 
 /**
@@ -601,7 +617,6 @@ struct iwl_mvm {
 
        enum iwl_ucode_type cur_ucode;
        bool ucode_loaded;
-       bool init_ucode_complete;
        bool calibrating;
        u32 error_event_table;
        u32 log_event_table;
@@ -646,12 +661,15 @@ struct iwl_mvm {
        u32 rts_threshold;
 
        /* Scan status, cmd (pre-allocated) and auxiliary station */
-       enum iwl_scan_status scan_status;
+       unsigned int scan_status;
        void *scan_cmd;
        struct iwl_mcast_filter_cmd *mcast_filter_cmd;
 
+       /* max number of simultaneous scans the FW supports */
+       unsigned int max_scans;
+
        /* UMAC scan tracking */
-       u32 scan_uid[IWL_MVM_MAX_SIMULTANEOUS_SCANS];
+       u32 scan_uid[IWL_MVM_MAX_UMAC_SCANS];
        u8 scan_seq_num, sched_scan_seq_num;
 
        /* rx chain antennas set through debugfs for the scan command */
@@ -686,7 +704,7 @@ struct iwl_mvm {
        bool disable_power_off;
        bool disable_power_off_d3;
 
-       bool scan_iter_notif_enabled;
+       u32 scan_iter_notif_enabled; /* must be u32 for debugfs_create_bool */
 
        struct debugfs_blob_wrapper nvm_hw_blob;
        struct debugfs_blob_wrapper nvm_sw_blob;
@@ -746,6 +764,7 @@ struct iwl_mvm {
        void *d3_resume_sram;
        u32 d3_test_pme_ptr;
        struct ieee80211_vif *keep_vif;
+       u32 last_netdetect_scans; /* no. of scans in the last net-detect wake */
 #endif
 #endif
 
@@ -934,7 +953,8 @@ static inline bool iwl_mvm_is_lar_supported(struct iwl_mvm *mvm)
 
 static inline bool iwl_mvm_is_wifi_mcc_supported(struct iwl_mvm *mvm)
 {
-       return mvm->fw->ucode_capa.api[0] & IWL_UCODE_TLV_API_WIFI_MCC_UPDATE;
+       return mvm->fw->ucode_capa.api[0] & IWL_UCODE_TLV_API_WIFI_MCC_UPDATE ||
+              mvm->fw->ucode_capa.capa[0] & IWL_UCODE_TLV_CAPA_LAR_MULTI_MCC;
 }
 
 static inline bool iwl_mvm_is_scd_cfg_supported(struct iwl_mvm *mvm)
@@ -1143,9 +1163,13 @@ int iwl_mvm_update_quotas(struct iwl_mvm *mvm, bool force_upload,
                          struct ieee80211_vif *disabled_vif);
 
 /* Scanning */
+int iwl_mvm_reg_scan_start(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
+                          struct cfg80211_scan_request *req,
+                          struct ieee80211_scan_ies *ies);
 int iwl_mvm_scan_size(struct iwl_mvm *mvm);
 int iwl_mvm_cancel_scan(struct iwl_mvm *mvm);
 int iwl_mvm_max_scan_ie_len(struct iwl_mvm *mvm, bool is_sched_scan);
+void iwl_mvm_report_scan_aborted(struct iwl_mvm *mvm);
 
 /* Scheduled scan */
 int iwl_mvm_rx_scan_offload_complete_notif(struct iwl_mvm *mvm,
@@ -1156,31 +1180,18 @@ int iwl_mvm_rx_scan_offload_iter_complete_notif(struct iwl_mvm *mvm,
                                                struct iwl_device_cmd *cmd);
 int iwl_mvm_config_sched_scan_profiles(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_sched_scan_start(struct iwl_mvm *mvm,
+                            struct ieee80211_vif *vif,
+                            struct cfg80211_sched_scan_request *req,
+                            struct ieee80211_scan_ies *ies,
+                            int type);
 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,
                                    struct iwl_device_cmd *cmd);
 
-/* Unified scan */
-int iwl_mvm_unified_scan_lmac(struct iwl_mvm *mvm,
-                             struct ieee80211_vif *vif,
-                             struct ieee80211_scan_request *req);
-int iwl_mvm_unified_sched_scan_lmac(struct iwl_mvm *mvm,
-                                   struct ieee80211_vif *vif,
-                                   struct cfg80211_sched_scan_request *req,
-                                   struct ieee80211_scan_ies *ies);
-
 /* UMAC scan */
 int iwl_mvm_config_scan(struct iwl_mvm *mvm);
-int iwl_mvm_scan_umac(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
-                     struct ieee80211_scan_request *req);
-int iwl_mvm_sched_scan_umac(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
-                           struct cfg80211_sched_scan_request *req,
-                           struct ieee80211_scan_ies *ies);
 int iwl_mvm_rx_umac_scan_complete_notif(struct iwl_mvm *mvm,
                                        struct iwl_rx_cmd_buffer *rxb,
                                        struct iwl_device_cmd *cmd);
@@ -1475,8 +1486,12 @@ int iwl_mvm_fw_dbg_collect_desc(struct iwl_mvm *mvm,
 void iwl_mvm_free_fw_dump_desc(struct iwl_mvm *mvm);
 int iwl_mvm_fw_dbg_collect_trig(struct iwl_mvm *mvm,
                                struct iwl_fw_dbg_trigger_tlv *trigger,
-                               const char *str, size_t len);
-
+                               const char *fmt, ...) __printf(3, 4);
+unsigned int iwl_mvm_get_wd_timeout(struct iwl_mvm *mvm,
+                                   struct ieee80211_vif *vif,
+                                   bool tdls, bool cmd_q);
+void iwl_mvm_connection_loss(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
+                            const char *errmsg);
 static inline bool
 iwl_fw_dbg_trigger_vif_match(struct iwl_fw_dbg_trigger_tlv *trig,
                             struct ieee80211_vif *vif)
@@ -1509,8 +1524,7 @@ iwl_fw_dbg_trigger_check_stop(struct iwl_mvm *mvm,
 static inline void
 iwl_fw_dbg_trigger_simple_stop(struct iwl_mvm *mvm,
                               struct ieee80211_vif *vif,
-                              enum iwl_fw_dbg_trigger trig,
-                              const char *str, size_t len)
+                              enum iwl_fw_dbg_trigger trig)
 {
        struct iwl_fw_dbg_trigger_tlv *trigger;
 
@@ -1521,7 +1535,7 @@ iwl_fw_dbg_trigger_simple_stop(struct iwl_mvm *mvm,
        if (!iwl_fw_dbg_trigger_check_stop(mvm, vif, trigger))
                return;
 
-       iwl_mvm_fw_dbg_collect_trig(mvm, trigger, str, len);
+       iwl_mvm_fw_dbg_collect_trig(mvm, trigger, NULL);
 }
 
 #endif /* __IWL_MVM_H__ */