From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id 76B233F9 for ; Wed, 17 Dec 2014 06:41:07 +0100 (CET) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga101.jf.intel.com with ESMTP; 16 Dec 2014 21:41:06 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.04,691,1406617200"; d="scan'208";a="499996817" Received: from shvmail01.sh.intel.com ([10.239.29.42]) by orsmga003.jf.intel.com with ESMTP; 16 Dec 2014 21:36:51 -0800 Received: from shecgisg004.sh.intel.com (shecgisg004.sh.intel.com [10.239.29.89]) by shvmail01.sh.intel.com with ESMTP id sBH5f3km006005; Wed, 17 Dec 2014 13:41:03 +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 sBH5f1bm007085; Wed, 17 Dec 2014 13:41:03 +0800 Received: (from hzhan75@localhost) by shecgisg004.sh.intel.com (8.13.6/8.13.6/Submit) id sBH5f05O007081; Wed, 17 Dec 2014 13:41:00 +0800 From: Helin Zhang To: dev@dpdk.org Date: Wed, 17 Dec 2014 13:40:59 +0800 Message-Id: <1418794859-7051-1-git-send-email-helin.zhang@intel.com> X-Mailer: git-send-email 1.7.4.1 Subject: [dpdk-dev] [PATCH] i40e: fix of compile errors 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: Wed, 17 Dec 2014 05:41:08 -0000 Compile warning which is treated as error occurs on Oracle Linux (kernel 2.6.39, gcc 4.4.7) as below. Aliasing 'struct i40e_aqc_debug_reg_read_write' should be avoided. Use the elements inside that structure directly can fix the issue. lib/librte_pmd_i40e/i40e_ethdev.c: In function 'eth_i40e_dev_init': lib/librte_pmd_i40e/i40e_ethdev.c:5318: error: dereferencing pointer 'cmd' does break strict-aliasing rules lib/librte_pmd_i40e/i40e_ethdev.c:5314: note: initialized from here Signed-off-by: Helin Zhang --- lib/librte_pmd_i40e/i40e_ethdev.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/lib/librte_pmd_i40e/i40e_ethdev.c b/lib/librte_pmd_i40e/i40e_ethdev.c index 624f0ce..b47a3d2 100644 --- a/lib/librte_pmd_i40e/i40e_ethdev.c +++ b/lib/librte_pmd_i40e/i40e_ethdev.c @@ -5310,18 +5310,17 @@ static int i40e_debug_read_register(struct i40e_hw *hw, uint32_t addr, uint64_t *val) { struct i40e_aq_desc desc; - struct i40e_aqc_debug_reg_read_write *cmd = - (struct i40e_aqc_debug_reg_read_write *)&desc.params.raw; enum i40e_status_code status; i40e_fill_default_direct_cmd_desc(&desc, i40e_aqc_opc_debug_read_reg); - cmd->address = rte_cpu_to_le_32(addr); + desc.params.internal.param1 = rte_cpu_to_le_32(addr); status = i40e_asq_send_command(hw, &desc, NULL, 0, NULL); if (status < 0) return status; - *val = ((uint64_t)(rte_le_to_cpu_32(cmd->value_high)) << (CHAR_BIT * - sizeof(uint32_t))) + rte_le_to_cpu_32(cmd->value_low); + *val = ((uint64_t)(rte_le_to_cpu_32(desc.params.internal.param2)) << + (CHAR_BIT * sizeof(uint32_t))) + + rte_le_to_cpu_32(desc.params.internal.param3); return status; } -- 1.8.1.4