Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch attributes for tunnel ECN mode #1153

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
328 changes: 328 additions & 0 deletions inc/saiswitch.h
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,182 @@ typedef enum _sai_switch_failover_config_mode_t

} sai_switch_failover_config_mode_t;

/**
* @brief Defines tunnel encap ECN mode
*/
typedef enum _sai_tunnel_ipinip_encap_ecn_mode_t
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to have enum per type, or can use a single enum ?
I think single enum would be good enough, but remember there is a prefix check, which maybe forces enum per type. Perhaps ask Kamil if a single enum can be used ?

{
/**
* @brief Normal mode behavior defined in RFC 6040
* section 4.1 copy from inner
*/
SAI_TUNNEL_IPINIP_ENCAP_ECN_MODE_STANDARD,

/**
* @brief User defined behavior.
*
* Need to provide #SAI_TUNNEL_MAP_TYPE_OECN_TO_UECN in #SAI_TUNNEL_ATTR_ENCAP_MAPPERS.
*/
SAI_TUNNEL_IPINIP_ENCAP_ECN_MODE_USER_DEFINED

} sai_tunnel_ipinip_encap_ecn_mode_t;

/**
* @brief Defines GRE tunnel encap ECN mode
*/
typedef enum _sai_tunnel_ipinip_gre_encap_ecn_mode_t
{
/**
* @brief Normal mode behavior defined in RFC 6040
* section 4.1 copy from inner
*/
SAI_TUNNEL_IPINIP_GRE_ENCAP_ECN_MODE_STANDARD,

/**
* @brief User defined behavior.
*
* Need to provide #SAI_TUNNEL_MAP_TYPE_OECN_TO_UECN in #SAI_TUNNEL_ATTR_ENCAP_MAPPERS.
*/
SAI_TUNNEL_IPINIP_GRE_ENCAP_ECN_MODE_USER_DEFINED

} sai_tunnel_ipinip_gre_encap_ecn_mode_t;

/**
* @brief Defines VXLAN tunnel encap ECN mode
*/
typedef enum _sai_tunnel_vxlan_encap_ecn_mode_t
{
/**
* @brief Normal mode behavior defined in RFC 6040
* section 4.1 copy from inner
*/
SAI_TUNNEL_VXLAN_ENCAP_ECN_MODE_STANDARD,

/**
* @brief User defined behavior.
*
* Need to provide #SAI_TUNNEL_MAP_TYPE_OECN_TO_UECN in #SAI_TUNNEL_ATTR_ENCAP_MAPPERS.
*/
SAI_TUNNEL_VXLAN_ENCAP_ECN_MODE_USER_DEFINED

} sai_tunnel_vxlan_encap_ecn_mode_t;

/**
* @brief Defines MPLS tunnel encap ECN mode
*/
typedef enum _sai_tunnel_mpls_encap_ecn_mode_t
{
/**
* @brief Normal mode behavior defined in RFC 6040
* section 4.1 copy from inner
*/
SAI_TUNNEL_MPLS_ENCAP_ECN_MODE_STANDARD,

/**
* @brief User defined behavior.
*
* Need to provide #SAI_TUNNEL_MAP_TYPE_OECN_TO_UECN in #SAI_TUNNEL_ATTR_ENCAP_MAPPERS.
*/
SAI_TUNNEL_MPLS_ENCAP_ECN_MODE_USER_DEFINED

} sai_tunnel_mpls_encap_ecn_mode_t;

/**
* @brief Defines tunnel decap ECN mode
*/
typedef enum _sai_tunnel_ipinip_decap_ecn_mode_t
{
/**
* @brief Behavior defined in RFC 6040 section 4.2
*/
SAI_TUNNEL_IPINIP_DECAP_ECN_MODE_STANDARD,

/**
* @brief Copy from outer ECN
*/
SAI_TUNNEL_IPINIP_DECAP_ECN_MODE_COPY_FROM_OUTER,

/**
* @brief User defined behavior
*
* Need to provide #SAI_TUNNEL_MAP_TYPE_UECN_OECN_TO_OECN in #SAI_TUNNEL_ATTR_DECAP_MAPPERS
*/
SAI_TUNNEL_IPINIP_DECAP_ECN_MODE_USER_DEFINED

} sai_tunnel_ipinip_decap_ecn_mode_t;

