From 0a51fd90621aab4b71f993ac20ac0799378a0a30 Mon Sep 17 00:00:00 2001 From: Judy Joseph Date: Tue, 7 Jan 2025 00:39:54 +0000 Subject: [PATCH 1/3] Remove check to see if m_supportedCounters is empty in CounterContext::updateSupportedCounters --- syncd/FlexCounter.cpp | 6 ------ 1 file changed, 6 deletions(-) diff --git a/syncd/FlexCounter.cpp b/syncd/FlexCounter.cpp index f907f4f07..a771bfd3e 100644 --- a/syncd/FlexCounter.cpp +++ b/syncd/FlexCounter.cpp @@ -859,12 +859,6 @@ class CounterContext : public BaseCounterContext _In_ sai_stats_mode_t stats_mode) { SWSS_LOG_ENTER(); - if (!m_supportedCounters.empty() && !always_check_supported_counters) - { - SWSS_LOG_NOTICE("Ignore checking of supported counters"); - return; - } - if (always_check_supported_counters) { m_supportedCounters.clear(); From 66de812352c91619999415920d39629909eb8564 Mon Sep 17 00:00:00 2001 From: Judy Joseph Date: Tue, 7 Jan 2025 21:10:09 +0000 Subject: [PATCH 2/3] Add a flag dont_clear_support_counter to support a case of not clearing the existing m_supportedCounters --- syncd/FlexCounter.cpp | 7 +++++++ syncd/FlexCounter.h | 1 + 2 files changed, 8 insertions(+) diff --git a/syncd/FlexCounter.cpp b/syncd/FlexCounter.cpp index a771bfd3e..8022ade94 100644 --- a/syncd/FlexCounter.cpp +++ b/syncd/FlexCounter.cpp @@ -859,6 +859,12 @@ class CounterContext : public BaseCounterContext _In_ sai_stats_mode_t stats_mode) { SWSS_LOG_ENTER(); + if (!m_supportedCounters.empty() && !always_check_supported_counters && !dont_clear_support_counter) + { + SWSS_LOG_NOTICE("Ignore checking of supported counters"); + return; + } + if (always_check_supported_counters) { m_supportedCounters.clear(); @@ -1658,6 +1664,7 @@ std::shared_ptr FlexCounter::createCounterContext( { auto context = std::make_shared>(context_name, SAI_OBJECT_TYPE_MACSEC_SA, m_vendorSai.get(), m_statsMode); context->use_sai_stats_capa_query = false; + context->dont_clear_support_counter = true; return context; } else if (context_name == COUNTER_TYPE_FLOW) diff --git a/syncd/FlexCounter.h b/syncd/FlexCounter.h index 18d3f3af1..757ae0af1 100644 --- a/syncd/FlexCounter.h +++ b/syncd/FlexCounter.h @@ -59,6 +59,7 @@ namespace syncd bool use_sai_stats_ext = false; bool double_confirm_supported_counters = false; bool no_double_check_bulk_capability = false; + bool dont_clear_support_counter = false; }; class FlexCounter { From de75f349bb548cc49a2866de6d3a458c7b1b874a Mon Sep 17 00:00:00 2001 From: Judy Joseph Date: Wed, 8 Jan 2025 23:36:55 +0000 Subject: [PATCH 3/3] Use always_check_supported_counters and dont_clear_support_counter for MACSEC_SA --- syncd/FlexCounter.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/syncd/FlexCounter.cpp b/syncd/FlexCounter.cpp index 8022ade94..4844b7b4e 100644 --- a/syncd/FlexCounter.cpp +++ b/syncd/FlexCounter.cpp @@ -859,13 +859,13 @@ class CounterContext : public BaseCounterContext _In_ sai_stats_mode_t stats_mode) { SWSS_LOG_ENTER(); - if (!m_supportedCounters.empty() && !always_check_supported_counters && !dont_clear_support_counter) + if (!m_supportedCounters.empty() && !always_check_supported_counters) { SWSS_LOG_NOTICE("Ignore checking of supported counters"); return; } - if (always_check_supported_counters) + if (always_check_supported_counters && !dont_clear_support_counter) { m_supportedCounters.clear(); } @@ -1663,6 +1663,7 @@ std::shared_ptr FlexCounter::createCounterContext( else if (context_name == COUNTER_TYPE_MACSEC_SA) { auto context = std::make_shared>(context_name, SAI_OBJECT_TYPE_MACSEC_SA, m_vendorSai.get(), m_statsMode); + context->always_check_supported_counters = true; context->use_sai_stats_capa_query = false; context->dont_clear_support_counter = true; return context;