diff options
author | Bill Fischofer <bill.fischofer@linaro.org> | 2015-11-17 18:16:37 -0600 |
---|---|---|
committer | Maxim Uvarov <maxim.uvarov@linaro.org> | 2015-11-24 16:45:08 +0300 |
commit | e1eeca3bb3e45d5194a07b41078b7562ce7ff526 (patch) | |
tree | 6a6457c04fed4ef540e5e88ba18ce123f5cef4b0 /platform/linux-generic | |
parent | 9127b7408b2bca7ebfe98d23b19aaf0a81994bd3 (diff) |
api: tm: add tm API definitions
This introduces an API for configuring and using Traffic Management
systems.
The purpose of this API is as a general packet scheduling system that
accepts packets from input queues and applies strict priority
scheduling, weighted fair queuing scheduling and/or bandwidth controls
to decide which input packet should be chosen as the next output
packet and when this output packet can be sent onwards.
Signed-off-by: Barry Spinney <spinney@ezchip.com>
Signed-off-by: Bill Fischofer <bill.fischofer@linaro.org>
Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
Diffstat (limited to 'platform/linux-generic')
-rw-r--r-- | platform/linux-generic/Makefile.am | 3 | ||||
-rw-r--r-- | platform/linux-generic/include/odp/plat/packet_types.h | 11 | ||||
-rw-r--r-- | platform/linux-generic/include/odp/plat/traffic_mngr_types.h | 185 | ||||
-rw-r--r-- | platform/linux-generic/include/odp/traffic_mngr.h | 35 | ||||
-rw-r--r-- | platform/linux-generic/include/odp_packet_internal.h | 5 |
5 files changed, 239 insertions, 0 deletions
diff --git a/platform/linux-generic/Makefile.am b/platform/linux-generic/Makefile.am index a6b602957..143167f85 100644 --- a/platform/linux-generic/Makefile.am +++ b/platform/linux-generic/Makefile.am @@ -51,6 +51,7 @@ odpinclude_HEADERS = \ $(srcdir)/include/odp/ticketlock.h \ $(srcdir)/include/odp/time.h \ $(srcdir)/include/odp/timer.h \ + $(srcdir)/include/odp/traffic_mngr.h \ $(srcdir)/include/odp/version.h odpplatincludedir= $(includedir)/odp/plat @@ -78,6 +79,7 @@ odpplatinclude_HEADERS = \ $(srcdir)/include/odp/plat/ticketlock_types.h \ $(srcdir)/include/odp/plat/time_types.h \ $(srcdir)/include/odp/plat/timer_types.h \ + $(srcdir)/include/odp/plat/traffic_mngr_types.h \ $(srcdir)/include/odp/plat/version_types.h odpapiincludedir= $(includedir)/odp/api @@ -122,6 +124,7 @@ odpapiinclude_HEADERS = \ $(top_srcdir)/include/odp/api/ticketlock.h \ $(top_srcdir)/include/odp/api/time.h \ $(top_srcdir)/include/odp/api/timer.h \ + $(top_srcdir)/include/odp/api/traffic_mngr.h \ $(top_srcdir)/include/odp/api/version.h noinst_HEADERS = \ diff --git a/platform/linux-generic/include/odp/plat/packet_types.h b/platform/linux-generic/include/odp/plat/packet_types.h index 45cb8010d..c3be63372 100644 --- a/platform/linux-generic/include/odp/plat/packet_types.h +++ b/platform/linux-generic/include/odp/plat/packet_types.h @@ -36,6 +36,17 @@ typedef ODP_HANDLE_T(odp_packet_seg_t); #define ODP_PACKET_SEG_INVALID _odp_cast_scalar(odp_packet_seg_t, 0xffffffff) +/** odp_packet_color_t assigns names to the various pkt "colors" */ +typedef enum { + ODP_PACKET_GREEN = 0, + ODP_PACKET_YELLOW = 1, + ODP_PACKET_RED = 2, + ODP_PACKET_ALL_COLORS = 3, +} odp_packet_color_t; + +/** Sets the maximum number of pkt "colors" */ +#define ODP_NUM_PACKET_COLORS 3 + /** Get printable format of odp_packet_t */ static inline uint64_t odp_packet_to_u64(odp_packet_t hdl) { diff --git a/platform/linux-generic/include/odp/plat/traffic_mngr_types.h b/platform/linux-generic/include/odp/plat/traffic_mngr_types.h new file mode 100644 index 000000000..52df64b7d --- /dev/null +++ b/platform/linux-generic/include/odp/plat/traffic_mngr_types.h @@ -0,0 +1,185 @@ +/* Copyright (c) 2015, Linaro Limited + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +/** + * @file + * + * ODP traffic mngr + */ + +#ifndef ODP_TRAFFIC_MNGR_TYPES_H_ +#define ODP_TRAFFIC_MNGR_TYPES_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <odp/std_types.h> +#include <odp/plat/strong_types.h> + +/** @addtogroup odp_traffic_mngr + * Macros and operations on a TM system. + * @{ + */ + +/** The ODP_TM_MAX_NUM_SYSTEMS constant specifies the maximum number of TM + * systems that may be created. On some platforms this might be much more + * limited to as little as one hardware TM system. + */ +#define ODP_TM_MAX_NUM_SYSTEMS 64 + +/** The ODP_TM_MAX_PRIORITIES constant specifies the largest range of + * priorities that any TM system can support. All strict priority values MUST + * in the range 0..ODP_TM_MAX_PRIORITIES-1. + */ +#define ODP_TM_MAX_PRIORITIES 16 + +/** The ODP_TM MAX_LEVELS constant specifies the largest range of + * tm_node levels that any TM system can support. Hence all tm_node level + * values MUST be in the range 0..ODP_TM_MAX_LEVELS-1. Smaller tm_node + * levels are associated with tm_nodes closer to the TM system egress. + */ +#define ODP_TM_MAX_LEVELS 8 + +/** + * The smallest SCHED weight is 1 (i.e. 0 is not a legal WFQ/WRR value). + */ +#define ODP_TM_MIN_SCHED_WEIGHT 1 + +/** The ODP_TM_MAX_SCHED_WEIGHT constant is the largest weight any TM system + * can support (at least from a configuration standpoint). A given TM system + * could have a smaller value. + */ +#define ODP_TM_MAX_SCHED_WEIGHT 255 + +/** The ODP_TM_MAX_TM_QUEUES constant is the largest number of tm_queues + * that can handled by any one TM system. + */ +#define ODP_TM_MAX_TM_QUEUES (16 * 1024 * 1024) + +/** The ODP_TM_MAX_NUM_OUTPUTS constant is the largest number of outputs that + * can be configured for any one TM system. + */ +#define ODP_TM_MAX_NUM_OUTPUTS 256 + +/** The ODP_TM_MAX_NUM_TM_NODES constant is the largest number of tm_nodes that + * can be in existence for any one TM system. + */ +#define ODP_TM_MAX_NUM_TM_NODES (1024 * 1024) + +/** The ODP_TM_MAX_TM_NODE_FANIN constant is the largest number of fan-in + * "inputs" that can be simultaneously connected to a single tm_node. + * *TBD* Does this need to be as large as ODP_TM_MAX_TM_QUEUES? *TBD* + */ +#define ODP_TM_MAX_TM_NODE_FANIN (1024 * 1024) + +/** The ODP_TM_MIN_SHAPER_BW constant is the smallest amount of bandwidth that + * can a shaper's peak or commit rate can be set to. It is in units of + * 1000 bytes/second so that it and the ODP_TM_MAX_SHAPER_BW can both fit in + * 32 bits. + */ +#define ODP_TM_MIN_SHAPER_BW 1 + +/** The ODP_TM_MAX_SHAPER_BW constant is the largest amound of bandwidth that + * any shaper's peak or commit rate can be set to. It is in units of + * 1000 bytes/second so that it and the ODP_TM_MIN_SHAPER_BW can both fit in + * 32 bits. + */ +#define ODP_TM_MAX_SHAPER_BW 12500000 + +/** The ODP_NUM_SHAPER_COLORS constant just counts the number of enumeration + * values defined in the odp_tm_shaper_color_t type. + */ +#define ODP_NUM_SHAPER_COLORS 3 + +/** The INVALID_PRIORITY constant is used when one needs to indicate an + * invalid priority value. + */ +#define ODP_TM_INVALID_PRIORITY 255 + +/** The odp_tm_percent_t type is used when specifying fields that are + * percentages. It is a fixed point integer whose units are 1/100 of a + * percent. Hence 100% is represented as the integer value 10000. Note + * that because it is often used as a ratio of the current queue value and + * maximum queue threshold, it can be > 100%, but in any event will never + * be larger than 500% (i.e. it MUST be capped at 50000). + */ +typedef uint16_t odp_tm_percent_t; + +/** The odp_tm_handle_t type is a generic type that can stand for any of the + * other ODP_TM handle types. + */ +typedef uint64_t odp_tm_handle_t; + +/** Each odp_tm_t value represents a specific TM system. Almost all + * functions in this API require a odp_tm_t value - either directly + * as a function parameter or indirectly by having another ODP TM handle value + * as a function parameter. + */ +typedef odp_tm_handle_t odp_tm_t; + +/** Each odp_tm_queue_t value is an opaque ODP handle representing a specific + * tm_queue within a specific TM system. + */ +typedef odp_tm_handle_t odp_tm_queue_t; + +/** Each odp_tm_node_t value is an opaque ODP handle representing a specific + * tm_node within a specific TM system. + */ +typedef odp_tm_handle_t odp_tm_node_t; + +/** Each odp_tm_shaper_t value is an opaque ODP handle representing a specific + * shaper profile usable across all TM systems described by this API. A given + * shaper profile can then be attached to any tm_queue or tm_node. + */ +typedef odp_tm_handle_t odp_tm_shaper_t; + +/** Each odp_tm_sched_t value is an opaque ODP handle representing a specific + * tm_node scheduler profile usable across all TM systems described by this + * API. A given tm_node scheduler profile can then be attached to any tm_node. + */ +typedef odp_tm_handle_t odp_tm_sched_t; + +/** Each odp_tm_threshold_t value is an opaque ODP handle representing a + * specific queue threshold profile usable across all TM systems described by + * this API. A given queue threshold profile can then be attached to any + * tm_queue or tm_node. + */ +typedef odp_tm_handle_t odp_tm_threshold_t; + +/** Each odp_tm_wred_t value is an opaque ODP handle representing a specific + * WRED profile usable across all TM systems described by this API. A given + * WRED profile can then be attached to any tm_queue or tm_node. + */ +typedef odp_tm_handle_t odp_tm_wred_t; + +/** The ODP_TM_INVALID constant can be used with any ODP TM handle type and + * indicates that this value does NOT represent a valid TM object. + */ +#define ODP_TM_INVALID 0 + +/** + * @def ODP_TM_ROOT + * Constant that is used to refer to the egress/root node of the TM subsystem's + * tree/hierarchy of nodes. + */ +#define ODP_TM_ROOT 0 + +/** Get printable format of odp_queue_t */ +static inline uint64_t odp_tm_handle_to_u64(odp_tm_handle_t hdl) +{ + return hdl; +} + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/platform/linux-generic/include/odp/traffic_mngr.h b/platform/linux-generic/include/odp/traffic_mngr.h new file mode 100644 index 000000000..3aa6267c5 --- /dev/null +++ b/platform/linux-generic/include/odp/traffic_mngr.h @@ -0,0 +1,35 @@ +/* Copyright (c) 2015, Linaro Limited + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +/** + * @file + * + * ODP Traffic manager + */ + +#ifndef ODP_PLAT_TRAFFIC_MNGR_H_ +#define ODP_PLAT_TRAFFIC_MNGR_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +/** @ingroup odp_traffic_mngr + * @{ + */ + +/** + * @} + */ + +#include <odp/plat/traffic_mngr_types.h> +#include <odp/api/traffic_mngr.h> + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/platform/linux-generic/include/odp_packet_internal.h b/platform/linux-generic/include/odp_packet_internal.h index 6f1521ca3..a1dd37599 100644 --- a/platform/linux-generic/include/odp_packet_internal.h +++ b/platform/linux-generic/include/odp_packet_internal.h @@ -62,6 +62,9 @@ typedef union { uint32_t tcpopt:1; /**< TCP options present */ uint32_t sctp:1; /**< SCTP */ uint32_t icmp:1; /**< ICMP */ + + uint32_t color:2; /**< Packet color for traffic mgmt */ + uint32_t nodrop:1; /**< Drop eligibility status */ }; } input_flags_t; @@ -103,6 +106,8 @@ typedef union { uint32_t l3_chksum:1; /**< L3 chksum override */ uint32_t l4_chksum_set:1; /**< L3 chksum bit is valid */ uint32_t l4_chksum:1; /**< L4 chksum override */ + + int8_t shaper_len_adj; /**< adjustment for traffic mgr */ }; } output_flags_t; |