Skip to content

Commit c460675

Browse files
authored
[SAI]Fix build in v1.7 and remove unnecessary change (opencomputeproject#1468)
* revert unnecessary changes Signed-off-by: richardyu-ms <[email protected]> * take back two removed method for bulk operation and add keyworkds for the ipsec Signed-off-by: richardyu-ms <[email protected]> * remove ipsec related interfaces and attributes Signed-off-by: richardyu-ms <[email protected]> * Remove unnecessary change related to ECN and VxLan udp souce port in PR opencomputeproject#1452,only leave TC map Signed-off-by: richardyu-ms <[email protected]> * In order to keep the enum value compatiable with latter version, add vxlan source port and ECN Signed-off-by: richardyu-ms <[email protected]> * Set enum values Signed-off-by: richardyu-ms <[email protected]> * add test to make sure the value of enum is right Signed-off-by: richardyu-ms <[email protected]> * refactor the testing code Signed-off-by: richardyu-ms <[email protected]> * remove a test method and remove a unused enum which might cause enum inconsistence between versions Signed-off-by: richardyu-ms <[email protected]> * remove the enum values which might cause value holes Signed-off-by: richardyu-ms <[email protected]>
1 parent bfaaa0e commit c460675

File tree

3 files changed

+91
-41
lines changed

3 files changed

+91
-41
lines changed

inc/saiswitch.h

Lines changed: 73 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2428,13 +2428,15 @@ typedef enum _sai_switch_attr_t
24282428
SAI_SWITCH_ATTR_SUPPORTED_FAILOVER_MODE,
24292429

24302430
/**
2431-
* @brief Packet action when a packet ingress and gets routed back to same tunnel
2431+
* @brief Switch scoped Tunnel objects
2432+
* Set to the same value as master branch.
24322433
*
2433-
* @type sai_packet_action_t
2434+
* @type sai_object_list_t
24342435
* @flags CREATE_AND_SET
2435-
* @default SAI_PACKET_ACTION_FORWARD
2436+
* @objects SAI_OBJECT_TYPE_SWITCH_TUNNEL
2437+
* @default empty
24362438
*/
2437-
SAI_SWITCH_ATTR_TUNNEL_LOOPBACK_PACKET_ACTION,
2439+
SAI_SWITCH_ATTR_TUNNEL_OBJECTS_LIST,
24382440

24392441
/**
24402442
* @brief End of attributes
@@ -2860,20 +2862,78 @@ typedef sai_status_t (*sai_clear_switch_stats_fn)(
28602862
_In_ uint32_t number_of_counters,
28612863
_In_ const sai_stat_id_t *counter_ids);
28622864

2865+
/**
2866+
* @brief Create switch scoped tunnel
2867+
*
2868+
* @param[out] switch_tunnel_id The Switch Tunnel Object ID
2869+
* @param[in] switch_id Switch id
2870+
* @param[in] attr_count Number of attributes
2871+
* @param[in] attr_list Array of attributes
2872+
*
2873+
* @return #SAI_STATUS_SUCCESS on success, failure status code on error
2874+
*/
2875+
typedef sai_status_t (*sai_create_switch_tunnel_fn)(
2876+
_Out_ sai_object_id_t *switch_tunnel_id,
2877+
_In_ sai_object_id_t switch_id,
2878+
_In_ uint32_t attr_count,
2879+
_In_ const sai_attribute_t *attr_list);
2880+
2881+
/**
2882+
* @brief Remove/disconnect Switch scope tunnel
2883+
*
2884+
* Release all resources associated with currently opened switch
2885+
*
2886+
* @param[in] switch_tunnel_id The Switch Tunnel id
2887+
*
2888+
* @return #SAI_STATUS_SUCCESS on success, failure status code on error
2889+
*/
2890+
typedef sai_status_t (*sai_remove_switch_tunnel_fn)(
2891+
_In_ sai_object_id_t switch_tunnel_id);
2892+
2893+
/**
2894+
* @brief Set switch scoped tunnel attribute value
2895+
*
2896+
* @param[in] switch_tunnel_id Switch Tunnel id
2897+
* @param[in] attr Switch tunnel attribute
2898+
*
2899+
* @return #SAI_STATUS_SUCCESS on success, failure status code on error
2900+
*/
2901+
typedef sai_status_t (*sai_set_switch_tunnel_attribute_fn)(
2902+
_In_ sai_object_id_t switch_tunnel_id,
2903+
_In_ const sai_attribute_t *attr);
2904+
2905+
/**
2906+
* @brief Get switch scoped tunnel attribute value
2907+
*
2908+
* @param[in] switch_tunnel_id Switch Tunnel id
2909+
* @param[in] attr_count Number of attributes
2910+
* @param[inout] attr_list Array of switch tunnel attributes
2911+
*
2912+
* @return #SAI_STATUS_SUCCESS on success, failure status code on error
2913+
*/
2914+
typedef sai_status_t (*sai_get_switch_tunnel_attribute_fn)(
2915+
_In_ sai_object_id_t switch_tunnel_id,
2916+
_In_ uint32_t attr_count,
2917+
_Inout_ sai_attribute_t *attr_list);
2918+
28632919
/**
28642920
* @brief Switch method table retrieved with sai_api_query()
28652921
*/
28662922
typedef struct _sai_switch_api_t
28672923
{
2868-
sai_create_switch_fn create_switch;
2869-
sai_remove_switch_fn remove_switch;
2870-
sai_set_switch_attribute_fn set_switch_attribute;
2871-
sai_get_switch_attribute_fn get_switch_attribute;
2872-
sai_get_switch_stats_fn get_switch_stats;
2873-
sai_get_switch_stats_ext_fn get_switch_stats_ext;
2874-
sai_clear_switch_stats_fn clear_switch_stats;
2875-
sai_switch_mdio_read_fn switch_mdio_read;
2876-
sai_switch_mdio_write_fn switch_mdio_write;
2924+
sai_create_switch_fn create_switch;
2925+
sai_remove_switch_fn remove_switch;
2926+
sai_set_switch_attribute_fn set_switch_attribute;
2927+
sai_get_switch_attribute_fn get_switch_attribute;
2928+
sai_get_switch_stats_fn get_switch_stats;
2929+
sai_get_switch_stats_ext_fn get_switch_stats_ext;
2930+
sai_clear_switch_stats_fn clear_switch_stats;
2931+
sai_switch_mdio_read_fn switch_mdio_read;
2932+
sai_switch_mdio_write_fn switch_mdio_write;
2933+
sai_create_switch_tunnel_fn create_switch_tunnel;
2934+
sai_remove_switch_tunnel_fn remove_switch_tunnel;
2935+
sai_set_switch_tunnel_attribute_fn set_switch_tunnel_attribute;
2936+
sai_get_switch_tunnel_attribute_fn get_switch_tunnel_attribute;
28772937

28782938
} sai_switch_api_t;
28792939

inc/saitunnel.h

Lines changed: 17 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,22 @@ typedef enum _sai_tunnel_type_t
325325

326326
} sai_tunnel_type_t;
327327

