iwlwifi: remove CMD_SYNC
[firefly-linux-kernel-4.4.55.git] / drivers / net / wireless / iwlwifi / mvm / ops.c
index 3c14ea1ffae333cc13ede9cbb8ff4ae5901816df..cc2f7de396deb396d2b20e261b4c2877137dfa3e 100644 (file)
@@ -79,8 +79,8 @@
 #include "iwl-prph.h"
 #include "rs.h"
 #include "fw-api-scan.h"
-#include "fw-error-dump.h"
 #include "time-event.h"
+#include "iwl-fw-error-dump.h"
 
 /*
  * module name, copyright, version, etc.
@@ -220,7 +220,7 @@ static const struct iwl_rx_handlers iwl_mvm_rx_handlers[] = {
        RX_HANDLER(BA_NOTIF, iwl_mvm_rx_ba_notif, false),
 
        RX_HANDLER(BT_PROFILE_NOTIFICATION, iwl_mvm_rx_bt_coex_notif, true),
-       RX_HANDLER(BEACON_NOTIFICATION, iwl_mvm_rx_beacon_notif, false),
+       RX_HANDLER(BEACON_NOTIFICATION, iwl_mvm_rx_beacon_notif, true),
        RX_HANDLER(STATISTICS_NOTIFICATION, iwl_mvm_rx_statistics, true),
        RX_HANDLER(ANTENNA_COUPLING_NOTIFICATION,
                   iwl_mvm_rx_ant_coupling_notif, true),
@@ -466,8 +466,13 @@ iwl_op_mode_mvm_start(struct iwl_trans *trans, const struct iwl_cfg *cfg,
 
        min_backoff = calc_min_backoff(trans, cfg);
        iwl_mvm_tt_initialize(mvm, min_backoff);
+       /* set the nvm_file_name according to priority */
+       if (iwlwifi_mod_params.nvm_file)
+               mvm->nvm_file_name = iwlwifi_mod_params.nvm_file;
+       else
+               mvm->nvm_file_name = mvm->cfg->default_nvm_file;
 
-       if (WARN(cfg->no_power_up_nic_in_init && !iwlwifi_mod_params.nvm_file,
+       if (WARN(cfg->no_power_up_nic_in_init && !mvm->nvm_file_name,
                 "not allowing power-up and not having nvm_file\n"))
                goto out_free;
 
@@ -477,7 +482,7 @@ iwl_op_mode_mvm_start(struct iwl_trans *trans, const struct iwl_cfg *cfg,
         * and not in the file.
         * for nics with no_power_up_nic_in_init: rely completley on nvm_file
         */
-       if (cfg->no_power_up_nic_in_init && iwlwifi_mod_params.nvm_file) {
+       if (cfg->no_power_up_nic_in_init && mvm->nvm_file_name) {
                err = iwl_nvm_init(mvm, false);
                if (err)
                        goto out_free;
@@ -525,7 +530,7 @@ iwl_op_mode_mvm_start(struct iwl_trans *trans, const struct iwl_cfg *cfg,
  out_free:
        iwl_phy_db_free(mvm->phy_db);
        kfree(mvm->scan_cmd);
-       if (!cfg->no_power_up_nic_in_init || !iwlwifi_mod_params.nvm_file)
+       if (!cfg->no_power_up_nic_in_init || !mvm->nvm_file_name)
                iwl_trans_op_mode_leave(trans);
        ieee80211_free_hw(mvm->hw);
        return NULL;
@@ -822,6 +827,7 @@ void iwl_mvm_fw_error_dump(struct iwl_mvm *mvm)
        struct iwl_fw_error_dump_file *dump_file;
        struct iwl_fw_error_dump_data *dump_data;
        u32 file_len;
+       u32 trans_len;
 
        lockdep_assert_held(&mvm->mutex);
 
@@ -833,6 +839,10 @@ void iwl_mvm_fw_error_dump(struct iwl_mvm *mvm)
                   sizeof(*dump_file) +
                   sizeof(*dump_data) * 2;
 
+       trans_len = iwl_trans_dump_data(mvm->trans, NULL, 0);
+       if (trans_len)
+               file_len += trans_len;
+
        dump_file = vmalloc(file_len);
        if (!dump_file)
                return;
@@ -846,7 +856,7 @@ void iwl_mvm_fw_error_dump(struct iwl_mvm *mvm)
        dump_data->len = cpu_to_le32(mvm->fw_error_rxf_len);
        memcpy(dump_data->data, mvm->fw_error_rxf, mvm->fw_error_rxf_len);
 
-       dump_data = (void *)((u8 *)dump_data->data + mvm->fw_error_rxf_len);
+       dump_data = iwl_mvm_fw_error_next_data(dump_data);
        dump_data->type = cpu_to_le32(IWL_FW_ERROR_DUMP_SRAM);
        dump_data->len = cpu_to_le32(mvm->fw_error_sram_len);
 
@@ -864,6 +874,15 @@ void iwl_mvm_fw_error_dump(struct iwl_mvm *mvm)
        kfree(mvm->fw_error_sram);
        mvm->fw_error_sram = NULL;
        mvm->fw_error_sram_len = 0;
+
+       if (trans_len) {
+               void *buf = iwl_mvm_fw_error_next_data(dump_data);
+               u32 real_trans_len = iwl_trans_dump_data(mvm->trans, buf,
+                                                        trans_len);
+               dump_data = (void *)((u8 *)buf + real_trans_len);
+               dump_file->file_len =
+                       cpu_to_le32(file_len - trans_len + real_trans_len);
+       }
 }
 #endif
 
@@ -1149,7 +1168,7 @@ static void iwl_mvm_d0i3_exit_work(struct work_struct *wk)
        struct iwl_mvm *mvm = container_of(wk, struct iwl_mvm, d0i3_exit_work);
        struct iwl_host_cmd get_status_cmd = {
                .id = WOWLAN_GET_STATUSES,
-               .flags = CMD_SYNC | CMD_HIGH_PRIO | CMD_WANT_SKB,
+               .flags = CMD_HIGH_PRIO | CMD_WANT_SKB,
        };
        struct iwl_wowlan_status *status;
        int ret;