/**
* @brief Defines GRE tunnel decap ECN mode
*/
typedef enum _sai_tunnel_ipinip_gre_decap_ecn_mode_t
{
/**
* @brief Behavior defined in RFC 6040 section 4.2
*/
SAI_TUNNEL_IPINIP_GRE_DECAP_ECN_MODE_STANDARD,

/**
* @brief Copy from outer ECN
*/
SAI_TUNNEL_IPINIP_GRE_DECAP_ECN_MODE_COPY_FROM_OUTER,

/**
* @brief User defined behavior
*
* Need to provide #SAI_TUNNEL_MAP_TYPE_UECN_OECN_TO_OECN in #SAI_TUNNEL_ATTR_DECAP_MAPPERS
*/
SAI_TUNNEL_IPINIP_GRE_DECAP_ECN_MODE_USER_DEFINED

} sai_tunnel_ipinip_gre_decap_ecn_mode_t;

/**
* @brief Defines VXLAN tunnel decap ECN mode
*/
typedef enum _sai_tunnel_vxlan_decap_ecn_mode_t
{
/**
* @brief Behavior defined in RFC 6040 section 4.2
*/
SAI_TUNNEL_VXLAN_DECAP_ECN_MODE_STANDARD,

/**
* @brief Copy from outer ECN
*/
SAI_TUNNEL_VXLAN_DECAP_ECN_MODE_COPY_FROM_OUTER,

/**
* @brief User defined behavior
*
* Need to provide #SAI_TUNNEL_MAP_TYPE_UECN_OECN_TO_OECN in #SAI_TUNNEL_ATTR_DECAP_MAPPERS
*/
SAI_TUNNEL_VXLAN_DECAP_ECN_MODE_USER_DEFINED

} sai_tunnel_vxlan_decap_ecn_mode_t;

/**
* @brief Defines MPLS tunnel decap ECN mode
*/
typedef enum _sai_tunnel_mpls_decap_ecn_mode_t
{
/**
* @brief Behavior defined in RFC 6040 section 4.2
*/
SAI_TUNNEL_MPLS_DECAP_ECN_MODE_STANDARD,

/**
* @brief Copy from outer ECN
*/
SAI_TUNNEL_MPLS_DECAP_ECN_MODE_COPY_FROM_OUTER,

/**
* @brief User defined behavior
*
* Need to provide #SAI_TUNNEL_MAP_TYPE_UECN_OECN_TO_OECN in #SAI_TUNNEL_ATTR_DECAP_MAPPERS
*/
SAI_TUNNEL_MPLS_DECAP_ECN_MODE_USER_DEFINED

} sai_tunnel_mpls_decap_ecn_mode_t;

/**
* @brief Attribute Id in sai_set_switch_attribute() and
* sai_get_switch_attribute() calls
Expand Down Expand Up @@ -2256,6 +2432,158 @@ typedef enum _sai_switch_attr_t
*/
SAI_SWITCH_ATTR_SUPPORTED_FAILOVER_MODE,

/**
* @brief Tunnel mappers for encap
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add IP in IP in beginning of comment

*
* @type sai_object_list_t
* @flags CREATE_AND_SET
* @objects SAI_OBJECT_TYPE_TUNNEL_MAP
* @default empty
*/
SAI_SWITCH_ATTR_TUNNEL_IPINIP_ENCAP_ECN_MAPPERS,

/**
* @brief VXLAN Tunnel mappers for encap
*
* @type sai_object_list_t
* @flags CREATE_AND_SET
* @objects SAI_OBJECT_TYPE_TUNNEL_MAP
* @default empty
*/
SAI_SWITCH_ATTR_TUNNEL_VXLAN_ENCAP_ECN_MAPPERS,

/**
* @brief GRE Tunnel mappers for encap
*
* @type sai_object_list_t
* @flags CREATE_AND_SET
* @objects SAI_OBJECT_TYPE_TUNNEL_MAP
* @default empty
*/
SAI_SWITCH_ATTR_TUNNEL_IPINIP_GRE_ENCAP_ECN_MAPPERS,

/**
* @brief MPLS Tunnel mappers for encap
*
* @type sai_object_list_t
* @flags CREATE_AND_SET
* @objects SAI_OBJECT_TYPE_TUNNEL_MAP
* @default empty
*/
SAI_SWITCH_ATTR_TUNNEL_MPLS_ENCAP_ECN_MAPPERS,

/**
* @brief Tunnel mappers for decap
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add IP in IP in beginning of comment

*
* @type sai_object_list_t
* @flags CREATE_AND_SET
* @objects SAI_OBJECT_TYPE_TUNNEL_MAP
* @default empty
*/
SAI_SWITCH_ATTR_TUNNEL_IPINIP_DECAP_ECN_MAPPERS,

/**
* @brief VXLAN Tunnel mappers for decap
*
* @type sai_object_list_t
* @flags CREATE_AND_SET
* @objects SAI_OBJECT_TYPE_TUNNEL_MAP
* @default empty
*/
SAI_SWITCH_ATTR_TUNNEL_VXLAN_DECAP_ECN_MAPPERS,

