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.
Signed-off-by: Chao Zhu <chaozhu at linux.vnet.ibm.com> --- drivers/net/fm10k/base/fm10k_tlv.c | 7 +++++-- 1 files changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/net/fm10k/base/fm10k_tlv.c b/drivers/net/fm10k/base/fm10k_tlv.c index 1d9d7d8..5b2937d 100644 --- a/drivers/net/fm10k/base/fm10k_tlv.c +++ b/drivers/net/fm10k/base/fm10k_tlv.c @@ -664,8 +664,11 @@ STATIC const s64 test_s64 = -0x123456789abcdef0ll; STATIC const s32 test_s32 = -0x1235678; STATIC const s16 test_s16 = -0x1234; STATIC const s8 test_s8 = -0x12; -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 /* The message below is meant to be used as a test message to demonstrate * how to use the TLV interface and to test the types. Normally this code -- 1.7.1