Skip to content

Commit

Permalink
Do not enter vendor SAI critical section for counter polling/clearing…
Browse files Browse the repository at this point in the history
… operations (sonic-net#1450)

There are two types of threads in syncd:

The syncd main thread in which the create/destroy/set/get SAI APIs are called
Flex counter threads in which counter-polling/-clearing APIs are called
The critical section in vendor SAI was introduced to protect vendors' SAI from being re-entered, which prevents the flex counter threads from running concurrently, and introduces latency for one flex counter thread when it's waiting for the critical section.
It is not necessary to enter a section in counter-polling/clearing operations since the objects' state won't be changed in that API.
  • Loading branch information
stephenxs authored and shiraez committed Dec 12, 2024
1 parent 0f62107 commit 294252f
Showing 1 changed file with 0 additions and 5 deletions.
5 changes: 0 additions & 5 deletions syncd/VendorSai.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,6 @@ 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 @@ -351,7 +350,6 @@ 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 @@ -366,7 +364,6 @@ 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 @@ -386,7 +383,6 @@ 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 @@ -414,7 +410,6 @@ 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

0 comments on commit 294252f

Please sign in to comment.