Skip to content

Commit

Permalink
Update SAI API for DASH metering. (opencomputeproject#1999)
Browse files Browse the repository at this point in the history
* Update SAI API for DASH metering.
  • Loading branch information
r12f authored Apr 29, 2024
1 parent 681334c commit 0117835
Show file tree
Hide file tree
Showing 5 changed files with 106 additions and 44 deletions.
22 changes: 21 additions & 1 deletion experimental/saiexperimentaldashinboundrouting.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,27 @@ typedef enum _sai_inbound_routing_entry_attr_t
SAI_INBOUND_ROUTING_ENTRY_ATTR_ACTION = SAI_INBOUND_ROUTING_ENTRY_ATTR_START,

/**
* @brief Action vxlan_decap_pa_validate parameter SRC_VNET_ID
* @brief Action tunnel_decap, tunnel_decap_pa_validate parameter METER_CLASS_OR
*
* @type sai_uint32_t
* @flags CREATE_AND_SET
* @default 0
* @validonly SAI_INBOUND_ROUTING_ENTRY_ATTR_ACTION == SAI_INBOUND_ROUTING_ENTRY_ACTION_VXLAN_DECAP or SAI_INBOUND_ROUTING_ENTRY_ATTR_ACTION == SAI_INBOUND_ROUTING_ENTRY_ACTION_VXLAN_DECAP_PA_VALIDATE
*/
SAI_INBOUND_ROUTING_ENTRY_ATTR_METER_CLASS_OR,

/**
* @brief Action tunnel_decap, tunnel_decap_pa_validate parameter METER_CLASS_AND
*
* @type sai_uint32_t
* @flags CREATE_AND_SET
* @default 4294967295
* @validonly SAI_INBOUND_ROUTING_ENTRY_ATTR_ACTION == SAI_INBOUND_ROUTING_ENTRY_ACTION_VXLAN_DECAP or SAI_INBOUND_ROUTING_ENTRY_ATTR_ACTION == SAI_INBOUND_ROUTING_ENTRY_ACTION_VXLAN_DECAP_PA_VALIDATE
*/
SAI_INBOUND_ROUTING_ENTRY_ATTR_METER_CLASS_AND,

/**
* @brief Action tunnel_decap_pa_validate parameter SRC_VNET_ID
*
* @type sai_object_id_t
* @flags CREATE_AND_SET
Expand Down
86 changes: 66 additions & 20 deletions experimental/saiexperimentaldashmeter.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,28 +57,11 @@ typedef enum _sai_meter_bucket_attr_t
/**
* @brief Exact matched key meter_class
*
* @type sai_uint16_t
* @type sai_uint32_t
* @flags MANDATORY_ON_CREATE | CREATE_ONLY
* @isvlan false
*/
SAI_METER_BUCKET_ATTR_METER_CLASS,

/**
* @brief Action meter_bucket_action parameter OUTBOUND_BYTES_COUNTER
*
* @type sai_uint64_t
* @flags READ_ONLY
*/
SAI_METER_BUCKET_ATTR_OUTBOUND_BYTES_COUNTER,

/**
* @brief Action meter_bucket_action parameter INBOUND_BYTES_COUNTER
*
* @type sai_uint64_t
* @flags READ_ONLY
*/
SAI_METER_BUCKET_ATTR_INBOUND_BYTES_COUNTER,

/**
* @brief End of attributes
*/
Expand All @@ -92,6 +75,19 @@ typedef enum _sai_meter_bucket_attr_t

} sai_meter_bucket_attr_t;

/**
* @brief Counter IDs for meter_bucket in sai_get_meter_bucket_stats() call
*/
typedef enum _sai_meter_bucket_stat_t
{
/** DASH METER_BUCKET OUTBOUND_BYTES stat count */
SAI_METER_BUCKET_STAT_OUTBOUND_BYTES,

/** DASH METER_BUCKET INBOUND_BYTES stat count */
SAI_METER_BUCKET_STAT_INBOUND_BYTES,

} sai_meter_bucket_stat_t;

/**
* @brief Attribute ID for dash_meter_meter_policy
*/
Expand Down Expand Up @@ -164,9 +160,8 @@ typedef enum _sai_meter_rule_attr_t
/**
* @brief Action set_policy_meter_class parameter METER_CLASS
*
* @type sai_uint16_t
* @type sai_uint32_t
* @flags CREATE_AND_SET
* @isvlan false
* @default 0
*/
SAI_METER_RULE_ATTR_METER_CLASS,
Expand Down Expand Up @@ -253,6 +248,54 @@ typedef sai_status_t (*sai_get_meter_bucket_attribute_fn)(
_In_ uint32_t attr_count,
_Inout_ sai_attribute_t *attr_list);

