[dpdk-dev] PPC64: add cpu cycle support to IBM POWER8 PPC64LE

Message ID 1438586178-19555-2-git-send-email-chaozhu@linux.vnet.ibm.com (mailing list archive)
State Accepted, archived
Headers

Commit Message

Chao Zhu Aug. 3, 2015, 7:16 a.m. UTC
  On IBM POWER8 PPC64 little endian architecture, the definition of tsc
union will be different. This patch fix this to enable the right output
from rte_rdtsc().

Signed-off-by: Chao Zhu <chaozhu@linux.vnet.ibm.com>
---
 .../common/include/arch/ppc_64/rte_cycles.h        |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
  

Comments

Thomas Monjalon Aug. 3, 2015, 10:45 a.m. UTC | #1
2015-08-03 15:16, Chao Zhu:
> On IBM POWER8 PPC64 little endian architecture, the definition of tsc
> union will be different. This patch fix this to enable the right output
> from rte_rdtsc().
> 
> Signed-off-by: Chao Zhu <chaozhu@linux.vnet.ibm.com>

Applied, thanks
  

Patch

diff --git a/lib/librte_eal/common/include/arch/ppc_64/rte_cycles.h b/lib/librte_eal/common/include/arch/ppc_64/rte_cycles.h
index fd26e8e..e663c48 100644
--- a/lib/librte_eal/common/include/arch/ppc_64/rte_cycles.h
+++ b/lib/librte_eal/common/include/arch/ppc_64/rte_cycles.h
@@ -51,8 +51,13 @@  rte_rdtsc(void)
 	union {
 		uint64_t tsc_64;
 		struct {
+#if RTE_BYTE_ORDER == RTE_BIG_ENDIAN
 			uint32_t hi_32;
 			uint32_t lo_32;
+#else
+			uint32_t lo_32;
+			uint32_t hi_32;
+#endif
 		};
 	} tsc;
 	uint32_t tmp;