Skip to content

Commit

Permalink
Class-Based Forwarding
Browse files Browse the repository at this point in the history
Signed-off-by: Jason Bos <jbos@cisco.com>
  • Loading branch information
j-bos authored and dshammond committed Mar 26, 2021
1 parent 5d51985 commit 54ffca0
Show file tree
Hide file tree
Showing 6 changed files with 117 additions and 4 deletions.
27 changes: 26 additions & 1 deletion inc/saiacl.h
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,12 @@ typedef enum _sai_acl_action_type_t
/** Set custom ECMP hash object ID */
SAI_ACL_ACTION_TYPE_SET_ECMP_HASH_ID,

/** Associate with virtual router */
SAI_ACL_ACTION_TYPE_SET_VRF,

/** Set Forwarding class */
SAI_ACL_ACTION_TYPE_SET_FORWARDING_CLASS,

} sai_acl_action_type_t;

/**
Expand Down Expand Up @@ -2909,10 +2915,29 @@ typedef enum _sai_acl_entry_attr_t
*/
SAI_ACL_ENTRY_ATTR_ACTION_SET_ECMP_HASH_ID,

/**
* @brief Set virtual router
*
* @type sai_acl_action_data_t sai_object_id_t
* @flags CREATE_AND_SET
* @objects SAI_OBJECT_TYPE_VIRTUAL_ROUTER
* @default disabled
*/
SAI_ACL_ENTRY_ATTR_ACTION_SET_VRF,

/**
* @brief Set Forwarding Class
*
* @type sai_acl_action_data_t sai_uint8_t
* @flags CREATE_AND_SET
* @default disabled
*/
SAI_ACL_ENTRY_ATTR_ACTION_SET_FORWARDING_CLASS,

/**
* @brief End of Rule Actions
*/
SAI_ACL_ENTRY_ATTR_ACTION_END = SAI_ACL_ENTRY_ATTR_ACTION_SET_ECMP_HASH_ID,
SAI_ACL_ENTRY_ATTR_ACTION_END = SAI_ACL_ENTRY_ATTR_ACTION_SET_FORWARDING_CLASS,

/**
* @brief End of ACL Entry attributes
Expand Down
18 changes: 16 additions & 2 deletions inc/sainexthopgroup.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ typedef enum _sai_next_hop_group_type_t
/** Next hop protection group. Contains primary and backup next hops. */
SAI_NEXT_HOP_GROUP_TYPE_PROTECTION,

/** Next hop group is class-based, with members selected by Forwarding class */
SAI_NEXT_HOP_GROUP_TYPE_CLASS_BASED,

/* Other types of next hop group to be defined in the future, e.g., WCMP */

} sai_next_hop_group_type_t;
Expand Down Expand Up @@ -169,6 +172,16 @@ typedef enum _sai_next_hop_group_attr_t
*/
SAI_NEXT_HOP_GROUP_ATTR_REAL_SIZE,

/**
* @brief Forwarding-class to index map
*
* @type sai_map_list_t
* @flags CREATE_AND_SET
* @default empty
* @validonly SAI_NEXT_HOP_GROUP_ATTR_TYPE == SAI_NEXT_HOP_GROUP_TYPE_CLASS_BASED
*/
SAI_NEXT_HOP_GROUP_ATTR_FORWARDING_CLASS_TO_INDEX_MAP,

/**
* @brief End of attributes
*/
Expand Down Expand Up @@ -203,7 +216,7 @@ typedef enum _sai_next_hop_group_member_attr_t
*
* @type sai_object_id_t
* @flags MANDATORY_ON_CREATE | CREATE_AND_SET
* @objects SAI_OBJECT_TYPE_NEXT_HOP
* @objects SAI_OBJECT_TYPE_NEXT_HOP, SAI_OBJECT_TYPE_NEXT_HOP_GROUP
*/
SAI_NEXT_HOP_GROUP_MEMBER_ATTR_NEXT_HOP_ID,

Expand Down Expand Up @@ -263,7 +276,8 @@ typedef enum _sai_next_hop_group_member_attr_t
*
* Index specifying the strict member's order.
* Allowed value range for is from 0 to SAI_NEXT_HOP_GROUP_ATTR_REAL_SIZE - 1.
* Should only be used if the type of owning group is SAI_NEXT_HOP_GROUP_TYPE_FINE_GRAIN_ECMP.
* Should only be used if the type of owning group is SAI_NEXT_HOP_GROUP_TYPE_FINE_GRAIN_ECMP
* or SAI_NEXT_HOP_GROUP_TYPE_CLASS_BASED.
*
* @type sai_uint32_t
* @flags CREATE_ONLY
Expand Down
28 changes: 28 additions & 0 deletions inc/saiport.h
Original file line number Diff line number Diff line change
Expand Up @@ -1707,6 +1707,34 @@ typedef enum _sai_port_attr_t
*/
SAI_PORT_ATTR_SYSTEM_PORT,