/**
* @brief Get meter_bucket statistics counters. Deprecated for backward compatibility.
*
* @param[in] meter_bucket_id Entry id
* @param[in] number_of_counters Number of counters in the array
* @param[in] counter_ids Specifies the array of counter ids
* @param[out] counters Array of resulting counter values.
*
* @return #SAI_STATUS_SUCCESS on success, failure status code on error
*/
typedef sai_status_t (*sai_get_meter_bucket_stats_fn)(
_In_ sai_object_id_t meter_bucket_id,
_In_ uint32_t number_of_counters,
_In_ const sai_stat_id_t *counter_ids,
_Out_ uint64_t *counters);

/**
* @brief Get meter_bucket statistics counters extended.
*
* @param[in] meter_bucket_id Entry id
* @param[in] number_of_counters Number of counters in the array
* @param[in] counter_ids Specifies the array of counter ids
* @param[in] mode Statistics mode
* @param[out] counters Array of resulting counter values.
*
* @return #SAI_STATUS_SUCCESS on success, failure status code on error
*/
typedef sai_status_t (*sai_get_meter_bucket_stats_ext_fn)(
_In_ sai_object_id_t meter_bucket_id,
_In_ uint32_t number_of_counters,
_In_ const sai_stat_id_t *counter_ids,
_In_ sai_stats_mode_t mode,
_Out_ uint64_t *counters);

/**
* @brief Clear meter_bucket statistics counters.
*
* @param[in] meter_bucket_id Entry id
* @param[in] number_of_counters Number of counters in the array
* @param[in] counter_ids Specifies the array of counter ids
*
* @return #SAI_STATUS_SUCCESS on success, failure status code on error
*/
typedef sai_status_t (*sai_clear_meter_bucket_stats_fn)(
_In_ sai_object_id_t meter_bucket_id,
_In_ uint32_t number_of_counters,
_In_ const sai_stat_id_t *counter_ids);

/**
* @brief Create dash_meter_meter_policy
*
Expand Down Expand Up @@ -363,6 +406,9 @@ typedef struct _sai_dash_meter_api_t
sai_remove_meter_bucket_fn remove_meter_bucket;
sai_set_meter_bucket_attribute_fn set_meter_bucket_attribute;
sai_get_meter_bucket_attribute_fn get_meter_bucket_attribute;
sai_get_meter_bucket_stats_fn get_meter_bucket_stats;
sai_get_meter_bucket_stats_ext_fn get_meter_bucket_stats_ext;
sai_clear_meter_bucket_stats_fn clear_meter_bucket_stats;
sai_bulk_object_create_fn create_meter_buckets;
sai_bulk_object_remove_fn remove_meter_buckets;

Expand Down
17 changes: 3 additions & 14 deletions experimental/saiexperimentaldashoutboundcatopa.h
Original file line number Diff line number Diff line change
Expand Up @@ -122,25 +122,14 @@ typedef enum _sai_outbound_ca_to_pa_entry_attr_t
SAI_OUTBOUND_CA_TO_PA_ENTRY_ATTR_USE_DST_VNET_VNI,

/**
* @brief Action set_tunnel_mapping, set_private_link_mapping parameter METER_CLASS
* @brief Action set_tunnel_mapping, set_private_link_mapping parameter METER_CLASS_OR
*
* @type sai_uint16_t
* @type sai_uint32_t
* @flags CREATE_AND_SET
* @isvlan false
* @default 0
* @validonly SAI_OUTBOUND_CA_TO_PA_ENTRY_ATTR_ACTION == SAI_OUTBOUND_CA_TO_PA_ENTRY_ACTION_SET_TUNNEL_MAPPING or SAI_OUTBOUND_CA_TO_PA_ENTRY_ATTR_ACTION == SAI_OUTBOUND_CA_TO_PA_ENTRY_ACTION_SET_PRIVATE_LINK_MAPPING
*/
SAI_OUTBOUND_CA_TO_PA_ENTRY_ATTR_METER_CLASS,

