iwlwifi: change fw.mvm_fw to fw.type
[cascardo/linux.git] / drivers / net / wireless / intel / iwlwifi / iwl-drv.c
index 48e8737..e2df544 100644 (file)
@@ -117,7 +117,7 @@ struct iwl_drv {
        const struct iwl_cfg *cfg;
 
        int fw_index;                   /* firmware we're trying to load */
-       char firmware_name[32];         /* name of firmware file to load */
+       char firmware_name[64];         /* name of firmware file to load */
 
        struct completion request_firmware_complete;
 
@@ -129,8 +129,8 @@ struct iwl_drv {
 };
 
 enum {
-       DVM_OP_MODE =   0,
-       MVM_OP_MODE =   1,
+       DVM_OP_MODE,
+       MVM_OP_MODE,
 };
 
 /* Protects the table contents, i.e. the ops pointer & drv list */
@@ -211,20 +211,12 @@ static int iwl_alloc_fw_desc(struct iwl_drv *drv, struct fw_desc *desc,
 static void iwl_req_fw_callback(const struct firmware *ucode_raw,
                                void *context);
 
-#define UCODE_EXPERIMENTAL_INDEX       100
-#define UCODE_EXPERIMENTAL_TAG         "exp"
-
 static int iwl_request_firmware(struct iwl_drv *drv, bool first)
 {
        const char *name_pre = drv->cfg->fw_name_pre;
        char tag[8];
 
        if (first) {
-#ifdef CONFIG_IWLWIFI_DEBUG_EXPERIMENTAL_UCODE
-               drv->fw_index = UCODE_EXPERIMENTAL_INDEX;
-               strcpy(tag, UCODE_EXPERIMENTAL_TAG);
-       } else if (drv->fw_index == UCODE_EXPERIMENTAL_INDEX) {
-#endif
                drv->fw_index = drv->cfg->ucode_api_max;
                sprintf(tag, "%d", drv->fw_index);
        } else {
@@ -240,22 +232,7 @@ static int iwl_request_firmware(struct iwl_drv *drv, bool first)
        snprintf(drv->firmware_name, sizeof(drv->firmware_name), "%s%s.ucode",
                 name_pre, tag);
 
-       /*
-        * Starting 8000B - FW name format has changed. This overwrites the
-        * previous name and uses the new format.
-        */
-       if (drv->trans->cfg->device_family == IWL_DEVICE_FAMILY_8000) {
-               char rev_step = 'A' + CSR_HW_REV_STEP(drv->trans->hw_rev);
-
-               if (rev_step != 'A')
-                       snprintf(drv->firmware_name,
-                                sizeof(drv->firmware_name), "%s%c-%s.ucode",
-                                name_pre, rev_step, tag);
-       }
-
-       IWL_DEBUG_INFO(drv, "attempting to load firmware %s'%s'\n",
-                      (drv->fw_index == UCODE_EXPERIMENTAL_INDEX)
-                               ? "EXPERIMENTAL " : "",
+       IWL_DEBUG_INFO(drv, "attempting to load firmware '%s'\n",
                       drv->firmware_name);
 
        return request_firmware_nowait(THIS_MODULE, 1, drv->firmware_name,
@@ -554,9 +531,7 @@ static int iwl_parse_v1_v2_firmware(struct iwl_drv *drv,
        }
 
        if (build)
-               sprintf(buildstr, " build %u%s", build,
-                      (drv->fw_index == UCODE_EXPERIMENTAL_INDEX)
-                               ? " (EXP)" : "");
+               sprintf(buildstr, " build %u", build);
        else
                buildstr[0] = '\0';
 
@@ -640,9 +615,7 @@ static int iwl_parse_tlv_firmware(struct iwl_drv *drv,
        build = le32_to_cpu(ucode->build);
 
        if (build)
-               sprintf(buildstr, " build %u%s", build,
-                      (drv->fw_index == UCODE_EXPERIMENTAL_INDEX)
-                               ? " (EXP)" : "");
+               sprintf(buildstr, " build %u", build);
        else
                buildstr[0] = '\0';
 
@@ -822,17 +795,17 @@ static int iwl_parse_tlv_firmware(struct iwl_drv *drv,
                 case IWL_UCODE_TLV_SEC_RT:
                        iwl_store_ucode_sec(pieces, tlv_data, IWL_UCODE_REGULAR,
                                            tlv_len);
-                       drv->fw.mvm_fw = true;
+                       drv->fw.type = IWL_FW_MVM;
                        break;
                case IWL_UCODE_TLV_SEC_INIT:
                        iwl_store_ucode_sec(pieces, tlv_data, IWL_UCODE_INIT,
                                            tlv_len);
-                       drv->fw.mvm_fw = true;
+                       drv->fw.type = IWL_FW_MVM;
                        break;
                case IWL_UCODE_TLV_SEC_WOWLAN:
                        iwl_store_ucode_sec(pieces, tlv_data, IWL_UCODE_WOWLAN,
                                            tlv_len);
-                       drv->fw.mvm_fw = true;
+                       drv->fw.type = IWL_FW_MVM;
                        break;
                case IWL_UCODE_TLV_DEF_CALIB:
                        if (tlv_len != sizeof(struct iwl_tlv_calib_data))
@@ -854,17 +827,17 @@ static int iwl_parse_tlv_firmware(struct iwl_drv *drv,
                 case IWL_UCODE_TLV_SECURE_SEC_RT:
                        iwl_store_ucode_sec(pieces, tlv_data, IWL_UCODE_REGULAR,
                                            tlv_len);
-                       drv->fw.mvm_fw = true;
+                       drv->fw.type = IWL_FW_MVM;
                        break;
                case IWL_UCODE_TLV_SECURE_SEC_INIT:
                        iwl_store_ucode_sec(pieces, tlv_data, IWL_UCODE_INIT,
                                            tlv_len);
-                       drv->fw.mvm_fw = true;
+                       drv->fw.type = IWL_FW_MVM;
                        break;
                case IWL_UCODE_TLV_SECURE_SEC_WOWLAN:
                        iwl_store_ucode_sec(pieces, tlv_data, IWL_UCODE_WOWLAN,
                                            tlv_len);
-                       drv->fw.mvm_fw = true;
+                       drv->fw.type = IWL_FW_MVM;
                        break;
                case IWL_UCODE_TLV_NUM_OF_CPU:
                        if (tlv_len != sizeof(u32))
@@ -1287,22 +1260,19 @@ static void iwl_req_fw_callback(const struct firmware *ucode_raw, void *context)
         * firmware filename ... but we don't check for that and only rely
         * on the API version read from firmware header from here on forward
         */
-       /* no api version check required for experimental uCode */
-       if (drv->fw_index != UCODE_EXPERIMENTAL_INDEX) {
-               if (api_ver < api_min || api_ver > api_max) {
-                       IWL_ERR(drv,
-                               "Driver unable to support your firmware API. "
-                               "Driver supports v%u, firmware is v%u.\n",
-                               api_max, api_ver);
-                       goto try_again;
-               }
+       if (api_ver < api_min || api_ver > api_max) {
+               IWL_ERR(drv,
+                       "Driver unable to support your firmware API. "
+                       "Driver supports v%u, firmware is v%u.\n",
+                       api_max, api_ver);
+               goto try_again;
        }
 
        /*
         * In mvm uCode there is no difference between data and instructions
         * sections.
         */
-       if (!fw->mvm_fw && validate_sec_sizes(drv, pieces, drv->cfg))
+       if (fw->type == IWL_FW_DVM && validate_sec_sizes(drv, pieces, drv->cfg))
                goto try_again;
 
        /* Allocate ucode buffers for card's bus-master loading ... */
@@ -1430,10 +1400,16 @@ static void iwl_req_fw_callback(const struct firmware *ucode_raw, void *context)
        release_firmware(ucode_raw);
 
        mutex_lock(&iwlwifi_opmode_table_mtx);
-       if (fw->mvm_fw)
-               op = &iwlwifi_opmode_table[MVM_OP_MODE];
-       else
+       switch (fw->type) {
+       case IWL_FW_DVM:
                op = &iwlwifi_opmode_table[DVM_OP_MODE];
+               break;
+       default:
+               WARN(1, "Invalid fw type %d\n", fw->type);
+       case IWL_FW_MVM:
+               op = &iwlwifi_opmode_table[MVM_OP_MODE];
+               break;
+       }
 
        IWL_INFO(drv, "loaded firmware version %s op_mode %s\n",
                 drv->fw.fw_version, op->name);
@@ -1685,7 +1661,8 @@ MODULE_PARM_DESC(11n_disable,
        "disable 11n functionality, bitmap: 1: full, 2: disable agg TX, 4: disable agg RX, 8 enable agg TX");
 module_param_named(amsdu_size, iwlwifi_mod_params.amsdu_size,
                   int, S_IRUGO);
-MODULE_PARM_DESC(amsdu_size, "amsdu size 0:4K 1:8K 2:12K (default 0)");
+MODULE_PARM_DESC(amsdu_size,
+                "amsdu size 0: 12K for multi Rx queue devices, 4K for other devices 1:4K 2:8K 3:12K (default 0)");
 module_param_named(fw_restart, iwlwifi_mod_params.restart_fw, bool, S_IRUGO);
 MODULE_PARM_DESC(fw_restart, "restart firmware in case of error (default true)");
 
@@ -1754,4 +1731,4 @@ MODULE_PARM_DESC(d0i3_timeout, "Timeout to D0i3 entry when idle (ms)");
 
 module_param_named(disable_11ac, iwlwifi_mod_params.disable_11ac, bool,
                   S_IRUGO);
-MODULE_PARM_DESC(disable_11ac, "Disable VHT capabilities");
+MODULE_PARM_DESC(disable_11ac, "Disable VHT capabilities (default: false)");