Skip to content

Commit 0317b16

Browse files
authored
Do not enter vendor SAI critical section for counter polling/clearing 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.
1 parent 90c79c7 commit 0317b16

File tree

1 file changed

+0
-5
lines changed

1 file changed

+0
-5
lines changed

syncd/VendorSai.cpp

-5
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,6 @@ sai_status_t VendorSai::getStats(
313313
_In_ const sai_stat_id_t *counter_ids,
314314
_Out_ uint64_t *counters)
315315
{
316-
MUTEX();
317316
SWSS_LOG_ENTER();
318317
VENDOR_CHECK_API_INITIALIZED();
319318

@@ -351,7 +350,6 @@ sai_status_t VendorSai::getStatsExt(
351350
_In_ sai_stats_mode_t mode,
352351
_Out_ uint64_t *counters)
353352
{
354-
MUTEX();
355353
SWSS_LOG_ENTER();
356354
VENDOR_CHECK_API_INITIALIZED();
357355

@@ -366,7 +364,6 @@ sai_status_t VendorSai::clearStats(
366364
_In_ uint32_t number_of_counters,
367365
_In_ const sai_stat_id_t *counter_ids)
368366
{
369-
MUTEX();
370367
SWSS_LOG_ENTER();
371368
VENDOR_CHECK_API_INITIALIZED();
372369

@@ -386,7 +383,6 @@ sai_status_t VendorSai::bulkGetStats(
386383
_Inout_ sai_status_t *object_statuses,
387384
_Out_ uint64_t *counters)
388385
{
389-
MUTEX();
390386
SWSS_LOG_ENTER();
391387
VENDOR_CHECK_API_INITIALIZED();
392388

@@ -414,7 +410,6 @@ sai_status_t VendorSai::bulkClearStats(
414410
_In_ sai_stats_mode_t mode,
415411
_Inout_ sai_status_t *object_statuses)
416412
{
417-
MUTEX();
418413
SWSS_LOG_ENTER();
419414
VENDOR_CHECK_API_INITIALIZED();
420415

0 commit comments

Comments
 (0)