From 93debffce873e483af2904d5e7669c7eded55e2f Mon Sep 17 00:00:00 2001 From: Helin Zhang Date: Tue, 9 Sep 2014 15:21:36 +0800 Subject: [PATCH] i40e/base: workaround for firmware version 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 Reviewed-by: Chen Jing Tested-by: HuilongX Xu --- lib/librte_pmd_i40e/i40e/i40e_adminq.c | 5 ++--- lib/librte_pmd_i40e/i40e/i40e_common.c | 12 ++++++++++-- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/lib/librte_pmd_i40e/i40e/i40e_adminq.c b/lib/librte_pmd_i40e/i40e/i40e_adminq.c index 9b5a29482e..80da710775 100644 --- a/lib/librte_pmd_i40e/i40e/i40e_adminq.c +++ b/lib/librte_pmd_i40e/i40e/i40e_adminq.c @@ -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); } diff --git a/lib/librte_pmd_i40e/i40e/i40e_common.c b/lib/librte_pmd_i40e/i40e/i40e_common.c index 7e750ec499..e82411a03e 100644 --- a/lib/librte_pmd_i40e/i40e/i40e_common.c +++ b/lib/librte_pmd_i40e/i40e/i40e_common.c @@ -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; -- 2.20.1