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

Function service_run

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

Expects the service 's' is valid. */

Source from the content-addressed store, hash-verified

410
411/* Expects the service 's' is valid. */
412static int32_t
413service_run(uint32_t i, struct core_state *cs, uint64_t service_mask,
414 struct rte_service_spec_impl *s, uint32_t serialize_mt_unsafe)
415{
416 if (!s)
417 return -EINVAL;
418
419 /* comp_runstate and app_runstate act as the guard variables.
420 * Use load-acquire memory order. This synchronizes with
421 * store-release in service state set functions.
422 */
423 if (rte_atomic_load_explicit(&s->comp_runstate, rte_memory_order_acquire) !=
424 RUNSTATE_RUNNING ||
425 rte_atomic_load_explicit(&s->app_runstate, rte_memory_order_acquire) !=
426 RUNSTATE_RUNNING ||
427 !(service_mask & (UINT64_C(1) << i))) {
428 cs->service_active_on_lcore[i] = 0;
429 return -ENOEXEC;
430 }
431
432 cs->service_active_on_lcore[i] = 1;
433
434 if ((service_mt_safe(s) == 0) && (serialize_mt_unsafe == 1)) {
435 if (!rte_spinlock_trylock(&s->execute_lock))
436 return -EBUSY;
437
438 service_runner_do_callback(s, cs, i);
439 rte_spinlock_unlock(&s->execute_lock);
440 } else
441 service_runner_do_callback(s, cs, i);
442
443 return 0;
444}
445
446int32_t
447rte_service_may_be_active(uint32_t id)

Callers 2

service_runner_funcFunction · 0.85

Calls 4

service_mt_safeFunction · 0.85
rte_spinlock_trylockFunction · 0.50
rte_spinlock_unlockFunction · 0.50

Tested by

no test coverage detected