-----Original Message----- > Date: Fri, 1 Dec 2017 14:00:55 -0600 > From: Erik Gabriel Carrillo <erik.g.carri...@intel.com> > To: pbhagavat...@caviumnetworks.com > CC: dev@dpdk.org, jerin.ja...@caviumnetworks.com, nipun.gu...@nxp.com, > hemant.agra...@nxp.com > Subject: [RFC PATCH v5 2/5] eventtimer: add common code > X-Mailer: git-send-email 1.7.10 > > This commit adds the logic that is shared by all event timer adapter > drivers; the common code handles instance allocation and some > initialization. > > Signed-off-by: Erik Gabriel Carrillo <erik.g.carri...@intel.com> > --- > config/common_base | 1 + > drivers/event/sw/sw_evdev.c | 18 + > lib/librte_eventdev/Makefile | 2 + > lib/librte_eventdev/rte_event_timer_adapter.c | 407 > ++++++++++++++++++++++ > lib/librte_eventdev/rte_event_timer_adapter_pmd.h | 159 +++++++++ > lib/librte_eventdev/rte_eventdev.h | 3 + > lib/librte_eventdev/rte_eventdev_pmd.h | 35 ++ > lib/librte_eventdev/rte_eventdev_version.map | 15 +- > 8 files changed, 639 insertions(+), 1 deletion(-) > create mode 100644 lib/librte_eventdev/rte_event_timer_adapter.c > create mode 100644 lib/librte_eventdev/rte_event_timer_adapter_pmd.h > > diff --git a/config/common_base b/config/common_base > index e74febe..91a2f0f 100644 > --- a/config/common_base > +++ b/config/common_base > @@ -574,6 +574,7 @@ CONFIG_RTE_LIBRTE_EVENTDEV=y > CONFIG_RTE_LIBRTE_EVENTDEV_DEBUG=n > CONFIG_RTE_EVENT_MAX_DEVS=16 > CONFIG_RTE_EVENT_MAX_QUEUES_PER_DEV=64 > +CONFIG_RTE_LIBRTE_EVENTDEV_TIMER_ADAPTER_DEBUG=n > > # > +rte_event_timer_arm_burst(const struct rte_event_timer_adapter *adapter, > + struct rte_event_timer **event_timers, > + uint16_t nb_event_timers) > +{ > +#ifdef RTE_LIBRTE_EVENTDEV_TIMER_ADAPTER_DEBUG > + ADAPTER_VALID_OR_ERR_RET(adapter, -EINVAL); > + FUNC_PTR_OR_ERR_RET(adapter->arm_burst, -EINVAL); > +#endif > + > + if (!adapter->data->started) > + return -EAGAIN;
Other subsystems like ethdev, cryptodev, eventdev does not have this check in fastpath as it is costly. IMO, We can remove this check. > + > + return adapter->arm_burst(adapter, event_timers, nb_event_timers); > +} > + > +int > +rte_event_timer_arm_tmo_tick_burst( > + const struct rte_event_timer_adapter *adapter, > + struct rte_event_timer **event_timers, > + const uint64_t timeout_ticks, > + const uint16_t nb_event_timers) > +{ > +#ifdef RTE_LIBRTE_EVENTDEV_TIMER_ADAPTER_DEBUG > + ADAPTER_VALID_OR_ERR_RET(adapter, -EINVAL); > + FUNC_PTR_OR_ERR_RET(adapter->arm_tmo_tick_burst, -EINVAL); > +#endif > + > + if (!adapter->data->started) > + return -EAGAIN; Same as above. > + > + for (int i = 0; i < nb_event_timers; i++) > + event_timers[i]->timeout_ticks = timeout_ticks; IMO, We can push this to driver as driver may be in a position to to do better driver specific optimization. > + > + return adapter->arm_tmo_tick_burst(adapter, event_timers, timeout_ticks, > + nb_event_timers); > +} > + > +int > +rte_event_timer_cancel_burst(const struct rte_event_timer_adapter *adapter, > + struct rte_event_timer **event_timers, > + uint16_t nb_event_timers) > +{ > +#ifdef RTE_LIBRTE_EVENTDEV_TIMER_ADAPTER_DEBUG > + ADAPTER_VALID_OR_ERR_RET(adapter, -EINVAL); > + FUNC_PTR_OR_ERR_RET(adapter->cancel_burst, -EINVAL); > +#endif > + > + if (!adapter->data->started) > + return -EAGAIN; Same as above. > + > + return adapter->cancel_burst(adapter, event_timers, nb_event_timers); > +} > */ >