/**
* @brief Enable DSCP -> Forwarding Class MAP on port
*
* Map id = #SAI_NULL_OBJECT_ID to disable map on port.
* Default no map.
*
* @type sai_object_id_t
* @flags CREATE_AND_SET
* @objects SAI_OBJECT_TYPE_QOS_MAP
* @allownull true
* @default SAI_NULL_OBJECT_ID
*/
SAI_PORT_ATTR_QOS_DSCP_TO_FORWARDING_CLASS_MAP,

/**
* @brief Enable EXP -> Forwarding Class MAP on port
*
* Map id = #SAI_NULL_OBJECT_ID to disable map on port.
* Default no map.
*
* @type sai_object_id_t
* @flags CREATE_AND_SET
* @objects SAI_OBJECT_TYPE_QOS_MAP
* @allownull true
* @default SAI_NULL_OBJECT_ID
*/
SAI_PORT_ATTR_QOS_MPLS_EXP_TO_FORWARDING_CLASS_MAP,

/**
* @brief End of attributes
*/
Expand Down
6 changes: 6 additions & 0 deletions inc/saiqosmap.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,12 @@ typedef enum _sai_qos_map_type_t
/** QOS Map to set traffic class and color to EXP */
SAI_QOS_MAP_TYPE_TC_AND_COLOR_TO_MPLS_EXP = 0x0000000c,

/** QOS Map to set DSCP to Forwarding class */
SAI_QOS_MAP_TYPE_DSCP_TO_FORWARDING_CLASS = 0x0000000d,

/** QOS Map to set EXP to Forwarding class */
SAI_QOS_MAP_TYPE_MPLS_EXP_TO_FORWARDING_CLASS = 0x0000000e,

/** Custom range base value */
SAI_QOS_MAP_TYPE_CUSTOM_RANGE_BASE = 0x10000000

Expand Down
38 changes: 37 additions & 1 deletion inc/saiswitch.h
Original file line number Diff line number Diff line change
Expand Up @@ -1350,7 +1350,7 @@ typedef enum _sai_switch_attr_t
* @brief Enable DSCP -> TC MAP on switch.
*
* MAP id = #SAI_NULL_OBJECT_ID to disable map on switch.
* To enable/disable trust DSCP, Map ID should be added/removed on port.
* To enable/disable trust DSCP, Map ID should be added/removed on switch.
* Default no map.
*
* @type sai_object_id_t
Expand Down Expand Up @@ -2265,6 +2265,42 @@ typedef enum _sai_switch_attr_t
*/
SAI_SWITCH_ATTR_TUNNEL_LOOPBACK_PACKET_ACTION,

/**
* @brief Maximum forwarding classes limit
*
* @type sai_uint8_t
* @flags READ_ONLY
*/
SAI_SWITCH_ATTR_MAX_NUMBER_OF_FORWARDING_CLASSES,

/**
* @brief Enable DSCP -> Forwarding Class MAP on switch
*
* MAP id = #SAI_NULL_OBJECT_ID to disable map on switch.
* Default no map.
*
* @type sai_object_id_t
* @flags CREATE_AND_SET
* @objects SAI_OBJECT_TYPE_QOS_MAP
* @allownull true
* @default SAI_NULL_OBJECT_ID
*/
SAI_SWITCH_ATTR_QOS_DSCP_TO_FORWARDING_CLASS_MAP,

/**
* @brief Enable EXP -> Forwarding Class MAP on switch
*
* MAP id = #SAI_NULL_OBJECT_ID to disable map on switch.
* Default no map.
*
* @type sai_object_id_t
* @flags CREATE_AND_SET
* @objects SAI_OBJECT_TYPE_QOS_MAP
* @allownull true
* @default SAI_NULL_OBJECT_ID
*/
SAI_SWITCH_ATTR_QOS_MPLS_EXP_TO_FORWARDING_CLASS_MAP,

/**
* @brief End of attributes
*/
Expand Down
4 changes: 4 additions & 0 deletions inc/saitypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -624,6 +624,7 @@ typedef enum _sai_packet_color_t
* dot1p/DSCP/MPLS_EXP --> TC
* dot1p/DSCP/MPLS_EXP --> Color
* dot1p/DSCP/MPLS_EXP --> TC + Color
* DSCP/MPLS_EXP --> FC
* TC --> dot1p/DSCP/MPLS_EXP.
* TC + color --> dot1p/DSCP/MPLS_EXP.
* TC --> Egress Queue.
Expand Down Expand Up @@ -657,6 +658,9 @@ typedef struct _sai_qos_map_params_t
/** MPLS exp value */
sai_uint8_t mpls_exp;

/** Forwarding class */
sai_uint8_t fc;

} sai_qos_map_params_t;

typedef struct _sai_qos_map_t
Expand Down

0 comments on commit 54ffca0

Please sign in to comment.