Skip to content

Commit

Permalink
Move DASH HA stats from dash_device to dash_ha
Browse files Browse the repository at this point in the history
  • Loading branch information
mukeshmv committed Mar 4, 2024
1 parent 27c1221 commit f4b1686
Show file tree
Hide file tree
Showing 4 changed files with 85 additions and 85 deletions.
81 changes: 0 additions & 81 deletions experimental/saiexperimentaldashdevice.h
Original file line number Diff line number Diff line change
Expand Up @@ -131,25 +131,6 @@ typedef enum _sai_dash_device_attr_t

} sai_dash_device_attr_t;

/**
* @brief Counter IDs in sai_get_dash_device_stats() call
*/
typedef enum _sai_dash_device_stat_t
{
/** DASH DEVICE stat HA heartbeat messages sent */
SAI_DASH_DEVICE_STAT_HA_HEARTBEAT_MSG_SENT,

/** DASH DEVICE stat HA heartbeat messages received */
SAI_DASH_DEVICE_STAT_HA_HEARTBEAT_MSG_RECEIVED,

/** DASH DEVICE stat HA flow sync requests sent */
SAI_DASH_DEVICE_STAT_HA_FLOW_SYNC_REQ_SENT,

/** DASH DEVICE stat HA flow sync acknowledgements sent */
SAI_DASH_DEVICE_STAT_HA_FLOW_SYNC_ACK_RECEIVED,

} sai_dash_device_stat_t;

/**
* @brief Create and return a DASH device object
*
Expand Down Expand Up @@ -202,74 +183,12 @@ typedef sai_status_t (*sai_get_dash_device_attribute_fn)(
_In_ uint32_t attr_count,
_Inout_ sai_attribute_t *attr_list);

/**
* @brief Get DASH device statistics counters.
*
* @param[in] dash_device_id Device 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_dash_device_stats_fn)(
_In_ sai_object_id_t dash_device_id,
_In_ uint32_t number_of_counters,
_In_ const sai_stat_id_t *counter_ids,
_Out_ uint64_t *counters);

/**
* @brief Get DASH device statistics counters extended.
*
* @param[in] dash_device_id Device 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_dash_device_stats_ext_fn)(
_In_ sai_object_id_t dash_device_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 DASH device statistics counters.
*
* @param[in] dash_device_id Device 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_dash_device_stats_fn)(
_In_ sai_object_id_t dash_device_id,
_In_ uint32_t number_of_counters,
_In_ const sai_stat_id_t *counter_ids);

/**
* @brief Clear DASH device statistics counters.
*
* @param[in] dash_device_id Switch id
*
* @return #SAI_STATUS_SUCCESS on success, failure status code on error
*/
typedef sai_status_t (*sai_clear_dash_device_all_stats_fn)(
_In_ sai_object_id_t dash_device_id);

typedef struct _sai_dash_device_api_t
{
sai_create_dash_device_fn create_dash_device;
sai_remove_dash_device_fn remove_dash_device;
sai_set_dash_device_attribute_fn set_dash_device_attribute;
sai_get_dash_device_attribute_fn get_dash_device_attribute;
sai_get_dash_device_stats_fn get_dash_device_stats;
sai_get_dash_device_stats_ext_fn get_dash_device_stats_ext;
sai_clear_dash_device_stats_fn clear_dash_device_stats;
sai_clear_dash_device_all_stats_fn clear_dash_device_all_stats;

} sai_dash_device_api_t;

Expand Down
81 changes: 81 additions & 0 deletions experimental/saiexperimentaldashha.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,25 @@ typedef enum _sai_dash_ha_attr_t

} sai_dash_ha_attr_t;

/**
* @brief Counter IDs in sai_get_dash_ha_stats() call
*/
typedef enum _sai_dash_ha_stat_t
{
/** DASH HA stat heartbeat messages sent */
SAI_DASH_HA_STAT_HEARTBEAT_MSG_SENT,

/** DASH HA stat heartbeat messages received */
SAI_DASH_HA_STAT_HEARTBEAT_MSG_RECEIVED,

/** DASH HA stat flow sync requests sent */
SAI_DASH_HA_STAT_FLOW_SYNC_REQ_SENT,

/** DASH HA stat flow sync acknowledgements sent */
SAI_DASH_HA_STAT_FLOW_SYNC_ACK_RECEIVED,

} sai_dash_ha_stat_t;

