A timer adapter in periodic mode can be used to arm periodic timers.
This patch adds flags used to advertise capability and configure timer
adapter in periodic mode. Capability flag should be set for adapters
which support periodic mode.
Below is a programming sequence on the usage:
/* check for periodic mode support by reading capability. */
rte_event_timer_adapter_caps_get(...);
/* create adapter in periodic mode by setting periodic flag
(RTE_EVENT_TIMER_ADAPTER_F_PERIODIC) and resolution. */
rte_event_timer_adapter_create_ext(...);
/* arm periodic timer of configured resolution */
rte_event_timer_arm_burst(...);
/* timer event will be periodically generated at configured
resolution till cancel is called. */
while (running) { rte_event_dequeue_burst(...); }
/* cancel periodic timer which stops generating events */
rte_event_timer_cancel_burst(...);
Signed-off-by: Shijith Thotton <sthotton@marvell.com>
Acked-by: Erik Gabriel Carrillo <erik.g.carrillo@intel.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
adapter needs to create an event port, giving the application the opportunity
to control how it is done.
+Adapter modes
+^^^^^^^^^^^^^
+An event timer adapter can be configured in either periodic or non-periodic mode
+to support timers of the respective type. A periodic timer expires at a fixed
+time interval repeatedly till it is cancelled. A non-periodic timer expires only
+once. The periodic capability flag, ``RTE_EVENT_TIMER_ADAPTER_CAP_PERIODIC``,
+can be set for implementations that support periodic mode if desired. To
+configure an adapter in periodic mode, ``timer_adapter_flags`` of
+``rte_event_timer_adapter_conf`` is set to include the periodic flag
+``RTE_EVENT_TIMER_ADAPTER_F_PERIODIC``. Maximum timeout (``max_tmo_nsec``) does
+not apply to periodic mode.
+
Retrieve Event Timer Adapter Contextual Information
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The event timer adapter implementation may have constraints on tick resolution
Once an event timer expires, the application may free it or rearm it as
necessary. If the application will rearm the timer, the state should be reset
-to RTE_EVENT_TIMER_NOT_ARMED by the application before rearming it.
+to RTE_EVENT_TIMER_NOT_ARMED by the application before rearming it. Timer expiry
+events will be generated once or periodically until the timer is cancelled based
+on adapter mode.
Multiple Event Timers with Same Expiry Value
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
* Added support for multi-segments mbuf.
+* **Introduced period timer mode in eventdev timer adapter.**
+
+ * Added support for periodic timer mode in eventdev timer adapter.
+
* **Updated testpmd.**
* Added a command line option to configure forced speed for Ethernet port.
* @see struct rte_event_timer_adapter_conf::flags
*/
+#define RTE_EVENT_TIMER_ADAPTER_F_PERIODIC (1ULL << 2)
+/**< Flag to configure an event timer adapter in periodic mode; non-periodic
+ * mode is the default. A timer will fire once or periodically until the timer
+ * is cancelled based on the adapter mode.
+ *
+ * @see struct rte_event_timer_adapter_conf::flags
+ */
+
/**
* Timer adapter configuration structure
*/
* expiry event attributes, timeout ticks from now.
* This function submits the event timer arm requests to the event timer adapter
* and on expiry, the events will be injected to designated event queue.
+ * Timer expiry events will be generated once or periodically until cancellation
+ * based on the adapter mode.
*
* @param adapter
* A pointer to an event timer adapter structure.
* destination event queue.
* - EAGAIN Specified timer adapter is not running
* - EALREADY A timer was encountered that was already armed
+ *
+ * @see RTE_EVENT_TIMER_ADAPTER_F_PERIODIC
+ *
*/
static inline uint16_t
rte_event_timer_arm_burst(const struct rte_event_timer_adapter *adapter,
#define RTE_EVENT_TIMER_ADAPTER_CAP_INTERNAL_PORT (1ULL << 0)
/**< This flag is set when the timer mechanism is in HW. */
+#define RTE_EVENT_TIMER_ADAPTER_CAP_PERIODIC (1ULL << 1)
+/**< This flag is set if periodic mode is supported. */
+
/**
* Retrieve the event device's timer adapter capabilities.
*