diff mbox

[RFC] api: traffic manager: Proposal for Marking APIs

Message ID 1461309534-19648-1-git-send-email-bala.manoharan@linaro.org
State New
Headers show

Commit Message

Balasubramanian Manoharan April 22, 2016, 7:18 a.m. UTC
Signed-off-by: Balasubramanian Manoharan <bala.manoharan@linaro.org>
---
 include/odp/api/spec/traffic_mngr.h | 96 +++++++++++++++++++++++++++++++++++++
 1 file changed, 96 insertions(+)
diff mbox

Patch

diff --git a/include/odp/api/spec/traffic_mngr.h b/include/odp/api/spec/traffic_mngr.h
index e4c15df..a32cf4f 100644
--- a/include/odp/api/spec/traffic_mngr.h
+++ b/include/odp/api/spec/traffic_mngr.h
@@ -273,6 +273,102 @@  typedef struct {
  */
 typedef void (*odp_tm_egress_fcn_t) (odp_packet_t odp_pkt);
 
+/** Marking APIs
+ * This Marking functionality entails changes to packet header to reflect the
+ * color marking of the packet on the port level shaper. This is an optional
+ * feature and if available on the platform is used to reflect the packet color
+ * on IPv4/IPv6 DiffServ filed in accordance with RFC 2474. There are three
+ * different packet marking fields supported they are,
+ * 1). Assured forwarding in accordance with RFC 2597, the DSCP is marked to
+ * set the packet Drop precedence in accordance with the color, i.e High Drop
+ * precedence for RED, Medium Drop precedence for YELLOW and leave the DSCP
+ * unchangesd if the color is GREEN.
+ * 2). Explicit Congestion Notification protocol per RFC 3168, where a router
+ * encountering congestion can notifiy it by setting the lower 2 bits in
+ * DiffServ field to "11" Congestion Encountered code, which will ultimately
+ * reduce the transmission rate of the packet sender.
+ * 3). In IEEE 802.1q VLAN tag header contains a DE - Drop Eligibility bit for
+ * marking a packet for Downstream switches, and is valid for Ethernet packet
+ * containing a VLAN tag.
+ *
+ * RFC 3168 is only valid for TCP packets whereas RFC 2597 is valid for IPv4/IPv6
+ * traffic.
+ */
+
+/** Drop Eligibility
+ * The odp_tm_drop_eligibility() functions allows one to enable drop
+ * eligibility for packet based on color, if enabled it will set DE
+ * bit for VLAN tagged packets.
+ *
+ * @param	odp_tm			Traffic Manager system
+ * @param	color			The packet color whose DE bit
+ *					will be modified
+ * @param	drop_eligibility	If true then DE bit will be set for
+ *					VLAN tagged packets with this color
+ *
+ * @return				0 upon success, < 0 upon failure.
+ */
+int odp_tm_drop_eligibility(odp_tm_t odp_tm, odp_packet_color_t color,
+			    odp_bool_t drop_eligibility);
+
+/** Drop Precedence
+ * The odp_tm_drop_precedence() functions allows one to enable drop
+ * precedence for packet based on color, if enabled it will set HIGH Drop
+ * for packets of RED color, MEDIUM drop precedence for packets of YELLOW
+ * color and the value is unchanged for GREEN color packets.
+ *
+ * @param	odp_tm			Traffic Manager system
+ * @param	color			The packet color whose Drop precedence
+ *					is enabled.
+ * @param	drop_precedence		If true then Drop precedence level will
+ *					be set according to packet color.
+ * @return				0 upon success, < 0 upon failure.
+ */
+int odp_tm_drop_precedence(odp_tm_t odp_tm, odp_packet_color_t color,
+			   odp_bool_t drop_precedence);
+
+/** Explicit Congestion Notification
+ * The odp_tm_ecn() functions allows one to enable ECN for packets based on
+ * color. If enabled will set the lower 2 bits in DiffServ field to "11"
+ * Congestion Encountered code.
+ *
+ * @param	odp_tm			Traffic Manager system
+ * @param	color			The packet color for which ECN will
+ *					be set.
+ * @param	ecn			If true then ECN will be set as "11"
+ *					Congestion Encountered code.
+ * @return				0 upon success, < 0 upon failure.
+ */
+int odp_tm_ecn(odp_tm_t odp_tm, odp_packet_color_t color,
+	       odp_bool_t ecn);
+
+/** Vlan Marking.
+ *
+ * The odp_tm_vlan__marking() function allows one to configure the TM
+ * egress so as to have it set the 4-bit VLAN priority field (but only for
+ * pkts that already carry a VLAN tag) of a pkt based upon the final pkt (or
+ * shaper?) color assigned to the pkt when it reaches the egress node.  When
+ * enable is false, then the given color no longer modifies the priority
+ * field.  When enable is true then a packet exiting this TM system whose
+ * color matches the given color parameter will cause the 4-bit VLAN priority
+ * field to be set to the given priority value.
+ *
+ * @param[in] odp_tm                 Odp_tm is used to identify the TM system
+ *                                   whose egress behavior is being changed.
+ * @param[in] color                  The packet color whose egress marking is
+ *                                   being changed.
+ * @param[in] priority_enabled       If true then egressed VLAN tagged pkts
+ *                                   with this color will have the pkt's VLAN
+ *                                   priority field set to the new_priority
+ *                                   parameter (below).
+ * @param[in] new_priority           The new VLAN priority value, if enabled
+ *                                   (see priority_enabled comments above).
+ *                                   Must be in the range 0..7.
+ * @param[in] drop_eligible_enabled  If true then will set the DEI bit for
+ *                                   egressed VLAN tagged pkts with this color.
+ * @return                           0 upon success, < 0 upon failure.
+ */
+
 /** The tm_egress_kind_e enumeration type is used to indicate the kind of
  * egress object ("spigot") associated with this TM system.  Most of these
  * kinds are optional - with ODP_TM_EGRESS_PKT_IO being the only mandatory