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

[sonic-sairedis] Support bulk counter #1094

Merged
merged 5 commits into from
Aug 8, 2022
Merged
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
39 changes: 39 additions & 0 deletions lib/ClientSai.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -983,6 +983,45 @@ sai_status_t ClientSai::waitForClearStatsResponse()
return status;
}

sai_status_t ClientSai::bulkGetStats(
_In_ sai_object_id_t switchId,
_In_ sai_object_type_t object_type,
_In_ uint32_t object_count,
_In_ const sai_object_key_t *object_key,
_In_ uint32_t number_of_counters,
_In_ const sai_stat_id_t *counter_ids,
_In_ sai_stats_mode_t mode,
_Inout_ sai_status_t *object_statuses,
_Out_ uint64_t *counters)
{
MUTEX();
SWSS_LOG_ENTER();
REDIS_CHECK_API_INITIALIZED();

SWSS_LOG_ERROR("not implemented");

return SAI_STATUS_NOT_IMPLEMENTED;
}

sai_status_t ClientSai::bulkClearStats(
_In_ sai_object_id_t switchId,
_In_ sai_object_type_t object_type,
_In_ uint32_t object_count,
_In_ const sai_object_key_t *object_key,
_In_ uint32_t number_of_counters,
_In_ const sai_stat_id_t *counter_ids,
_In_ sai_stats_mode_t mode,
_Inout_ sai_status_t *object_statuses)
{
MUTEX();
SWSS_LOG_ENTER();
REDIS_CHECK_API_INITIALIZED();

SWSS_LOG_ERROR("not implemented");

return SAI_STATUS_NOT_IMPLEMENTED;
}

// BULK CREATE

sai_status_t ClientSai::bulkCreate(
Expand Down
21 changes: 21 additions & 0 deletions lib/ClientSai.h
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,27 @@ namespace sairedis
_In_ uint32_t number_of_counters,
_In_ const sai_stat_id_t *counter_ids) override;

virtual sai_status_t bulkGetStats(
_In_ sai_object_id_t switchId,
_In_ sai_object_type_t object_type,
_In_ uint32_t object_count,
_In_ const sai_object_key_t *object_key,
_In_ uint32_t number_of_counters,
_In_ const sai_stat_id_t *counter_ids,
_In_ sai_stats_mode_t mode,
_Inout_ sai_status_t *object_statuses,
_Out_ uint64_t *counters) override;

virtual sai_status_t bulkClearStats(
_In_ sai_object_id_t switchId,
_In_ sai_object_type_t object_type,
_In_ uint32_t object_count,
_In_ const sai_object_key_t *object_key,
_In_ uint32_t number_of_counters,
_In_ const sai_stat_id_t *counter_ids,
_In_ sai_stats_mode_t mode,
_Inout_ sai_status_t *object_statuses) override;

public: // non QUAD API

virtual sai_status_t flushFdbEntries(
Expand Down
50 changes: 50 additions & 0 deletions lib/ClientServerSai.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,56 @@ sai_status_t ClientServerSai::clearStats(
counter_ids);
}

sai_status_t ClientServerSai::bulkGetStats(
_In_ sai_object_id_t switchId,
_In_ sai_object_type_t object_type,
_In_ uint32_t object_count,
_In_ const sai_object_key_t *object_key,
_In_ uint32_t number_of_counters,
_In_ const sai_stat_id_t *counter_ids,
_In_ sai_stats_mode_t mode,
_Inout_ sai_status_t *object_statuses,
_Out_ uint64_t *counters)
{
MUTEX();
SWSS_LOG_ENTER();
REDIS_CHECK_API_INITIALIZED();

return m_sai->bulkGetStats(switchId,
object_type,
object_count,
object_key,
number_of_counters,
counter_ids,
mode,
object_statuses,
counters);
}

sai_status_t ClientServerSai::bulkClearStats(
_In_ sai_object_id_t switchId,
_In_ sai_object_type_t object_type,
_In_ uint32_t object_count,
_In_ const sai_object_key_t *object_key,
_In_ uint32_t number_of_counters,
_In_ const sai_stat_id_t *counter_ids,
_In_ sai_stats_mode_t mode,
_Inout_ sai_status_t *object_statuses)
{
MUTEX();
SWSS_LOG_ENTER();
REDIS_CHECK_API_INITIALIZED();

return m_sai->bulkClearStats(switchId,
object_type,
object_count,
object_key,
number_of_counters,
counter_ids,
mode,
object_statuses);
}

// BULK QUAD OID

