diff --git a/doc/SAI-IPv6-Segment-Routing-Update.md b/doc/SAI-IPv6-Segment-Routing-Update.md new file mode 100644 index 000000000..a2febf9c3 --- /dev/null +++ b/doc/SAI-IPv6-Segment-Routing-Update.md @@ -0,0 +1,479 @@ +SAI IPv6 Segment Routing Update + +## Overview ## + +Segment Routing with IPv6(SRv6) support was added in SAI 1.2 about 4 years ago. Since then SAI +pipeline model for tunnels and MPLS fowarding has evolved and there have been several +modifications to SRv6 RFCs. This proposal will bring SRv6 APIs and attributes in-line with the +latest RFCs and SAI MPLS/tunnel pipeline model. + +Note that SRv6 features and use cases continue to evolve and this proposal is focused on functions +and behaviors described in the SRv6 Network Programming RFC [ +Segment Routing over IPv6 (SRv6) Network Programming]. We will submit additional +PRs in future to add support for other functions and use cases. Also, this PR doesn't explicitly address +the functionality related to Traffic Class, Hop-Limit, ECN marking and load-balancing hash calculation. +It's assumed that existing attributes for other IPv6 tunnels will apply to the SRv6 as well. + +Following list of changes are being proposed: + +## Behavioral Model Changes ## + +### Endpoint Behavior ### +In the earlier proposal, In order to program the hardware for an Endpoint SID, first a route entry is created for the my SID and then a nexthop entry +is created to specify the endpoint behavior and parameters. This will require either the application or the operating system responsible for making the SAI +API calls to create two additional objects for every MySID entry - a route object and a nexthop object. This model is different from the programming model +used for IP tunnels and MPLS. For IP and MPLS tunnel terminations, a separate tunnel_term or Insegment object is created without a need to decompose the tunnel +termination entry into multiple SAI objects. +This proposal will follow the programming model of MPLS segment routing and IP tunnel termination by adding a MySID object for SRv6 similar to InSegment +for MPLS. + +![SRv6 Endpoint Behavioral Model](figures/SRv6_Endpoint_behavioral_model.png "Figure 1: Endpoint Behavior ") +__Figure 1: Endpoint Behavior.__ + +### Source/Headend Behavior ### +- This proposal will remove "Endpoint" from the Nexthop table attributes and leave other attributes like SIDLIST in order to implement the Headend Behavior. + +![SRv6 Headend Behavioral Model](figures/SRv6_Headend_behavioral_model.png "Figure 1: Headend Behavior ") +__Figure 1: Headend Behavior.__ + +## SAI Header changes ## + +### sainexthop.h + +1. sai_next_hop_endpoint_type_t and sai_nexthop_endpoint_pop_type_t is deprecated. + +``` +typedef enum _sai_next_hop_type_t +{ + .... + .... + + /** IPv6 Segment Route SID List */ + SAI_NEXT_HOP_TYPE_SEGMENTROUTE_SIDLIST, + + /** IPv6 Segment Route Endpoint Function. **Deprecated and replaced by SAI_MY_SID_ENTRY_ATTR object ***/ + SAI_NEXT_HOP_TYPE_SEGMENTROUTE_ENDPOINT, + ... + +} sai_next_hop_type_t; + + +** + * @brief Enum defining Endpoint Segment Pop types for End, End.X and End.T. **Deprecated + * and replaced by sai_my_sid_entry_endpoint_flavor_t** + */ + +typedef enum _sai_next_hop_endpoint_pop_type_t +{ + /** Penultimate segment pop */ + SAI_NEXT_HOP_ENDPOINT_POP_TYPE_PSP, + + /** Ultimate Segment pop */ + SAI_NEXT_HOP_ENDPOINT_POP_TYPE_USP, + +} sai_next_hop_endpoint_pop_type_t; + + + +/** + * @brief Attribute id for next hop + */ +typedef enum _sai_next_hop_attr_t +{ +... +... + + /** + * @brief Next hop entry Segment Route SID List + * + * @type sai_object_id_t + * @flags MANDATORY_ON_CREATE | CREATE_ONLY + * @objects SAI_OBJECT_TYPE_SEGMENTROUTE_SIDLIST + * @condition SAI_NEXT_HOP_ATTR_TYPE == SAI_NEXT_HOP_TYPE_SEGMENTROUTE_SIDLIST + */ + SAI_NEXT_HOP_ATTR_SEGMENTROUTE_SIDLIST_ID, + + /** + * @brief Next hop entry Segment Route Endpoint Function. **Deprecated and replaced + * with SAI_MY_SID_ENTRY_ATTR_ENDPOINT_TYPE.** + * + * @type sai_next_hop_endpoint_type_t + * @flags MANDATORY_ON_CREATE | CREATE_AND_SET + * @condition SAI_NEXT_HOP_ATTR_TYPE == SAI_NEXT_HOP_TYPE_SEGMENTROUTE_ENDPOINT + ** * @deprecated true** + */ + SAI_NEXT_HOP_ATTR_SEGMENTROUTE_ENDPOINT_TYPE, + + /** + * @brief Next hop entry Segment Route Endpoint Pop Option. **Deprecated and replaced + * with SAI_MY_SID_ENTRY_ATTR_ENDPOINT_FLAVOR** + * + * @type sai_next_hop_endpoint_pop_type_t + * @flags MANDATORY_ON_CREATE | CREATE_AND_SET + * @condition SAI_NEXT_HOP_ATTR_TYPE == SAI_NEXT_HOP_TYPE_SEGMENTROUTE_ENDPOINT + *** @deprecated true** + */ + SAI_NEXT_HOP_ATTR_SEGMENTROUTE_ENDPOINT_POP_TYPE, + +... +... + +} sai_next_hop_attr_t; +``` + +### saisegmentroute.h ### + +1. Added new enums for SR Headend functionality with reduced SRH. These new behaviors reduce the length of + SRH by excluding the first segment in the pushed IPv6 header. First segment is placed in only the DA of + the outer IPv6 header. + +``` + typedef enum _sai_segmentroute_sidlist_type_t +{ + ... + + /** Insertion of Segment Route Policy with Reduced SRH */ + SAI_SEGMENTROUTE_SIDLIST_TYPE_INSERT_RED, + + ... + + /** Encapsulation in a Segment Route Policy with Reduced SRH */ + SAI_SEGMENTROUTE_SIDLIST_TYPE_ENCAPS_RED, + + +} sai_segmentroute_sidlist_type_t; +``` + +2. Added enum sai_my_sid_entry_endpoint_type_t to provide the initial list of endpoint behaviors. + +``` +/** + * @brief Enum defining Endpoint Behavior + */ +typedef enum _sai_my_sid_entry_endpoint_behavior_t +{ + /** Basic Endpoint */ + SAI_MY_SID_ENTRY_ENDPOINT_BEHAVIOR_E, + + /** End.X Endpoint with Layer-3 Cross-connect */ + SAI_MY_SID_ENTRY_ENDPOINT_BEHAVIOR_X, + + /** End.T Endpoint with specific IPv6 Table */ + SAI_MY_SID_ENTRY_ENDPOINT_BEHAVIOR_T, + + /** Endpoint with decapsulation and IPv6 Cross-connect */ + SAI_MY_SID_ENTRY_ENDPOINT_BEHAVIOR_DX6, + + /** Endpoint with decapsulation and IPv4 Cross-connect */ + SAI_MY_SID_ENTRY_ENDPOINT_BEHAVIOR_DX4, + + /** Endpoint with decapsulation and specific IPv6 table lookup */ + SAI_MY_SID_ENTRY_ENDPOINT_BEHAVIOR_DT6, + + /** Endpoint with decapsulation and specific IPv6 table lookup */ + SAI_MY_SID_ENTRY_ENDPOINT_BEHAVIOR_DT4, + + /** Endpoint with decapsulation and specific IP table lookup */ + SAI_MY_SID_ENTRY_ENDPOINT_BEHAVIOR_DT46, + + /** Endpoint Bound to a policy with Encapsulation */ + SAI_MY_SID_ENTRY_ENDPOINT_BEHAVIOR_B6_ENCAPS, + + /** End.B6.Encaps function with a reduced SRH */ + SAI_MY_SID_ENTRY_ENDPOINT_BEHAVIOR_B6_ENCAPS_RED, + + /** Endpoint Bound to a policy with Insertion */ + SAI_MY_SID_ENTRY_ENDPOINT_BEHAVIOR_B6_INSERT, + + /** End.B6.Insert function with a reduced SRH */ + SAI_MY_SID_ENTRY_ENDPOINT_BEHAVIOR_B6_INSERT_RED, + + /** Custom range base value */ + SAI_MY_SID_ENTRY_ENDPOINT_BEHAVIOR_CUSTOM_RANGE_START = 0x10000000, + + /** End of Custom range base */ + SAI_MY_SID_ENTRY_ENDPOINT_BEHAVIOR_CUSTOM_RANGE_END + +} sai_my_sid_entry_endpoint_behavior_t; + +``` +3. Added enum sai_my_sid_entry_endpoint_flavor_t to list all the combinations of endpoint flavors + as defined in RFC-8986 + +``` +/** + * @brief Enum defining Endpoint Behavior flavors for End, End.X and End.T functions + */ +typedef enum _sai_my_sid_entry_endpoint_behavior_flavor_t +{ + /** None */ + SAI_MY_SID_ENTRY_ENDPOINT_BEHAVIOR_FLAVOR_NONE, + + /** Penultimate segment pop */ + SAI_MY_SID_ENTRY_ENDPOINT_BEHAVIOR_FLAVOR_PSP, + + /** Ultimate Segment pop */ + SAI_MY_SID_ENTRY_ENDPOINT_BEHAVIOR_FLAVOR_USP, + + /** Ultimate Segment decapsulation */ + SAI_MY_SID_ENTRY_ENDPOINT_BEHAVIOR_FLAVOR_USD, + + /** PSP and USP */ + SAI_MY_SID_ENTRY_ENDPOINT_BEHAVIOR_FLAVOR_PSP_AND_USP, + + /** USD and USP */ + SAI_MY_SID_ENTRY_ENDPOINT_BEHAVIOR_FLAVOR_USD_AND_USP, + + /** PSP and USD */ + SAI_MY_SID_ENTRY_ENDPOINT_BEHAVIOR_FLAVOR_PSP_AND_USD, + + /** PSP, USP and USD */ + SAI_MY_SID_ENTRY_ENDPOINT_BEHAVIOR_FLAVOR_PSP_AND_USP_AND_USD + +} sai_my_sid_entry_endpoint_behavior_flavor_t; + +``` + +4. Added a new object sai_my_sid_entry_t configure Endpoint behavior. + +``` +/** + * @brief Attribute list for My SID + */ +typedef enum _sai_my_sid_entry_attr_t +{ + /** + * @brief Start of attributes + */ + SAI_MY_SID_ENTRY_ATTR_START, + + /** + * @brief Endpoint Function + * + * @type sai_my_sid_entry_endpoint_behavior_t + * @flags MANDATORY_ON_CREATE | CREATE_AND_SET + */ + SAI_MY_SID_ENTRY_ATTR_ENDPOINT_BEHAVIOR = SAI_MY_SID_ENTRY_ATTR_START, + + /** + * @brief Flavor for End, End.X and End.T functions + * + * @type sai_my_sid_entry_endpoint_behavior_flavor_t + * @flags CREATE_AND_SET + * @default SAI_MY_SID_ENTRY_ENDPOINT_BEHAVIOR_FLAVOR_NONE + * @validonly SAI_MY_SID_ENTRY_ATTR_ENDPOINT_BEHAVIOR == SAI_MY_SID_ENTRY_ENDPOINT_BEHAVIOR_E or SAI_MY_SID_ENTRY_ATTR_ENDPOINT_BEHAVIOR == SAI_MY_SID_ENTRY_ENDPOINT_BEHAVIOR_X or SAI_MY_SID_ENTRY_ATTR_ENDPOINT_BEHAVIOR == SAI_MY_SID_ENTRY_ENDPOINT_BEHAVIOR_T + */ + SAI_MY_SID_ENTRY_ATTR_ENDPOINT_BEHAVIOR_FLAVOR, + + /** + * @brief Packet action + * + * @type sai_packet_action_t + * @flags CREATE_AND_SET + * @default SAI_PACKET_ACTION_FORWARD + */ + SAI_MY_SID_ENTRY_ATTR_PACKET_ACTION, + + /** + * @brief Packet priority for trap/log actions + * + * @type sai_uint8_t + * @flags CREATE_AND_SET + * @default 0 + */ + SAI_MY_SID_ENTRY_ATTR_TRAP_PRIORITY, + + /** + * @brief Next hop for cross-connect functions + * + * @type sai_object_id_t + * @flags CREATE_AND_SET + * @objects SAI_OBJECT_TYPE_NEXT_HOP, SAI_OBJECT_TYPE_NEXT_HOP_GROUP, SAI_OBJECT_TYPE_ROUTER_INTERFACE + * @allownull true + * @default SAI_NULL_OBJECT_ID + * @validonly SAI_MY_SID_ENTRY_ATTR_ENDPOINT_BEHAVIOR == SAI_MY_SID_ENTRY_ENDPOINT_BEHAVIOR_X or SAI_MY_SID_ENTRY_ATTR_ENDPOINT_BEHAVIOR == SAI_MY_SID_ENTRY_ENDPOINT_BEHAVIOR_DX4 or SAI_MY_SID_ENTRY_ATTR_ENDPOINT_BEHAVIOR == SAI_MY_SID_ENTRY_ENDPOINT_BEHAVIOR_DX6 or SAI_MY_SID_ENTRY_ATTR_ENDPOINT_BEHAVIOR == SAI_MY_SID_ENTRY_ENDPOINT_BEHAVIOR_B6_ENCAPS or SAI_MY_SID_ENTRY_ATTR_ENDPOINT_BEHAVIOR == SAI_MY_SID_ENTRY_ENDPOINT_BEHAVIOR_B6_ENCAPS_RED or SAI_MY_SID_ENTRY_ATTR_ENDPOINT_BEHAVIOR == SAI_MY_SID_ENTRY_ENDPOINT_BEHAVIOR_B6_INSERT or SAI_MY_SID_ENTRY_ATTR_ENDPOINT_BEHAVIOR == SAI_MY_SID_ENTRY_ENDPOINT_BEHAVIOR_B6_INSERT_RED + */ + SAI_MY_SID_ENTRY_ATTR_NEXT_HOP_ID, + + /** + * @brief Tunnel id for decapsulation + * + * @type sai_object_id_t + * @flags CREATE_AND_SET + * @objects SAI_OBJECT_TYPE_TUNNEL + * @allownull true + * @default SAI_NULL_OBJECT_ID + * @validonly SAI_MY_SID_ENTRY_ATTR_ENDPOINT_BEHAVIOR == SAI_MY_SID_ENTRY_ENDPOINT_BEHAVIOR_DT4 or SAI_MY_SID_ENTRY_ATTR_ENDPOINT_BEHAVIOR == SAI_MY_SID_ENTRY_ENDPOINT_BEHAVIOR_DT6 or SAI_MY_SID_ENTRY_ATTR_ENDPOINT_BEHAVIOR == SAI_MY_SID_ENTRY_ENDPOINT_BEHAVIOR_DT46 + */ + SAI_MY_SID_ENTRY_ATTR_TUNNEL_ID, + + /** + * @brief VRF for decapsulation and specific table lookup functions + * + * @type sai_object_id_t + * @flags CREATE_AND_SET + * @objects SAI_OBJECT_TYPE_VIRTUAL_ROUTER + * @allownull true + * @default SAI_NULL_OBJECT_ID + * @validonly SAI_MY_SID_ENTRY_ATTR_ENDPOINT_BEHAVIOR == SAI_MY_SID_ENTRY_ENDPOINT_BEHAVIOR_T or SAI_MY_SID_ENTRY_ATTR_ENDPOINT_BEHAVIOR == SAI_MY_SID_ENTRY_ENDPOINT_BEHAVIOR_DT4 or SAI_MY_SID_ENTRY_ATTR_ENDPOINT_BEHAVIOR == SAI_MY_SID_ENTRY_ENDPOINT_BEHAVIOR_DT6 or SAI_MY_SID_ENTRY_ATTR_ENDPOINT_BEHAVIOR == SAI_MY_SID_ENTRY_ENDPOINT_BEHAVIOR_DT46 + */ + SAI_MY_SID_ENTRY_ATTR_VRF, + + /** + * @brief Attach a counter + * + * When it is empty, then packet hits won't be counted + * + * @type sai_object_id_t + * @flags CREATE_AND_SET + * @objects SAI_OBJECT_TYPE_COUNTER + * @allownull true + * @default SAI_NULL_OBJECT_ID + */ + SAI_MY_SID_ENTRY_ATTR_COUNTER_ID, + + /** + * @brief End of attributes + */ + SAI_MY_SID_ENTRY_ATTR_END, + + /** Custom range base value */ + SAI_MY_SID_ENTRY_ATTR_CUSTOM_RANGE_START = 0x10000000, + + /** End of custom range base */ + SAI_MY_SID_ENTRY_ATTR_CUSTOM_RANGE_END + +} sai_my_sid_entry_attr_t; + +/** + * @brief My SID Entry + */ +typedef struct _sai_my_sid_entry_t +{ + /** + * @brief Switch ID + * + * @objects SAI_OBJECT_TYPE_SWITCH + */ + sai_object_id_t switch_id; + + /** + * @brief Virtual Router ID + * + * @objects SAI_OBJECT_TYPE_VIRTUAL_ROUTER + */ + sai_object_id_t vr_id; + + /** + * @brief Length of the Locator Block part of the SID + */ + sai_uint8_t locator_block_len; + + /** + * @brief Length of the Locator Node part of the SID + */ + sai_uint8_t locator_node_len; + + /** + * @brief Length of the Function part of the SID + */ + sai_uint8_t function_len; + + /** + * @brief Length of the Args part of the SID + */ + sai_uint8_t args_len; + + /** + * @brief IPv6 prefix for My SID + */ + sai_ip6_t sid; + +} sai_my_sid_entry_t; + +``` + +5. Added apis to create/remove and set/get attributes for my_sid_entry + + - add_my_sid_entry + - remove_my_sid_entry + - set_my_sid_entry_attribute + - get_my_sid_entry_attribute + - create_my_sid_entries + - remove_my_sid_entries + - set_my_sid_entries_attribute + - get_my_sid_entries_attribute + + +## Examples ## +- SR Headend + Example configuration for H.Encaps.Red behavior + + 1. Create a SID list object with 3 segments + + sidlist_entry_attrs[0].id = SAI_SEGMENTROUTE_SIDLIST_ATTR_TYPE + sidlist_entry_attrs01].value.s32 = SAI_SEGMENTROUTE_SIDLIST_TYPE_ENCAPS_RED + sidlist_entry_attrs[1].id = SAI_SEGMENTROUTE_SIDLIST_ATTR_SEGMENT_LIST + sidlist_entry_attrs[1].value.objlist.count = 3; + CONVERT_STR_TO_IPV6(sidlist_entry_attrs[1].value.objlist.list[0], "2001:db8:85a3::8a2e:370:7334"); + CONVERT_STR_TO_IPV6(sidlist_entry_attrs[1].value.objlist.list[1], "2001:db8:85a3::8a2e:370:2345"); + CONVERT_STR_TO_IPV6(sidlist_entry_attrs[1].value.objlist.list[2], "2001:db8:85a3::8a2e:370:3456"); + saistatus = sai_srv6_api->create_segmentroute_sidlist(&sidlist_id, switch_id, 2, sidlist_entry_attrs); + + 2. Create a tunnel object with source IP used for tunnel encapsulation + + tunnel_entry_attrs[0].id = SAI_TUNNEL_ATTR_TYPE + tunnel_entry_attrs[0].value = SAI_TUNNEL_TYPE_SRV6 + tunnel_entry_attrs[1].id = SAI_TUNNEL_ATTR_ENCAP_SRC_IP + CONVERT_STR_TO_IPV6(tunnel_entry_attrs[1].value, "2001:db8:85a3::8a2e:370:9876"); + tunnel_entry_attrs[2].id = SAI_TUNNEL_ATTR_UNDERLAY_INTERFACE + tunnel_entry_attrs[2].value.oid = underlay_rif // created elsewhere + saistatus = sai_tunnel_api->create_tunnel(&tunnel_id, switch_id, 3, tunnel_entry_attrs) + + 3. Create a srv6 nexthop object bound to the SID list object and H.Encaps.Red behavior + + nexthop_entry_attrs[0].id = SAI_NEXTHOP_ATTR_TYPE + nexthop_entry_attrs[0].value = SAI_NEXT_HOP_TYPE_SEGMENTROUTE_SIDLIST + nexthop_entry_attrs[1].id = SAI_NEXTHOP_ATTR_TUNNEL_ID + nexthop_entry_attrs[1].value.oid = tunnel_id + nexthop_entry_attrs[2].id = SAI_NEXT_HOP_ATTR_SEGMENTROUTE_SIDLIST_ID + nexthop_entry_attrs[2].value.oid = sidlist_id + saistatus = sai_nexthop_api->create_nexthop(&nexthop_id, switch_id, 3, nexthop_entry_attrs) + + 4. Create a route entry which points to the srv6 nexthop + + route_entry.switch_id = 0 + route_entry.vr_id = vr_id_1 // created elsewhere + route_entry.destination.addr_family = SAI_IP_ADDR_FAMILY_IPV4 + route_entry.destination.addr.ip4 = "198.51.100.0" + route_entry.destination.addr.mask = "255.255.255.0" + + route_entry_attrs[0].id = SAI_ROUTE_ENTRY_ATTR_NEXT_HOP_ID; + route_entry_attrs[0].value.oid = nexthop_id; + saisstatus = sai_route_api->create_route(&route_entry, 1, route_entry_attrs) + + +- SR Endpoint/Transit + + Example configuration for End.DT46 behavior + + my_sid_entry.switch_id = 0 + my_sid_entry.vr_id = vr_id_1 // underlay VRF + my_sid_entry.locator_len = 64 + my_sid_entry.function_len = 8 + CONVERT_STR_TO_IPV6(my_sid_entry.sid, "2001:db8:0:1::1000:0:0:0"); + + my_sid_attr[0].id = SAI_MY_SID_ENTRY_ATTR_ENDPOINT_TYPE + my_sid_attr[0].value = SAI_MY_SID_ENTRY_ENDPOINT_TYPE_DT46 + my_sid_attr[1].id = SAI_MY_SID_ENTRY_ATTR_VRF + my_sid_attr[1].value.oid = vr_id_1001 // overlay vrf, created elsewhere + saistatus = sai_srv6_api->create_my_sid(&my_sid_entry, 2, my_sid_attr) + + +## References ## +1. [IPv6 Segment Routing Header (SRH)](https://tools.ietf.org/html/rfc8754) +2. [Segment Routing over IPv6 (SRv6) Network Programming](https://tools.ietf.org/html/rfc8986) +3. [Segment Routing Policy Architecture](https://tools.ietf.org/html/draft-ietf-spring-segment-routing-policy-11) +4. [Segment Routing Architecture](https://datatracker.ietf.org/doc/html/rfc8402) +5. [SRv6 NET-PGM extension: Insertion](https://datatracker.ietf.org/doc/html/draft-filsfils-spring-srv6-net-pgm-insertion-04) +6. [Network Programming extension: SRv6 uSID instruction](https://datatracker.ietf.org/doc/html/draft-filsfils-spring-net-pgm-extension-srv6-usid-10) \ No newline at end of file diff --git a/doc/figures/SRv6_Endpoint_behavioral_model.png b/doc/figures/SRv6_Endpoint_behavioral_model.png new file mode 100755 index 000000000..4dc02ca9c Binary files /dev/null and b/doc/figures/SRv6_Endpoint_behavioral_model.png differ diff --git a/doc/figures/SRv6_Headend_behavioral_model.png b/doc/figures/SRv6_Headend_behavioral_model.png new file mode 100755 index 000000000..fb2d60c60 Binary files /dev/null and b/doc/figures/SRv6_Headend_behavioral_model.png differ diff --git a/inc/sai.h b/inc/sai.h index f5f9fa3a2..dcce39c12 100644 --- a/inc/sai.h +++ b/inc/sai.h @@ -55,7 +55,7 @@ #include "saisamplepacket.h" #include "saischedulergroup.h" #include "saischeduler.h" -#include "saisegmentroute.h" +#include "saisrv6.h" #include "saistatus.h" #include "saistp.h" #include "saiswitch.h" @@ -123,7 +123,7 @@ typedef enum _sai_api_t SAI_API_MCAST_FDB = 32, /**< sai_mcast_fdb_api_t */ SAI_API_BRIDGE = 33, /**< sai_bridge_api_t */ SAI_API_TAM = 34, /**< sai_tam_api_t */ - SAI_API_SEGMENTROUTE = 35, /**< sai_segmentroute_api_t */ + SAI_API_SRV6 = 35, /**< sai_srv6_api_t */ SAI_API_MPLS = 36, /**< sai_mpls_api_t */ SAI_API_DTEL = 37, /**< sai_dtel_api_t (experimental) */ SAI_API_BFD = 38, /**< sai_bfd_api_t */ diff --git a/inc/sainexthop.h b/inc/sainexthop.h index 77ee4d5c6..ae137f4ff 100644 --- a/inc/sainexthop.h +++ b/inc/sainexthop.h @@ -47,61 +47,11 @@ typedef enum _sai_next_hop_type_t /** Tunnel next hop */ SAI_NEXT_HOP_TYPE_TUNNEL_ENCAP, - /** IPv6 Segment Route SID List */ - SAI_NEXT_HOP_TYPE_SEGMENTROUTE_SIDLIST, - - /** IPv6 Segment Route Endpoint Function */ - SAI_NEXT_HOP_TYPE_SEGMENTROUTE_ENDPOINT, + /** SRV6 SID List */ + SAI_NEXT_HOP_TYPE_SRV6_SIDLIST, } sai_next_hop_type_t; -/** - * @brief Enum defining Endpoint Action types - */ -typedef enum _sai_next_hop_endpoint_type_t -{ - /** Basic Endpoint */ - SAI_NEXT_HOP_ENDPOINT_TYPE_E, - - /** End.X Endpoint with Layer-3 Cross-connect */ - SAI_NEXT_HOP_ENDPOINT_TYPE_X, - - /** End.T Endpoint with specific IPv6 Table */ - SAI_NEXT_HOP_ENDPOINT_TYPE_T, - - /** Endpoint with decapsulation and Layer 2 Cross-connect */ - SAI_NEXT_HOP_ENDPOINT_TYPE_DX2, - - /** Endpoint with decapsulation and IPv6 Cross-connect */ - SAI_NEXT_HOP_ENDPOINT_TYPE_DX6, - - /** Endpoint with decapsulation and IPv4 Cross-connect */ - SAI_NEXT_HOP_ENDPOINT_TYPE_DX4, - - /** Endpoint with decapsulation and specific IPv6 */ - SAI_NEXT_HOP_ENDPOINT_TYPE_DT6, - - /** Endpoint with decapsulation and specific IPv6 */ - SAI_NEXT_HOP_ENDPOINT_TYPE_DT4, - - /** Custom range base value */ - SAI_NEXT_HOP_ENDPOINT_TYPE_CUSTOM_RANGE_BASE = 0x10000000 - -} sai_next_hop_endpoint_type_t; - -/** - * @brief Enum defining Endpoint Segment Pop types for End, End.X and End.T - */ -typedef enum _sai_next_hop_endpoint_pop_type_t -{ - /** Penultimate segment pop */ - SAI_NEXT_HOP_ENDPOINT_POP_TYPE_PSP, - - /** Ultimate Segment pop */ - SAI_NEXT_HOP_ENDPOINT_POP_TYPE_USP, - -} sai_next_hop_endpoint_pop_type_t; - /** * @brief Attribute id for next hop */ @@ -146,7 +96,7 @@ typedef enum _sai_next_hop_attr_t * @type sai_object_id_t * @flags MANDATORY_ON_CREATE | CREATE_ONLY * @objects SAI_OBJECT_TYPE_TUNNEL - * @condition SAI_NEXT_HOP_ATTR_TYPE == SAI_NEXT_HOP_TYPE_TUNNEL_ENCAP + * @condition SAI_NEXT_HOP_ATTR_TYPE == SAI_NEXT_HOP_TYPE_TUNNEL_ENCAP or SAI_NEXT_HOP_ATTR_TYPE == SAI_NEXT_HOP_TYPE_SRV6_SIDLIST */ SAI_NEXT_HOP_ATTR_TUNNEL_ID, @@ -171,32 +121,14 @@ typedef enum _sai_next_hop_attr_t SAI_NEXT_HOP_ATTR_TUNNEL_MAC, /** - * @brief Next hop entry Segment Route SID List + * @brief Next hop entry SRV6 SID List * * @type sai_object_id_t * @flags MANDATORY_ON_CREATE | CREATE_ONLY - * @objects SAI_OBJECT_TYPE_SEGMENTROUTE_SIDLIST - * @condition SAI_NEXT_HOP_ATTR_TYPE == SAI_NEXT_HOP_TYPE_SEGMENTROUTE_SIDLIST - */ - SAI_NEXT_HOP_ATTR_SEGMENTROUTE_SIDLIST_ID, - - /** - * @brief Next hop entry Segment Route Endpoint Function - * - * @type sai_next_hop_endpoint_type_t - * @flags MANDATORY_ON_CREATE | CREATE_AND_SET - * @condition SAI_NEXT_HOP_ATTR_TYPE == SAI_NEXT_HOP_TYPE_SEGMENTROUTE_ENDPOINT - */ - SAI_NEXT_HOP_ATTR_SEGMENTROUTE_ENDPOINT_TYPE, - - /** - * @brief Next hop entry Segment Route Endpoint Pop Option - * - * @type sai_next_hop_endpoint_pop_type_t - * @flags MANDATORY_ON_CREATE | CREATE_AND_SET - * @condition SAI_NEXT_HOP_ATTR_TYPE == SAI_NEXT_HOP_TYPE_SEGMENTROUTE_ENDPOINT + * @objects SAI_OBJECT_TYPE_SRV6_SIDLIST + * @condition SAI_NEXT_HOP_ATTR_TYPE == SAI_NEXT_HOP_TYPE_SRV6_SIDLIST */ - SAI_NEXT_HOP_ATTR_SEGMENTROUTE_ENDPOINT_POP_TYPE, + SAI_NEXT_HOP_ATTR_SRV6_SIDLIST_ID, /** * @brief Push label diff --git a/inc/saiobject.h b/inc/saiobject.h index b158745d9..18c67c17e 100644 --- a/inc/saiobject.h +++ b/inc/saiobject.h @@ -34,6 +34,7 @@ #include #include #include +#include /** * @defgroup SAIOBJECT SAI - Object API definitions. @@ -77,6 +78,9 @@ typedef union _sai_object_key_entry_t /** @validonly object_type == SAI_OBJECT_TYPE_NAT_ENTRY */ sai_nat_entry_t nat_entry; + /** @validonly object_type == SAI_OBJECT_TYPE_MY_SID_ENTRY */ + sai_my_sid_entry_t my_sid_entry; + } sai_object_key_entry_t; /** diff --git a/inc/saisegmentroute.h b/inc/saisegmentroute.h deleted file mode 100644 index 7525ede24..000000000 --- a/inc/saisegmentroute.h +++ /dev/null @@ -1,168 +0,0 @@ -/** - * Copyright (c) 2017 Microsoft Open Technologies, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. You may obtain - * a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 - * - * THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR - * CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT - * LIMITATION ANY IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS - * FOR A PARTICULAR PURPOSE, MERCHANTABILITY OR NON-INFRINGEMENT. - * - * See the Apache Version 2.0 License for specific language governing - * permissions and limitations under the License. - * - * Microsoft would like to thank the following companies for their review and - * assistance with these files: Intel Corporation, Mellanox Technologies Ltd, - * Dell Products, L.P., Facebook, Inc., Marvell International Ltd. - * - * @file saisegmentroute.h - * - * @brief This module defines SAI Segment Route Entry interface - */ - -#if !defined (__SAISEGMENTROUTE_H_) -#define __SAISEGMENTROUTE_H_ - -#include - -/** - * @defgroup SAISEGMENTROUTE SAI - Segment Route specific API definitions - * - * @{ - */ - -/** - * @brief Enum defining Transit or Source types - */ -typedef enum _sai_segmentroute_sidlist_type_t -{ - /** Insertion of Segment Route Policy */ - SAI_SEGMENTROUTE_SIDLIST_TYPE_INSERT, - - /** Encapsulation in a Segment Route Policy */ - SAI_SEGMENTROUTE_SIDLIST_TYPE_ENCAPS, - - /** Custom range base value */ - SAI_SEGMENTROUTE_SIDLIST_TYPE_CUSTOM_RANGE_BASE = 0x10000000 - -} sai_segmentroute_sidlist_type_t; - -/** - * @brief Attribute data for Segment Route Segment ID List Entry - */ -typedef enum _sai_segmentroute_sidlist_attr_t -{ - /** - * @brief Start of attributes - */ - SAI_SEGMENTROUTE_SIDLIST_ATTR_START = 0x00000000, - - /** - * @brief Transit or Source Type - * - * @type sai_segmentroute_sidlist_type_t - * @flags MANDATORY_ON_CREATE | CREATE_ONLY - */ - SAI_SEGMENTROUTE_SIDLIST_ATTR_TYPE = SAI_SEGMENTROUTE_SIDLIST_ATTR_START, - - /** - * @brief List of Type Length Values for Source - * - * @type sai_tlv_list_t - * @flags CREATE_AND_SET - * @default empty - */ - SAI_SEGMENTROUTE_SIDLIST_ATTR_TLV_LIST, - - /** - * @brief List of Segments for Source / Transit - * - * @type sai_segment_list_t - * @flags CREATE_AND_SET - * @default empty - */ - SAI_SEGMENTROUTE_SIDLIST_ATTR_SEGMENT_LIST, - - /** - * @brief End of attributes - */ - SAI_SEGMENTROUTE_SIDLIST_ATTR_END, - - /** Custom range base value */ - SAI_SEGMENTROUTE_SIDLIST_ATTR_CUSTOM_RANGE_START = 0x10000000, - - /** End of custom range base */ - SAI_SEGMENTROUTE_SIDLIST_ATTR_CUSTOM_RANGE_END -} sai_segmentroute_sidlist_attr_t; - -/** - * @brief Create Segment ID List - * - * @param[out] segmentroute_sidlist_id Segment ID List ID - * @param[in] switch_id Switch id - * @param[in] attr_count Number of attributes - * @param[in] attr_list Array of attributes - * - * @return #SAI_STATUS_SUCCESS on success Failure status code on error - */ -typedef sai_status_t (*sai_create_segmentroute_sidlist_fn)( - _Out_ sai_object_id_t *segmentroute_sidlist_id, - _In_ sai_object_id_t switch_id, - _In_ uint32_t attr_count, - _In_ const sai_attribute_t *attr_list); - -/** - * @brief Remove Segment ID List - * - * @param[in] segmentroute_sidlist_id Segment ID List ID - * - * @return #SAI_STATUS_SUCCESS on success Failure status code on error - */ -typedef sai_status_t (*sai_remove_segmentroute_sidlist_fn)( - _In_ sai_object_id_t segmentroute_sidlist_id); - -/** - * @brief Set Segment ID List attribute value - * - * @param[in] segmentroute_sidlist_id Segment ID List ID - * @param[in] attr Attribute - * - * @return #SAI_STATUS_SUCCESS on success Failure status code on error - */ -typedef sai_status_t (*sai_set_segmentroute_sidlist_attribute_fn)( - _In_ sai_object_id_t segmentroute_sidlist_id, - _In_ const sai_attribute_t *attr); - -/** - * @brief Get Segment ID List attribute value - * - * @param[in] segmentroute_sidlist_id Segment ID List ID - * @param[in] attr_count Number of attributes - * @param[inout] attr_list Array of attributes - * - * @return #SAI_STATUS_SUCCESS on success Failure status code on error - */ -typedef sai_status_t (*sai_get_segmentroute_sidlist_attribute_fn)( - _In_ sai_object_id_t segmentroute_sidlist_id, - _In_ uint32_t attr_count, - _Inout_ sai_attribute_t *attr_list); - -/** - * @brief Segment Route methods table retrieved with sai_api_query() - */ -typedef struct _sai_segmentroute_api_t -{ - sai_create_segmentroute_sidlist_fn create_segmentroute_sidlist; - sai_remove_segmentroute_sidlist_fn remove_segmentroute_sidlist; - sai_set_segmentroute_sidlist_attribute_fn set_segmentroute_sidlist_attribute; - sai_get_segmentroute_sidlist_attribute_fn get_segmentroute_sidlist_attribute; - sai_bulk_object_create_fn create_segmentroute_sidlists; - sai_bulk_object_remove_fn remove_segmentroute_sidlists; -} sai_segmentroute_api_t; - -/** - * @} - */ -#endif /** __SAISEGMENTROUTE_H_ */ diff --git a/inc/saisrv6.h b/inc/saisrv6.h new file mode 100644 index 000000000..bb27d31de --- /dev/null +++ b/inc/saisrv6.h @@ -0,0 +1,561 @@ +/** + * Copyright (c) 2017 Microsoft Open Technologies, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. You may obtain + * a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 + * + * THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR + * CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT + * LIMITATION ANY IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS + * FOR A PARTICULAR PURPOSE, MERCHANTABILITY OR NON-INFRINGEMENT. + * + * See the Apache Version 2.0 License for specific language governing + * permissions and limitations under the License. + * + * Microsoft would like to thank the following companies for their review and + * assistance with these files: Intel Corporation, Mellanox Technologies Ltd, + * Dell Products, L.P., Facebook, Inc., Marvell International Ltd. + * + * @file saisrv6.h + * + * @brief This module defines SAI SRV6 Entry interface + */ + +#if !defined (__SAISRV6_H_) +#define __SAISRV6_H_ + +#include + +/** + * @defgroup SAISRV6 SAI - SRV6 specific API definitions + * + * @{ + */ + +/** + * @brief Enum defining Head-end Behavior + */ +typedef enum _sai_srv6_sidlist_type_t +{ + /** Insertion of SRV6 Policy */ + SAI_SRV6_SIDLIST_TYPE_INSERT, + + /** Insertion of SRV6 Policy with Reduced SRH */ + SAI_SRV6_SIDLIST_TYPE_INSERT_RED, + + /** Encapsulation in a SRV6 Policy */ + SAI_SRV6_SIDLIST_TYPE_ENCAPS, + + /** Encapsulation in a SRV6 Policy with Reduced SRH */ + SAI_SRV6_SIDLIST_TYPE_ENCAPS_RED, + + /** Custom range base value */ + SAI_SRV6_SIDLIST_TYPE_CUSTOM_RANGE_BASE = 0x10000000 + +} sai_srv6_sidlist_type_t; + +/** + * @brief Enum defining Endpoint Behavior + */ +typedef enum _sai_my_sid_entry_endpoint_behavior_t +{ + /** Basic Endpoint */ + SAI_MY_SID_ENTRY_ENDPOINT_BEHAVIOR_E, + + /** End.X Endpoint with Layer-3 Cross-connect */ + SAI_MY_SID_ENTRY_ENDPOINT_BEHAVIOR_X, + + /** End.T Endpoint with specific IPv6 Table */ + SAI_MY_SID_ENTRY_ENDPOINT_BEHAVIOR_T, + + /** Endpoint with decapsulation and IPv6 Cross-connect */ + SAI_MY_SID_ENTRY_ENDPOINT_BEHAVIOR_DX6, + + /** Endpoint with decapsulation and IPv4 Cross-connect */ + SAI_MY_SID_ENTRY_ENDPOINT_BEHAVIOR_DX4, + + /** Endpoint with decapsulation and specific IPv6 table lookup */ + SAI_MY_SID_ENTRY_ENDPOINT_BEHAVIOR_DT6, + + /** Endpoint with decapsulation and specific IPv6 table lookup */ + SAI_MY_SID_ENTRY_ENDPOINT_BEHAVIOR_DT4, + + /** Endpoint with decapsulation and specific IP table lookup */ + SAI_MY_SID_ENTRY_ENDPOINT_BEHAVIOR_DT46, + + /** Endpoint Bound to a policy with Encapsulation */ + SAI_MY_SID_ENTRY_ENDPOINT_BEHAVIOR_B6_ENCAPS, + + /** End.B6.Encaps function with a reduced SRH */ + SAI_MY_SID_ENTRY_ENDPOINT_BEHAVIOR_B6_ENCAPS_RED, + + /** Endpoint Bound to a policy with Insertion */ + SAI_MY_SID_ENTRY_ENDPOINT_BEHAVIOR_B6_INSERT, + + /** End.B6.Insert function with a reduced SRH */ + SAI_MY_SID_ENTRY_ENDPOINT_BEHAVIOR_B6_INSERT_RED, + + /** Custom range base value */ + SAI_MY_SID_ENTRY_ENDPOINT_BEHAVIOR_CUSTOM_RANGE_START = 0x10000000, + + /** End of Custom range base */ + SAI_MY_SID_ENTRY_ENDPOINT_BEHAVIOR_CUSTOM_RANGE_END + +} sai_my_sid_entry_endpoint_behavior_t; + +/** + * @brief Enum defining Endpoint Behavior flavors for End, End.X and End.T functions + */ +typedef enum _sai_my_sid_entry_endpoint_behavior_flavor_t +{ + /** None */ + SAI_MY_SID_ENTRY_ENDPOINT_BEHAVIOR_FLAVOR_NONE, + + /** Penultimate segment pop */ + SAI_MY_SID_ENTRY_ENDPOINT_BEHAVIOR_FLAVOR_PSP, + + /** Ultimate Segment pop */ + SAI_MY_SID_ENTRY_ENDPOINT_BEHAVIOR_FLAVOR_USP, + + /** Ultimate Segment decapsulation */ + SAI_MY_SID_ENTRY_ENDPOINT_BEHAVIOR_FLAVOR_USD, + + /** PSP and USP */ + SAI_MY_SID_ENTRY_ENDPOINT_BEHAVIOR_FLAVOR_PSP_AND_USP, + + /** USD and USP */ + SAI_MY_SID_ENTRY_ENDPOINT_BEHAVIOR_FLAVOR_USD_AND_USP, + + /** PSP and USD */ + SAI_MY_SID_ENTRY_ENDPOINT_BEHAVIOR_FLAVOR_PSP_AND_USD, + + /** PSP, USP and USD */ + SAI_MY_SID_ENTRY_ENDPOINT_BEHAVIOR_FLAVOR_PSP_AND_USP_AND_USD + +} sai_my_sid_entry_endpoint_behavior_flavor_t; + +/** + * @brief Attribute data for SRV6 SID List Entry + */ +typedef enum _sai_srv6_sidlist_attr_t +{ + /** + * @brief Start of attributes + */ + SAI_SRV6_SIDLIST_ATTR_START = 0x00000000, + + /** + * @brief Transit or Source Type + * + * @type sai_srv6_sidlist_type_t + * @flags MANDATORY_ON_CREATE | CREATE_ONLY + */ + SAI_SRV6_SIDLIST_ATTR_TYPE = SAI_SRV6_SIDLIST_ATTR_START, + + /** + * @brief List of Type Length Values for Source + * + * @type sai_tlv_list_t + * @flags CREATE_AND_SET + * @default empty + */ + SAI_SRV6_SIDLIST_ATTR_TLV_LIST, + + /** + * @brief List of Segments for Source / Transit + * + * @type sai_segment_list_t + * @flags CREATE_AND_SET + * @default empty + */ + SAI_SRV6_SIDLIST_ATTR_SEGMENT_LIST, + + /** + * @brief End of attributes + */ + SAI_SRV6_SIDLIST_ATTR_END, + + /** Custom range base value */ + SAI_SRV6_SIDLIST_ATTR_CUSTOM_RANGE_START = 0x10000000, + + /** End of custom range base */ + SAI_SRV6_SIDLIST_ATTR_CUSTOM_RANGE_END +} sai_srv6_sidlist_attr_t; + +/** + * @brief Create Segment ID List + * + * @param[out] srv6_sidlist_id Segment ID List ID + * @param[in] switch_id Switch id + * @param[in] attr_count Number of attributes + * @param[in] attr_list Array of attributes + * + * @return #SAI_STATUS_SUCCESS on success Failure status code on error + */ +typedef sai_status_t (*sai_create_srv6_sidlist_fn)( + _Out_ sai_object_id_t *srv6_sidlist_id, + _In_ sai_object_id_t switch_id, + _In_ uint32_t attr_count, + _In_ const sai_attribute_t *attr_list); + +/** + * @brief Remove Segment ID List + * + * @param[in] srv6_sidlist_id Segment ID List ID + * + * @return #SAI_STATUS_SUCCESS on success Failure status code on error + */ +typedef sai_status_t (*sai_remove_srv6_sidlist_fn)( + _In_ sai_object_id_t srv6_sidlist_id); + +/** + * @brief Set Segment ID List attribute value + * + * @param[in] srv6_sidlist_id Segment ID List ID + * @param[in] attr Attribute + * + * @return #SAI_STATUS_SUCCESS on success Failure status code on error + */ +typedef sai_status_t (*sai_set_srv6_sidlist_attribute_fn)( + _In_ sai_object_id_t srv6_sidlist_id, + _In_ const sai_attribute_t *attr); + +/** + * @brief Get Segment ID List attribute value + * + * @param[in] srv6_sidlist_id Segment ID List ID + * @param[in] attr_count Number of attributes + * @param[inout] attr_list Array of attributes + * + * @return #SAI_STATUS_SUCCESS on success Failure status code on error + */ +typedef sai_status_t (*sai_get_srv6_sidlist_attribute_fn)( + _In_ sai_object_id_t srv6_sidlist_id, + _In_ uint32_t attr_count, + _Inout_ sai_attribute_t *attr_list); + +/** + * @brief Attribute list for My SID + */ +typedef enum _sai_my_sid_entry_attr_t +{ + /** + * @brief Start of attributes + */ + SAI_MY_SID_ENTRY_ATTR_START, + + /** + * @brief Endpoint Function + * + * @type sai_my_sid_entry_endpoint_behavior_t + * @flags MANDATORY_ON_CREATE | CREATE_AND_SET + */ + SAI_MY_SID_ENTRY_ATTR_ENDPOINT_BEHAVIOR = SAI_MY_SID_ENTRY_ATTR_START, + + /** + * @brief Flavor for End, End.X and End.T functions + * + * @type sai_my_sid_entry_endpoint_behavior_flavor_t + * @flags CREATE_AND_SET + * @default SAI_MY_SID_ENTRY_ENDPOINT_BEHAVIOR_FLAVOR_NONE + * @validonly SAI_MY_SID_ENTRY_ATTR_ENDPOINT_BEHAVIOR == SAI_MY_SID_ENTRY_ENDPOINT_BEHAVIOR_E or SAI_MY_SID_ENTRY_ATTR_ENDPOINT_BEHAVIOR == SAI_MY_SID_ENTRY_ENDPOINT_BEHAVIOR_X or SAI_MY_SID_ENTRY_ATTR_ENDPOINT_BEHAVIOR == SAI_MY_SID_ENTRY_ENDPOINT_BEHAVIOR_T + */ + SAI_MY_SID_ENTRY_ATTR_ENDPOINT_BEHAVIOR_FLAVOR, + + /** + * @brief Packet action + * + * @type sai_packet_action_t + * @flags CREATE_AND_SET + * @default SAI_PACKET_ACTION_FORWARD + */ + SAI_MY_SID_ENTRY_ATTR_PACKET_ACTION, + + /** + * @brief Packet priority for trap/log actions + * + * @type sai_uint8_t + * @flags CREATE_AND_SET + * @default 0 + */ + SAI_MY_SID_ENTRY_ATTR_TRAP_PRIORITY, + + /** + * @brief Next hop for cross-connect functions + * + * @type sai_object_id_t + * @flags CREATE_AND_SET + * @objects SAI_OBJECT_TYPE_NEXT_HOP, SAI_OBJECT_TYPE_NEXT_HOP_GROUP, SAI_OBJECT_TYPE_ROUTER_INTERFACE + * @allownull true + * @default SAI_NULL_OBJECT_ID + * @validonly SAI_MY_SID_ENTRY_ATTR_ENDPOINT_BEHAVIOR == SAI_MY_SID_ENTRY_ENDPOINT_BEHAVIOR_X or SAI_MY_SID_ENTRY_ATTR_ENDPOINT_BEHAVIOR == SAI_MY_SID_ENTRY_ENDPOINT_BEHAVIOR_DX4 or SAI_MY_SID_ENTRY_ATTR_ENDPOINT_BEHAVIOR == SAI_MY_SID_ENTRY_ENDPOINT_BEHAVIOR_DX6 or SAI_MY_SID_ENTRY_ATTR_ENDPOINT_BEHAVIOR == SAI_MY_SID_ENTRY_ENDPOINT_BEHAVIOR_B6_ENCAPS or SAI_MY_SID_ENTRY_ATTR_ENDPOINT_BEHAVIOR == SAI_MY_SID_ENTRY_ENDPOINT_BEHAVIOR_B6_ENCAPS_RED or SAI_MY_SID_ENTRY_ATTR_ENDPOINT_BEHAVIOR == SAI_MY_SID_ENTRY_ENDPOINT_BEHAVIOR_B6_INSERT or SAI_MY_SID_ENTRY_ATTR_ENDPOINT_BEHAVIOR == SAI_MY_SID_ENTRY_ENDPOINT_BEHAVIOR_B6_INSERT_RED + */ + SAI_MY_SID_ENTRY_ATTR_NEXT_HOP_ID, + + /** + * @brief Tunnel id for decapsulation + * + * @type sai_object_id_t + * @flags CREATE_AND_SET + * @objects SAI_OBJECT_TYPE_TUNNEL + * @allownull true + * @default SAI_NULL_OBJECT_ID + * @validonly SAI_MY_SID_ENTRY_ATTR_ENDPOINT_BEHAVIOR == SAI_MY_SID_ENTRY_ENDPOINT_BEHAVIOR_DT4 or SAI_MY_SID_ENTRY_ATTR_ENDPOINT_BEHAVIOR == SAI_MY_SID_ENTRY_ENDPOINT_BEHAVIOR_DT6 or SAI_MY_SID_ENTRY_ATTR_ENDPOINT_BEHAVIOR == SAI_MY_SID_ENTRY_ENDPOINT_BEHAVIOR_DT46 + */ + SAI_MY_SID_ENTRY_ATTR_TUNNEL_ID, + + /** + * @brief VRF for decapsulation and specific table lookup functions + * + * @type sai_object_id_t + * @flags CREATE_AND_SET + * @objects SAI_OBJECT_TYPE_VIRTUAL_ROUTER + * @allownull true + * @default SAI_NULL_OBJECT_ID + * @validonly SAI_MY_SID_ENTRY_ATTR_ENDPOINT_BEHAVIOR == SAI_MY_SID_ENTRY_ENDPOINT_BEHAVIOR_T or SAI_MY_SID_ENTRY_ATTR_ENDPOINT_BEHAVIOR == SAI_MY_SID_ENTRY_ENDPOINT_BEHAVIOR_DT4 or SAI_MY_SID_ENTRY_ATTR_ENDPOINT_BEHAVIOR == SAI_MY_SID_ENTRY_ENDPOINT_BEHAVIOR_DT6 or SAI_MY_SID_ENTRY_ATTR_ENDPOINT_BEHAVIOR == SAI_MY_SID_ENTRY_ENDPOINT_BEHAVIOR_DT46 + */ + SAI_MY_SID_ENTRY_ATTR_VRF, + + /** + * @brief Attach a counter + * + * When it is empty, then packet hits won't be counted + * + * @type sai_object_id_t + * @flags CREATE_AND_SET + * @objects SAI_OBJECT_TYPE_COUNTER + * @allownull true + * @default SAI_NULL_OBJECT_ID + */ + SAI_MY_SID_ENTRY_ATTR_COUNTER_ID, + + /** + * @brief End of attributes + */ + SAI_MY_SID_ENTRY_ATTR_END, + + /** Custom range base value */ + SAI_MY_SID_ENTRY_ATTR_CUSTOM_RANGE_START = 0x10000000, + + /** End of custom range base */ + SAI_MY_SID_ENTRY_ATTR_CUSTOM_RANGE_END + +} sai_my_sid_entry_attr_t; + +/** + * @brief My SID Entry + */ +typedef struct _sai_my_sid_entry_t +{ + /** + * @brief Switch ID + * + * @objects SAI_OBJECT_TYPE_SWITCH + */ + sai_object_id_t switch_id; + + /** + * @brief Virtual Router ID + * + * @objects SAI_OBJECT_TYPE_VIRTUAL_ROUTER + */ + sai_object_id_t vr_id; + + /** + * @brief Length of the Locator Block part of the SID + */ + sai_uint8_t locator_block_len; + + /** + * @brief Length of the Locator Node part of the SID + */ + sai_uint8_t locator_node_len; + + /** + * @brief Length of the Function part of the SID + */ + sai_uint8_t function_len; + + /** + * @brief Length of the Args part of the SID + */ + sai_uint8_t args_len; + + /** + * @brief IPv6 Address for My SID + */ + sai_ip6_t sid; + +} sai_my_sid_entry_t; + +/** + * @brief Create My SID entry + * + * @param[in] my_sid_entry My SID entry + * @param[in] attr_count Number of attributes + * @param[in] attr_list Array of attributes + * + * @return #SAI_STATUS_SUCCESS on success, failure status code on error + */ +typedef sai_status_t (*sai_create_my_sid_entry_fn)( + _In_ const sai_my_sid_entry_t *my_sid_entry, + _In_ uint32_t attr_count, + _In_ const sai_attribute_t *attr_list); + +/** + * @brief Remove My SID entry + * + * @param[in] my_sid_entry My SID entry + * + * @return #SAI_STATUS_SUCCESS on success, failure status code on error + */ +typedef sai_status_t (*sai_remove_my_sid_entry_fn)( + _In_ const sai_my_sid_entry_t *my_sid_entry); + +/** + * @brief Set My SID attribute value + * + * @param[in] my_sid_entry My SID entry + * @param[in] attr Attribute + * + * @return #SAI_STATUS_SUCCESS on success, failure status code on error + */ +typedef sai_status_t (*sai_set_my_sid_entry_attribute_fn)( + _In_ const sai_my_sid_entry_t *my_sid_entry, + _In_ const sai_attribute_t *attr); + +/** + * @brief My SID attribute value + * + * @param[in] my_sid_entry My SID entry + * @param[in] attr_count Number of attributes + * @param[inout] attr_list Array of attributes + * + * @return #SAI_STATUS_SUCCESS on success, failure status code on error + */ +typedef sai_status_t (*sai_get_my_sid_entry_attribute_fn)( + _In_ const sai_my_sid_entry_t *my_sid_entry, + _In_ uint32_t attr_count, + _Inout_ sai_attribute_t *attr_list); + +/** + * @brief Bulk create My SID entries + * + * @param[in] object_count Number of objects to create + * @param[in] my_sid_entry List of object to create + * @param[in] attr_count List of attr_count. Caller passes the number + * of attribute for each object to create. + * @param[in] attr_list List of attributes for every object. + * @param[in] mode Bulk operation error handling mode. + * @param[out] object_statuses List of status for every object. Caller needs to + * allocate the buffer + * + * @return #SAI_STATUS_SUCCESS on success when all objects are created or + * #SAI_STATUS_FAILURE when any of the objects fails to create. When there is + * failure, Caller is expected to go through the list of returned statuses to + * find out which fails and which succeeds. + */ +typedef sai_status_t (*sai_bulk_create_my_sid_entry_fn)( + _In_ uint32_t object_count, + _In_ const sai_my_sid_entry_t *my_sid_entry, + _In_ const uint32_t *attr_count, + _In_ const sai_attribute_t **attr_list, + _In_ sai_bulk_op_error_mode_t mode, + _Out_ sai_status_t *object_statuses); + +/** + * @brief Bulk remove My SID entries + * + * @param[in] object_count Number of objects to remove + * @param[in] my_sid_entry List of objects to remove + * @param[in] mode Bulk operation error handling mode. + * @param[out] object_statuses List of status for every object. Caller needs to + * allocate the buffer + * + * @return #SAI_STATUS_SUCCESS on success when all objects are removed or + * #SAI_STATUS_FAILURE when any of the objects fails to remove. When there is + * failure, Caller is expected to go through the list of returned statuses to + * find out which fails and which succeeds. + */ +typedef sai_status_t (*sai_bulk_remove_my_sid_entry_fn)( + _In_ uint32_t object_count, + _In_ const sai_my_sid_entry_t *my_sid_entry, + _In_ sai_bulk_op_error_mode_t mode, + _Out_ sai_status_t *object_statuses); + +/** + * @brief Bulk set attribute on My SID entry + * + * @param[in] object_count Number of objects to set attribute + * @param[in] my_sid_entry List of objects to set attribute + * @param[in] attr_list List of attributes to set on objects, one attribute per object + * @param[in] mode Bulk operation error handling mode. + * @param[out] object_statuses List of status for every object. Caller needs to + * allocate the buffer + * + * @return #SAI_STATUS_SUCCESS on success when all objects are removed or + * #SAI_STATUS_FAILURE when any of the objects fails to remove. When there is + * failure, Caller is expected to go through the list of returned statuses to + * find out which fails and which succeeds. + */ +typedef sai_status_t (*sai_bulk_set_my_sid_entry_attribute_fn)( + _In_ uint32_t object_count, + _In_ const sai_my_sid_entry_t *my_sid_entry, + _In_ const sai_attribute_t *attr_list, + _In_ sai_bulk_op_error_mode_t mode, + _Out_ sai_status_t *object_statuses); + +/** + * @brief Bulk get attribute on My SID entry + * + * @param[in] object_count Number of objects to set attribute + * @param[in] my_sid_entry List of objects to set attribute + * @param[in] attr_count List of attr_count. Caller passes the number + * of attribute for each object to get + * @param[inout] attr_list List of attributes to set on objects, one attribute per object + * @param[in] mode Bulk operation error handling mode + * @param[out] object_statuses List of status for every object. Caller needs to + * allocate the buffer + * + * @return #SAI_STATUS_SUCCESS on success when all objects are removed or + * #SAI_STATUS_FAILURE when any of the objects fails to remove. When there is + * failure, Caller is expected to go through the list of returned statuses to + * find out which fails and which succeeds. + */ +typedef sai_status_t (*sai_bulk_get_my_sid_entry_attribute_fn)( + _In_ uint32_t object_count, + _In_ const sai_my_sid_entry_t *my_sid_entry, + _In_ const uint32_t *attr_count, + _Inout_ sai_attribute_t **attr_list, + _In_ sai_bulk_op_error_mode_t mode, + _Out_ sai_status_t *object_statuses); + +/** + * @brief SRV6 methods table retrieved with sai_api_query() + */ +typedef struct _sai_srv6_api_t +{ + sai_create_srv6_sidlist_fn create_srv6_sidlist; + sai_remove_srv6_sidlist_fn remove_srv6_sidlist; + sai_set_srv6_sidlist_attribute_fn set_srv6_sidlist_attribute; + sai_get_srv6_sidlist_attribute_fn get_srv6_sidlist_attribute; + sai_bulk_object_create_fn create_srv6_sidlists; + sai_bulk_object_remove_fn remove_srv6_sidlists; + + sai_create_my_sid_entry_fn create_my_sid_entry; + sai_remove_my_sid_entry_fn remove_my_sid_entry; + sai_set_my_sid_entry_attribute_fn set_my_sid_entry_attribute; + sai_get_my_sid_entry_attribute_fn get_my_sid_entry_attribute; + + sai_bulk_create_my_sid_entry_fn create_my_sid_entries; + sai_bulk_remove_my_sid_entry_fn remove_my_sid_entries; + sai_bulk_set_my_sid_entry_attribute_fn set_my_sid_entries_attribute; + sai_bulk_get_my_sid_entry_attribute_fn get_my_sid_entries_attribute; + +} sai_srv6_api_t; + +/** + * @} + */ +#endif /** __SAISRV6_H_ */ diff --git a/inc/saiswitch.h b/inc/saiswitch.h index 9e96bd0f1..0966d9363 100644 --- a/inc/saiswitch.h +++ b/inc/saiswitch.h @@ -338,6 +338,8 @@ typedef enum _sai_tunnel_type_t SAI_TUNNEL_TYPE_MPLS, + SAI_TUNNEL_TYPE_SRV6, + } sai_tunnel_type_t; /** @@ -1115,6 +1117,14 @@ typedef enum _sai_switch_attr_t */ SAI_SWITCH_ATTR_AVAILABLE_ACL_TABLE_GROUP, + /** + * @brief Available My SID entries + * + * @type sai_uint32_t + * @flags READ_ONLY + */ + SAI_SWITCH_ATTR_AVAILABLE_MY_SID_ENTRY, + /** * @brief Default trap group * @@ -1809,12 +1819,12 @@ typedef enum _sai_switch_attr_t SAI_SWITCH_ATTR_ACL_STAGE_EGRESS, /** - * @brief Max number of Segments in a single SID List supported + * @brief Max number of Segments supported in a single SRV6 SID List * * @type sai_uint32_t * @flags READ_ONLY */ - SAI_SWITCH_ATTR_SEGMENTROUTE_MAX_SID_DEPTH, + SAI_SWITCH_ATTR_SRV6_MAX_SID_DEPTH, /** * @brief List of Type Length Value types supported for source @@ -1822,7 +1832,7 @@ typedef enum _sai_switch_attr_t * @type sai_s32_list_t sai_tlv_type_t * @flags READ_ONLY */ - SAI_SWITCH_ATTR_SEGMENTROUTE_TLV_TYPE, + SAI_SWITCH_ATTR_SRV6_TLV_TYPE, /** * @brief The number of lossless queues per port supported by the switch diff --git a/inc/saitunnel.h b/inc/saitunnel.h index 405fd232a..1b8ed6804 100644 --- a/inc/saitunnel.h +++ b/inc/saitunnel.h @@ -414,7 +414,7 @@ typedef enum _sai_tunnel_attr_t * @type sai_object_id_t * @flags MANDATORY_ON_CREATE | CREATE_ONLY * @objects SAI_OBJECT_TYPE_ROUTER_INTERFACE - * @condition SAI_TUNNEL_ATTR_TYPE == SAI_TUNNEL_TYPE_IPINIP or SAI_TUNNEL_ATTR_TYPE == SAI_TUNNEL_TYPE_IPINIP_GRE or SAI_TUNNEL_ATTR_TYPE == SAI_TUNNEL_TYPE_VXLAN + * @condition SAI_TUNNEL_ATTR_TYPE == SAI_TUNNEL_TYPE_IPINIP or SAI_TUNNEL_ATTR_TYPE == SAI_TUNNEL_TYPE_IPINIP_GRE or SAI_TUNNEL_ATTR_TYPE == SAI_TUNNEL_TYPE_VXLAN or SAI_TUNNEL_ATTR_TYPE == SAI_TUNNEL_TYPE_SRV6 */ SAI_TUNNEL_ATTR_UNDERLAY_INTERFACE, diff --git a/inc/saitypes.h b/inc/saitypes.h index f4831496d..5310a000f 100644 --- a/inc/saitypes.h +++ b/inc/saitypes.h @@ -243,7 +243,7 @@ typedef enum _sai_object_type_t SAI_OBJECT_TYPE_BRIDGE_PORT = 58, SAI_OBJECT_TYPE_TUNNEL_MAP_ENTRY = 59, SAI_OBJECT_TYPE_TAM = 60, - SAI_OBJECT_TYPE_SEGMENTROUTE_SIDLIST = 61, + SAI_OBJECT_TYPE_SRV6_SIDLIST = 61, SAI_OBJECT_TYPE_PORT_POOL = 62, SAI_OBJECT_TYPE_INSEG_ENTRY = 63, SAI_OBJECT_TYPE_DTEL = 64, /**< experimental */ @@ -278,6 +278,7 @@ typedef enum _sai_object_type_t SAI_OBJECT_TYPE_SYSTEM_PORT = 93, SAI_OBJECT_TYPE_FINE_GRAINED_HASH_FIELD = 94, SAI_OBJECT_TYPE_SWITCH_TUNNEL = 95, + SAI_OBJECT_TYPE_MY_SID_ENTRY = 96, SAI_OBJECT_TYPE_MAX, /* Must remain in last position */ } sai_object_type_t; diff --git a/meta/acronyms.txt b/meta/acronyms.txt index 9bd24da27..e44e962fa 100644 --- a/meta/acronyms.txt +++ b/meta/acronyms.txt @@ -145,6 +145,11 @@ EEPROM - Electrically erasable programmable read-only memory PRBS - Pseudorandom binary sequence NAPT - Network Address Port Translation SNAPT - Source Network Address Port Translation -DNAPT - Destination Network Address Port Trasnlation +DNAPT - Destination Network Address Port Translation +SRH - Segment Routing Header +SRV6 - Segment Routing with IPv6 +PSP - Penultimate Segment Pop +USP - Ultimate Segment Pop +USD - Ultimate Segment Decapsulation SGMII - Serial Gigabit Media Independent Interface MDIX - Medium Dependent Interface Crossover diff --git a/meta/aspell.en.pws b/meta/aspell.en.pws index 05a5be52a..5724f8fdf 100644 --- a/meta/aspell.en.pws +++ b/meta/aspell.en.pws @@ -157,3 +157,8 @@ watchlist wildcard Wildcard www +Encaps +Args +xconnect +uA +uN \ No newline at end of file diff --git a/meta/parse.pl b/meta/parse.pl index d160bc751..f75627ef4 100755 --- a/meta/parse.pl +++ b/meta/parse.pl @@ -2269,6 +2269,8 @@ sub ProcessStructValueType return "SAI_ATTR_VALUE_TYPE_MACSEC_AUTH_KEY" if $type eq "sai_macsec_auth_key_t"; return "SAI_ATTR_VALUE_TYPE_MACSEC_SALT" if $type eq "sai_macsec_salt_t"; return "SAI_ATTR_VALUE_TYPE_BOOL" if $type eq "bool"; + return "SAI_ATTR_VALUE_TYPE_IPV6" if $type eq "sai_ip6_t"; + return "SAI_ATTR_VALUE_TYPE_UINT8" if $type eq "sai_uint8_t"; return "SAI_ATTR_VALUE_TYPE_INT32" if defined $SAI_ENUMS{$type}; # enum return "-1" if $type eq "sai_fdb_entry_t"; @@ -3134,7 +3136,7 @@ sub ProcessSingleNonObjectId # allowed entries on object structs - if (not $type =~ /^sai_(nat_entry_data|mac|object_id|vlan_id|ip_address|ip_prefix|label_id|\w+_type)_t$/) + if (not $type =~ /^sai_(nat_entry_data|mac|object_id|vlan_id|ip_address|ip_prefix|label_id|ip6|uint8|\w+_type)_t$/) { LogError "struct member $member type '$type' is not allowed on struct $structname"; next; diff --git a/meta/saisanitycheck.c b/meta/saisanitycheck.c index 5573664a6..5b90a7cff 100644 --- a/meta/saisanitycheck.c +++ b/meta/saisanitycheck.c @@ -3146,6 +3146,7 @@ void check_non_object_id_object_types() case SAI_ATTR_VALUE_TYPE_INT32: case SAI_ATTR_VALUE_TYPE_UINT32: case SAI_ATTR_VALUE_TYPE_UINT16: + case SAI_ATTR_VALUE_TYPE_UINT8: case SAI_ATTR_VALUE_TYPE_IP_ADDRESS: case SAI_ATTR_VALUE_TYPE_IP_PREFIX: case SAI_ATTR_VALUE_TYPE_OBJECT_ID: @@ -3153,6 +3154,7 @@ void check_non_object_id_object_types() case SAI_ATTR_VALUE_TYPE_MACSEC_SAK: case SAI_ATTR_VALUE_TYPE_MACSEC_AUTH_KEY: case SAI_ATTR_VALUE_TYPE_MACSEC_SALT: + case SAI_ATTR_VALUE_TYPE_IPV6: break; default: