aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBill Fischofer <bill.fischofer@linaro.org>2016-08-30 09:18:46 -0500
committerBalakrishna Garapati <balakrishna.garapati@linaro.org>2016-12-06 12:50:03 +0100
commit3385e3e1a36dbb37c6b121ef3162f94d1cc21ac5 (patch)
tree4334621b2801d88ccf333ee4acc6563565d90427
parentf6f1dac75dade441eef7c7289782dbcefba565c5 (diff)
linux-dpdk: time: harmonize odp_time_t definition with linux-genericv1.10.1.0_DPDK_16.07
odp-dpdk used a slightly different internal representation of odp_time_t than odp-linux. For ABI compatibility, change to use the odp-linux representation. This has no functional or performance difference but keeps the ABI tool compatibility checker happy. Signed-off-by: Bill Fischofer <bill.fischofer@linaro.org> Reviewed-by: Balakrishna Garapati <balakrishna.garapati@linaro.org>
-rw-r--r--platform/linux-dpdk/include/odp/api/plat/time_types.h14
-rw-r--r--platform/linux-dpdk/odp_time.c16
2 files changed, 12 insertions, 18 deletions
diff --git a/platform/linux-dpdk/include/odp/api/plat/time_types.h b/platform/linux-dpdk/include/odp/api/plat/time_types.h
index 6f6e44a4a..cd1e75d18 100644
--- a/platform/linux-dpdk/include/odp/api/plat/time_types.h
+++ b/platform/linux-dpdk/include/odp/api/plat/time_types.h
@@ -21,18 +21,12 @@ extern "C" {
* @internal Time structure used to isolate linux-generic implementation from
* the linux timespec structure, which is dependent on POSIX extension level.
*/
-typedef union {
- struct {
- uint64_t ticks; /**< @internal ticks */
- uint64_t pad;
- };
- struct {
- int64_t tv_sec; /**< @internal Seconds */
- int64_t tv_nsec; /**< @internal Nanoseconds */
- };
+typedef struct {
+ int64_t tv_sec; /**< @internal Seconds or DPDK ticks */
+ int64_t tv_nsec; /**< @internal Nanoseconds */
} odp_time_t;
-#define ODP_TIME_NULL ((odp_time_t){ {0} })
+#define ODP_TIME_NULL ((odp_time_t){0, 0})
#ifdef __cplusplus
}
diff --git a/platform/linux-dpdk/odp_time.c b/platform/linux-dpdk/odp_time.c
index a94313e2a..c1ad973cc 100644
--- a/platform/linux-dpdk/odp_time.c
+++ b/platform/linux-dpdk/odp_time.c
@@ -42,7 +42,7 @@ uint64_t time_to_ns(odp_time_t time)
static inline uint64_t time_to_ns_dpdk(odp_time_t time)
{
- return (time.ticks * nsec_per_tick);
+ return (time.tv_sec * nsec_per_tick);
}
static inline odp_time_t time_diff(odp_time_t t2, odp_time_t t1)
@@ -64,7 +64,7 @@ static inline odp_time_t time_diff_dpdk(odp_time_t t2, odp_time_t t1)
{
odp_time_t time;
- time.ticks = t2.ticks - t1.ticks;
+ time.tv_sec = t2.tv_sec - t1.tv_sec;
return time;
}
@@ -83,7 +83,7 @@ static inline odp_time_t time_curr_dpdk(void)
{
odp_time_t time;
- time.ticks = rte_get_timer_cycles();
+ time.tv_sec = rte_get_timer_cycles();
return time;
}
@@ -108,9 +108,9 @@ static inline int time_cmp(odp_time_t t2, odp_time_t t1)
static inline int time_cmp_dpdk(odp_time_t t2, odp_time_t t1)
{
- if (t2.ticks < t1.ticks)
+ if (t2.tv_sec < t1.tv_sec)
return -1;
- if (t2.ticks > t1.ticks)
+ if (t2.tv_sec > t1.tv_sec)
return 1;
return 0;
}
@@ -134,7 +134,7 @@ static inline odp_time_t time_sum_dpdk(odp_time_t t1, odp_time_t t2)
{
odp_time_t time;
- time.ticks = t2.ticks + t1.ticks;
+ time.tv_sec = t2.tv_sec + t1.tv_sec;
return time;
}
@@ -151,7 +151,7 @@ static inline odp_time_t time_local_from_ns(uint64_t ns)
static inline odp_time_t time_local_from_ns_dpdk(uint64_t ns)
{
odp_time_t time;
- time.ticks = ns * tick_per_nsec;
+ time.tv_sec = ns * tick_per_nsec;
return time;
}
@@ -257,7 +257,7 @@ static uint64_t time_to_u64(odp_time_t time)
static uint64_t time_to_u64_dpdk(odp_time_t time)
{
- return time.ticks;
+ return time.tv_sec;
}
uint64_t odp_time_to_u64(odp_time_t time)