Expects the service 's' is valid. */
| 410 | |
| 411 | /* Expects the service 's' is valid. */ |
| 412 | static int32_t |
| 413 | service_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 | |
| 446 | int32_t |
| 447 | rte_service_may_be_active(uint32_t id) |
no test coverage detected