2 * SPDX-License-Identifier: BSD-3-Clause
3 * Copyright(c) 2017 Cavium, Inc
6 #include "timvf_worker.h"
9 timvf_timer_reg_checks(const struct timvf_ring * const timr,
10 struct rte_event_timer * const tim)
12 if (unlikely(tim->state)) {
13 tim->state = RTE_EVENT_TIMER_ERROR;
18 if (unlikely(!tim->timeout_ticks ||
19 tim->timeout_ticks >= timr->nb_bkts)) {
20 tim->state = tim->timeout_ticks ? RTE_EVENT_TIMER_ERROR_TOOLATE
21 : RTE_EVENT_TIMER_ERROR_TOOEARLY;
32 timvf_format_event(const struct rte_event_timer * const tim,
33 struct tim_mem_entry * const entry)
35 entry->w0 = (tim->ev.event & 0xFFC000000000) >> 6 |
36 (tim->ev.event & 0xFFFFFFFFF);
37 entry->wqe = tim->ev.u64;
41 timvf_timer_cancel_burst(const struct rte_event_timer_adapter *adptr,
42 struct rte_event_timer **tim, const uint16_t nb_timers)
48 for (index = 0; index < nb_timers; index++) {
49 if (tim[index]->state == RTE_EVENT_TIMER_CANCELED) {
54 if (tim[index]->state != RTE_EVENT_TIMER_ARMED) {
58 ret = timvf_rem_entry(tim[index]);
68 timvf_timer_arm_burst_mp(const struct rte_event_timer_adapter *adptr,
69 struct rte_event_timer **tim, const uint16_t nb_timers)
73 struct tim_mem_entry entry;
74 struct timvf_ring *timr = adptr->data->adapter_priv;
75 for (index = 0; index < nb_timers; index++) {
76 if (timvf_timer_reg_checks(timr, tim[index]))
78 timvf_format_event(tim[index], &entry);
79 ret = timvf_add_entry_mp(timr, tim[index]->timeout_ticks,
91 timvf_timer_arm_burst_mp_stats(const struct rte_event_timer_adapter *adptr,
92 struct rte_event_timer **tim, const uint16_t nb_timers)
95 struct timvf_ring *timr = adptr->data->adapter_priv;
97 ret = timvf_timer_arm_burst_mp(adptr, tim, nb_timers);
98 timr->tim_arm_cnt += ret;
104 timvf_set_chunk_refill(struct timvf_ring * const timr)
106 timr->refill_chunk = timvf_refill_chunk_generic;