| 580 | } |
| 581 | |
| 582 | static int |
| 583 | __rte_timer_stop(struct rte_timer *tim, |
| 584 | struct rte_timer_data *timer_data) |
| 585 | { |
| 586 | union rte_timer_status prev_status, status; |
| 587 | unsigned lcore_id = rte_lcore_id(); |
| 588 | int ret; |
| 589 | struct priv_timer *priv_timer = timer_data->priv_timer; |
| 590 | |
| 591 | /* wait that the timer is in correct status before update, |
| 592 | * and mark it as being configured */ |
| 593 | ret = timer_set_config_state(tim, &prev_status, priv_timer); |
| 594 | if (ret < 0) |
| 595 | return -1; |
| 596 | |
| 597 | __TIMER_STAT_ADD(priv_timer, stop, 1); |
| 598 | if (prev_status.state == RTE_TIMER_RUNNING && |
| 599 | lcore_id < RTE_MAX_LCORE) { |
| 600 | priv_timer[lcore_id].updated = 1; |
| 601 | } |
| 602 | |
| 603 | /* remove it from list */ |
| 604 | if (prev_status.state == RTE_TIMER_PENDING) { |
| 605 | timer_del(tim, prev_status, 0, priv_timer); |
| 606 | __TIMER_STAT_ADD(priv_timer, pending, -1); |
| 607 | } |
| 608 | |
| 609 | /* mark timer as stopped */ |
| 610 | status.state = RTE_TIMER_STOP; |
| 611 | status.owner = RTE_TIMER_NO_OWNER; |
| 612 | /* The "RELEASE" ordering guarantees the memory operations above |
| 613 | * the status update are observed before the update by all threads |
| 614 | */ |
| 615 | rte_atomic_store_explicit(&tim->status.u32, status.u32, rte_memory_order_release); |
| 616 | |
| 617 | return 0; |
| 618 | } |
| 619 | |
| 620 | /* Stop the timer associated with the timer handle tim */ |
| 621 | int |
no test coverage detected