| 370 | } |
| 371 | |
| 372 | static inline void |
| 373 | service_runner_do_callback(struct rte_service_spec_impl *s, |
| 374 | struct core_state *cs, uint32_t service_idx) |
| 375 | { |
| 376 | rte_eal_trace_service_run_begin(service_idx, rte_lcore_id()); |
| 377 | void *userdata = s->spec.callback_userdata; |
| 378 | |
| 379 | if (service_stats_enabled(s)) { |
| 380 | uint64_t start = rte_rdtsc(); |
| 381 | int rc = s->spec.callback(userdata); |
| 382 | |
| 383 | /* The lcore service worker thread is the only writer, |
| 384 | * and thus only a non-atomic load and an atomic store |
| 385 | * is needed, and not the more expensive atomic |
| 386 | * add. |
| 387 | */ |
| 388 | struct service_stats *service_stats = |
| 389 | &cs->service_stats[service_idx]; |
| 390 | |
| 391 | if (likely(rc != -EAGAIN)) { |
| 392 | uint64_t end = rte_rdtsc(); |
| 393 | uint64_t cycles = end - start; |
| 394 | |
| 395 | rte_atomic_store_explicit(&cs->cycles, cs->cycles + cycles, |
| 396 | rte_memory_order_relaxed); |
| 397 | rte_atomic_store_explicit(&service_stats->cycles, |
| 398 | service_stats->cycles + cycles, |
| 399 | rte_memory_order_relaxed); |
| 400 | } |
| 401 | |
| 402 | rte_atomic_store_explicit(&service_stats->calls, |
| 403 | service_stats->calls + 1, rte_memory_order_relaxed); |
| 404 | } else { |
| 405 | s->spec.callback(userdata); |
| 406 | } |
| 407 | rte_eal_trace_service_run_end(service_idx, rte_lcore_id()); |
| 408 | } |
| 409 | |
| 410 | |
| 411 | /* Expects the service 's' is valid. */ |
no test coverage detected