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

Function swtim_callback

dpdk/lib/eventdev/rte_event_timer_adapter.c:651–736  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

649}
650
651static void
652swtim_callback(struct rte_timer *tim)
653{
654 struct rte_event_timer *evtim = tim->arg;
655 struct rte_event_timer_adapter *adapter;
656 unsigned int lcore = rte_lcore_id();
657 struct swtim *sw;
658 uint16_t nb_evs_flushed = 0;
659 uint16_t nb_evs_invalid = 0;
660 uint64_t opaque;
661 int ret;
662 int n_lcores;
663 enum rte_timer_type type;
664
665 opaque = evtim->impl_opaque[1];
666 adapter = (struct rte_event_timer_adapter *)(uintptr_t)opaque;
667 sw = swtim_pmd_priv(adapter);
668 type = get_timer_type(adapter);
669
670 if (unlikely(sw->in_use[lcore].v == 0)) {
671 sw->in_use[lcore].v = 1;
672 n_lcores = rte_atomic_fetch_add_explicit(&sw->n_poll_lcores, 1,
673 rte_memory_order_relaxed);
674 rte_atomic_store_explicit(&sw->poll_lcores[n_lcores], lcore,
675 rte_memory_order_relaxed);
676 }
677
678 ret = event_buffer_add(&sw->buffer, &evtim->ev);
679 if (ret < 0) {
680 if (type == SINGLE) {
681 /* If event buffer is full, put timer back in list with
682 * immediate expiry value, so that we process it again
683 * on the next iteration.
684 */
685 ret = rte_timer_alt_reset(sw->timer_data_id, tim, 0,
686 SINGLE, lcore, NULL, evtim);
687 if (ret < 0) {
688 EVTIM_LOG_DBG("event buffer full, failed to "
689 "reset timer with immediate "
690 "expiry value");
691 } else {
692 sw->stats.evtim_retry_count++;
693 EVTIM_LOG_DBG("event buffer full, resetting "
694 "rte_timer with immediate "
695 "expiry value");
696 }
697 } else {
698 sw->stats.evtim_drop_count++;
699 }
700
701 } else {
702 EVTIM_BUF_LOG_DBG("buffered an event timer expiry event");
703
704 /* Empty the buffer here, if necessary, to free older expired
705 * timers only
706 */
707 if (unlikely(sw->n_expired_timers == EXP_TIM_BUF_SZ)) {
708 rte_mempool_put_bulk(sw->tim_pool,

Callers

nothing calls this directly

Calls 8

rte_lcore_idFunction · 0.85
swtim_pmd_privFunction · 0.85
get_timer_typeFunction · 0.85
event_buffer_addFunction · 0.85
rte_timer_alt_resetFunction · 0.85
rte_mempool_put_bulkFunction · 0.85
event_buffer_batch_readyFunction · 0.85
event_buffer_flushFunction · 0.85

Tested by

no test coverage detected