Skip to content

Commit

Permalink
[SAI]Fix build in v1.7 and remove unnecessary change (#1468)
Browse files Browse the repository at this point in the history
* 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 #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]>
  • Loading branch information
richardyu-ms authored Apr 26, 2022
1 parent bfaaa0e commit c460675
Show file tree
Hide file tree
Showing 3 changed files with 91 additions and 41 deletions.
86 changes: 73 additions & 13 deletions inc/saiswitch.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;

Expand Down
45 changes: 17 additions & 28 deletions inc/saitunnel.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions inc/saitypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit c460675

Please sign in to comment.