/**
* @brief DASH HA event type
*/
Expand Down Expand Up @@ -191,6 +210,64 @@ typedef sai_status_t (*sai_flow_reconcile_dash_ha_fn)(
_In_ uint32_t attr_count,
_In_ const sai_attribute_t *attr_list);

/**
* @brief Get DASH HA statistics counters.
*
* @param[in] switch_id Switch 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_dash_ha_stats_fn)(
_In_ sai_object_id_t switch_id,
_In_ uint32_t number_of_counters,
_In_ const sai_stat_id_t *counter_ids,
_Out_ uint64_t *counters);

/**
* @brief Get DASH HA statistics counters extended.
*
* @param[in] switch_id Switch 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_dash_ha_stats_ext_fn)(
_In_ sai_object_id_t switch_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 DASH HA statistics counters.
*
* @param[in] switch_id Switch 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_dash_ha_stats_fn)(
_In_ sai_object_id_t switch_id,
_In_ uint32_t number_of_counters,
_In_ const sai_stat_id_t *counter_ids);

/**
* @brief Clear all DASH HA statistics counters.
*
* @param[in] switch_id Switch id
*
* @return #SAI_STATUS_SUCCESS on success, failure status code on error
*/
typedef sai_status_t (*sai_clear_dash_ha_all_stats_fn)(
_In_ sai_object_id_t switch_id);

/**
* @brief DASH HA notifications
*
Expand All @@ -210,6 +287,10 @@ typedef struct _sai_dash_ha_api_t
sai_activate_admin_role_dash_ha_fn activate_admin_role_dash_ha;
sai_initiate_switchover_dash_ha_fn initiate_switchover_dash_ha;
sai_flow_reconcile_dash_ha_fn flow_reconcile_dash_ha;
sai_get_dash_ha_stats_fn get_dash_ha_stats;
sai_get_dash_ha_stats_ext_fn get_dash_ha_stats_ext;
sai_clear_dash_ha_stats_fn clear_dash_ha_stats;
sai_clear_dash_ha_all_stats_fn clear_dash_ha_all_stats;
} sai_dash_ha_api_t;

/**
Expand Down
2 changes: 1 addition & 1 deletion meta/parse.pl
Original file line number Diff line number Diff line change
Expand Up @@ -4295,7 +4295,7 @@ sub ExtractStatsFunctionMap
# exceptions

next if $fn eq "clear_port_all_stats";
next if $fn eq "clear_dash_device_all_stats";
next if $fn eq "clear_dash_ha_all_stats";
next if $fn eq "get_tam_snapshot_stats";

if (not $fn =~ /^(?:get|clear)_(\w+)_stats(?:_ext)?$/)
Expand Down
6 changes: 3 additions & 3 deletions meta/style.pm
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ sub CheckStatsFunction
return if $fname eq "sai_get_tam_snapshot_stats_fn"; # exception
return if $fname eq "sai_bulk_object_get_stats_fn"; # exception
return if $fname eq "sai_bulk_object_clear_stats_fn"; # exception
return if $fname eq "sai_clear_dash_device_all_stats_fn"; # exception
return if $fname eq "sai_clear_dash_ha_all_stats_fn"; # exception

if (not $fname =~ /^sai_((get|clear)_(\w+)_stats|get_\w+_stats_ext)_fn$/)
{
Expand Down Expand Up @@ -311,7 +311,7 @@ sub CheckFunctionsParams
$pattern = "${pattern}_id";
}

if (not $first =~ /^$pattern$/)
if (not $first =~ /^$pattern$/ and not $first eq "switch_id")
{
LogWarning "first param should be called ${pattern} but is $first in $fname: $file";
}
Expand Down Expand Up @@ -516,7 +516,7 @@ sub CheckQuadApi
$f =~ s/remove_all_neighbor_entries/X/;
$f =~ s/clear_port_all_stats/X/;
$f =~ s/clear_dash_device_all_stats/X/;
$f =~ s/clear_dash_ha_all_stats/X/;
$f =~ s/^create_\w+/c/;
$f =~ s/^remove_\w+/r/;
Expand Down

0 comments on commit f4b1686

Please sign in to comment.