Skip to content

Commit

Permalink
[DASH] Update dash flow and dash tunnel (opencomputeproject#2093)
Browse files Browse the repository at this point in the history
Update SAI of dash flow to align with its p4 table in dash-pipeline
Update SAI of dash tunnel to align with its p4 table in dash-pipeline
  • Loading branch information
jimmyzhai authored Oct 28, 2024
1 parent 7456dcd commit 8f500eb
Show file tree
Hide file tree
Showing 4 changed files with 290 additions and 9 deletions.
27 changes: 27 additions & 0 deletions experimental/saiexperimentaldashflow.h
Original file line number Diff line number Diff line change
Expand Up @@ -435,6 +435,33 @@ typedef enum _sai_flow_entry_attr_t
*/
SAI_FLOW_ENTRY_ATTR_IP_ADDR_FAMILY,

/**
* @brief Action parameter DASH flow sync state
*
* @type sai_dash_flow_sync_state_t
* @flags CREATE_AND_SET
* @default SAI_DASH_FLOW_SYNC_STATE_FLOW_MISS
*/
SAI_FLOW_ENTRY_ATTR_DASH_FLOW_SYNC_STATE,

/**
* @brief Action parameter underlay0 source MAC
*
* @type sai_mac_t
* @flags CREATE_AND_SET
* @default vendor
*/
SAI_FLOW_ENTRY_ATTR_UNDERLAY0_SMAC,

/**
* @brief Action parameter underlay0 destination MAC
*
* @type sai_mac_t
* @flags CREATE_AND_SET
* @default vendor
*/
SAI_FLOW_ENTRY_ATTR_UNDERLAY0_DMAC,

/**
* @brief End of attributes
*/
Expand Down
225 changes: 217 additions & 8 deletions experimental/saiexperimentaldashtunnel.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ typedef enum _sai_dash_tunnel_attr_t
* @brief Action parameter DASH encapsulation
*
* @type sai_dash_encapsulation_t
* @flags CREATE_AND_SET
* @flags CREATE_ONLY
* @default SAI_DASH_ENCAPSULATION_VXLAN
*/
SAI_DASH_TUNNEL_ATTR_DASH_ENCAPSULATION,
Expand All @@ -67,11 +67,29 @@ typedef enum _sai_dash_tunnel_attr_t
* @brief Action parameter tunnel key
*
* @type sai_uint32_t
* @flags CREATE_AND_SET
* @flags CREATE_ONLY
* @default 0
*/
SAI_DASH_TUNNEL_ATTR_TUNNEL_KEY,

/**
* @brief Action parameter max member size
*
* @type sai_uint32_t
* @flags CREATE_ONLY
* @default 1
*/
SAI_DASH_TUNNEL_ATTR_MAX_MEMBER_SIZE,

/**
* @brief Action parameter sip
*
* @type sai_ip_address_t
* @flags CREATE_AND_SET
* @default 0.0.0.0
*/
SAI_DASH_TUNNEL_ATTR_SIP,

/**
* @brief End of attributes
*/
Expand All @@ -85,6 +103,79 @@ typedef enum _sai_dash_tunnel_attr_t

} sai_dash_tunnel_attr_t;

/**
* @brief Attribute ID for DASH tunnel member
*/
typedef enum _sai_dash_tunnel_member_attr_t
{
/**
* @brief Start of attributes
*/
SAI_DASH_TUNNEL_MEMBER_ATTR_START,

/**
* @brief Action parameter DASH tunnel id
*
* @type sai_object_id_t
* @flags MANDATORY_ON_CREATE | CREATE_ONLY
* @objects SAI_OBJECT_TYPE_DASH_TUNNEL
*/
SAI_DASH_TUNNEL_MEMBER_ATTR_DASH_TUNNEL_ID = SAI_DASH_TUNNEL_MEMBER_ATTR_START,

/**
* @brief Action parameter DASH tunnel next hop id
*
* @type sai_object_id_t
* @flags MANDATORY_ON_CREATE | CREATE_AND_SET
* @objects SAI_OBJECT_TYPE_DASH_TUNNEL_NEXT_HOP
*/
SAI_DASH_TUNNEL_MEMBER_ATTR_DASH_TUNNEL_NEXT_HOP_ID,

/**
* @brief End of attributes
*/
SAI_DASH_TUNNEL_MEMBER_ATTR_END,

/** Custom range base value */
SAI_DASH_TUNNEL_MEMBER_ATTR_CUSTOM_RANGE_START = 0x10000000,

/** End of custom range base */
SAI_DASH_TUNNEL_MEMBER_ATTR_CUSTOM_RANGE_END,

} sai_dash_tunnel_member_attr_t;