sai_status_t ClientServerSai::bulkCreate(
Expand Down
21 changes: 21 additions & 0 deletions lib/ClientServerSai.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,27 @@ namespace sairedis
_In_ uint32_t number_of_counters,
_In_ const sai_stat_id_t *counter_ids) override;

virtual sai_status_t bulkGetStats(
_In_ sai_object_id_t switchId,
_In_ sai_object_type_t object_type,
_In_ uint32_t object_count,
_In_ const sai_object_key_t *object_key,
_In_ uint32_t number_of_counters,
_In_ const sai_stat_id_t *counter_ids,
_In_ sai_stats_mode_t mode,
_Inout_ sai_status_t *object_statuses,
_Out_ uint64_t *counters) override;

virtual sai_status_t bulkClearStats(
_In_ sai_object_id_t switchId,
_In_ sai_object_type_t object_type,
_In_ uint32_t object_count,
_In_ const sai_object_key_t *object_key,
_In_ uint32_t number_of_counters,
_In_ const sai_stat_id_t *counter_ids,
_In_ sai_stats_mode_t mode,
_Inout_ sai_status_t *object_statuses) override;

public: // non QUAD API

virtual sai_status_t flushFdbEntries(
Expand Down
35 changes: 35 additions & 0 deletions lib/RedisRemoteSaiInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1211,6 +1211,41 @@ sai_status_t RedisRemoteSaiInterface::clearStats(
return status;
}

sai_status_t RedisRemoteSaiInterface::bulkGetStats(
_In_ sai_object_id_t switchId,
_In_ sai_object_type_t object_type,
_In_ uint32_t object_count,
_In_ const sai_object_key_t *object_key,
_In_ uint32_t number_of_counters,
_In_ const sai_stat_id_t *counter_ids,
_In_ sai_stats_mode_t mode,
_Inout_ sai_status_t *object_statuses,
_Out_ uint64_t *counters)
{
SWSS_LOG_ENTER();

SWSS_LOG_ERROR("not implemented");

return SAI_STATUS_NOT_IMPLEMENTED;
}

sai_status_t RedisRemoteSaiInterface::bulkClearStats(
_In_ sai_object_id_t switchId,
_In_ sai_object_type_t object_type,
_In_ uint32_t object_count,
_In_ const sai_object_key_t *object_key,
_In_ uint32_t number_of_counters,
_In_ const sai_stat_id_t *counter_ids,
_In_ sai_stats_mode_t mode,
_Inout_ sai_status_t *object_statuses)
{
SWSS_LOG_ENTER();

SWSS_LOG_ERROR("not implemented");

return SAI_STATUS_NOT_IMPLEMENTED;
}

sai_status_t RedisRemoteSaiInterface::waitForClearStatsResponse()
{
SWSS_LOG_ENTER();
Expand Down
21 changes: 21 additions & 0 deletions lib/RedisRemoteSaiInterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,27 @@ namespace sairedis
_In_ uint32_t number_of_counters,
_In_ const sai_stat_id_t *counter_ids) override;

virtual sai_status_t bulkGetStats(
_In_ sai_object_id_t switchId,
_In_ sai_object_type_t object_type,
_In_ uint32_t object_count,
_In_ const sai_object_key_t *object_key,
_In_ uint32_t number_of_counters,
_In_ const sai_stat_id_t *counter_ids,
_In_ sai_stats_mode_t mode,
_Inout_ sai_status_t *object_statuses,
_Out_ uint64_t *counters) override;

virtual sai_status_t bulkClearStats(
_In_ sai_object_id_t switchId,
_In_ sai_object_type_t object_type,
_In_ uint32_t object_count,
_In_ const sai_object_key_t *object_key,
_In_ uint32_t number_of_counters,
_In_ const sai_stat_id_t *counter_ids,
_In_ sai_stats_mode_t mode,
_Inout_ sai_status_t *object_statuses) override;

public: // non QUAD API

virtual sai_status_t flushFdbEntries(
Expand Down
31 changes: 31 additions & 0 deletions lib/Sai.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,37 @@ sai_status_t Sai::clearStats(
counter_ids);
}

sai_status_t Sai::bulkGetStats(
_In_ sai_object_id_t switchId,
_In_ sai_object_type_t object_type,
_In_ uint32_t object_count,
_In_ const sai_object_key_t *object_key,
_In_ uint32_t number_of_counters,
_In_ const sai_stat_id_t *counter_ids,
_In_ sai_stats_mode_t mode,
_Inout_ sai_status_t *object_statuses,
_Out_ uint64_t *counters)
{
SWSS_LOG_ENTER();

return SAI_STATUS_NOT_IMPLEMENTED;
}

sai_status_t Sai::bulkClearStats(
_In_ sai_object_id_t switchId,
_In_ sai_object_type_t object_type,
_In_ uint32_t object_count,
_In_ const sai_object_key_t *object_key,
_In_ uint32_t number_of_counters,
_In_ const sai_stat_id_t *counter_ids,
_In_ sai_stats_mode_t mode,
_Inout_ sai_status_t *object_statuses)
{
SWSS_LOG_ENTER();

return SAI_STATUS_NOT_IMPLEMENTED;
}

// BULK QUAD OID

sai_status_t Sai::bulkCreate(
Expand Down
21 changes: 21 additions & 0 deletions lib/Sai.h
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,27 @@ namespace sairedis
_In_ uint32_t number_of_counters,
_In_ const sai_stat_id_t *counter_ids) override;

virtual sai_status_t bulkGetStats(
_In_ sai_object_id_t switchId,
_In_ sai_object_type_t object_type,
_In_ uint32_t object_count,
_In_ const sai_object_key_t *object_key,
_In_ uint32_t number_of_counters,
_In_ const sai_stat_id_t *counter_ids,
_In_ sai_stats_mode_t mode,
_Inout_ sai_status_t *object_statuses,
_Out_ uint64_t *counters) override;

virtual sai_status_t bulkClearStats(
_In_ sai_object_id_t switchId,
_In_ sai_object_type_t object_type,
_In_ uint32_t object_count,
_In_ const sai_object_key_t *object_key,
_In_ uint32_t number_of_counters,
_In_ const sai_stat_id_t *counter_ids,
_In_ sai_stats_mode_t mode,
_Inout_ sai_status_t *object_statuses) override;

public: // non QUAD API

virtual sai_status_t flushFdbEntries(
Expand Down
50 changes: 50 additions & 0 deletions lib/ServerSai.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,56 @@ sai_status_t ServerSai::clearStats(
counter_ids);
}

sai_status_t ServerSai::bulkGetStats(
_In_ sai_object_id_t switchId,
_In_ sai_object_type_t object_type,
_In_ uint32_t object_count,
_In_ const sai_object_key_t *object_key,
_In_ uint32_t number_of_counters,
_In_ const sai_stat_id_t *counter_ids,
_In_ sai_stats_mode_t mode,
_Inout_ sai_status_t *object_statuses,
_Out_ uint64_t *counters)
{
MUTEX();
SWSS_LOG_ENTER();
REDIS_CHECK_API_INITIALIZED();

return m_sai->bulkGetStats(switchId,
object_type,
object_count,
object_key,
number_of_counters,
counter_ids,
mode,
object_statuses,
counters);
}

sai_status_t ServerSai::bulkClearStats(
_In_ sai_object_id_t switchId,
_In_ sai_object_type_t object_type,
_In_ uint32_t object_count,
_In_ const sai_object_key_t *object_key,
_In_ uint32_t number_of_counters,
_In_ const sai_stat_id_t *counter_ids,
_In_ sai_stats_mode_t mode,
_Inout_ sai_status_t *object_statuses)
{
MUTEX();
SWSS_LOG_ENTER();
REDIS_CHECK_API_INITIALIZED();

return m_sai->bulkClearStats(switchId,
object_type,
object_count,
object_key,
number_of_counters,
counter_ids,
mode,
object_statuses);
}

// BULK QUAD OID

sai_status_t ServerSai::bulkCreate(
Expand Down
21 changes: 21 additions & 0 deletions lib/ServerSai.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,27 @@ namespace sairedis
_In_ uint32_t number_of_counters,
_In_ const sai_stat_id_t *counter_ids) override;

virtual sai_status_t bulkGetStats(
_In_ sai_object_id_t switchId,
_In_ sai_object_type_t object_type,
_In_ uint32_t object_count,
_In_ const sai_object_key_t *object_key,
_In_ uint32_t number_of_counters,
_In_ const sai_stat_id_t *counter_ids,
_In_ sai_stats_mode_t mode,
_Inout_ sai_status_t *object_statuses,
_Out_ uint64_t *counters) override;

virtual sai_status_t bulkClearStats(
_In_ sai_object_id_t switchId,
_In_ sai_object_type_t object_type,
_In_ uint32_t object_count,
_In_ const sai_object_key_t *object_key,
_In_ uint32_t number_of_counters,
_In_ const sai_stat_id_t *counter_ids,
_In_ sai_stats_mode_t mode,
_Inout_ sai_status_t *object_statuses) override;

public: // non QUAD API

virtual sai_status_t flushFdbEntries(
Expand Down
Loading