On Thu, Jun 18, 2015 at 08:57:45PM -0400, Yeddula, Avinash wrote: > Hello Dpdk-team, > > I have few very basic questions. In the DPDK timer sample application, the > periodic timer0's callback function is not called unless "rte_timer_manage()" > is called. I understand rte_timer_manage() function looks at all the expired > timers in the core and runs them. > > Here are my questions: > > 1. If I comment out the rte_timer_manage() function in the code, > time0_cb function is not getting called at all. Why is this ? > I see some documentation saying if they are in Running state the timer > would fail, what exactly does this mean, could you please provide more > details. > > 2. Is it mandatory to call rte_timer_manage to trigger for the dpdk > timers when they expire? > > 3. I see this point "The Timer library provides a timer service to > Intel(r) DPDK execution units to enable execution of callback functions > asynchronously." What does asynchronously means ? > > For example, I just have 1 worker thread in my application and the periodic > timer expired and the corresponding call back function has to be executed. > Now does the worker thread stop what it is doing now and starts executing > timer's callback function or how does it work. > > I apologies if the questions are very basic and doesn't make sense. > > Thanks > -Avinash > The timers in DPDK are asynchronous in the sense that the timers will fire at a time given by the timeout command, and not at a guaranteed point in the code execution. On the other hand, they are also synchronous in that the timers' callbacks can only be executed at specific designated points in the code - the rte_timer_manage calls.
This arrangement allows greater predictability of execution - as timer callbacks fire at known points - and helps apps avoid race conditions e.g. if you are modifying a setting on a port/queue in a callback, you can know that the core on which this callback is executing is not performing packet IO on that port/queue at the same time. So overall, the rte_timer_manage functions are required in order to have timer callbacks executed - since it is that function which itself triggers the callbacks, at known points in the code. /Bruce