-
Notifications
You must be signed in to change notification settings - Fork 574
Class-Based Forwarding #1193
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Class-Based Forwarding #1193
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
fb7ea4d
Class-Based Forwarding
j-bos 85db8bc
Create Class-Based-Forwarding.md
j-bos c043c39
Fix for comment formatting
j-bos 1d822c8
Add Behavior Model diagram
j-bos e8d3c10
Fix attribute ordering after merge
j-bos d7983c1
Changes towards new object for fc to index map
j-bos 9075a31
More changes towards new object for fc to index map
j-bos e163778
Merge remote-tracking branch 'upstream/master'
j-bos e615f4c
Bump serializetest count for unknown object type since, with
j-bos 1e46a95
Updates to documentation
j-bos 5063ef8
Handle review comments
j-bos 0efff48
minor documentation update
j-bos c6eb5df
Update pipeline_v9.vsdx
j-bos 46120df
Merge branch 'master' into master
j-bos d9bc49c
small merge fixup
j-bos 4ee95c9
Merge remote-tracking branch 'upstream/master'
j-bos 0b5e37c
revert meta change which is no longer needed
j-bos 931ed05
fix the recently-introduced enum value checking to allow SAI_OBJECT_T…
j-bos 632d265
Update pipeline_v9.vsdx
j-bos b11e57c
Add SAI_API_MAX to meta check skipping
j-bos File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,211 @@ | ||
| # Class-based Forwarding | ||
|
|
||
| Title | Class-based Forwarding | ||
| ------------|---------------- | ||
| Authors | Cisco | ||
| Status | In review | ||
| Type | Standards track | ||
| Created | 04/14/2021 | ||
| SAI-Version | 1.8 | ||
|
|
||
| Class-based forwarding provides a method to steer traffic among multiple paths through the network by policy rather than, or in combination with, traditional ECMP/UCMP flow-hashing. | ||
|
|
||
| A new type of next-hop group is introduced: | ||
|
|
||
| ``` | ||
| typedef enum _sai_next_hop_group_type_t | ||
| { | ||
| ... | ||
| /** Next hop group is class-based, with members selected by Forwarding class */ | ||
| SAI_NEXT_HOP_GROUP_TYPE_CLASS_BASED, | ||
| ... | ||
| } sai_next_hop_group_type_t; | ||
| ``` | ||
|
|
||
| The behavior of SAI_NEXT_HOP_GROUP_TYPE_CLASS_BASED differs from the traditional SAI_NEXT_HOP_GROUP_TYPE_ECMP, in that each packet will have a Forwarding class that chooses next-hop group member index. | ||
|
|
||
| This is accomplished by directly mapping each forwarding class to the group member index, via map configured to the next-hop group object. | ||
|
|
||
| ``` | ||
| /** | ||
| * @brief Member selection map | ||
| * | ||
| * @type sai_object_id_t | ||
| * @flags CREATE_AND_SET | ||
| * @objects SAI_OBJECT_TYPE_NEXT_HOP_GROUP_MAP | ||
| * @allownull true | ||
| * @default SAI_NULL_OBJECT_ID | ||
| * @validonly SAI_NEXT_HOP_GROUP_ATTR_TYPE == SAI_NEXT_HOP_GROUP_TYPE_CLASS_BASED | ||
| */ | ||
| SAI_NEXT_HOP_GROUP_ATTR_SELECTION_MAP, | ||
| ``` | ||
|
|
||
| If a packet arrives with a forwarding-class which is not present in the map, the chosen index shall be 0. | ||
|
|
||
| ``` | ||
| typedef enum _sai_next_hop_group_member_attr_t | ||
| { | ||
| ... | ||
| /** | ||
| * @brief Object index in the next-hop group. | ||
| * | ||
| * 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 | ||
| * or SAI_NEXT_HOP_GROUP_TYPE_CLASS_BASED. | ||
| * | ||
| * @type sai_uint32_t | ||
| * @flags CREATE_ONLY | ||
| * @default 0 | ||
| */ | ||
| SAI_NEXT_HOP_GROUP_MEMBER_ATTR_INDEX, | ||
| ... | ||
| } sai_next_hop_group_member_attr_t; | ||
| ``` | ||
|
|
||
| If the map selects an index for which a member does not exist, the packet shall be treated as having a next-hop of SAI_NULL_OBJECT_ID, dropping the packet. | ||
|
|
||
| Members of type next-hop or next-hop groups of type ECMP shall be allowed. To allow this, next-hop group member type is extended to allow other next-hop groups: | ||
|
|
||
| ``` | ||
| /** | ||
| * @brief Next hop id | ||
| * | ||
| * @type sai_object_id_t | ||
| * @flags MANDATORY_ON_CREATE | CREATE_AND_SET | ||
| * @objects SAI_OBJECT_TYPE_NEXT_HOP, <b>SAI_OBJECT_TYPE_NEXT_HOP_GROUP</b> | ||
| */ | ||
| SAI_NEXT_HOP_GROUP_MEMBER_ATTR_NEXT_HOP_ID, | ||
| ``` | ||
|
|
||
| *Note: While this would also be a means to configure a hierarchical ECMP, hierarchical ECMP is outside the scope of this proposal.* | ||
|
|
||
| The forwarding-class for a packet may be selected via qos-map or ACL. | ||
|
|
||
| ``` | ||
| typedef enum _sai_qos_map_type_t | ||
| { | ||
| ... | ||
| /** 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, | ||
| ... | ||
| } sai_qos_map_type_t; | ||
| ``` | ||
|
|
||
| ``` | ||
| typedef enum _sai_acl_entry_attr_t | ||
| ... | ||
| /** | ||
| * @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, | ||
| ... | ||
| } sai_acl_entry_attr_t; | ||
| ``` | ||
|
|
||
j-bos marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| If the packet is not assigned a forwarding-class, then the forwarding-class of the packet shall be 0. For example, if no qos-map or ACL is configured. Normal QOS/ACL precedence rules apply; if supported by the implementation, the ACL would override the QOS MAP decision. | ||
|
|
||
| *Resource monitoring considerations:* | ||
|
|
||
| The attribute SAI_SWITCH_ATTR_MAX_NUMBER_OF_FORWARDING_CLASSES may be used to identify the maximum forwarding-class allowed. | ||
|
|
||
| The SAI_OBJECT_TYPE_NEXT_HOP_GROUP_MAP object is a resource. The sai_object_type_get_availability() API may be used to query the maximum number of permitted maps. | ||
|
|
||
| *Class-based forwarding group configuration example:* | ||
| ``` | ||
| /****************************************************** | ||
| * Create a forwarding-class -> index map. | ||
| * In this example, map 8 forwarding-classes to 2 members. | ||
| * FC 0-5 -> index 0 | ||
| * FC 6-7 -> index 1 | ||
| ******************************************************/ | ||
| const int num_forwarding_classes = 8; | ||
| const int num_members = 2; | ||
|
|
||
| sai_object_id_t nh_group_map; | ||
|
|
||
| sai_map_t fc_map[num_forwarding_classes]; | ||
| for (int fc = 0; fc < num_forwarding_classes; ++fc) { | ||
| fc_map[fc].key = fc; | ||
| if (fc >= 6) { | ||
| fc_map[fc].value = 1; | ||
| } else { | ||
| fc_map[fc].value = 0; | ||
| } | ||
| } | ||
|
|
||
| sai_map_list_t fc_map_list; | ||
| fc_map_list.key.count = num_forwarding_classes; | ||
| fc_map_list.key.list = fc_map; | ||
|
|
||
| attr.id = SAI_NEXT_HOP_GROUP_MAP_ATTR_TYPE; | ||
| attr.value.u32 = SAI_NEXT_HOP_GROUP_MAP_TYPE_FORWARDING_CLASS_TO_INDEX; | ||
| attrs.push_back(attr); | ||
|
|
||
| attr.id = SAI_NEXT_HOP_GROUP_MAP_ATTR_MAP_TO_VALUE_LIST; | ||
| attr.value.maplist = fc_map_list; | ||
| attrs.push_back(attr); | ||
|
|
||
| sai_next_hop_group_api->create_next_hop_group_map( | ||
| &nh_group_map, | ||
| g_switch_id, | ||
| attrs.size(), | ||
| attrs.data()); | ||
|
|
||
| /***************************************************** | ||
| * Create a class-based forwarding group | ||
| *****************************************************/ | ||
| attrs.clear(); | ||
|
|
||
| sai_object_id_t nh_group; | ||
|
|
||
| attr.id = SAI_NEXT_HOP_GROUP_ATTR_TYPE; | ||
| attr.value.u32 = SAI_NEXT_HOP_GROUP_TYPE_CLASS_BASED; | ||
| attrs.push_back(attr); | ||
|
|
||
| attr.id = SAI_NEXT_HOP_GROUP_ATTR_CONFIGURED_SIZE; | ||
| attr.value.u32 = num_members; | ||
| attrs.push_back(attr); | ||
|
|
||
| attr.id = SAI_NEXT_HOP_GROUP_ATTR_SELECTION_MAP; | ||
| attr.value.oid = nh_group_map; | ||
| attrs.push_back(attr); | ||
|
|
||
| sai_next_hop_group_api->create_next_hop_group( | ||
| &nh_group, | ||
| g_switch_id, | ||
| attrs.size(), | ||
| attrs.data()); | ||
|
|
||
| /***************************************************** | ||
| * Create members | ||
| *****************************************************/ | ||
| attrs.clear(); | ||
|
|
||
| for (index = 0; index < num_members; ++index) { | ||
| attr.id = SAI_NEXT_HOP_GROUP_MEMBER_ATTR_NEXT_HOP_GROUP_ID; | ||
| attr.value.oid = nh_group; | ||
| attrs.push_back(attr); | ||
|
|
||
| attr.id = SAI_NEXT_HOP_GROUP_MEMBER_ATTR_NEXT_HOP_ID; | ||
| attr.value.oid = destinations[index]; // Next-hop or ECMP group | ||
| attrs.push_back(attr); | ||
|
|
||
| attr.id = SAI_NEXT_HOP_GROUP_MEMBER_ATTR_INDEX; | ||
| attr.value.u32 = index; | ||
| attrs.push_back(attr); | ||
|
|
||
| sai_next_hop_group_api->create_next_hop_group_member( | ||
| &members[member_index], | ||
| g_switch_id, | ||
| attrs.size(), | ||
| attrs.data()); | ||
| } | ||
| ``` | ||
Binary file not shown.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.