From 035fc2570142807ad0929c8566585319abefd2b2 Mon Sep 17 00:00:00 2001 From: Damian Krolik Date: Thu, 28 Jul 2022 17:02:41 +0200 Subject: [PATCH] [mrp] Increase MRP backoff time for SED sender When sender is sleepy, it may take more time until it receives an acknowledgment from a peer, so MRP backoff time should be extended by the sleepy active interval. Signed-off-by: Damian Krolik --- src/messaging/ReliableMessageMgr.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/messaging/ReliableMessageMgr.cpp b/src/messaging/ReliableMessageMgr.cpp index 753c95871e4335..96a8563b1a4464 100644 --- a/src/messaging/ReliableMessageMgr.cpp +++ b/src/messaging/ReliableMessageMgr.cpp @@ -34,6 +34,7 @@ #include #include #include +#include using namespace chip::System::Clock::Literals; @@ -248,6 +249,18 @@ System::Clock::Timestamp ReliableMessageMgr::GetBackoff(System::Clock::Timestamp uint32_t jitter = MRP_BACKOFF_JITTER_BASE + Crypto::GetRandU8(); mrpBackoffTime = mrpBackoffTime * jitter / MRP_BACKOFF_JITTER_BASE; +#if CHIP_DEVICE_CONFIG_ENABLE_SED + // Implement: + // "A sleepy sender SHOULD increase t to also account for its own sleepy interval + // required to receive the acknowledgment" + DeviceLayer::ConnectivityManager::SEDIntervalsConfig sedIntervals; + + if (DeviceLayer::ConnectivityMgr().GetSEDIntervalsConfig(sedIntervals) == CHIP_NO_ERROR) + { + mrpBackoffTime += System::Clock::Timestamp(sedIntervals.ActiveIntervalMS); + } +#endif + return mrpBackoffTime; }