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

Function timer_del

dpdk/lib/timer/rte_timer.c:427–464  ·  view source on GitHub ↗

* del from list, lock if needed * timer must be in config state * timer must be in a list */

Source from the content-addressed store, hash-verified

425 * timer must be in a list
426 */
427static void
428timer_del(struct rte_timer *tim, union rte_timer_status prev_status,
429 int local_is_locked, struct priv_timer *priv_timer)
430{
431 unsigned lcore_id = rte_lcore_id();
432 unsigned prev_owner = prev_status.owner;
433 int i;
434 struct rte_timer *prev[MAX_SKIPLIST_DEPTH+1];
435
436 /* if timer needs is pending another core, we need to lock the
437 * list; if it is on local core, we need to lock if we are not
438 * called from rte_timer_manage() */
439 if (prev_owner != lcore_id || !local_is_locked)
440 rte_spinlock_lock(&priv_timer[prev_owner].list_lock);
441
442 /* save the lowest list entry into the expire field of the dummy hdr.
443 * NOTE: this is not atomic on 32-bit */
444 if (tim == priv_timer[prev_owner].pending_head.sl_next[0])
445 priv_timer[prev_owner].pending_head.expire =
446 ((tim->sl_next[0] == NULL) ? 0 : tim->sl_next[0]->expire);
447
448 /* adjust pointers from previous entries to point past this */
449 timer_get_prev_entries_for_node(tim, prev_owner, prev, priv_timer);
450 for (i = priv_timer[prev_owner].curr_skiplist_depth - 1; i >= 0; i--) {
451 if (prev[i]->sl_next[i] == tim)
452 prev[i]->sl_next[i] = tim->sl_next[i];
453 }
454
455 /* in case we deleted last entry at a level, adjust down max level */
456 for (i = priv_timer[prev_owner].curr_skiplist_depth - 1; i >= 0; i--)
457 if (priv_timer[prev_owner].pending_head.sl_next[i] == NULL)
458 priv_timer[prev_owner].curr_skiplist_depth --;
459 else
460 break;
461
462 if (prev_owner != lcore_id || !local_is_locked)
463 rte_spinlock_unlock(&priv_timer[prev_owner].list_lock);
464}
465
466/* Reset and start the timer associated with the timer handle (private func) */
467static int

Callers 2

__rte_timer_resetFunction · 0.85
__rte_timer_stopFunction · 0.85

Calls 4

rte_lcore_idFunction · 0.85
rte_spinlock_lockFunction · 0.50
rte_spinlock_unlockFunction · 0.50

Tested by

no test coverage detected