DPDK patches and discussions
 help / color / mirror / Atom feed
From: Erik Gabriel Carrillo <erik.g.carrillo@intel.com>
To: pbhagavatula@caviumnetworks.com
Cc: dev@dpdk.org, jerin.jacob@caviumnetworks.com,
	nipun.gupta@nxp.com, hemant.agrawal@nxp.com
Subject: [dpdk-dev] [PATCH v8 1/9] eventtimer: introduce event timer adapter
Date: Thu, 29 Mar 2018 16:27:24 -0500	[thread overview]
Message-ID: <1522358852-3630-2-git-send-email-erik.g.carrillo@intel.com> (raw)
In-Reply-To: <1522358852-3630-1-git-send-email-erik.g.carrillo@intel.com>

Event devices can be coupled with various components to provide
new event sources by using event adapters.  The event timer adapter
is one such adapter; it bridges event devices and timer mechanisms.
This library extends the event-driven programming model by
introducing a new type of event that represents a timer expiration,
and it provides APIs with which adapters can be created or destroyed
and event timers can be armed and canceled.

Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
Signed-off-by: Erik Gabriel Carrillo <erik.g.carrillo@intel.com>
---
 lib/librte_eventdev/Makefile                  |   1 +
 lib/librte_eventdev/rte_event_timer_adapter.h | 715 ++++++++++++++++++++++++++
 lib/librte_eventdev/rte_eventdev.h            |   4 +-
 3 files changed, 718 insertions(+), 2 deletions(-)
 create mode 100644 lib/librte_eventdev/rte_event_timer_adapter.h

diff --git a/lib/librte_eventdev/Makefile b/lib/librte_eventdev/Makefile
index d27dd07..549b182 100644
--- a/lib/librte_eventdev/Makefile
+++ b/lib/librte_eventdev/Makefile
@@ -28,6 +28,7 @@ SYMLINK-y-include += rte_eventdev_pmd_pci.h
 SYMLINK-y-include += rte_eventdev_pmd_vdev.h
 SYMLINK-y-include += rte_event_ring.h
 SYMLINK-y-include += rte_event_eth_rx_adapter.h
+SYMLINK-y-include += rte_event_timer_adapter.h
 
 # versioning export map
 EXPORT_MAP := rte_eventdev_version.map
