MCPcopy Create free account
hub / github.com/F-Stack/f-stack / service_runner_do_callback

Function service_runner_do_callback

dpdk/lib/eal/common/rte_service.c:372–408  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

370}
371
372static inline void
373service_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. */

Callers 1

service_runFunction · 0.85

Calls 3

rte_lcore_idFunction · 0.85
service_stats_enabledFunction · 0.85
rte_rdtscFunction · 0.50

Tested by

no test coverage detected