From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id 0FEFAB3B7 for ; Tue, 9 Sep 2014 09:17:06 +0200 (CEST) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga102.fm.intel.com with ESMTP; 09 Sep 2014 00:22:08 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.04,491,1406617200"; d="scan'208";a="588396220" Received: from shvmail01.sh.intel.com ([10.239.29.42]) by fmsmga001.fm.intel.com with ESMTP; 09 Sep 2014 00:22:07 -0700 Received: from shecgisg004.sh.intel.com (shecgisg004.sh.intel.com [10.239.29.89]) by shvmail01.sh.intel.com with ESMTP id s897M4hV008845; Tue, 9 Sep 2014 15:22:04 +0800 Received: from shecgisg004.sh.intel.com (localhost [127.0.0.1]) by shecgisg004.sh.intel.com (8.13.6/8.13.6/SuSE Linux 0.8) with ESMTP id s897M25p004474; Tue, 9 Sep 2014 15:22:04 +0800 Received: (from hzhan75@localhost) by shecgisg004.sh.intel.com (8.13.6/8.13.6/Submit) id s897M2U4004470; Tue, 9 Sep 2014 15:22:02 +0800 From: Helin Zhang To: dev@dpdk.org Date: Tue, 9 Sep 2014 15:21:31 +0800 Message-Id: <1410247299-4365-8-git-send-email-helin.zhang@intel.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1410247299-4365-1-git-send-email-helin.zhang@intel.com> References: <1410247299-4365-1-git-send-email-helin.zhang@intel.com> Subject: [dpdk-dev] [PATCH 07/15] i40e: Get rid of sparse warnings, and remove unreachable code X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Sep 2014 07:17:08 -0000 There are variables that represent values in little endian. Adding prefix of '__Le' can remove warnings during sparse checks. In addition, remove some unreachable 'break' statements, and add 'UL' on a couple of constants. Signed-off-by: Helin Zhang Reviewed-by: Chen Jing --- lib/librte_pmd_i40e/i40e/i40e_lan_hmc.c | 24 ++++++++++++++---------- lib/librte_pmd_i40e/i40e/i40e_lan_hmc.h | 1 - 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/lib/librte_pmd_i40e/i40e/i40e_lan_hmc.c b/lib/librte_pmd_i40e/i40e/i40e_lan_hmc.c index 9f98d6d..b08534b 100644 --- a/lib/librte_pmd_i40e/i40e/i40e_lan_hmc.c +++ b/lib/librte_pmd_i40e/i40e/i40e_lan_hmc.c @@ -424,7 +424,6 @@ enum i40e_status_code i40e_create_lan_hmc_object(struct i40e_hw *hw, default: ret_code = I40E_ERR_INVALID_SD_TYPE; goto exit; - break; } } } @@ -509,7 +508,6 @@ try_type_paged: DEBUGOUT1("i40e_configure_lan_hmc: Unknown SD type: %d\n", ret_code); goto configure_lan_hmc_out; - break; } /* Configure and program the FPM registers so objects can be created */ @@ -803,9 +801,10 @@ static void i40e_write_word(u8 *hmc_bits, struct i40e_context_ele *ce_info, u8 *src) { - u16 src_word, dest_word, mask; + u16 src_word, mask; u8 *from, *dest; u16 shift_width; + __le16 dest_word; /* copy from the next struct field */ from = src + ce_info->offset; @@ -846,9 +845,10 @@ static void i40e_write_dword(u8 *hmc_bits, struct i40e_context_ele *ce_info, u8 *src) { - u32 src_dword, dest_dword, mask; + u32 src_dword, mask; u8 *from, *dest; u16 shift_width; + __le32 dest_dword; /* copy from the next struct field */ from = src + ce_info->offset; @@ -897,9 +897,10 @@ static void i40e_write_qword(u8 *hmc_bits, struct i40e_context_ele *ce_info, u8 *src) { - u64 src_qword, dest_qword, mask; + u64 src_qword, mask; u8 *from, *dest; u16 shift_width; + __le64 dest_qword; /* copy from the next struct field */ from = src + ce_info->offset; @@ -914,7 +915,7 @@ static void i40e_write_qword(u8 *hmc_bits, if (ce_info->width < 64) mask = ((u64)1 << ce_info->width) - 1; else - mask = 0xFFFFFFFFFFFFFFFF; + mask = 0xFFFFFFFFFFFFFFFFUL; /* don't swizzle the bits until after the mask because the mask bits * will be in a different bit position on big endian machines @@ -985,9 +986,10 @@ static void i40e_read_word(u8 *hmc_bits, struct i40e_context_ele *ce_info, u8 *dest) { - u16 src_word, dest_word, mask; + u16 dest_word, mask; u8 *src, *target; u16 shift_width; + __le16 src_word; /* prepare the bits and mask */ shift_width = ce_info->lsb % 8; @@ -1028,9 +1030,10 @@ static void i40e_read_dword(u8 *hmc_bits, struct i40e_context_ele *ce_info, u8 *dest) { - u32 src_dword, dest_dword, mask; + u32 dest_dword, mask; u8 *src, *target; u16 shift_width; + __le32 src_dword; /* prepare the bits and mask */ shift_width = ce_info->lsb % 8; @@ -1080,9 +1083,10 @@ static void i40e_read_qword(u8 *hmc_bits, struct i40e_context_ele *ce_info, u8 *dest) { - u64 src_qword, dest_qword, mask; + u64 dest_qword, mask; u8 *src, *target; u16 shift_width; + __le64 src_qword; /* prepare the bits and mask */ shift_width = ce_info->lsb % 8; @@ -1094,7 +1098,7 @@ static void i40e_read_qword(u8 *hmc_bits, if (ce_info->width < 64) mask = ((u64)1 << ce_info->width) - 1; else - mask = 0xFFFFFFFFFFFFFFFF; + mask = 0xFFFFFFFFFFFFFFFFUL; /* shift to correct alignment */ mask <<= shift_width; diff --git a/lib/librte_pmd_i40e/i40e/i40e_lan_hmc.h b/lib/librte_pmd_i40e/i40e/i40e_lan_hmc.h index f0f0f89..70ef65c 100644 --- a/lib/librte_pmd_i40e/i40e/i40e_lan_hmc.h +++ b/lib/librte_pmd_i40e/i40e/i40e_lan_hmc.h @@ -36,7 +36,6 @@ POSSIBILITY OF SUCH DAMAGE. /* forward-declare the HW struct for the compiler */ struct i40e_hw; -enum i40e_status_code; /* HMC element context information */ -- 1.8.1.4