/**
* @brief GRE Tunnel mappers for decap
*
* @type sai_object_list_t
* @flags CREATE_AND_SET
* @objects SAI_OBJECT_TYPE_TUNNEL_MAP
* @default empty
*/
SAI_SWITCH_ATTR_TUNNEL_IPINIP_GRE_DECAP_ECN_MAPPERS,

/**
* @brief MPLS Tunnel mappers for decap
*
* @type sai_object_list_t
* @flags CREATE_AND_SET
* @objects SAI_OBJECT_TYPE_TUNNEL_MAP
* @default empty
*/
SAI_SWITCH_ATTR_TUNNEL_MPLS_DECAP_ECN_MAPPERS,

/**
* @brief Tunnel encap ECN Mode load method
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add IP in IP in beginning of comment

*
* @type sai_tunnel_ipinip_encap_ecn_mode_t
* @flags CREATE_AND_SET
* @default SAI_TUNNEL_IPINIP_ENCAP_ECN_MODE_STANDARD
*/
SAI_SWITCH_ATTR_TUNNEL_IPINIP_ENCAP_ECN_MODE,

/**
* @brief GRE Tunnel encap ECN Mode load method
*
* @type sai_tunnel_ipinip_gre_encap_ecn_mode_t
* @flags CREATE_AND_SET
* @default SAI_TUNNEL_IPINIP_GRE_ENCAP_ECN_MODE_STANDARD
*/
SAI_SWITCH_ATTR_TUNNEL_IPINIP_GRE_ENCAP_ECN_MODE,

/**
* @brief VXLAN Tunnel encap ECN Mode load method
*
* @type sai_tunnel_vxlan_encap_ecn_mode_t
* @flags CREATE_AND_SET
* @default SAI_TUNNEL_VXLAN_ENCAP_ECN_MODE_STANDARD
*/
SAI_SWITCH_ATTR_TUNNEL_VXLAN_ENCAP_ECN_MODE,

/**
* @brief MPLS Tunnel encap ECN Mode load method
*
* @type sai_tunnel_mpls_encap_ecn_mode_t
* @flags CREATE_AND_SET
* @default SAI_TUNNEL_MPLS_ENCAP_ECN_MODE_STANDARD
*/
SAI_SWITCH_ATTR_TUNNEL_MPLS_ENCAP_ECN_MODE,

/**
* @brief Tunnel decap ECN Mode load method
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add IP in IP in beginning of comment

*
* @type sai_tunnel_ipinip_decap_ecn_mode_t
* @flags CREATE_AND_SET
* @default SAI_TUNNEL_IPINIP_DECAP_ECN_MODE_STANDARD
*/
SAI_SWITCH_ATTR_TUNNEL_IPINIP_DECAP_ECN_MODE,

/**
* @brief GRE Tunnel decap ECN Mode load method
*
* @type sai_tunnel_ipinip_gre_decap_ecn_mode_t
* @flags CREATE_AND_SET
* @default SAI_TUNNEL_IPINIP_GRE_DECAP_ECN_MODE_STANDARD
*/
SAI_SWITCH_ATTR_TUNNEL_IPINIP_GRE_DECAP_ECN_MODE,

/**
* @brief VXLAN Tunnel decap ECN Mode load method
*
* @type sai_tunnel_vxlan_decap_ecn_mode_t
* @flags CREATE_AND_SET
* @default SAI_TUNNEL_VXLAN_DECAP_ECN_MODE_STANDARD
*/
SAI_SWITCH_ATTR_TUNNEL_VXLAN_DECAP_ECN_MODE,

/**
* @brief MPLS Tunnel decap ECN Mode load method
*
* @type sai_tunnel_mpls_decap_ecn_mode_t
* @flags CREATE_AND_SET
* @default SAI_TUNNEL_MPLS_DECAP_ECN_MODE_STANDARD
*/
SAI_SWITCH_ATTR_TUNNEL_MPLS_DECAP_ECN_MODE,

/**
* @brief End of attributes
*/
Expand Down
2 changes: 1 addition & 1 deletion meta/saisanitycheck.c
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ void check_attr_by_object_type()
sai_object_type_t current = ot[index]->objecttype;

META_ASSERT_TRUE(current == i, "object type must be equal on object type list");
META_ASSERT_TRUE(index < 200, "object defines > 200 attributes, metadata bug?");
META_ASSERT_TRUE(index < 300, "object defines > 300 attributes, metadata bug?");
META_ASSERT_TRUE(current > SAI_OBJECT_TYPE_NULL, "object type must be > NULL");
META_ASSERT_TRUE(current < SAI_OBJECT_TYPE_EXTENSIONS_MAX, "object type must be < MAX");

Expand Down