i40e/base: workaround for firmware version
authorHelin Zhang <helin.zhang@intel.com>
Tue, 9 Sep 2014 07:21:36 +0000 (15:21 +0800)
committerThomas Monjalon <thomas.monjalon@6wind.com>
Tue, 7 Oct 2014 16:02:11 +0000 (18:02 +0200)
The workaround helps fix the API if the FW is 4.2 or later.
In addition, an unreachable 'break' statement has been removed.

Signed-off-by: Helin Zhang <helin.zhang@intel.com>
Reviewed-by: Chen Jing <jing.d.chen@intel.com>
Tested-by: HuilongX Xu <huilongx.xu@intel.com>
lib/librte_pmd_i40e/i40e/i40e_adminq.c
lib/librte_pmd_i40e/i40e/i40e_common.c

index 9b5a294..80da710 100644 (file)
@@ -879,7 +879,6 @@ enum i40e_status_code i40e_asq_send_command(struct i40e_hw *hw,
         */
        if (!details->async && !details->postpone) {
                u32 total_delay = 0;
-               u32 delay_len = 1;
 
                do {
                        /* AQ designers suggest use of head for better
@@ -888,8 +887,8 @@ enum i40e_status_code i40e_asq_send_command(struct i40e_hw *hw,
                        if (i40e_asq_done(hw))
                                break;
                        /* ugh! delay while spin_lock */
-                       i40e_msec_delay(delay_len);
-                       total_delay += delay_len;
+                       i40e_msec_delay(1);
+                       total_delay++;
                } while (total_delay < hw->aq.asq_cmd_timeout);
        }
 
index 7e750ec..e82411a 100644 (file)
@@ -570,7 +570,6 @@ enum i40e_status_code i40e_init_shared_code(struct i40e_hw *hw)
                break;
        default:
                return I40E_ERR_DEVICE_NOT_SUPPORTED;
-               break;
        }
 
        hw->phy.get_link_info = true;
@@ -869,6 +868,7 @@ enum i40e_status_code i40e_pf_reset(struct i40e_hw *hw)
 
        i40e_clear_pxe_mode(hw);
 
+
        return I40E_SUCCESS;
 }
 
@@ -1943,6 +1943,14 @@ enum i40e_status_code i40e_aq_get_firmware_version(struct i40e_hw *hw,
                        *api_major_version = LE16_TO_CPU(resp->api_major);
                if (api_minor_version != NULL)
                        *api_minor_version = LE16_TO_CPU(resp->api_minor);
+
+               /* A workaround to fix the API version in SW */
+               if (api_major_version && api_minor_version &&
+                   fw_major_version && fw_minor_version &&
+                   ((*api_major_version == 1) && (*api_minor_version == 1)) &&
+                   (((*fw_major_version == 4) && (*fw_minor_version >= 2)) ||
+                    (*fw_major_version > 4)))
+                       *api_minor_version = 2;
        }
 
        return status;
@@ -4681,6 +4689,7 @@ enum i40e_status_code i40e_aq_send_msg_to_pf(struct i40e_hw *hw,
                                struct i40e_asq_cmd_details *cmd_details)
 {
        struct i40e_aq_desc desc;
+       struct i40e_asq_cmd_details details;
        enum i40e_status_code status;
 
        i40e_fill_default_direct_cmd_desc(&desc, i40e_aqc_opc_send_msg_to_pf);
@@ -4695,7 +4704,6 @@ enum i40e_status_code i40e_aq_send_msg_to_pf(struct i40e_hw *hw,
                desc.datalen = CPU_TO_LE16(msglen);
        }
        if (!cmd_details) {
-               struct i40e_asq_cmd_details details;
                i40e_memset(&details, 0, sizeof(details), I40E_NONDMA_MEM);
                details.async = true;
                cmd_details = &details;