From c4606758f183de0f3b6e49dd2dba67ae02233eac Mon Sep 17 00:00:00 2001 From: "Richard.Yu" Date: Mon, 25 Apr 2022 17:27:01 -0700 Subject: [PATCH] [SAI]Fix build in v1.7 and remove unnecessary change (#1468) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * revert unnecessary changes Signed-off-by: richardyu-ms * take back two removed method for bulk operation and add keyworkds for the ipsec Signed-off-by: richardyu-ms * remove ipsec related interfaces and attributes Signed-off-by: richardyu-ms * Remove unnecessary change related to ECN and VxLan udp souce port in PR #1452,only leave TC map Signed-off-by: richardyu-ms * In order to keep the enum value compatiable with latter version, add vxlan source port and ECN Signed-off-by: richardyu-ms * Set enum values Signed-off-by: richardyu-ms * add test to make sure the value of enum is right Signed-off-by: richardyu-ms * refactor the testing code Signed-off-by: richardyu-ms * remove a test method and remove a unused enum which might cause enum inconsistence between versions Signed-off-by: richardyu-ms * remove the enum values which might cause value holes Signed-off-by: richardyu-ms --- inc/saiswitch.h | 86 +++++++++++++++++++++++++++++++++++++++++-------- inc/saitunnel.h | 45 ++++++++++---------------- inc/saitypes.h | 1 + 3 files changed, 91 insertions(+), 41 deletions(-) diff --git a/inc/saiswitch.h b/inc/saiswitch.h index b3833acd5..e8f7ff800 100644 --- a/inc/saiswitch.h +++ b/inc/saiswitch.h @@ -2428,13 +2428,15 @@ typedef enum _sai_switch_attr_t SAI_SWITCH_ATTR_SUPPORTED_FAILOVER_MODE, /** - * @brief Packet action when a packet ingress and gets routed back to same tunnel + * @brief Switch scoped Tunnel objects + * Set to the same value as master branch. * - * @type sai_packet_action_t + * @type sai_object_list_t * @flags CREATE_AND_SET - * @default SAI_PACKET_ACTION_FORWARD + * @objects SAI_OBJECT_TYPE_SWITCH_TUNNEL + * @default empty */ - SAI_SWITCH_ATTR_TUNNEL_LOOPBACK_PACKET_ACTION, + SAI_SWITCH_ATTR_TUNNEL_OBJECTS_LIST, /** * @brief End of attributes @@ -2860,20 +2862,78 @@ typedef sai_status_t (*sai_clear_switch_stats_fn)( _In_ uint32_t number_of_counters, _In_ const sai_stat_id_t *counter_ids); +/** + * @brief Create switch scoped tunnel + * + * @param[out] switch_tunnel_id The Switch Tunnel Object 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_switch_tunnel_fn)( + _Out_ sai_object_id_t *switch_tunnel_id, + _In_ sai_object_id_t switch_id, + _In_ uint32_t attr_count, + _In_ const sai_attribute_t *attr_list); + +/** + * @brief Remove/disconnect Switch scope tunnel + * + * Release all resources associated with currently opened switch + * + * @param[in] switch_tunnel_id The Switch Tunnel id + * + * @return #SAI_STATUS_SUCCESS on success, failure status code on error + */ +typedef sai_status_t (*sai_remove_switch_tunnel_fn)( + _In_ sai_object_id_t switch_tunnel_id); + +/** + * @brief Set switch scoped tunnel attribute value + * + * @param[in] switch_tunnel_id Switch Tunnel id + * @param[in] attr Switch tunnel attribute + * + * @return #SAI_STATUS_SUCCESS on success, failure status code on error + */ +typedef sai_status_t (*sai_set_switch_tunnel_attribute_fn)( + _In_ sai_object_id_t switch_tunnel_id, + _In_ const sai_attribute_t *attr); + +/** + * @brief Get switch scoped tunnel attribute value + * + * @param[in] switch_tunnel_id Switch Tunnel id + * @param[in] attr_count Number of attributes + * @param[inout] attr_list Array of switch tunnel attributes + * + * @return #SAI_STATUS_SUCCESS on success, failure status code on error + */ +typedef sai_status_t (*sai_get_switch_tunnel_attribute_fn)( + _In_ sai_object_id_t switch_tunnel_id, + _In_ uint32_t attr_count, + _Inout_ sai_attribute_t *attr_list); + /** * @brief Switch method table retrieved with sai_api_query() */ typedef struct _sai_switch_api_t { - sai_create_switch_fn create_switch; - sai_remove_switch_fn remove_switch; - sai_set_switch_attribute_fn set_switch_attribute; - sai_get_switch_attribute_fn get_switch_attribute; - sai_get_switch_stats_fn get_switch_stats; - sai_get_switch_stats_ext_fn get_switch_stats_ext; - sai_clear_switch_stats_fn clear_switch_stats; - sai_switch_mdio_read_fn switch_mdio_read; - sai_switch_mdio_write_fn switch_mdio_write; + sai_create_switch_fn create_switch; + sai_remove_switch_fn remove_switch; + sai_set_switch_attribute_fn set_switch_attribute; + sai_get_switch_attribute_fn get_switch_attribute; + sai_get_switch_stats_fn get_switch_stats; + sai_get_switch_stats_ext_fn get_switch_stats_ext; + sai_clear_switch_stats_fn clear_switch_stats; + sai_switch_mdio_read_fn switch_mdio_read; + sai_switch_mdio_write_fn switch_mdio_write; + sai_create_switch_tunnel_fn create_switch_tunnel; + sai_remove_switch_tunnel_fn remove_switch_tunnel; + sai_set_switch_tunnel_attribute_fn set_switch_tunnel_attribute; + sai_get_switch_tunnel_attribute_fn get_switch_tunnel_attribute; } sai_switch_api_t; diff --git a/inc/saitunnel.h b/inc/saitunnel.h index 591bef286..cb61eb559 100644 --- a/inc/saitunnel.h +++ b/inc/saitunnel.h @@ -325,6 +325,22 @@ typedef enum _sai_tunnel_type_t } sai_tunnel_type_t; +/** + * @brief Defines VXLAN tunnel UDP source port mode + */ +typedef enum _sai_tunnel_vxlan_udp_sport_mode_t +{ + /** + * @brief User define value + */ + SAI_TUNNEL_VXLAN_UDP_SPORT_MODE_USER_DEFINED, + + /** + * @brief RFC6335 Computed hash value in range 49152-65535 + */ + SAI_TUNNEL_VXLAN_UDP_SPORT_MODE_EPHEMERAL, +} sai_tunnel_vxlan_udp_sport_mode_t; + /** * @brief Defines tunnel TTL mode */ @@ -686,36 +702,9 @@ typedef enum _sai_tunnel_attr_t */ SAI_TUNNEL_ATTR_VXLAN_UDP_SPORT_MASK, - /** - * @brief IPsec encryption SA index - * - * Index to bind an egress IPsec SA to a tunnel. - * - * @type sai_uint32_t - * @flags CREATE_AND_SET - * @default 0 - * @validonly SAI_TUNNEL_ATTR_TYPE == SAI_TUNNEL_TYPE_IPINIP_ESP or SAI_TUNNEL_ATTR_TYPE == SAI_TUNNEL_TYPE_IPINIP_UDP_ESP or SAI_TUNNEL_ATTR_TYPE == SAI_TUNNEL_TYPE_VXLAN_UDP_ESP - */ - SAI_TUNNEL_ATTR_SA_INDEX, - - /** - * @brief List of ports that are programmed with SAs for this IPsec tunnel. - * Useful only when IPsec is implemented in a PHY Chip (different sai_switch - * object). - * - * For IPsec hardware in the Switch ASIC, the per-tunnel port list can be - * derived from the union of SAI_IPSEC_SA_ATTR_IPSEC_PORT_LIST for all - * sai_ipsec_sa objects for that tunnel. - * - * @type sai_object_list_t - * @flags CREATE_AND_SET - * @objects SAI_OBJECT_TYPE_PORT - * @default empty - */ - SAI_TUNNEL_ATTR_IPSEC_SA_PORT_LIST, - /** * @brief Enable TC AND COLOR -> DSCP MAP on tunnel at encapsulation (access-to-network) node to remark the DSCP in tunnel header + * Set to the same value as master branch * * @type sai_object_id_t * @flags CREATE_AND_SET diff --git a/inc/saitypes.h b/inc/saitypes.h index 528cc8a9c..6f71bc245 100644 --- a/inc/saitypes.h +++ b/inc/saitypes.h @@ -277,6 +277,7 @@ typedef enum _sai_object_type_t SAI_OBJECT_TYPE_MACSEC_SA = 92, SAI_OBJECT_TYPE_SYSTEM_PORT = 93, SAI_OBJECT_TYPE_FINE_GRAINED_HASH_FIELD = 94, + SAI_OBJECT_TYPE_SWITCH_TUNNEL = 95, SAI_OBJECT_TYPE_MAX, /* Must remain in last position */ } sai_object_type_t;