328+
/**
329+
* @brief Defines VXLAN tunnel UDP source port mode
330+
*/
331+
typedef enum _sai_tunnel_vxlan_udp_sport_mode_t
332+
{
333+
/**
334+
* @brief User define value
335+
*/
336+
SAI_TUNNEL_VXLAN_UDP_SPORT_MODE_USER_DEFINED,
337+
338+
/**
339+
* @brief RFC6335 Computed hash value in range 49152-65535
340+
*/
341+
SAI_TUNNEL_VXLAN_UDP_SPORT_MODE_EPHEMERAL,
342+
} sai_tunnel_vxlan_udp_sport_mode_t;
343+
328344
/**
329345
* @brief Defines tunnel TTL mode
330346
*/
@@ -686,36 +702,9 @@ typedef enum _sai_tunnel_attr_t
686702
*/
687703
SAI_TUNNEL_ATTR_VXLAN_UDP_SPORT_MASK,
688704

689-
/**
690-
* @brief IPsec encryption SA index
691-
*
692-
* Index to bind an egress IPsec SA to a tunnel.
693-
*
694-
* @type sai_uint32_t
695-
* @flags CREATE_AND_SET
696-
* @default 0
697-
* @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
698-
*/
699-
SAI_TUNNEL_ATTR_SA_INDEX,
700-
701-
/**
702-
* @brief List of ports that are programmed with SAs for this IPsec tunnel.
703-
* Useful only when IPsec is implemented in a PHY Chip (different sai_switch
704-
* object).
705-
*
706-
* For IPsec hardware in the Switch ASIC, the per-tunnel port list can be
707-
* derived from the union of SAI_IPSEC_SA_ATTR_IPSEC_PORT_LIST for all
708-
* sai_ipsec_sa objects for that tunnel.
709-
*
710-
* @type sai_object_list_t
711-
* @flags CREATE_AND_SET
712-
* @objects SAI_OBJECT_TYPE_PORT
713-
* @default empty
714-
*/
715-
SAI_TUNNEL_ATTR_IPSEC_SA_PORT_LIST,
716-
717705
/**
718706
* @brief Enable TC AND COLOR -> DSCP MAP on tunnel at encapsulation (access-to-network) node to remark the DSCP in tunnel header
707+
* Set to the same value as master branch
719708
*
720709
* @type sai_object_id_t
721710
* @flags CREATE_AND_SET

inc/saitypes.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,7 @@ typedef enum _sai_object_type_t
277277
SAI_OBJECT_TYPE_MACSEC_SA = 92,
278278
SAI_OBJECT_TYPE_SYSTEM_PORT = 93,
279279
SAI_OBJECT_TYPE_FINE_GRAINED_HASH_FIELD = 94,
280+
SAI_OBJECT_TYPE_SWITCH_TUNNEL = 95,
280281
SAI_OBJECT_TYPE_MAX, /* Must remain in last position */
281282
} sai_object_type_t;
282283

0 commit comments

Comments
 (0)