Skip to content

Commit

Permalink
test: packet_gen: use strict global time read function
Browse files Browse the repository at this point in the history
Use odp_time_global_strict() function to read global time to make sure time
value is read at the correct point in application processing. Previously,
depending on CPU architecture the time value could be read too early in the
processing path.

Signed-off-by: Matias Elo <[email protected]>
Reviewed-by: Petri Savolainen <[email protected]>
  • Loading branch information
MatiasElo committed Jun 14, 2024
1 parent eb72718 commit a2ebaaf
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions test/performance/odp_packet_gen.c
Original file line number Diff line number Diff line change
Expand Up @@ -1476,7 +1476,7 @@ static int rx_thread(void *arg)
}

if (ts_off && num)
rx_ts = odp_time_global();
rx_ts = odp_time_global_strict();

exit_test = odp_atomic_load_u32(&global->exit_test);
if (exit_test) {
Expand Down Expand Up @@ -1802,7 +1802,7 @@ static inline int update_rand_data(uint8_t *data, uint32_t data_len)

static inline void set_timestamp(odp_packet_t pkt, uint32_t ts_off)
{
const ts_data_t ts_data = { .magic = TS_MAGIC, .tx_ts = odp_time_global() };
const ts_data_t ts_data = { .magic = TS_MAGIC, .tx_ts = odp_time_global_strict() };

(void)odp_packet_copy_from_mem(pkt, ts_off, sizeof(ts_data), &ts_data);
}
Expand Down

0 comments on commit a2ebaaf

Please sign in to comment.