* [dpdk-dev] [PATCH] i40e: fix of compile errors
@ 2014-12-17 5:40 Helin Zhang
2014-12-17 23:41 ` Thomas Monjalon
0 siblings, 1 reply; 2+ messages in thread
From: Helin Zhang @ 2014-12-17 5:40 UTC (permalink / raw)
To: dev
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 <helin.zhang@intel.com>
---
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [dpdk-dev] [PATCH] i40e: fix of compile errors
2014-12-17 5:40 [dpdk-dev] [PATCH] i40e: fix of compile errors Helin Zhang
@ 2014-12-17 23:41 ` Thomas Monjalon
0 siblings, 0 replies; 2+ messages in thread
From: Thomas Monjalon @ 2014-12-17 23:41 UTC (permalink / raw)
To: Helin Zhang; +Cc: dev
> 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 <helin.zhang@intel.com>
Applied
Thanks
--
Thomas
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-12-17 23:41 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-12-17 5:40 [dpdk-dev] [PATCH] i40e: fix of compile errors Helin Zhang
2014-12-17 23:41 ` Thomas Monjalon
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).