From 294252f061ad5a3dbcbce26ab80f7fa91edcaafd Mon Sep 17 00:00:00 2001 From: Stephen Sun <5379172+stephenxs@users.noreply.github.com> Date: Wed, 6 Nov 2024 16:10:35 +0800 Subject: [PATCH] Do not enter vendor SAI critical section for counter polling/clearing operations (#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. --- syncd/VendorSai.cpp | 5 ----- 1 file changed, 5 deletions(-) diff --git a/syncd/VendorSai.cpp b/syncd/VendorSai.cpp index ed4580df2..a256ff404 100644 --- a/syncd/VendorSai.cpp +++ b/syncd/VendorSai.cpp @@ -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(); @@ -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(); @@ -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(); @@ -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(); @@ -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();