2015-08-03 14:31, Chao Zhu: > The rte_cpu_to_le_32 function can't be used to define const variables > because it has different implementation on big endian platforms. If > doing so, it will cause 'initializer element is not constant' compiling > error. This patch fixes this problem.
> --- a/drivers/net/fm10k/base/fm10k_tlv.c > +++ b/drivers/net/fm10k/base/fm10k_tlv.c You cannot change a base driver file except the osdep header where FM10K_CPU_TO_LE32 is defined. I don't understand why it doesn't give you a constant, given this definition: #define rte_bswap32(x) ((uint32_t)(__builtin_constant_p(x) ? \ rte_constant_bswap32(x) : \ rte_arch_bswap32(x))) Have you tried CONFIG_RTE_FORCE_INTRINSICS=y ? It should trigger this definition: #define rte_bswap32(x) __builtin_bswap32(x) > -STATIC const __le32 test_le[2] = { FM10K_CPU_TO_LE32(0x12345678), > - FM10K_CPU_TO_LE32(0x9abcdef0)}; > +#if RTE_BYTE_ORDER == RTE_BIG_ENDIAN > +STATIC const __le32 test_le[2] = {0x78563412,0xf0debc9a}; > +#else > +STATIC const __le32 test_le[2] = {0x12345678,0x9abcdef0}; > +#endif