diff --git a/lib/librte_eventdev/rte_event_timer_adapter.h b/lib/librte_eventdev/rte_event_timer_adapter.h
new file mode 100644
index 0000000..6a76791
--- /dev/null
+++ b/lib/librte_eventdev/rte_event_timer_adapter.h
@@ -0,0 +1,715 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2017 Cavium, Inc.
+ * Copyright(c) 2017-2018 Intel Corporation.
+ * All rights reserved.
+ */
+
+#ifndef __RTE_EVENT_TIMER_ADAPTER_H__
+#define __RTE_EVENT_TIMER_ADAPTER_H__
+
+/**
+ * @file
+ *
+ * RTE Event Timer Adapter
+ *
+ * An event timer adapter has the following abstract working model:
+ *
+ *                               timer_tick_ns
+ *                                   +
+ *                      +-------+    |
+ *                      |       |    |
+ *              +-------+ bkt 0 +----v---+
+ *              |       |       |        |
+ *              |       +-------+        |
+ *          +---+---+                +---+---+  +---+---+---+---+
+ *          |       |                |       |  |   |   |   |   |
+ *          | bkt n |                | bkt 1 |<-> t0| t1| t2| tn|
+ *          |       |                |       |  |   |   |   |   |
+ *          +---+---+                +---+---+  +---+---+---+---+
+ *              |     Timer adapter      |
+ *          +---+---+                +---+---+
+ *          |       |                |       |
+ *          | bkt 4 |                | bkt 2 |<--- Current bucket
+ *          |       |                |       |
+ *          +---+---+                +---+---+
+ *               |      +-------+       |
+ *               |      |       |       |
+ *               +------+ bkt 3 +-------+
+ *                      |       |
+ *                      +-------+
+ *
+ * - It has a virtual monotonically increasing 64-bit timer adapter clock based
+ *   on *enum rte_event_timer_adapter_clk_src* clock source. The clock source
+ *   could be a CPU clock, or a platform dependent external clock.
+ *
+ * - The application creates a timer adapter instance with given the clock
+ *   source, the total number of event timers, and a resolution(expressed in ns)
+ *   to traverse between the buckets.
+ *
+ * - Each timer adapter may have 0 to n buckets based on the configured
+ *   max timeout(max_tmo_ns) and resolution(timer_tick_ns). Upon starting the
+ *   timer adapter, the adapter starts ticking at *timer_tick_ns* resolution.
+ *
+ * - The application arms an event timer that will expire *timer_tick_ns*
+ *   from now.
+ *
+ * - The application can cancel an armed timer and no timer expiry event will be
+ *   generated.
+ *
+ * - If a timer expires then the library injects the timer expiry event in
+ *   the designated event queue.
+ *
+ * - The timer expiry event will be received through *rte_event_dequeue_burst*.
+ *
+ * - The application frees the timer adapter instance.
+ *
+ * Multiple timer adapters can be created with a varying level of resolution
+ * for various expiry use cases that run in parallel.
+ *
+ * Before using the timer adapter, the application has to create and configure
+ * an event device along with the event port. Based on the event device
+ * capability it might require creating an additional event port to be used
+ * by the timer adapter.
+ *
+ * The application creates the event timer adapter using the
+ * ``rte_event_timer_adapter_create()``. The event device id is passed to this
+ * function, inside this function the event device capability is checked,
+ * and if an in-built port is absent the application uses the default
+ * function to create a new producer port.
+ *
+ * The application may also use the function
+ * ``rte_event_timer_adapter_create_ext()`` to have granular control over
+ * producer port creation in a case where the in-built port is absent.
+ *
+ * After creating the timer adapter, the application has to start it
+ * using ``rte_event_timer_adapter_start()``. The buckets are traversed from
+ * 0 to n; when the adapter ticks, the next bucket is visited. Each time,
+ * the list per bucket is processed, and timer expiry events are sent to the
+ * designated event queue.
+ *
+ * The application can arm one or more event timers using the
+ * ``rte_event_timer_arm_burst()``. The *timeout_ticks* represents the number
+ * of *timer_tick_ns* after which the timer has to expire. The timeout at
+ * which the timers expire can be grouped or be independent of each
+ * event timer instance. ``rte_event_timer_arm_tmo_tick_burst()`` addresses the
+ * former case and ``rte_event_timer_arm_burst()`` addresses the latter case.
+ *
+ * The application can cancel the timers from expiring using the
+ * ``rte_event_timer_cancel_burst()``.
+ *
+ * On the secondary process, ``rte_event_timer_adapter_lookup()`` can be used
+ * to get the timer adapter pointer from its id and use it to invoke fastpath
+ * operations such as arm and cancel.
+ *
+ * Some of the use cases of event timer adapter are Beacon Timers,
+ * Generic SW Timeout, Wireless MAC Scheduling, 3G Frame Protocols,
+ * Packet Scheduling, Protocol Retransmission Timers, Supervision Timers.
+ * All these use cases require high resolution and low time drift.
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rte_spinlock.h>
+#include <rte_memory.h>
+
+#include "rte_eventdev.h"
+
+/**
+ * @warning
+ * @b EXPERIMENTAL: this enum may change without prior notice
+ *
+ * Timer adapter clock source
+ */
+enum rte_event_timer_adapter_clk_src {
+	RTE_EVENT_TIMER_ADAPTER_CPU_CLK,
+	/**< Use CPU clock as the clock source. */
+	RTE_EVENT_TIMER_ADAPTER_EXT_CLK0,
+	/**< Platform dependent external clock source 0. */
+	RTE_EVENT_TIMER_ADAPTER_EXT_CLK1,
+	/**< Platform dependent external clock source 1. */
+	RTE_EVENT_TIMER_ADAPTER_EXT_CLK2,
+	/**< Platform dependent external clock source 2. */
+	RTE_EVENT_TIMER_ADAPTER_EXT_CLK3,
+	/**< Platform dependent external clock source 3. */
+};
+
+#define RTE_EVENT_TIMER_ADAPTER_F_ADJUST_RES	(1ULL << 0)
+/**< The event timer adapter implementation may have constraints on the
+ * resolution (timer_tick_ns) and maximum timer expiry timeout(max_tmo_ns)
+ * based on the given timer adapter or system.  If this flag is set, the
+ * implementation adjusts the resolution and maximum timeout to the best
+ * possible configuration. On successful timer adapter creation, the
+ * application can get the configured resolution and max timeout with
+ * ``rte_event_timer_adapter_get_info()``.
+ *
+ * @see struct rte_event_timer_adapter_info::min_resolution_ns
+ * @see struct rte_event_timer_adapter_info::max_tmo_ns
+ */
+#define RTE_EVENT_TIMER_ADAPTER_F_SP_PUT	(1ULL << 1)
+/**< ``rte_event_timer_arm_burst()`` API to be used in single producer mode.
+ *
+ * @see struct rte_event_timer_adapter_conf::flags
+ */
+
+/**
+ * @warning
+ * @b EXPERIMENTAL: this structure may change without prior notice
+ *
+ * Timer adapter configuration structure
+ */
+struct rte_event_timer_adapter_conf {
+	uint8_t event_dev_id;
+	/**< Event device identifier */
+	uint16_t timer_adapter_id;
+	/**< Event timer adapter identifier */
+	uint32_t socket_id;
+	/**< Identifier of socket from which to allocate memory for adapter */
+	enum rte_event_timer_adapter_clk_src clk_src;
+	/**< Clock source for timer adapter */
+	uint64_t timer_tick_ns;
+	/**< Timer adapter resolution in ns */
+	uint64_t max_tmo_ns;
+	/**< Maximum timer timeout(expiry) in ns */
+	uint64_t nb_timers;
+	/**< Total number of timers per adapter */
+	uint64_t flags;
+	/**< Timer adapter config flags (RTE_EVENT_TIMER_ADAPTER_F_*) */
+};
+
+/**
+ * @warning
+ * @b EXPERIMENTAL: this structure may change without prior notice
+ *
+ * Event timer adapter stats structure
+ */
+struct rte_event_timer_adapter_stats {
+	uint64_t evtim_exp_count;
+	/**< Number of event timers that have expired. */
+	uint64_t ev_enq_count;
+	/**< Eventdev enqueue count */
+	uint64_t ev_inv_count;
+	/**< Invalid expiry event count */
+	uint64_t evtim_retry_count;
+	/**< Event timer retry count */
+	uint64_t adapter_tick_count;
+	/**< Tick count for the adapter, at its resolution */
+};
+
+struct rte_event_timer_adapter;
+
+/**
+ * @warning
+ * @b EXPERIMENTAL: this API may change without prior notice
+ *
+ * Callback function type for producer port creation.
+ */
+typedef int (*rte_event_timer_adapter_port_conf_cb_t)(uint16_t id,
+						      uint8_t event_dev_id,
+						      uint8_t *event_port_id,
+						      void *conf_arg);
+
+/**
+ * @warning
+ * @b EXPERIMENTAL: this API may change without prior notice
+ *
+ * Create an event timer adapter.
+ *
+ * This function must be invoked first before any other function in the API.
+ *
+ * @param conf
+ *   The event timer adapter configuration structure.
+ *
+ * @return
+ *   A pointer to the new allocated event timer adapter on success.
+ *   NULL on error with rte_errno set appropriately.
+ *   Possible rte_errno values include:
+ *   - ERANGE: timer_tick_ns is not in supported range.
+ *   - ENOMEM: unable to allocate sufficient memory for adapter instances
+ *   - EINVAL: invalid event device identifier specified in config
+ *   - ENOSPC: maximum number of adapters already created
+ *   - EIO: event device reconfiguration and restart error.  The adapter
+ *   reconfigures the event device with an additional port by default if it is
+ *   required to use a service to manage timers. If the device had been started
+ *   before this call, this error code indicates an error in restart following
+ *   an error in reconfiguration, i.e., a combination of the two error codes.
+ */
+struct rte_event_timer_adapter * __rte_experimental
+rte_event_timer_adapter_create(const struct rte_event_timer_adapter_conf *conf);
+
+/**
+ * @warning
+ * @b EXPERIMENTAL: this API may change without prior notice
+ *
+ * Create a timer adapter with the supplied callback.
+ *
+ * This function can be used to have a more granular control over the timer
+ * adapter creation.  If a built-in port is absent, then the function uses the
+ * callback provided to create and get the port id to be used as a producer
+ * port.
+ *
+ * @param conf
+ *   The timer adapter configuration structure
+ * @param conf_cb
+ *   The port config callback function.
+ * @param conf_arg
+ *   Opaque pointer to the argument for the callback function
+ *
+ * @return
+ *   A pointer to the new allocated event timer adapter on success.
+ *   NULL on error with rte_errno set appropriately.
+ *   Possible rte_errno values include:
+ *   - ERANGE: timer_tick_ns is not in supported range.
+ *   - ENOMEM: unable to allocate sufficient memory for adapter instances
+ *   - EINVAL: invalid event device identifier specified in config
+ *   - ENOSPC: maximum number of adapters already created
+ */
+struct rte_event_timer_adapter * __rte_experimental
+rte_event_timer_adapter_create_ext(
+		const struct rte_event_timer_adapter_conf *conf,
+		rte_event_timer_adapter_port_conf_cb_t conf_cb,
+		void *conf_arg);
+
+/**
+ * @warning
+ * @b EXPERIMENTAL: this structure may change without prior notice
+ *
+ * Timer adapter info structure.
+ */
+struct rte_event_timer_adapter_info {
+	uint64_t min_resolution_ns;
+	/**< Minimum timer adapter resolution in ns */
+	uint64_t resolution_ns;
+	/**< Actual timer adapter resolution in ns */
+	uint64_t max_tmo_ns;
+	/**< Maximum timer timeout(expire) in ns */
+	struct rte_event_timer_adapter_conf conf;
+	/**< Configured timer adapter attributes */
+	uint32_t caps;
+	/**< Event timer adapter capabilities */
+	int16_t event_dev_port_id;
+	/**< Event device port ID, if applicable */
+};
+
+/**
+ * @warning
+ * @b EXPERIMENTAL: this API may change without prior notice
+ *
+ * Retrieve the contextual information of an event timer adapter.
+ *
+ * @param adapter
+ *   A pointer to the event timer adapter structure.
+ *
+ * @param[out] adapter_info
+ *   A pointer to a structure of type *rte_event_timer_adapter_info* to be
+ *   filled with the contextual information of the adapter.
+ *
+ * @return
+ *   - 0: Success, driver updates the contextual information of the
+ *   timer adapter
+ *   - <0: Error code returned by the driver info get function.
+ *   - -EINVAL: adapter identifier invalid
+ *
+ * @see RTE_EVENT_TIMER_ADAPTER_F_ADJUST_RES,
+ *   struct rte_event_timer_adapter_info
+ *
+ */
+int __rte_experimental
+rte_event_timer_adapter_get_info(
+		const struct rte_event_timer_adapter *adapter,
+		struct rte_event_timer_adapter_info *adapter_info);
+
+/**
+ * @warning
+ * @b EXPERIMENTAL: this API may change without prior notice
+ *
+ * Start a timer adapter.
+ *
+ * The adapter start step is the last one and consists of setting the timer
+ * adapter to start accepting the timers and schedules to event queues.
+ *
+ * On success, all basic functions exported by the API (timer arm,
+ * timer cancel and so on) can be invoked.
+ *
+ * @param adapter
+ *   A pointer to the event timer adapter structure.
+ *
+ * @return
+ *   - 0: Success, adapter started.
+ *   - <0: Error code returned by the driver start function.
+ *   - -EINVAL if adapter identifier invalid
+ */
+int __rte_experimental
+rte_event_timer_adapter_start(
+		const struct rte_event_timer_adapter *adapter);
+
+/**
+ * @warning
+ * @b EXPERIMENTAL: this API may change without prior notice
+ *
+ * Stop an event timer adapter.
+ *
+ * The adapter can be restarted with a call to
+ * ``rte_event_timer_adapter_start()``.
+ *
+ * @param adapter
+ *   A pointer to the event timer adapter structure.
+ *
+ * @return
+ *   - 0: Success, adapter stopped.
+ *   - <0: Error code returned by the driver stop function.
+ *   - -EINVAL if adapter identifier invalid
+ */
+int __rte_experimental
+rte_event_timer_adapter_stop(const struct rte_event_timer_adapter *adapter);
+
+/**
+ * @warning
+ * @b EXPERIMENTAL: this API may change without prior notice
+ *
+ * Lookup an event timer adapter using its identifier.
+ *
+ * If an event timer adapter was created in another process with the same
+ * identifier, this function will locate its state and set up access to it
+ * so that it can be used in this process.
+ *
+ * @param adapter_id
+ *  The event timer adapter identifier.
+ *
+ * @return
+ *  A pointer to the event timer adapter matching the identifier on success.
+ *  NULL on error with rte_errno set appropriately.
+ *  Possible rte_errno values include:
+ *   - ENOENT - requested entry not available to return.
+ */
+struct rte_event_timer_adapter * __rte_experimental
+rte_event_timer_adapter_lookup(uint16_t adapter_id);
+
+/**
+ * @warning
+ * @b EXPERIMENTAL: this API may change without prior notice
+ *
+ * Free an event timer adapter.
+ *
+ * Destroy an event timer adapter, freeing all resources.
+ *
+ * Before invoking this function, the application must wait for all the
+ * armed timers to expire or cancel the outstanding armed timers.
+ *
+ * @param adapter
+ *   A pointer to an event timer adapter structure.
+ *
+ * @return
+ *   - 0: Successfully freed the event timer adapter resources.
+ *   - <0: Failed to free the event timer adapter resources.
+ *   - -EAGAIN:  adapter is busy; timers outstanding
+ *   - -EBUSY: stop hasn't been called for this adapter yet
+ *   - -EINVAL: adapter id invalid, or adapter invalid
+ */
+int __rte_experimental
+rte_event_timer_adapter_free(struct rte_event_timer_adapter *adapter);
+
+/**
+ * Retrieve the service ID of the event timer adapter. If the adapter doesn't
+ * use an rte_service function, this function returns -ESRCH.
+ *
+ * @param adapter
+ *   A pointer to an event timer adapter.
+ *
+ * @param [out] service_id
+ *   A pointer to a uint32_t, to be filled in with the service id.
+ *
+ * @return
+ *   - 0: Success
+ *   - <0: Error code on failure
+ *   - -ESRCH: the adapter does not require a service to operate
+ */
+int __rte_experimental
+rte_event_timer_adapter_service_id_get(struct rte_event_timer_adapter *adapter,
+				       uint32_t *service_id);
+
+/**
+ * @warning
+ * @b EXPERIMENTAL: this API may change without prior notice
+ *
+ * Retrieve statistics for an event timer adapter instance.
+ *
+ * @param adapter
+ *   A pointer to an event timer adapter structure.
+ * @param[out] stats
+ *   A pointer to a structure to fill with statistics.
+ *
+ * @return
+ *   - 0: Successfully retrieved.
+ *   - <0: Failure; error code returned.
+ */
+int __rte_experimental
+rte_event_timer_adapter_stats_get(struct rte_event_timer_adapter *adapter,
+		struct rte_event_timer_adapter_stats *stats);
+
+/**
+ * @warning
+ * @b EXPERIMENTAL: this API may change without prior notice
+ *
+ * Reset statistics for an event timer adapter instance.
+ *
+ * @param adapter
+ *   A pointer to an event timer adapter structure.
+ *
+ * @return
+ *   - 0: Successfully reset;
+ *   - <0: Failure; error code returned.
+ */
+int __rte_experimental rte_event_timer_adapter_stats_reset(
+		struct rte_event_timer_adapter *adapter);
+
+/**
+ * @warning
+ * @b EXPERIMENTAL: this structure may change without prior notice
+ *
+ * Event timer state.
+ */
+enum rte_event_timer_state {
+	RTE_EVENT_TIMER_NOT_ARMED	= 0,
+	/**< Event timer not armed. */
+	RTE_EVENT_TIMER_ARMED		= 1,
+	/**< Event timer successfully armed. */
+	RTE_EVENT_TIMER_CANCELED	= 2,
+	/**< Event timer successfully canceled. */
+	RTE_EVENT_TIMER_ERROR		= -1,
+	/**< Generic event timer error. */
+	RTE_EVENT_TIMER_ERROR_TOOEARLY	= -2,
+	/**< Event timer timeout tick value is too small for the adapter to
+	 * handle, given its configured resolution.
+	 */
+	RTE_EVENT_TIMER_ERROR_TOOLATE	= -3,
+	/**< Event timer timeout tick is greater than the maximum timeout.*/
+};
+
+/**
+ * @warning
+ * @b EXPERIMENTAL: this structure may change without prior notice
+ *
+ * The generic *rte_event_timer* structure to hold the event timer attributes
+ * for arm and cancel operations.
+ */
+RTE_STD_C11
+struct rte_event_timer {
+	struct rte_event ev;
+	/**<
+	 * Expiry event attributes.  On successful event timer timeout,
+	 * the following attributes will be used to inject the expiry event to
+	 * the eventdev:
+	 *  - event_queue_id: Targeted event queue id for expiry events.
+	 *  - event_priority: Event priority of the event expiry event in the
+	 *  event queue relative to other events.
+	 *  - sched_type: Scheduling type of the expiry event.
+	 *  - flow_id: Flow id of the expiry event.
+	 *  - op: RTE_EVENT_OP_NEW
+	 *  - event_type: RTE_EVENT_TYPE_TIMER
+	 */
+	volatile enum rte_event_timer_state state;
+	/**< State of the event timer. */
+	uint64_t timeout_ticks;
+	/**< Expiry timer ticks expressed in number of *timer_ticks_ns* from
+	 * now.
+	 * @see struct rte_event_timer_adapter_info::adapter_conf::timer_tick_ns
+	 */
+	uint64_t impl_opaque[2];
+	/**< Implementation-specific opaque data.
+	 * An event timer adapter implementation use this field to hold
+	 * implementation specific values to share between the arm and cancel
+	 * operations.  The application should not modify this field.
+	 */
+	uint8_t user_meta[0];
+	/**< Memory to store user specific metadata.
+	 * The event timer adapter implementation should not modify this area.
+	 */
+} __rte_cache_aligned;
+
+typedef uint16_t (*rte_event_timer_arm_burst_t)(
+		const struct rte_event_timer_adapter *adapter,
+		struct rte_event_timer **tims,
+		uint16_t nb_tims);
+/**< @internal Enable event timers to enqueue timer events upon expiry */
+typedef uint16_t (*rte_event_timer_arm_tmo_tick_burst_t)(
+		const struct rte_event_timer_adapter *adapter,
+		struct rte_event_timer **tims,
+		uint64_t timeout_tick,
+		uint16_t nb_tims);
+/**< @internal Enable event timers with common expiration time */
+typedef uint16_t (*rte_event_timer_cancel_burst_t)(
+		const struct rte_event_timer_adapter *adapter,
+		struct rte_event_timer **tims,
+		uint16_t nb_tims);
+/**< @internal Prevent event timers from enqueuing timer events */
+
+/**
+ * @internal Data structure associated with each event timer adapter.
+ */
+struct rte_event_timer_adapter {
+	rte_event_timer_arm_burst_t arm_burst;
+	/**< Pointer to driver arm_burst function. */
+	rte_event_timer_arm_tmo_tick_burst_t arm_tmo_tick_burst;
+	/**< Pointer to driver arm_tmo_tick_burst function. */
+	rte_event_timer_cancel_burst_t cancel_burst;
+	/**< Pointer to driver cancel function. */
+	struct rte_event_timer_adapter_data *data;
+	/**< Pointer to shared adapter data */
+	const struct rte_event_timer_adapter_ops *ops;
+	/**< Functions exported by adapter driver */
+
+	RTE_STD_C11
+	uint8_t allocated : 1;
+	/**< Flag to indicate that this adapter has been allocated */
+} __rte_cache_aligned;
+
+#define ADAPTER_VALID_OR_ERR_RET(adapter, retval) do { \
+	if (adapter == NULL || !adapter->allocated)    \
+		return retval;			       \
+} while (0)
+#define FUNC_PTR_OR_ERR_RET(func, errval) do { \
+	if ((func) == NULL)		       \
+		return errval;		       \
+} while (0)
+
+#define FUNC_PTR_OR_NULL_RET_WITH_ERRNO(func, errval) do { \
+	if ((func) == NULL) {				   \
+		rte_errno = errval;			   \
+		return NULL;				   \
+	}						   \
+} while (0)
+
+/**
+ * @warning
+ * @b EXPERIMENTAL: this API may change without prior notice
+ *
+ * Arm a burst of event timers with separate expiration timeout tick for each
+ * event timer.
+ *
+ * Before calling this function, the application allocates
+ * ``struct rte_event_timer`` objects from mempool or huge page backed
+ * application buffers of desired size. On successful allocation,
+ * application updates the `struct rte_event_timer`` attributes such as
+ * 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.
+ *
+ * @param adapter
+ *   A pointer to an event timer adapter structure.
+ * @param evtims
+ *   Pointer to an array of objects of type *rte_event_timer* structure.
+ * @param nb_evtims
+ *   Number of event timers in the supplied array.
+ *
+ * @return
+ *   The number of successfully armed event timers. The return value can be less
+ *   than the value of the *nb_evtims* parameter. If the return value is less
+ *   than *nb_evtims*, the remaining event timers at the end of *evtims*
+ *   are not consumed, and the caller has to take care of them, and rte_errno
+ *   is set accordingly. Possible errno values include:
+ *   - EINVAL Invalid timer adapter, expiry event queue ID is invalid, or an
+ *   expiry event's sched type doesn't match the capabilities of the
+ *   destination event queue.
+ *   - EAGAIN Specified timer adapter is not running
+ *   - EALREADY A timer was encountered that was already armed
+ */
+static inline uint16_t __rte_experimental
+rte_event_timer_arm_burst(const struct rte_event_timer_adapter *adapter,
+			  struct rte_event_timer **evtims,
+			  uint16_t nb_evtims)
+{
+#ifdef RTE_LIBRTE_EVENTDEV_DEBUG
+	ADAPTER_VALID_OR_ERR_RET(adapter, -EINVAL);
+	FUNC_PTR_OR_ERR_RET(adapter->arm_burst, -EINVAL);
+#endif
+
+	return adapter->arm_burst(adapter, evtims, nb_evtims);
+}
+
+/**
+ * @warning
+ * @b EXPERIMENTAL: this API may change without prior notice
+ *
+ * Arm a burst of event timers with same expiration timeout tick.
+ *
+ * Provides the same functionality as ``rte_event_timer_arm_burst()``, except
+ * that application can use this API when all the event timers have the
+ * same timeout expiration tick. This specialized function can provide the
+ * additional hint to the adapter implementation and optimize if possible.
+ *
+ * @param adapter
+ *   A pointer to an event timer adapter structure.
+ * @param evtims
+ *   Points to an array of objects of type *rte_event_timer* structure.
+ * @param timeout_ticks
+ *   The number of ticks in which the timers should expire.
+ * @param nb_evtims
+ *   Number of event timers in the supplied array.
+ *
+ * @return
+ *   The number of successfully armed event timers. The return value can be less
+ *   than the value of the *nb_evtims* parameter. If the return value is less
+ *   than *nb_evtims*, the remaining event timers at the end of *evtims*
+ *   are not consumed, and the caller has to take care of them, and rte_errno
+ *   is set accordingly. Possible errno values include:
+ *   - EINVAL Invalid timer adapter, expiry event queue ID is invalid, or an
+ *   expiry event's sched type doesn't match the capabilities of the
+ *   destination event queue.
+ *   - EAGAIN Specified event timer adapter is not running
+ *   - EALREADY A timer was encountered that was already armed
+ */
+static inline uint16_t __rte_experimental
+rte_event_timer_arm_tmo_tick_burst(
+			const struct rte_event_timer_adapter *adapter,
+			struct rte_event_timer **evtims,
+			const uint64_t timeout_ticks,
+			const uint16_t nb_evtims)
+{
+#ifdef RTE_LIBRTE_EVENTDEV_DEBUG
+	ADAPTER_VALID_OR_ERR_RET(adapter, -EINVAL);
+	FUNC_PTR_OR_ERR_RET(adapter->arm_tmo_tick_burst, -EINVAL);
+#endif
+
+	return adapter->arm_tmo_tick_burst(adapter, evtims, timeout_ticks,
+					   nb_evtims);
+}
+
+/**
+ * @warning
+ * @b EXPERIMENTAL: this API may change without prior notice
+ *
+ * Cancel a burst of event timers from being scheduled to the event device.
+ *
+ * @param adapter
+ *   A pointer to an event timer adapter structure.
+ * @param evtims
+ *   Points to an array of objects of type *rte_event_timer* structure
+ * @param nb_evtims
+ *   Number of event timer instances in the supplied array.
+ *
+ * @return
+ *   The number of successfully canceled event timers. The return value can be
+ *   less than the value of the *nb_evtims* parameter. If the return value is
+ *   less than *nb_evtims*, the remaining event timers at the end of *evtims*
+ *   are not consumed, and the caller has to take care of them, and rte_errno
+ *   is set accordingly. Possible errno values include:
+ *   - EINVAL Invalid timer adapter identifier
+ *   - EAGAIN Specified timer adapter is not running
+ *   - EALREADY  A timer was encountered that was already canceled
+ */
+static inline uint16_t __rte_experimental
+rte_event_timer_cancel_burst(const struct rte_event_timer_adapter *adapter,
+			     struct rte_event_timer **evtims,
+			     uint16_t nb_evtims)
+{
+#ifdef RTE_LIBRTE_EVENTDEV_DEBUG
+	ADAPTER_VALID_OR_ERR_RET(adapter, -EINVAL);
+	FUNC_PTR_OR_ERR_RET(adapter->cancel_burst, -EINVAL);
+#endif
+
+	return adapter->cancel_burst(adapter, evtims, nb_evtims);
+}
+
+#endif /* __RTE_EVENT_TIMER_ADAPTER_H__ */
diff --git a/lib/librte_eventdev/rte_eventdev.h b/lib/librte_eventdev/rte_eventdev.h
index b21c271..e79583a 100644
--- a/lib/librte_eventdev/rte_eventdev.h
+++ b/lib/librte_eventdev/rte_eventdev.h
@@ -923,8 +923,8 @@ rte_event_dev_close(uint8_t dev_id);
 /**< The event generated from ethdev subsystem */
 #define RTE_EVENT_TYPE_CRYPTODEV        0x1
 /**< The event generated from crypodev subsystem */