/**
* @brief Action set_tunnel_mapping, set_private_link_mapping parameter METER_CLASS_OVERRIDE
*
* @type bool
* @flags CREATE_AND_SET
* @default false
* @validonly SAI_OUTBOUND_CA_TO_PA_ENTRY_ATTR_ACTION == SAI_OUTBOUND_CA_TO_PA_ENTRY_ACTION_SET_TUNNEL_MAPPING or SAI_OUTBOUND_CA_TO_PA_ENTRY_ATTR_ACTION == SAI_OUTBOUND_CA_TO_PA_ENTRY_ACTION_SET_PRIVATE_LINK_MAPPING
*/
SAI_OUTBOUND_CA_TO_PA_ENTRY_ATTR_METER_CLASS_OVERRIDE,
SAI_OUTBOUND_CA_TO_PA_ENTRY_ATTR_METER_CLASS_OR,

/**
* @brief Action set_private_link_mapping parameter OVERLAY_SIP
Expand Down
17 changes: 8 additions & 9 deletions experimental/saiexperimentaldashoutboundrouting.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,25 +110,24 @@ typedef enum _sai_outbound_routing_entry_attr_t
SAI_OUTBOUND_ROUTING_ENTRY_ATTR_DST_VNET_ID,

/**
* @brief Action route_vnet, route_vnet_direct, route_direct, route_service_tunnel parameter METER_POLICY_EN
* @brief Action route_vnet, route_vnet_direct, route_direct, route_service_tunnel parameter METER_CLASS_OR
*
* @type bool
* @type sai_uint32_t
* @flags CREATE_AND_SET
* @default false
* @default 0
* @validonly SAI_OUTBOUND_ROUTING_ENTRY_ATTR_ACTION == SAI_OUTBOUND_ROUTING_ENTRY_ACTION_ROUTE_VNET or SAI_OUTBOUND_ROUTING_ENTRY_ATTR_ACTION == SAI_OUTBOUND_ROUTING_ENTRY_ACTION_ROUTE_VNET_DIRECT or SAI_OUTBOUND_ROUTING_ENTRY_ATTR_ACTION == SAI_OUTBOUND_ROUTING_ENTRY_ACTION_ROUTE_DIRECT or SAI_OUTBOUND_ROUTING_ENTRY_ATTR_ACTION == SAI_OUTBOUND_ROUTING_ENTRY_ACTION_ROUTE_SERVICE_TUNNEL
*/
SAI_OUTBOUND_ROUTING_ENTRY_ATTR_METER_POLICY_EN,
SAI_OUTBOUND_ROUTING_ENTRY_ATTR_METER_CLASS_OR,

/**
* @brief Action route_vnet, route_vnet_direct, route_direct, route_service_tunnel parameter METER_CLASS
* @brief Action route_vnet, route_vnet_direct, route_direct, route_service_tunnel parameter METER_CLASS_AND
*
* @type sai_uint16_t
* @type sai_uint32_t
* @flags CREATE_AND_SET
* @isvlan false
* @default 0
* @default 4294967295
* @validonly SAI_OUTBOUND_ROUTING_ENTRY_ATTR_ACTION == SAI_OUTBOUND_ROUTING_ENTRY_ACTION_ROUTE_VNET or SAI_OUTBOUND_ROUTING_ENTRY_ATTR_ACTION == SAI_OUTBOUND_ROUTING_ENTRY_ACTION_ROUTE_VNET_DIRECT or SAI_OUTBOUND_ROUTING_ENTRY_ATTR_ACTION == SAI_OUTBOUND_ROUTING_ENTRY_ACTION_ROUTE_DIRECT or SAI_OUTBOUND_ROUTING_ENTRY_ATTR_ACTION == SAI_OUTBOUND_ROUTING_ENTRY_ACTION_ROUTE_SERVICE_TUNNEL
*/
SAI_OUTBOUND_ROUTING_ENTRY_ATTR_METER_CLASS,
SAI_OUTBOUND_ROUTING_ENTRY_ATTR_METER_CLASS_AND,

/**
* @brief Action route_vnet_direct parameter OVERLAY_IP
Expand Down
8 changes: 8 additions & 0 deletions experimental/saiswitchextensions.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,14 @@ typedef enum _sai_switch_attr_extensions_t
{
SAI_SWITCH_ATTR_EXTENSIONS_RANGE_START = SAI_SWITCH_ATTR_END,

/**
* @brief Maximum number of meter buckets per ENI.
*
* @type sai_uint32_t
* @flags READ_ONLY
*/
SAI_SWITCH_ATTR_DASH_CAPS_MAX_METER_BUCKET_COUNT_PER_ENI = SAI_SWITCH_ATTR_EXTENSIONS_RANGE_START,

SAI_SWITCH_ATTR_EXTENSIONS_RANGE_END

} sai_switch_attr_extensions_t;
Expand Down

0 comments on commit 0117835

Please sign in to comment.