aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/odp/api/spec/ipsec.h9
-rw-r--r--include/odp/api/spec/packet_io.h8
-rw-r--r--include/odp/api/spec/time.h55
-rw-r--r--include/odp/api/spec/timer.h109
-rw-r--r--include/odp/api/spec/traffic_mngr.h132
5 files changed, 258 insertions, 55 deletions
diff --git a/include/odp/api/spec/ipsec.h b/include/odp/api/spec/ipsec.h
index 5c4ee03ab..2030b19e8 100644
--- a/include/odp/api/spec/ipsec.h
+++ b/include/odp/api/spec/ipsec.h
@@ -937,6 +937,15 @@ typedef struct odp_ipsec_stats_t {
/** Number of packets with hard lifetime(packets) expired */
uint64_t hard_exp_pkts_err;
+
+ /** Total bytes of packet data processed by IPsec SA in success cases
+ *
+ * The range of packet bytes included in the success_bytes count is
+ * implementation defined but includes at least the bytes input for
+ * encryption or bytes output after decryption in ESP or the bytes
+ * authenticated in AH.
+ */
+ uint64_t success_bytes;
} odp_ipsec_stats_t;
/**
diff --git a/include/odp/api/spec/packet_io.h b/include/odp/api/spec/packet_io.h
index fcb0a39c3..1f4ac84f6 100644
--- a/include/odp/api/spec/packet_io.h
+++ b/include/odp/api/spec/packet_io.h
@@ -1074,8 +1074,10 @@ int odp_pktout_queue_config(odp_pktio_t pktio,
* output. If return value (N) is less than 'num', only queues[0 ... N-1] have
* been written.
*
- * Packets (and other events) from these queues are received with
- * odp_queue_deq(), odp_schedule(), etc calls.
+ * In addition to packet input, application and other parts of ODP (e.g. timer)
+ * may enqueue events into these queues. Depending on the queue mode, application
+ * uses either odp_queue_deq() or odp_schedule() (or variants of those) to receive
+ * packets and other events from these queues.
*
* @param pktio Packet IO handle
* @param[out] queues Points to an array of queue handles for output
@@ -1117,7 +1119,7 @@ int odp_pktin_queue(odp_pktio_t pktio, odp_pktin_queue_t queues[], int num);
*
* Packets are enqueued to these queues with odp_queue_enq() or
* odp_queue_enq_multi(). Behaviour is undefined if other events than packets
- * are enqueued.
+ * are enqueued. Application cannot dequeue from these queues.
*
* @param pktio Packet IO handle
* @param[out] queues Points to an array of queue handles for output
diff --git a/include/odp/api/spec/time.h b/include/odp/api/spec/time.h
index c5756e492..c25338a51 100644
--- a/include/odp/api/spec/time.h
+++ b/include/odp/api/spec/time.h
@@ -1,5 +1,5 @@
/* Copyright (c) 2013-2018, Linaro Limited
- * Copyright (c) 2020, Nokia
+ * Copyright (c) 2020-2021, Nokia
* All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
@@ -66,6 +66,35 @@ extern "C" {
odp_time_t odp_time_local(void);
/**
+ * Current local time in nanoseconds
+ *
+ * Like odp_time_local(), but the time stamp value is converted into nanoseconds.
+ *
+ * @return Local time stamp in nanoseconds
+ */
+uint64_t odp_time_local_ns(void);
+
+/**
+ * Current local time (strict)
+ *
+ * Like odp_time_local(), but reads the time stamp value more strictly in the program order.
+ * The function may decrease CPU performance around the call, as it may include additional
+ * barrier instructions or otherwise limit out-of-order execution.
+ *
+ * @return Local time stamp
+ */
+odp_time_t odp_time_local_strict(void);
+
+/**
+ * Current local time in nanoseconds (strict)
+ *
+ * Like odp_time_local_strict(), but the time stamp value is converted into nanoseconds.
+ *
+ * @return Local time stamp in nanoseconds
+ */
+uint64_t odp_time_local_strict_ns(void);
+
+/**
* Current global time
*
* Returns current global time stamp value. The global time source provides high
@@ -78,22 +107,32 @@ odp_time_t odp_time_local(void);
odp_time_t odp_time_global(void);
/**
- * Current local time in nanoseconds
+ * Current global time in nanoseconds
*
- * Like odp_time_local(), but the time stamp value is converted into nanoseconds.
+ * Like odp_time_global(), but the time stamp value is converted into nanoseconds.
*
- * @return Local time stamp in nanoseconds
+ * @return Global time stamp in nanoseconds
*/
-uint64_t odp_time_local_ns(void);
+uint64_t odp_time_global_ns(void);
/**
- * Current global time in nanoseconds
+ * Current global time (strict)
*
- * Like odp_time_global(), but the time stamp value is converted into nanoseconds.
+ * Like odp_time_global(), but reads the time stamp value more strictly (see
+ * odp_time_local_strict() documentation) in the program order.
+ *
+ * @return Global time stamp
+ */
+odp_time_t odp_time_global_strict(void);
+
+/**
+ * Current global time in nanoseconds (strict)
+ *
+ * Like odp_time_global_strict(), but the time stamp value is converted into nanoseconds.
*
* @return Global time stamp in nanoseconds
*/
-uint64_t odp_time_global_ns(void);
+uint64_t odp_time_global_strict_ns(void);
/**
* Time difference
diff --git a/include/odp/api/spec/timer.h b/include/odp/api/spec/timer.h
index 62151e485..a90fb9b07 100644
--- a/include/odp/api/spec/timer.h
+++ b/include/odp/api/spec/timer.h
@@ -1,5 +1,5 @@
/* Copyright (c) 2013-2018, Linaro Limited
- * Copyright (c) 2019-2020, Nokia
+ * Copyright (c) 2019-2021, Nokia
*
* All rights reserved.
*
@@ -36,16 +36,47 @@ extern "C" {
*/
/**
- * Clock sources for timers in timer pool.
+ * Clock sources for timer pools
+ *
+ * ODP_CLOCK_DEFAULT is the default clock source and it is supported always. It is implementation
+ * defined which other clock sources are supported. See from implementation documentation how the
+ * supported clock sources are mapped into these enumerations.
*/
typedef enum {
- /** Use CPU clock as clock source for timers */
- ODP_CLOCK_CPU,
- /** Use external clock as clock source for timers */
- ODP_CLOCK_EXT
- /* Platform dependent which other clock sources exist */
+ /** Clock source number 0 */
+ ODP_CLOCK_SRC_0,
+
+ /** Clock source number 1 */
+ ODP_CLOCK_SRC_1,
+
+ /** Clock source number 2 */
+ ODP_CLOCK_SRC_2,
+
+ /** Clock source number 3 */
+ ODP_CLOCK_SRC_3,
+
+ /** Clock source number 4 */
+ ODP_CLOCK_SRC_4,
+
+ /** Clock source number 5 */
+ ODP_CLOCK_SRC_5,
+
+ /** Number of clock source enumerations */
+ ODP_CLOCK_NUM_SRC
+
} odp_timer_clk_src_t;
+/** The default clock source */
+#define ODP_CLOCK_DEFAULT ODP_CLOCK_SRC_0
+
+/** For backwards compatibility, ODP_CLOCK_CPU is synonym of ODP_CLOCK_DEFAULT.
+ * This will be deprecated in the future. */
+#define ODP_CLOCK_CPU ODP_CLOCK_DEFAULT
+
+/** For backwards compatibility, ODP_CLOCK_EXT is synonym of ODP_CLOCK_SRC_1.
+ * This will be deprecated in the future. */
+#define ODP_CLOCK_EXT ODP_CLOCK_SRC_1
+
/**
* @typedef odp_timer_t
* ODP timer handle
@@ -70,31 +101,34 @@ typedef enum {
* Return values of timer set calls.
*/
typedef enum {
- /**
- * Timer set operation succeeded
- */
+ /** Timer set operation succeeded */
ODP_TIMER_SUCCESS = 0,
- /**
- * Timer set operation failed, expiration too early.
- * Either retry with a later expiration time or process the timeout
- * immediately. */
- ODP_TIMER_TOOEARLY = -1,
+ /** Timer set operation failed because expiration time is too near to
+ * the current time. */
+ ODP_TIMER_TOO_NEAR = -1,
- /**
- * Timer set operation failed, expiration too late.
- * Truncate the expiration time against the maximum timeout for the
- * timer pool. */
- ODP_TIMER_TOOLATE = -2,
+ /** Timer set operation failed because expiration time is too far from
+ * the current time. */
+ ODP_TIMER_TOO_FAR = -2,
- /**
- * Timer set operation failed because no event specified and no event
- * present in the timer (timer inactive/expired).
- */
- ODP_TIMER_NOEVENT = -3
+ /** Timer set operation failed */
+ ODP_TIMER_FAIL = -3
} odp_timer_set_t;
+/** For backwards compatibility, ODP_TIMER_TOOEARLY is synonym of ODP_TIMER_TOO_NEAR.
+ * This will be deprecated in the future. */
+#define ODP_TIMER_TOOEARLY ODP_TIMER_TOO_NEAR
+
+/** For backwards compatibility, ODP_TIMER_TOOLATE is synonym of ODP_TIMER_TOO_FAR.
+ * This will be deprecated in the future. */
+#define ODP_TIMER_TOOLATE ODP_TIMER_TOO_FAR
+
+/** For backwards compatibility, ODP_TIMER_NOEVENT is synonym of ODP_TIMER_FAIL.
+ * This will be deprecated in the future. */
+#define ODP_TIMER_NOEVENT ODP_TIMER_FAIL
+
/**
* @def ODP_TIMER_POOL_NAME_LEN
* Maximum timer pool name length in chars including null char
@@ -240,18 +274,19 @@ typedef struct {
} odp_timer_capability_t;
/**
- * Query timer capabilities
+ * Query timer capabilities per clock source
*
- * Outputs timer capabilities on success.
+ * Outputs timer capabilities on success. Returns -1 if the clock source
+ * is not supported.
*
* @param clk_src Clock source for timers
* @param[out] capa Pointer to capability structure for output
*
- * @retval 0 on success
- * @retval <0 on failure
+ * @retval 0 on success
+ * @retval -1 when the clock source is not supported
+ * @retval <-1 on other failures
*/
-int odp_timer_capability(odp_timer_clk_src_t clk_src,
- odp_timer_capability_t *capa);
+int odp_timer_capability(odp_timer_clk_src_t clk_src, odp_timer_capability_t *capa);
/**
* Timer resolution capability
@@ -423,11 +458,11 @@ odp_event_t odp_timer_free(odp_timer_t timer);
* outputs the old event here.
*
* @retval ODP_TIMER_SUCCESS Success
- * @retval ODP_TIMER_TOOEARLY Failure. Expiration time is too near to
+ * @retval ODP_TIMER_TOO_NEAR Failure. Expiration time is too near to
* the current time.
- * @retval ODP_TIMER_TOOLATE Failure. Expiration time is too far from
+ * @retval ODP_TIMER_TOO_FAR Failure. Expiration time is too far from
* the current time.
- * @retval ODP_TIMER_NOEVENT Failure. Set operation: No event provided.
+ * @retval ODP_TIMER_FAIL Failure. Set operation: No event provided.
* Reset operation: Too late to reset the timer.
*
* @see odp_timer_set_rel(), odp_timer_alloc(), odp_timer_cancel()
@@ -451,11 +486,11 @@ int odp_timer_set_abs(odp_timer_t timer, uint64_t abs_tick,
* outputs the old event here.
*
* @retval ODP_TIMER_SUCCESS Success
- * @retval ODP_TIMER_TOOEARLY Failure. Expiration time is too near to
+ * @retval ODP_TIMER_TOO_NEAR Failure. Expiration time is too near to
* the current time.
- * @retval ODP_TIMER_TOOLATE Failure. Expiration time is too far from
+ * @retval ODP_TIMER_TOO_FAR Failure. Expiration time is too far from
* the current time.
- * @retval ODP_TIMER_NOEVENT Failure. Set operation: No event provided.
+ * @retval ODP_TIMER_FAIL Failure. Set operation: No event provided.
* Reset operation: Too late to reset the timer.
*
* @see odp_timer_set_abs(), odp_timer_alloc(), odp_timer_cancel()
diff --git a/include/odp/api/spec/traffic_mngr.h b/include/odp/api/spec/traffic_mngr.h
index 04848a0ea..699d0bb26 100644
--- a/include/odp/api/spec/traffic_mngr.h
+++ b/include/odp/api/spec/traffic_mngr.h
@@ -224,6 +224,10 @@ typedef struct {
* all support TM shaping, */
odp_bool_t tm_node_shaper_supported;
+ /** tm_node_shaper_packet_mode indicates that tm_nodes at this level
+ * support shaper in packet mode */
+ odp_bool_t tm_node_shaper_packet_mode;
+
/** tm_node_wred_supported indicates that the tm_nodes at this level
* support some form of Random Early Detection. */
odp_bool_t tm_node_wred_supported;
@@ -285,6 +289,10 @@ typedef struct {
* expected to do. */
odp_bool_t tm_queue_shaper_supported;
+ /** tm_queue_shaper_packet_mode indicates that tm_queues support
+ * shaper in packet mode */
+ odp_bool_t tm_queue_shaper_packet_mode;
+
/** tm_queue_wred_supported indicates that the tm_queues support some
* form of Random Early Detection. */
odp_bool_t tm_queue_wred_supported;
@@ -331,6 +339,52 @@ typedef struct {
/** The per_level array specifies the TM system capabilities that
* can vary based upon the tm_node level. */
odp_tm_level_capabilities_t per_level[ODP_TM_MAX_LEVELS];
+
+ /** dynamic_topology_update indicates support for TM system dynamic
+ * topology update. A dynamic topology update is defined as update to
+ * a TM system topology while TM system is not in stopped state.
+ * When TRUE, application can update topology dynamically
+ * without bringing the TM system to stopped state. When FALSE,
+ * application has to call odp_tm_stop() before updating the
+ * topology and odp_tm_start() after completing the update.
+ */
+ odp_bool_t dynamic_topology_update;
+
+ /** dynamic_shaper_update indicates support for TM system's dynamic
+ * shaper profile changes. When TRUE, application can update shaper
+ * profile of a TM queue or TM node dynamically.
+ * When FALSE, it implies that TM system should be brought to
+ * stopped state before changing the shaper profile or updating
+ * the parameters of the shaper profile of any TM node or TM queue.
+ */
+ odp_bool_t dynamic_shaper_update;
+
+ /** dynamic_sched_update indicates support for TM system's dynamic
+ * sched profile changes. When TRUE, application can update sched
+ * profile of a TM queue or TM node dynamically.
+ * When FALSE, it implies that TM system should be brought to
+ * stopped state before changing the sched profile or updating
+ * the parameters of the sched profile of any TM node or TM queue.
+ */
+ odp_bool_t dynamic_sched_update;
+
+ /** dynamic_wred_update indicates support for TM system's dynamic
+ * wred profile changes. When TRUE, application can update wred
+ * profile of a TM queue or TM node dynamically.
+ * When FALSE, it implies that TM system should be brought to
+ * stopped state before changing the wred profile or updating
+ * the parameters of the wred profile of any TM node or TM queue.
+ */
+ odp_bool_t dynamic_wred_update;
+
+ /** dynamic_threshold_update indicates support for TM system's dynamic
+ * threshold profile changes. When TRUE, application can update
+ * threshold profile of a TM queue or TM node dynamically.
+ * When FALSE, it implies that TM system should be brought to
+ * stopped state before changing the threshold profile or updating
+ * the parameters of the threshold profile of any TM node or TM queue.
+ */
+ odp_bool_t dynamic_threshold_update;
} odp_tm_capabilities_t;
/** Per Level Requirements
@@ -605,6 +659,48 @@ odp_tm_t odp_tm_find(const char *name,
*/
int odp_tm_capability(odp_tm_t odp_tm, odp_tm_capabilities_t *capabilities);
+/**
+ * Start a TM system
+ *
+ * odp_tm_start() needs to be used to start an already created or found TM
+ * system. By default, all the TM systems are in stopped state.
+ *
+ * @param tm TM system to be started
+ *
+ * @retval 0 on success
+ * @retval <0 on failure
+ */
+int odp_tm_start(odp_tm_t tm);
+
+/**
+ * Stop a TM system
+ *
+ * odp_tm_stop() can to used to stop a TM system that is already started for the
+ * purpose of reconfiguration that cannot be done dynamically.
+ *
+ * When TM is in the stopped state,
+ * - New packets must not be sent to the TM either directly by TM API or indirectly
+ * via IPsec outbound inline API. New packets can only be enqueued after
+ * starting the TM system using odp_tm_start().
+ * - Packets already inflight inside TM or IPSec for transmit may get silently dropped
+ * or may get transmitted with unspecified TM treatment.
+ *
+ * A following call to odp_tm_start() restarts TM system and its scheduling/shaping
+ * on existing and new packets.
+ *
+ * @param tm TM system to be stopped
+ *
+ * @retval 0 on success
+ * @retval <0 on failure
+ *
+ * @see odp_tm_capabilities_t::dynamic_topology_update
+ * @see odp_tm_capabilities_t::dynamic_shaper_update
+ * @see odp_tm_capabilities_t::dynamic_sched_update
+ * @see odp_tm_capabilities_t::dynamic_wred_update
+ * @see odp_tm_capabilities_t::dynamic_threshold_update
+ */
+int odp_tm_stop(odp_tm_t tm);
+
/** Destroy a TM system.
*
* odp_tm_destroy() may be used to destroy TM systems created via
@@ -746,20 +842,34 @@ typedef enum {
*/
typedef struct {
/** The committed information rate for this shaper profile. The units
- * for this integer are always in bits per second. */
- uint64_t commit_bps;
+ * for this integer is in bits per second when packet_mode is
+ * not TRUE while packets per second when packet mode is TRUE.
+ */
+ union {
+ /**< @deprecated Use commit_rate instead */
+ uint64_t ODP_DEPRECATE(commit_bps);
+ uint64_t commit_rate; /**< Commit information rate */
+ };
/** The peak information rate for this shaper profile. The units for
- * this integer are always in bits per second. */
- uint64_t peak_bps;
+ * this integer is in bits per second when packet_mode is
+ * not TRUE while in packets per second when packet mode is TRUE.
+ */
+ union {
+ /**< @deprecated Use peak_rate instead */
+ uint64_t ODP_DEPRECATE(peak_bps);
+ uint64_t peak_rate; /**< Peak information rate */
+ };
/** The commit burst tolerance for this shaper profile. The units for
- * this field are always bits. This value sets an upper limit for the
+ * this field is bits when packet_mode is not TRUE and packets when
+ * packet_mode is TRUE. This value sets an upper limit for the
* size of the commitCnt. */
uint32_t commit_burst;
/** The peak burst tolerance for this shaper profile. The units for
- * this field are always bits. This value sets an upper limit for the
+ * this field in bits when packet_mode is not TRUE and packets
+ * when packet_mode is TRUE. This value sets an upper limit for the
* size of the peakCnt. */
uint32_t peak_burst;
@@ -771,7 +881,9 @@ typedef struct {
* to a value approximating the "time" (in units of bytes) taken by
* the Ethernet preamble and Inter Frame Gap. Traditionally this
* would be the value 20 (8 + 12), but in same cases can be as low as
- * 9 (4 + 5). */
+ * 9 (4 + 5).
+ * This field is ignored when packet_mode is TRUE.
+ */
int8_t shaper_len_adjust;
/** If dual_rate is TRUE it indicates the desire for the
@@ -780,6 +892,12 @@ typedef struct {
* implementation specific, but in any case require a non-zero set of
* both commit and peak parameters. */
odp_bool_t dual_rate;
+
+ /** If packet_mode is TRUE it indicates that shaper should work
+ * in packet mode ignoring lengths of packet and hence shaping
+ * traffic in packet's per second as opposed to bits per second.
+ */
+ odp_bool_t packet_mode;
} odp_tm_shaper_params_t;
/** odp_tm_shaper_params_init() must be called to initialize any