/**
* @brief Attribute ID for DASH tunnel next hop
*/
typedef enum _sai_dash_tunnel_next_hop_attr_t
{
/**
* @brief Start of attributes
*/
SAI_DASH_TUNNEL_NEXT_HOP_ATTR_START,

/**
* @brief Action parameter dip
*
* @type sai_ip_address_t
* @flags CREATE_AND_SET
* @default 0.0.0.0
*/
SAI_DASH_TUNNEL_NEXT_HOP_ATTR_DIP = SAI_DASH_TUNNEL_NEXT_HOP_ATTR_START,

/**
* @brief End of attributes
*/
SAI_DASH_TUNNEL_NEXT_HOP_ATTR_END,

/** Custom range base value */
SAI_DASH_TUNNEL_NEXT_HOP_ATTR_CUSTOM_RANGE_START = 0x10000000,

/** End of custom range base */
SAI_DASH_TUNNEL_NEXT_HOP_ATTR_CUSTOM_RANGE_END,

} sai_dash_tunnel_next_hop_attr_t;

/**
* @brief Create DASH tunnel
*
Expand Down Expand Up @@ -137,14 +228,132 @@ typedef sai_status_t (*sai_get_dash_tunnel_attribute_fn)(
_In_ uint32_t attr_count,
_Inout_ sai_attribute_t *attr_list);

/**
* @brief Create DASH tunnel member
*
* @param[out] dash_tunnel_member_id Entry 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_dash_tunnel_member_fn)(
_Out_ sai_object_id_t *dash_tunnel_member_id,
_In_ sai_object_id_t switch_id,
_In_ uint32_t attr_count,
_In_ const sai_attribute_t *attr_list);

/**
* @brief Remove DASH tunnel member
*
* @param[in] dash_tunnel_member_id Entry id
*
* @return #SAI_STATUS_SUCCESS on success Failure status code on error
*/
typedef sai_status_t (*sai_remove_dash_tunnel_member_fn)(
_In_ sai_object_id_t dash_tunnel_member_id);

/**
* @brief Set attribute for DASH tunnel member
*
* @param[in] dash_tunnel_member_id Entry id
* @param[in] attr Attribute
*
* @return #SAI_STATUS_SUCCESS on success Failure status code on error
*/
typedef sai_status_t (*sai_set_dash_tunnel_member_attribute_fn)(
_In_ sai_object_id_t dash_tunnel_member_id,
_In_ const sai_attribute_t *attr);

/**
* @brief Get attribute for DASH tunnel member
*
* @param[in] dash_tunnel_member_id Entry 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_dash_tunnel_member_attribute_fn)(
_In_ sai_object_id_t dash_tunnel_member_id,
_In_ uint32_t attr_count,
_Inout_ sai_attribute_t *attr_list);

/**
* @brief Create DASH tunnel next hop
*
* @param[out] dash_tunnel_next_hop_id Entry 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_dash_tunnel_next_hop_fn)(
_Out_ sai_object_id_t *dash_tunnel_next_hop_id,
_In_ sai_object_id_t switch_id,
_In_ uint32_t attr_count,
_In_ const sai_attribute_t *attr_list);

/**
* @brief Remove DASH tunnel next hop
*
* @param[in] dash_tunnel_next_hop_id Entry id
*
* @return #SAI_STATUS_SUCCESS on success Failure status code on error
*/
typedef sai_status_t (*sai_remove_dash_tunnel_next_hop_fn)(
_In_ sai_object_id_t dash_tunnel_next_hop_id);

/**
* @brief Set attribute for DASH tunnel next hop
*
* @param[in] dash_tunnel_next_hop_id Entry id
* @param[in] attr Attribute
*
* @return #SAI_STATUS_SUCCESS on success Failure status code on error
*/
typedef sai_status_t (*sai_set_dash_tunnel_next_hop_attribute_fn)(
_In_ sai_object_id_t dash_tunnel_next_hop_id,
_In_ const sai_attribute_t *attr);

