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_sp(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]))
79 timvf_format_event(tim[index], &entry);
80 ret = timvf_add_entry_sp(timr, tim[index]->timeout_ticks,
92 timvf_timer_arm_burst_sp_stats(const struct rte_event_timer_adapter *adptr,
93 struct rte_event_timer **tim, const uint16_t nb_timers)
96 struct timvf_ring *timr = adptr->data->adapter_priv;
98 ret = timvf_timer_arm_burst_sp(adptr, tim, nb_timers);
99 timr->tim_arm_cnt += ret;
105 timvf_timer_arm_burst_mp(const struct rte_event_timer_adapter *adptr,
106 struct rte_event_timer **tim, const uint16_t nb_timers)
110 struct tim_mem_entry entry;
111 struct timvf_ring *timr = adptr->data->adapter_priv;
112 for (index = 0; index < nb_timers; index++) {
113 if (timvf_timer_reg_checks(timr, tim[index]))
115 timvf_format_event(tim[index], &entry);
116 ret = timvf_add_entry_mp(timr, tim[index]->timeout_ticks,
128 timvf_timer_arm_burst_mp_stats(const struct rte_event_timer_adapter *adptr,
129 struct rte_event_timer **tim, const uint16_t nb_timers)
132 struct timvf_ring *timr = adptr->data->adapter_priv;
134 ret = timvf_timer_arm_burst_mp(adptr, tim, nb_timers);
135 timr->tim_arm_cnt += ret;
141 timvf_set_chunk_refill(struct timvf_ring * const timr)
143 timr->refill_chunk = timvf_refill_chunk_generic;