-#define RTE_EVENT_TYPE_TIMERDEV         0x2
-/**< The event generated from timerdev subsystem */
+#define RTE_EVENT_TYPE_TIMER		0x2
+/**< The event generated from event timer adapter */
 #define RTE_EVENT_TYPE_CPU              0x3
 /**< The event generated from cpu for pipelining.
  * Application may use *sub_event_type* to further classify the event
-- 
2.6.4

  reply	other threads:[~2018-03-29 21:27 UTC|newest]

Thread overview: 133+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1511890148-22295-1-git-send-email-erik.g.carrillo@intel.com>
2017-12-01 20:00 ` [dpdk-dev] [RFC PATCH v5 0/5] " Erik Gabriel Carrillo
2017-12-01 20:00   ` [dpdk-dev] [RFC PATCH v5 1/5] " Erik Gabriel Carrillo
2017-12-06 15:17     ` Jerin Jacob
2017-12-06 16:23       ` Carrillo, Erik G
2017-12-01 20:00   ` [dpdk-dev] [RFC PATCH v5 2/5] eventtimer: add common code Erik Gabriel Carrillo
2017-12-06 15:35     ` Jerin Jacob
2017-12-01 20:00   ` [dpdk-dev] [RFC PATCH v5 3/5] eventtimer: add config variable for adapter Erik Gabriel Carrillo
2017-12-06 15:41     ` Jerin Jacob
2017-12-06 20:01       ` Carrillo, Erik G
2017-12-01 20:00   ` [dpdk-dev] [RFC PATCH v5 4/5] eventtimer: add default software implementation stub Erik Gabriel Carrillo
2017-12-01 20:00   ` [dpdk-dev] [RFC PATCH v5 5/5] test: add event timer adapter auto-test Erik Gabriel Carrillo
2018-01-11  0:20   ` [dpdk-dev] [PATCH v6 00/23] eventtimer: introduce event timer adapter Erik Gabriel Carrillo
2018-01-11  0:20     ` [dpdk-dev] [PATCH v6 01/23] eventtimer: add event timer adapter API Erik Gabriel Carrillo
2018-01-11 11:10       ` Pavan Nikhilesh
2018-01-11 16:56         ` Carrillo, Erik G
2018-01-11 17:31           ` Pavan Nikhilesh
2018-01-11  0:20     ` [dpdk-dev] [PATCH v6 02/23] eventtimer: add common code Erik Gabriel Carrillo
2018-01-11  0:20     ` [dpdk-dev] [PATCH v6 03/23] eventtimer: add default software driver stub Erik Gabriel Carrillo
2018-01-11  0:20     ` [dpdk-dev] [PATCH v6 04/23] test: add event timer adapter auto-test Erik Gabriel Carrillo
2018-01-11  0:20     ` [dpdk-dev] [PATCH v6 05/23] eventtimer: add adapter allocation definitions Erik Gabriel Carrillo
2018-01-11 11:18       ` Pavan Nikhilesh
2018-01-11  0:20     ` [dpdk-dev] [PATCH v6 06/23] test: exercise event timer adapter allocation functions Erik Gabriel Carrillo
2018-01-11  0:20     ` [dpdk-dev] [PATCH v6 07/23] eventtimer: add adapter get info function definition Erik Gabriel Carrillo
2018-01-11  0:20     ` [dpdk-dev] [PATCH v6 08/23] eventtimer: add adapter start/stop definitions Erik Gabriel Carrillo
2018-01-11 17:28       ` Pavan Nikhilesh
2018-01-18 23:57         ` Carrillo, Erik G
2018-01-11  0:21     ` [dpdk-dev] [PATCH v6 09/23] eventtimer: add API to get service id Erik Gabriel Carrillo
2018-01-11  0:21     ` [dpdk-dev] [PATCH v6 10/23] eventtimer: remove service id entry from info structure Erik Gabriel Carrillo
2018-01-11 11:34       ` Pavan Nikhilesh
2018-01-11  0:21     ` [dpdk-dev] [PATCH v6 11/23] test: exercise event timer adapter start/stop functions Erik Gabriel Carrillo
2018-01-11  0:21     ` [dpdk-dev] [PATCH v6 12/23] eventtimer: add event timer arm/cancel function definitions Erik Gabriel Carrillo
2018-01-11 11:38       ` Pavan Nikhilesh
2018-01-11  0:21     ` [dpdk-dev] [PATCH v6 13/23] eventtimer: add adapter service definition Erik Gabriel Carrillo
2018-01-11 12:03       ` Pavan Nikhilesh
2018-01-11  0:21     ` [dpdk-dev] [PATCH v6 14/23] eventtimer: add event timer initializer function Erik Gabriel Carrillo
2018-01-11  0:21     ` [dpdk-dev] [PATCH v6 15/23] eventtimer: add buffering of timer expiry events Erik Gabriel Carrillo
2018-01-11 12:18       ` Pavan Nikhilesh
2018-01-18 23:07         ` Carrillo, Erik G
2018-01-20  8:55           ` Pavan Nikhilesh
2018-01-11  0:21     ` [dpdk-dev] [PATCH v6 16/23] eventtimer: add stats to API Erik Gabriel Carrillo
2018-01-11  0:21     ` [dpdk-dev] [PATCH v6 17/23] eventtimer: add support for single-producer put mode Erik Gabriel Carrillo
2018-01-11  0:21     ` [dpdk-dev] [PATCH v6 18/23] eventtimer: add non-blocking mode for event timer operations Erik Gabriel Carrillo
2018-01-11  0:21     ` [dpdk-dev] [PATCH v6 19/23] test: exercise event timer arm and expiry Erik Gabriel Carrillo
2018-01-11 12:26       ` Pavan Nikhilesh
2018-01-11  0:21     ` [dpdk-dev] [PATCH v6 20/23] maintainers: add event timer adapter section Erik Gabriel Carrillo
2018-01-11  0:21     ` [dpdk-dev] [PATCH v6 21/23] doc: add event timer adapter to API index Erik Gabriel Carrillo
2018-01-12 11:12       ` Kovacevic, Marko
2018-01-11  0:21     ` [dpdk-dev] [PATCH v6 22/23] doc: add event timer adapter section to programmer's guide Erik Gabriel Carrillo
2018-01-11 15:26       ` Kovacevic, Marko
2018-01-11  0:21     ` [dpdk-dev] [PATCH v6 23/23] doc: add event timer adapter to release notes Erik Gabriel Carrillo
2018-01-12 10:48       ` Kovacevic, Marko
2018-03-08 21:53     ` [dpdk-dev] [PATCH v7 0/7] eventtimer: introduce event timer adapter Erik Gabriel Carrillo
2018-03-08 21:54       ` [dpdk-dev] [PATCH v7 1/7] eventtimer: add event timer adapter API Erik Gabriel Carrillo
2018-03-12  7:53         ` Jerin Jacob
2018-03-12 16:22           ` Carrillo, Erik G
2018-03-08 21:54       ` [dpdk-dev] [PATCH v7 2/7] eventtimer: add common code Erik Gabriel Carrillo
2018-03-12  8:11         ` Jerin Jacob
2018-03-08 21:54       ` [dpdk-dev] [PATCH v7 3/7] eventtimer: add default software driver Erik Gabriel Carrillo
2018-03-12  8:45         ` Jerin Jacob
2018-03-12 21:20           ` Carrillo, Erik G
2018-03-08 21:54       ` [dpdk-dev] [PATCH v7 4/7] eventtimer: add support for meson build system Erik Gabriel Carrillo
2018-03-08 21:54       ` [dpdk-dev] [PATCH v7 5/7] test: add event timer adapter auto-test Erik Gabriel Carrillo
2018-03-14 12:52         ` Pavan Nikhilesh
2018-03-14 21:42           ` Carrillo, Erik G
2018-03-14 13:31         ` Pavan Nikhilesh
2018-03-14 21:40           ` Carrillo, Erik G
2018-03-08 21:54       ` [dpdk-dev] [PATCH v7 6/7] doc: add event timer adapter section to programmer's guide Erik Gabriel Carrillo
2018-03-12 11:21         ` Jerin Jacob
2018-03-12 22:02           ` Carrillo, Erik G
2018-03-08 21:54       ` [dpdk-dev] [PATCH v7 7/7] doc: add event timer adapter documentation Erik Gabriel Carrillo
2018-03-12 11:28         ` Jerin Jacob
2018-03-29 21:27       ` [dpdk-dev] [PATCH v8 0/9] eventtimer: introduce event timer adapter Erik Gabriel Carrillo
2018-03-29 21:27         ` Erik Gabriel Carrillo [this message]
2018-03-29 21:27         ` [dpdk-dev] [PATCH v8 2/9] eventdev: convert to SPDX license tag in header Erik Gabriel Carrillo
2018-04-02  8:12           ` Jerin Jacob
2018-04-02  9:16             ` Hemant Agrawal
2018-03-29 21:27         ` [dpdk-dev] [PATCH v8 3/9] eventtimer: add common code Erik Gabriel Carrillo
2018-03-29 21:27         ` [dpdk-dev] [PATCH v8 4/9] mk: update library order in static build Erik Gabriel Carrillo
2018-03-29 21:27         ` [dpdk-dev] [PATCH v8 5/9] eventtimer: add default software driver Erik Gabriel Carrillo
2018-04-02  8:42           ` Jerin Jacob
2018-03-29 21:27         ` [dpdk-dev] [PATCH v8 6/9] eventtimer: add support for meson build system Erik Gabriel Carrillo
2018-03-29 21:27         ` [dpdk-dev] [PATCH v8 7/9] test: add event timer adapter auto-test Erik Gabriel Carrillo
2018-03-30 15:48           ` Bhagavatula, Pavan
2018-03-30 18:47             ` Carrillo, Erik G
2018-03-29 21:27         ` [dpdk-dev] [PATCH v8 8/9] doc: add event timer adapter section to programmer's guide Erik Gabriel Carrillo
2018-03-29 21:27         ` [dpdk-dev] [PATCH v8 9/9] doc: add event timer adapter documentation Erik Gabriel Carrillo
2018-04-02 19:39         ` [dpdk-dev] [PATCH v9 0/9] eventtimer: introduce event timer adapter Erik Gabriel Carrillo
2018-04-02 19:39           ` [dpdk-dev] [PATCH v9 1/9] " Erik Gabriel Carrillo
2018-04-02 23:25             ` Jerin Jacob
2018-04-02 19:39           ` [dpdk-dev] [PATCH v9 2/9] eventdev: convert to SPDX license tag in header Erik Gabriel Carrillo
2018-04-02 23:27             ` Jerin Jacob
2018-04-02 19:39           ` [dpdk-dev] [PATCH v9 3/9] eventtimer: add common code Erik Gabriel Carrillo
2018-04-02 23:35             ` Jerin Jacob
2018-04-03 18:38               ` Carrillo, Erik G
2018-04-02 19:39           ` [dpdk-dev] [PATCH v9 4/9] mk: update library order in static build Erik Gabriel Carrillo
2018-04-02 23:36             ` Jerin Jacob
2018-04-02 19:39           ` [dpdk-dev] [PATCH v9 5/9] eventtimer: add default software driver Erik Gabriel Carrillo
2018-04-03  9:59             ` Pavan Nikhilesh
2018-04-02 19:39           ` [dpdk-dev] [PATCH v9 6/9] eventtimer: add support for meson build system Erik Gabriel Carrillo
2018-04-02 19:39           ` [dpdk-dev] [PATCH v9 7/9] test: add event timer adapter auto-test Erik Gabriel Carrillo
2018-04-03  9:52             ` Pavan Nikhilesh
2018-04-02 19:39           ` [dpdk-dev] [PATCH v9 8/9] doc: add event timer adapter section to programmer's guide Erik Gabriel Carrillo
2018-04-03  0:00             ` Jerin Jacob
2018-04-02 19:39           ` [dpdk-dev] [PATCH v9 9/9] doc: add event timer adapter documentation Erik Gabriel Carrillo
2018-04-02 23:42             ` Jerin Jacob
2018-04-02 23:19           ` [dpdk-dev] [PATCH v9 0/9] eventtimer: introduce event timer adapter Jerin Jacob
2018-04-03 14:09             ` Carrillo, Erik G
2018-04-03 14:15               ` Jerin Jacob
2018-04-03 18:32                 ` Carrillo, Erik G
2018-04-03 21:44           ` [dpdk-dev] [PATCH v10 " Erik Gabriel Carrillo
2018-04-03 21:44             ` [dpdk-dev] [PATCH v10 1/9] " Erik Gabriel Carrillo
2018-04-03 21:44             ` [dpdk-dev] [PATCH v10 2/9] eventdev: convert to SPDX license tag in header Erik Gabriel Carrillo
2018-04-03 21:44             ` [dpdk-dev] [PATCH v10 3/9] eventtimer: add common code Erik Gabriel Carrillo
2018-04-04 16:50               ` Pavan Nikhilesh
2018-04-03 21:44             ` [dpdk-dev] [PATCH v10 4/9] mk: update library order in static build Erik Gabriel Carrillo
2018-04-03 21:44             ` [dpdk-dev] [PATCH v10 5/9] eventtimer: add default software driver Erik Gabriel Carrillo
2018-04-03 21:44             ` [dpdk-dev] [PATCH v10 6/9] eventtimer: add support for meson build system Erik Gabriel Carrillo
2018-04-04 16:51               ` Pavan Nikhilesh
2018-04-03 21:44             ` [dpdk-dev] [PATCH v10 7/9] test: add event timer adapter auto-test Erik Gabriel Carrillo
2018-04-03 21:44             ` [dpdk-dev] [PATCH v10 8/9] doc: add event timer adapter section to programmer's guide Erik Gabriel Carrillo
2018-04-03 21:44             ` [dpdk-dev] [PATCH v10 9/9] doc: add event timer adapter documentation Erik Gabriel Carrillo
2018-04-04  2:31             ` [dpdk-dev] [PATCH v10 0/9] eventtimer: introduce event timer adapter Jerin Jacob
2018-04-04 21:51             ` [dpdk-dev] [PATCH v11 " Erik Gabriel Carrillo
2018-04-04 21:51               ` [dpdk-dev] [PATCH v11 1/9] " Erik Gabriel Carrillo
2018-04-04 21:51               ` [dpdk-dev] [PATCH v11 2/9] eventdev: convert to SPDX license tag in header Erik Gabriel Carrillo
2018-04-04 21:51               ` [dpdk-dev] [PATCH v11 3/9] eventtimer: add common code Erik Gabriel Carrillo
2018-04-04 21:51               ` [dpdk-dev] [PATCH v11 4/9] mk: update library order in static build Erik Gabriel Carrillo
2018-04-04 21:51               ` [dpdk-dev] [PATCH v11 5/9] eventtimer: add default software driver Erik Gabriel Carrillo
2018-04-04 21:51               ` [dpdk-dev] [PATCH v11 6/9] eventtimer: add support for meson build system Erik Gabriel Carrillo
2018-04-04 21:51               ` [dpdk-dev] [PATCH v11 7/9] test: add event timer adapter auto-test Erik Gabriel Carrillo
2018-04-04 21:51               ` [dpdk-dev] [PATCH v11 8/9] doc: add event timer adapter section to programmer's guide Erik Gabriel Carrillo
2018-04-04 21:51               ` [dpdk-dev] [PATCH v11 9/9] doc: add event timer adapter documentation Erik Gabriel Carrillo
2018-04-05  3:31               ` [dpdk-dev] [PATCH v11 0/9] eventtimer: introduce event timer adapter Jerin Jacob

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=1522358852-3630-2-git-send-email-erik.g.carrillo@intel.com \
    --to=erik.g.carrillo@intel.com \
    --cc=dev@dpdk.org \
    --cc=hemant.agrawal@nxp.com \
    --cc=jerin.jacob@caviumnetworks.com \
    --cc=nipun.gupta@nxp.com \
    --cc=pbhagavatula@caviumnetworks.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).