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

[action] [PR:1498] Revert "Do not enter vendor SAI critical section for counter polling/clearing operations (#1450)" #1541

Merged
merged 1 commit into from
Feb 26, 2025
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
5 changes: 5 additions & 0 deletions syncd/VendorSai.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,7 @@ sai_status_t VendorSai::getStats(
_In_ const sai_stat_id_t *counter_ids,
_Out_ uint64_t *counters)
{
MUTEX();
SWSS_LOG_ENTER();
VENDOR_CHECK_API_INITIALIZED();

Expand Down Expand Up @@ -350,6 +351,7 @@ sai_status_t VendorSai::getStatsExt(
_In_ sai_stats_mode_t mode,
_Out_ uint64_t *counters)
{
MUTEX();
SWSS_LOG_ENTER();
VENDOR_CHECK_API_INITIALIZED();

Expand All @@ -364,6 +366,7 @@ sai_status_t VendorSai::clearStats(
_In_ uint32_t number_of_counters,
_In_ const sai_stat_id_t *counter_ids)
{
MUTEX();
SWSS_LOG_ENTER();
VENDOR_CHECK_API_INITIALIZED();

Expand All @@ -383,6 +386,7 @@ sai_status_t VendorSai::bulkGetStats(
_Inout_ sai_status_t *object_statuses,
_Out_ uint64_t *counters)
{
MUTEX();
SWSS_LOG_ENTER();
VENDOR_CHECK_API_INITIALIZED();

Expand Down Expand Up @@ -410,6 +414,7 @@ sai_status_t VendorSai::bulkClearStats(
_In_ sai_stats_mode_t mode,
_Inout_ sai_status_t *object_statuses)
{
MUTEX();
SWSS_LOG_ENTER();
VENDOR_CHECK_API_INITIALIZED();

Expand Down
22 changes: 22 additions & 0 deletions unittest/syncd/TestVendorSai.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,28 @@ TEST(VendorSai, bulkGetStats)
nullptr));
}

TEST(VendorSai, getStatsExt)
{
VendorSai sai;
sai.apiInitialize(0, &test_services);
ASSERT_EQ(SAI_STATUS_NOT_SUPPORTED, sai.getStatsExt(SAI_OBJECT_TYPE_NULL,
SAI_NULL_OBJECT_ID,
0,
nullptr,
SAI_STATS_MODE_READ,
nullptr));
}

TEST(VendorSai, clearStats)
{
VendorSai sai;
sai.apiInitialize(0, &test_services);
ASSERT_EQ(SAI_STATUS_NOT_SUPPORTED, sai.clearStats(SAI_OBJECT_TYPE_NULL,
SAI_NULL_OBJECT_ID,
0,
nullptr));
}

sai_object_id_t create_port(
_In_ VendorSai& sai,
_In_ sai_object_id_t switch_id)
Expand Down
Loading