From: Barry Spinney
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
Signed-off-by: Bill Fischofer
---
include/odp.h |1 +
include/odp/api/packet.h | 49 +
include/odp/api/traffic_mngr.h | 1610
.../linux-generic/include/odp/plat/packet_types.h | 11 +
.../include/odp/plat/traffic_mngr_types.h | 185 +++
platform/linux-generic/include/odp/traffic_mngr.h | 35 +
.../linux-generic/include/odp_packet_internal.h|5 +
7 files changed, 1896 insertions(+)
create mode 100644 include/odp/api/traffic_mngr.h
create mode 100644 platform/linux-generic/include/odp/plat/traffic_mngr_types.h
create mode 100644 platform/linux-generic/include/odp/traffic_mngr.h
diff --git a/include/odp.h b/include/odp.h
index 825c7e1..f6a6ea9 100644
--- a/include/odp.h
+++ b/include/odp.h
@@ -56,6 +56,7 @@ extern "C" {
#include
#include
#include
+#include
#ifdef __cplusplus
}
diff --git a/include/odp/api/packet.h b/include/odp/api/packet.h
index 5d46b7b..e7c52af 100644
--- a/include/odp/api/packet.h
+++ b/include/odp/api/packet.h
@@ -700,6 +700,55 @@ odp_packet_seg_t odp_packet_last_seg(odp_packet_t pkt);
*/
odp_packet_seg_t odp_packet_next_seg(odp_packet_t pkt, odp_packet_seg_t seg);
+/**
+ * Get packet color
+ *
+ * @param pkt Packet handle
+ * @return packet color
+ */
+odp_packet_color_t odp_packet_color(odp_packet_t pkt);
+
+/**
+ * Set packet color
+ *
+ * @param pkt Packet handle
+ * @param color Color to set
+ */
+void odp_packet_color_set(odp_packet_t pkt, odp_packet_color_t color);
+
+/**
+ * Get drop eligible status
+ *
+ * @param pkt Packet handle
+ * @return Packet drop eligibility status
+ * @retval 0 Packet is not drop eligible
+ * @retval 1 Packet is drop
+ */
+odp_bool_t odp_packet_drop_eligible(odp_packet_t pkt);
+
+/**
+ * Set drop eligible status
+ *
+ * @param pkt Packet handle
+ * @param status Drop eligibility status
+ */
+void odp_packet_drop_eligible_set(odp_packet_t pkt, odp_bool_t status);
+
+/**
+ * Get shaper length adjustment
+ *
+ * @param pkt Packet handle
+ * @return Shaper adjustment (-128..127)
+ */
+int8_t odp_packet_shaper_len_adjust(odp_packet_t pkt);
+
+/**
+ * Set shaper length adjustment
+ *
+ * @param pkt Packet handle
+ * @param adj Signed adjustment value
+ */
+void odp_packet_shaper_len_adjust_set(odp_packet_t pkt, int8_t adj);
/*
*
diff --git a/include/odp/api/traffic_mngr.h b/include/odp/api/traffic_mngr.h
new file mode 100644
index 000..5f9ddf3
--- /dev/null
+++ b/include/odp/api/traffic_mngr.h
@@ -0,0 +1,1610 @@
+/** Copyright (c) 2015, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#ifndef ODP_TRAFFIC_MNGR_H_
+#define ODP_TRAFFIC_MNGR_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include
+#include
+
+/**
+ * @file
+ *
+ */
+
+/** @defgroup odp_traffic_mngr ODP TRAFFIC MNGR
+ * @{
+ *
+ * An API for configuring and using Traffic Management systems
+ *
+ * This file forms a simple interface for creating, configuring and using
+ * Traffic Management (TM) subsystems. By TM subsystem it is meant a general
+ * packet scheduling system that accepts packets from input queues and applies
+ * strict priority scheduling, weighted fair queueing 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.
+ *
+ * A given platform supporting this TM API could support one or more pure
+ * hardware based packet scheduling systems, one or more pure software
+ * based systems or one or more hybrid systems - where because of
+ * hardware constraints some of the packet scheduling is done in hardware
+ * and some is done in software. In addition, there may also be additional
+ * API's beyond those described here for (a) controlling advanced capabilities
+ * supported by specific hardware, software or hybrid subsystems or (b)
+ * dealing with constraints and limitations of specific implementations.
+ * The intention here is to be the simplest API that covers the vast majority
+ * of packet scheduling requirements.
+ *
+ * Often a TM subsystem's output(s) will be directly connected
+ * to a device's physical (or virtual) output interfaces/links, in which case
+ * sometimes such a system will be called an Egress Packet Scheduler or an
+ * Output Link Shaper, etc.. While the TM subsystems configured by this API
+ * can be used in such a way, this API equally well supports the ability to
+ * have the TM subsystem's ou