| 53 | RTE_DEFINE_PER_LCORE(unsigned, n_reset_collisions); |
| 54 | |
| 55 | static int |
| 56 | reload_timer(struct rte_timer *tim) |
| 57 | { |
| 58 | /* Make timer expire roughly when the TSC hits the next BILLION |
| 59 | * multiple. Add in timer's index to make them expire in nearly |
| 60 | * sorted order. This makes all timers somewhat synchronized, |
| 61 | * firing ~2-3 times per second, assuming 2-3 GHz TSCs. |
| 62 | */ |
| 63 | uint64_t ticks = BILLION - (rte_get_timer_cycles() % BILLION) + |
| 64 | (tim - timer); |
| 65 | int ret; |
| 66 | |
| 67 | ret = rte_timer_reset(tim, ticks, PERIODICAL, main_lcore, timer_cb, NULL); |
| 68 | if (ret != 0) { |
| 69 | rte_log(RTE_LOG_DEBUG, timer_logtype_test, |
| 70 | "- core %u failed to reset timer %" PRIuPTR " (OK)\n", |
| 71 | rte_lcore_id(), tim - timer); |
| 72 | RTE_PER_LCORE(n_reset_collisions) += 1; |
| 73 | } |
| 74 | return ret; |
| 75 | } |
| 76 | |
| 77 | static int |
| 78 | worker_main_loop(__rte_unused void *arg) |
no test coverage detected