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

Function rte_timer_alt_manage

dpdk/lib/timer/rte_timer.c:792–970  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

790}
791
792int
793rte_timer_alt_manage(uint32_t timer_data_id,
794 unsigned int *poll_lcores,
795 int nb_poll_lcores,
796 rte_timer_alt_manage_cb_t f)
797{
798 unsigned int default_poll_lcores[] = {rte_lcore_id()};
799 union rte_timer_status status;
800 struct rte_timer *tim, *next_tim, **pprev;
801 struct rte_timer *run_first_tims[RTE_MAX_LCORE];
802 unsigned int this_lcore = rte_lcore_id();
803 struct rte_timer *prev[MAX_SKIPLIST_DEPTH + 1];
804 uint64_t cur_time;
805 int i, j, ret;
806 int nb_runlists = 0;
807 struct rte_timer_data *data;
808 struct priv_timer *privp;
809 uint32_t poll_lcore;
810
811 TIMER_DATA_VALID_GET_OR_ERR_RET(timer_data_id, data, -EINVAL);
812
813 /* timer manager only runs on EAL thread with valid lcore_id */
814 assert(this_lcore < RTE_MAX_LCORE);
815
816 __TIMER_STAT_ADD(data->priv_timer, manage, 1);
817
818 if (poll_lcores == NULL) {
819 poll_lcores = default_poll_lcores;
820 nb_poll_lcores = RTE_DIM(default_poll_lcores);
821 }
822
823 for (i = 0; i < nb_poll_lcores; i++) {
824 poll_lcore = poll_lcores[i];
825 privp = &data->priv_timer[poll_lcore];
826
827 /* optimize for the case where per-cpu list is empty */
828 if (privp->pending_head.sl_next[0] == NULL)
829 continue;
830 cur_time = rte_get_timer_cycles();
831
832#ifdef RTE_ARCH_64
833 /* on 64-bit the value cached in the pending_head.expired will
834 * be updated atomically, so we can consult that for a quick
835 * check here outside the lock
836 */
837 if (likely(privp->pending_head.expire > cur_time))
838 continue;
839#endif
840
841 /* browse ordered list, add expired timers in 'expired' list */
842 rte_spinlock_lock(&privp->list_lock);
843
844 /* if nothing to do just unlock and return */
845 if (privp->pending_head.sl_next[0] == NULL ||
846 privp->pending_head.sl_next[0]->expire > cur_time) {
847 rte_spinlock_unlock(&privp->list_lock);
848 continue;
849 }

Callers 2

swtim_service_funcFunction · 0.85
timer_manage_loopFunction · 0.85

Calls 6

rte_lcore_idFunction · 0.85
timer_get_prev_entriesFunction · 0.85
timer_set_running_stateFunction · 0.85
__rte_timer_resetFunction · 0.85
rte_spinlock_lockFunction · 0.50
rte_spinlock_unlockFunction · 0.50

Tested by 1

timer_manage_loopFunction · 0.68