From 8bf406a8c171142bc93d53195d5fb19ed3a60bf1 Mon Sep 17 00:00:00 2001 From: Junior Martinez Date: Wed, 26 Jul 2023 08:42:26 -0400 Subject: [PATCH 1/3] Move a trace that was being spammed in low active/idle interval. Now only reported on ICD mode update calls --- src/app/icd/ICDManager.cpp | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/src/app/icd/ICDManager.cpp b/src/app/icd/ICDManager.cpp index f400a7e5801087..ff406ecf8df0da 100644 --- a/src/app/icd/ICDManager.cpp +++ b/src/app/icd/ICDManager.cpp @@ -93,6 +93,13 @@ void ICDManager::UpdateIcdMode() } } mICDMode = tempMode; + + // When in SIT mode, the slow poll interval SHOULDN'T be greater than the SIT mode polling threshold, per spec. + if (mICDMode == ICDMode::SIT && GetSlowPollingInterval() > GetSITPollingThreshold()) + { + ChipLogDetail(AppServer, "The Slow Polling Interval of an ICD in SIT mode should be <= %" PRIu32, + (GetSITPollingThreshold().count() / 1000)); + } } void ICDManager::UpdateOperationState(OperationalState state) @@ -108,14 +115,14 @@ void ICDManager::UpdateOperationState(OperationalState state) DeviceLayer::SystemLayer().StartTimer(System::Clock::Timeout(idleModeInterval), OnIdleModeDone, this); System::Clock::Milliseconds32 slowPollInterval = GetSlowPollingInterval(); - // When in SIT mode, the slow poll interval SHOULDN'T be greater than the SIT mode polling threshold, per spec. - if (mICDMode == ICDMode::SIT && slowPollInterval > GetSITPollingThreshold()) + +#if 0 // TODO ICD Spec to define this conformance as a SHALL + // When in SIT mode, the slow poll interval SHOULDN'T be greater than the SIT mode polling threshold, per spec. + if (mICDMode == ICDMode::SIT && GetSlowPollingInterval() > GetSITPollingThreshold()) { - ChipLogDetail(AppServer, "The Slow Polling Interval of an ICD in SIT mode should be <= %" PRIu32, - (GetSITPollingThreshold().count() / 1000)); - // TODO Spec to define this conformance as a SHALL - // slowPollInterval = GetSITPollingThreshold(); + slowPollInterval = GetSITPollingThreshold(); } +#endif CHIP_ERROR err = DeviceLayer::ConnectivityMgr().SetPollingInterval(slowPollInterval); if (err != CHIP_NO_ERROR) From 95466b83347edf6d424d077241979a192f3bbfcb Mon Sep 17 00:00:00 2001 From: Junior Martinez Date: Wed, 26 Jul 2023 11:13:30 -0400 Subject: [PATCH 2/3] add define to enable enforcing the SIT slow polling upper limit --- src/app/icd/ICDManager.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/app/icd/ICDManager.cpp b/src/app/icd/ICDManager.cpp index ff406ecf8df0da..bb0a97ba63997d 100644 --- a/src/app/icd/ICDManager.cpp +++ b/src/app/icd/ICDManager.cpp @@ -28,6 +28,11 @@ #include #include +#ifndef ICD_ENFORCE_SIT_SLOW_POLL_LIMIT +// Set to 1 to enforce SIT Slow Polling Max value to 15seconds (spec 9.16.1.5) +#define ICD_ENFORCE_SIT_SLOW_POLL_LIMIT 0 +#endif + namespace chip { namespace app { @@ -116,8 +121,8 @@ void ICDManager::UpdateOperationState(OperationalState state) System::Clock::Milliseconds32 slowPollInterval = GetSlowPollingInterval(); -#if 0 // TODO ICD Spec to define this conformance as a SHALL - // When in SIT mode, the slow poll interval SHOULDN'T be greater than the SIT mode polling threshold, per spec. +#if ICD_ENFORCE_SIT_SLOW_POLL_LIMIT + // When in SIT mode, the slow poll interval SHOULDN'T be greater than the SIT mode polling threshold, per spec. if (mICDMode == ICDMode::SIT && GetSlowPollingInterval() > GetSITPollingThreshold()) { slowPollInterval = GetSITPollingThreshold(); From d6d8fb63158988d49ab2550852a697ead8a33351 Mon Sep 17 00:00:00 2001 From: Junior Martinez <67972863+jmartinez-silabs@users.noreply.github.com> Date: Wed, 26 Jul 2023 11:15:03 -0400 Subject: [PATCH 3/3] Update src/app/icd/ICDManager.cpp Co-authored-by: Boris Zbarsky --- src/app/icd/ICDManager.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/icd/ICDManager.cpp b/src/app/icd/ICDManager.cpp index bb0a97ba63997d..853fd044d36732 100644 --- a/src/app/icd/ICDManager.cpp +++ b/src/app/icd/ICDManager.cpp @@ -102,7 +102,7 @@ void ICDManager::UpdateIcdMode() // When in SIT mode, the slow poll interval SHOULDN'T be greater than the SIT mode polling threshold, per spec. if (mICDMode == ICDMode::SIT && GetSlowPollingInterval() > GetSITPollingThreshold()) { - ChipLogDetail(AppServer, "The Slow Polling Interval of an ICD in SIT mode should be <= %" PRIu32, + ChipLogDetail(AppServer, "The Slow Polling Interval of an ICD in SIT mode should be <= %" PRIu32 " seconds", (GetSITPollingThreshold().count() / 1000)); } }