/**
* @brief Get attribute for DASH tunnel next hop
*
* @param[in] dash_tunnel_next_hop_id Entry 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_dash_tunnel_next_hop_attribute_fn)(
_In_ sai_object_id_t dash_tunnel_next_hop_id,
_In_ uint32_t attr_count,
_Inout_ sai_attribute_t *attr_list);

typedef struct _sai_dash_tunnel_api_t
{
sai_create_dash_tunnel_fn create_dash_tunnel;
sai_remove_dash_tunnel_fn remove_dash_tunnel;
sai_set_dash_tunnel_attribute_fn set_dash_tunnel_attribute;
sai_get_dash_tunnel_attribute_fn get_dash_tunnel_attribute;
sai_bulk_object_create_fn create_dash_tunnels;
sai_bulk_object_remove_fn remove_dash_tunnels;
sai_create_dash_tunnel_fn create_dash_tunnel;
sai_remove_dash_tunnel_fn remove_dash_tunnel;
sai_set_dash_tunnel_attribute_fn set_dash_tunnel_attribute;
sai_get_dash_tunnel_attribute_fn get_dash_tunnel_attribute;
sai_bulk_object_create_fn create_dash_tunnels;
sai_bulk_object_remove_fn remove_dash_tunnels;

sai_create_dash_tunnel_member_fn create_dash_tunnel_member;
sai_remove_dash_tunnel_member_fn remove_dash_tunnel_member;
sai_set_dash_tunnel_member_attribute_fn set_dash_tunnel_member_attribute;
sai_get_dash_tunnel_member_attribute_fn get_dash_tunnel_member_attribute;
sai_bulk_object_create_fn create_dash_tunnel_members;
sai_bulk_object_remove_fn remove_dash_tunnel_members;

sai_create_dash_tunnel_next_hop_fn create_dash_tunnel_next_hop;
sai_remove_dash_tunnel_next_hop_fn remove_dash_tunnel_next_hop;
sai_set_dash_tunnel_next_hop_attribute_fn set_dash_tunnel_next_hop_attribute;
sai_get_dash_tunnel_next_hop_attribute_fn get_dash_tunnel_next_hop_attribute;
sai_bulk_object_create_fn create_dash_tunnel_next_hops;
sai_bulk_object_remove_fn remove_dash_tunnel_next_hops;

} sai_dash_tunnel_api_t;

Expand Down
45 changes: 44 additions & 1 deletion experimental/saitypesextensions.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,10 @@ typedef enum _sai_object_type_extensions_t

SAI_OBJECT_TYPE_DASH_APPLIANCE,

SAI_OBJECT_TYPE_DASH_TUNNEL_MEMBER,

SAI_OBJECT_TYPE_DASH_TUNNEL_NEXT_HOP,

/* Add new experimental object types above this line */

SAI_OBJECT_TYPE_EXTENSIONS_RANGE_END
Expand Down Expand Up @@ -180,10 +184,32 @@ typedef enum _sai_dash_flow_enabled_key_t

/**
* @brief Defines a list of enums for dash_flow_action
*
* @flags strict
*/
typedef enum _sai_dash_flow_action_t
{
SAI_DASH_FLOW_ACTION_NONE,
SAI_DASH_FLOW_ACTION_NONE = 0,

SAI_DASH_FLOW_ACTION_ENCAP_U0 = 1 << 0,

SAI_DASH_FLOW_ACTION_ENCAP_U1 = 1 << 1,

SAI_DASH_FLOW_ACTION_SET_SMAC = 1 << 2,

SAI_DASH_FLOW_ACTION_SET_DMAC = 1 << 3,

SAI_DASH_FLOW_ACTION_SNAT = 1 << 4,

SAI_DASH_FLOW_ACTION_DNAT = 1 << 5,

SAI_DASH_FLOW_ACTION_NAT46 = 1 << 6,

SAI_DASH_FLOW_ACTION_NAT64 = 1 << 7,

SAI_DASH_FLOW_ACTION_SNAT_PORT = 1 << 8,

SAI_DASH_FLOW_ACTION_DNAT_PORT = 1 << 9,

} sai_dash_flow_action_t;

Expand Down Expand Up @@ -292,5 +318,22 @@ typedef enum _sai_dash_eni_mac_override_type_t

} sai_dash_eni_mac_override_type_t;

/**
* @brief Defines a list of enums for dash_flow_sync_state
*/
typedef enum _sai_dash_flow_sync_state_t
{
SAI_DASH_FLOW_SYNC_STATE_FLOW_MISS,

SAI_DASH_FLOW_SYNC_STATE_FLOW_CREATED,

SAI_DASH_FLOW_SYNC_STATE_FLOW_SYNCED,

SAI_DASH_FLOW_SYNC_STATE_FLOW_PENDING_DELETE,

SAI_DASH_FLOW_SYNC_STATE_FLOW_PENDING_RESIMULATION,

} sai_dash_flow_sync_state_t;

#endif /* __SAITYPESEXTENSIONS_H_ */

2 changes: 2 additions & 0 deletions inc/saiobject.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@
#include <saisrv6.h>

/* new experimental object type includes */
#include <saiexperimentaldashtunnel.h>
#include <saiexperimentaldashha.h>
#include <saiexperimentaldashappliance.h>
#include <saiexperimentaldashflow.h>
#include <saiexperimentaldashmeter.h>
Expand Down

0 comments on commit 8f500eb

Please sign in to comment.