iwlwifi: mvm: track and report IBSS manager status to mac80211
[GitHub/moto-9609/android_kernel_motorola_exynos9610.git] / drivers / net / wireless / intel / iwlwifi / mvm / mvm.h
index 4e74a6b90e70626d6e0e8bb8092796f078c7d55d..a4bee9c740e03a6641adf73374819aed9599154d 100644 (file)
@@ -754,6 +754,8 @@ struct iwl_mvm {
 
        struct work_struct roc_done_wk;
 
+       unsigned long init_status;
+
        unsigned long status;
 
        u32 queue_sync_cookie;
@@ -765,7 +767,6 @@ struct iwl_mvm {
        struct iwl_mvm_vif *bf_allowed_vif;
 
        enum iwl_ucode_type cur_ucode;
-       bool ucode_loaded;
        bool hw_registered;
        bool calibrating;
        u32 error_event_table[2];
@@ -1020,6 +1021,9 @@ struct iwl_mvm {
        /* system time of last beacon (for AP/GO interface) */
        u32 ap_last_beacon_gp2;
 
+       /* indicates that we transmitted the last beacon */
+       bool ibss_manager;
+
        bool lar_regdom_set;
        enum iwl_mcc_source mcc_src;
 
@@ -1086,6 +1090,15 @@ enum iwl_mvm_status {
        IWL_MVM_STATUS_ROC_AUX_RUNNING,
        IWL_MVM_STATUS_D3_RECONFIG,
        IWL_MVM_STATUS_DUMPING_FW_LOG,
+       IWL_MVM_STATUS_FIRMWARE_RUNNING,
+};
+
+/* Keep track of completed init configuration */
+enum iwl_mvm_init_status {
+       IWL_MVM_INIT_STATUS_THERMAL_INIT_COMPLETE = BIT(0),
+       IWL_MVM_INIT_STATUS_LEDS_INIT_COMPLETE = BIT(1),
+       IWL_MVM_INIT_STATUS_REG_HW_INIT_COMPLETE = BIT(2),
+       IWL_MVM_INIT_STATUS_TOF_INIT_COMPLETE = BIT(3),
 };
 
 static inline bool iwl_mvm_is_radio_killed(struct iwl_mvm *mvm)
@@ -1099,6 +1112,11 @@ static inline bool iwl_mvm_is_radio_hw_killed(struct iwl_mvm *mvm)
        return test_bit(IWL_MVM_STATUS_HW_RFKILL, &mvm->status);
 }
 
+static inline bool iwl_mvm_firmware_running(struct iwl_mvm *mvm)
+{
+       return test_bit(IWL_MVM_STATUS_FIRMWARE_RUNNING, &mvm->status);
+}
+
 /* Must be called with rcu_read_lock() held and it can only be
  * released when mvmsta is not needed anymore.
  */
@@ -1188,7 +1206,7 @@ static inline bool iwl_mvm_is_lar_supported(struct iwl_mvm *mvm)
         * Enable LAR only if it is supported by the FW (TLV) &&
         * enabled in the NVM
         */
-       if (mvm->cfg->device_family == IWL_DEVICE_FAMILY_8000)
+       if (mvm->cfg->ext_nvm)
                return nvm_lar && tlv_lar;
        else
                return tlv_lar;
@@ -1355,6 +1373,8 @@ const char *iwl_mvm_get_tx_fail_reason(u32 status);
 static inline const char *iwl_mvm_get_tx_fail_reason(u32 status) { return ""; }
 #endif
 int iwl_mvm_flush_tx_path(struct iwl_mvm *mvm, u32 tfd_msk, u32 flags);
+int iwl_mvm_flush_sta(struct iwl_mvm *mvm, void *sta, bool internal, u32 flags);
+
 void iwl_mvm_async_handlers_purge(struct iwl_mvm *mvm);
 
 static inline void iwl_mvm_set_tx_cmd_ccmp(struct ieee80211_tx_info *info,
@@ -1381,7 +1401,9 @@ void iwl_mvm_accu_radio_stats(struct iwl_mvm *mvm);
 
 /* NVM */
 int iwl_nvm_init(struct iwl_mvm *mvm, bool read_nvm_from_nic);
+int iwl_mvm_nvm_get_from_fw(struct iwl_mvm *mvm);
 int iwl_mvm_load_nvm_to_nic(struct iwl_mvm *mvm);
+int iwl_mvm_read_external_nvm(struct iwl_mvm *mvm);
 
 static inline u8 iwl_mvm_get_valid_tx_ant(struct iwl_mvm *mvm)
 {
@@ -1730,8 +1752,11 @@ int iwl_mvm_find_free_queue(struct iwl_mvm *mvm, u8 sta_id, u8 minq, u8 maxq);
  */
 static inline u32 iwl_mvm_flushable_queues(struct iwl_mvm *mvm)
 {
+       u32 cmd_queue = iwl_mvm_is_dqa_supported(mvm) ? IWL_MVM_DQA_CMD_QUEUE :
+               IWL_MVM_CMD_QUEUE;
+
        return ((BIT(mvm->cfg->base_params->num_of_queues) - 1) &
-               ~BIT(IWL_MVM_CMD_QUEUE));
+               ~BIT(cmd_queue));
 }
 
 static inline
@@ -1752,7 +1777,8 @@ static inline void iwl_mvm_stop_device(struct iwl_mvm *mvm)
 {
        if (!iwl_mvm_has_new_tx_api(mvm))
                iwl_free_fw_paging(mvm);
-       mvm->ucode_loaded = false;
+       clear_bit(IWL_MVM_STATUS_FIRMWARE_RUNNING, &mvm->status);
+       mvm->fw_dbg_conf = FW_DBG_INVALID;
        iwl_trans_stop_device(mvm->trans);
 }