DPDK patches and discussions
 help / color / mirror / Atom feed
From: Shijith Thotton <sthotton@marvell.com>
To: Erik Gabriel Carrillo <erik.g.carrillo@intel.com>
Cc: Shijith Thotton <sthotton@marvell.com>,
	Pavan Nikhilesh <pbhagavatula@marvell.com>,
	Jerin Jacob <jerinj@marvell.com>, <dev@dpdk.org>
Subject: [dpdk-dev] [PATCH v3 1/3] eventdev: introduce adapter flags for periodic mode
Date: Wed, 17 Mar 2021 13:34:19 +0530	[thread overview]
Message-ID: <a3613cd7764efac7cee26575443b5c62ed95fa1e.1615967694.git.sthotton@marvell.com> (raw)
In-Reply-To: <cover.1615967694.git.sthotton@marvell.com>

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>
---
 doc/guides/prog_guide/event_timer_adapter.rst | 16 +++++++++++++++-
 lib/librte_eventdev/rte_event_timer_adapter.h | 13 +++++++++++++
 lib/librte_eventdev/rte_eventdev.h            |  3 +++
 3 files changed, 31 insertions(+), 1 deletion(-)

diff --git a/doc/guides/prog_guide/event_timer_adapter.rst b/doc/guides/prog_guide/event_timer_adapter.rst
index a95efbe0d..8b18cd169 100644
--- a/doc/guides/prog_guide/event_timer_adapter.rst
+++ b/doc/guides/prog_guide/event_timer_adapter.rst
@@ -138,6 +138,18 @@ This function is passed a callback function that will be invoked if the
 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
@@ -229,7 +241,9 @@ Now we can arm the event timer with ``rte_event_timer_arm_burst()``:
 
 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
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
diff --git a/lib/librte_eventdev/rte_event_timer_adapter.h b/lib/librte_eventdev/rte_event_timer_adapter.h
index d2ebcb090..4e0d2a819 100644
--- a/lib/librte_eventdev/rte_event_timer_adapter.h
+++ b/lib/librte_eventdev/rte_event_timer_adapter.h
@@ -151,6 +151,14 @@ enum rte_event_timer_adapter_clk_src {
  * @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
  */
@@ -551,6 +559,8 @@ struct rte_event_timer_adapter {
  * 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.
@@ -570,6 +580,9 @@ struct rte_event_timer_adapter {
  *   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,
diff --git a/lib/librte_eventdev/rte_eventdev.h b/lib/librte_eventdev/rte_eventdev.h
index ce1fc2ce0..9fc39e9ca 100644
--- a/lib/librte_eventdev/rte_eventdev.h
+++ b/lib/librte_eventdev/rte_eventdev.h
@@ -1154,6 +1154,9 @@ rte_event_eth_rx_adapter_caps_get(uint8_t dev_id, uint16_t eth_port_id,
 #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.
  *
-- 
2.25.1


  reply	other threads:[~2021-03-17  8:05 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-08 20:45 [dpdk-dev] [PATCH 0/3] periodic mode for event timer adapter Shijith Thotton
2021-03-08 20:45 ` [dpdk-dev] [PATCH 1/3] eventdev: introduce adapter flags for periodic mode Shijith Thotton
2021-03-09 20:04   ` Carrillo, Erik G
2021-03-10  9:14     ` Shijith Thotton
2021-03-11 20:47       ` Carrillo, Erik G
2021-03-12 15:30   ` Carrillo, Erik G
2021-03-14 16:49     ` Shijith Thotton
2021-03-08 20:45 ` [dpdk-dev] [PATCH 2/3] test/event: add unit tests for periodic timer Shijith Thotton
2021-03-08 20:45 ` [dpdk-dev] [PATCH 3/3] event/octeontx2: add timer periodic mode support Shijith Thotton
2021-03-14 16:45 ` [dpdk-dev] [PATCH v2 0/3] periodic mode for event timer adapter Shijith Thotton
2021-03-14 16:45   ` [dpdk-dev] [PATCH v2 1/3] eventdev: introduce adapter flags for periodic mode Shijith Thotton
2021-03-16 19:04     ` Carrillo, Erik G
2021-03-17  6:10       ` Shijith Thotton
2021-03-14 16:45   ` [dpdk-dev] [PATCH v2 2/3] test/event: add unit tests for periodic timer Shijith Thotton
2021-03-14 16:45   ` [dpdk-dev] [PATCH v2 3/3] event/octeontx2: add timer periodic mode support Shijith Thotton
2021-03-17  8:04   ` [dpdk-dev] [PATCH v3 0/3] periodic mode for event timer adapter Shijith Thotton
2021-03-17  8:04     ` Shijith Thotton [this message]
2021-03-17 18:07       ` [dpdk-dev] [PATCH v3 1/3] eventdev: introduce adapter flags for periodic mode Carrillo, Erik G
2021-03-22  9:50         ` Jerin Jacob
2021-03-17  8:04     ` [dpdk-dev] [PATCH v3 2/3] test/event: add unit tests for periodic timer Shijith Thotton
2021-03-17 18:11       ` Carrillo, Erik G
2021-03-17  8:04     ` [dpdk-dev] [PATCH v3 3/3] event/octeontx2: add timer periodic mode support Shijith Thotton
2021-03-21 14:43       ` Pavan Nikhilesh Bhagavatula

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a3613cd7764efac7cee26575443b5c62ed95fa1e.1615967694.git.sthotton@marvell.com \
    --to=sthotton@marvell.com \
    --cc=dev@dpdk.org \
    --cc=erik.g.carrillo@intel.com \
    --cc=jerinj@marvell.com \
    --cc=pbhagavatula@marvell.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).