From 166106a0838f1e62a7e0466a55c7e97f8021a6e9 Mon Sep 17 00:00:00 2001 From: Arkadiusz Bokowy Date: Fri, 30 Jun 2023 11:51:45 +0200 Subject: [PATCH] Default MRP_RETRY_INTERVAL_SENDER_BOOST to 0 ms (#27555) --- src/messaging/ReliableMessageMgr.cpp | 2 -- src/messaging/ReliableMessageProtocolConfig.h | 4 +++- src/messaging/tests/TestAbortExchangesForFabric.cpp | 3 +-- src/messaging/tests/TestReliableMessageProtocol.cpp | 10 +++------- src/protocols/secure_channel/tests/TestPASESession.cpp | 3 ++- 5 files changed, 9 insertions(+), 13 deletions(-) diff --git a/src/messaging/ReliableMessageMgr.cpp b/src/messaging/ReliableMessageMgr.cpp index 5c0989c74a1540..8a9e88d426b41f 100644 --- a/src/messaging/ReliableMessageMgr.cpp +++ b/src/messaging/ReliableMessageMgr.cpp @@ -261,9 +261,7 @@ System::Clock::Timestamp ReliableMessageMgr::GetBackoff(System::Clock::Timestamp } #endif -#ifdef CHIP_CONFIG_MRP_RETRY_INTERVAL_SENDER_BOOST mrpBackoffTime += CHIP_CONFIG_MRP_RETRY_INTERVAL_SENDER_BOOST; -#endif return mrpBackoffTime; } diff --git a/src/messaging/ReliableMessageProtocolConfig.h b/src/messaging/ReliableMessageProtocolConfig.h index 859dcb4703d59d..a77483f3262e27 100644 --- a/src/messaging/ReliableMessageProtocolConfig.h +++ b/src/messaging/ReliableMessageProtocolConfig.h @@ -162,8 +162,10 @@ namespace chip { #ifndef CHIP_CONFIG_MRP_RETRY_INTERVAL_SENDER_BOOST #if CHIP_ENABLE_OPENTHREAD && !CHIP_DEVICE_LAYER_TARGET_LINUX #define CHIP_CONFIG_MRP_RETRY_INTERVAL_SENDER_BOOST (500_ms) +#else +#define CHIP_CONFIG_MRP_RETRY_INTERVAL_SENDER_BOOST (0_ms) #endif -#endif // CHIP_CONFIG_MRP_RETRY_INTERVAL_SENDER_BOOST && !CHIP_DEVICE_LAYER_TARGET_LINUX +#endif // CHIP_CONFIG_MRP_RETRY_INTERVAL_SENDER_BOOST /** * @brief diff --git a/src/messaging/tests/TestAbortExchangesForFabric.cpp b/src/messaging/tests/TestAbortExchangesForFabric.cpp index ef9ff8ca8039b7..33b2dfce33d958 100644 --- a/src/messaging/tests/TestAbortExchangesForFabric.cpp +++ b/src/messaging/tests/TestAbortExchangesForFabric.cpp @@ -206,11 +206,10 @@ void CommonCheckAbortAllButOneExchange(nlTestSuite * inSuite, TestContext & ctx, // trigger a MRP failure due to timing out waiting for an ACK. // auto waitTimeout = System::Clock::Milliseconds32(1000); -#ifdef CHIP_CONFIG_MRP_RETRY_INTERVAL_SENDER_BOOST // Account for the retry delay booster, so that we do not timeout our IO processing before the // retransmission failure is triggered. waitTimeout += CHIP_CONFIG_RMP_DEFAULT_MAX_RETRANS * CHIP_CONFIG_MRP_RETRY_INTERVAL_SENDER_BOOST; -#endif + ctx.GetIOContext().DriveIOUntil(waitTimeout, [&]() { return false; }); } else diff --git a/src/messaging/tests/TestReliableMessageProtocol.cpp b/src/messaging/tests/TestReliableMessageProtocol.cpp index 0db244965ebcab..101367e7f10428 100644 --- a/src/messaging/tests/TestReliableMessageProtocol.cpp +++ b/src/messaging/tests/TestReliableMessageProtocol.cpp @@ -58,17 +58,13 @@ using TestContext = Test::LoopbackMessagingContext; const char PAYLOAD[] = "Hello!"; -#ifdef CHIP_CONFIG_MRP_RETRY_INTERVAL_SENDER_BOOST -// When the CHIP_CONFIG_MRP_RETRY_INTERVAL_SENDER_BOOST is set, the stack -// operates under the assumption of a high latency network (like Thread), -// so it adds extra delays to avoid spurious retransmits. +// The CHIP_CONFIG_MRP_RETRY_INTERVAL_SENDER_BOOST can be set to non-zero value +// to boost the retransmission timeout for a high latency network like Thread to +// avoid spurious retransmits. // // This adds extra I/O time to account for this. See the documentation for // CHIP_CONFIG_MRP_RETRY_INTERVAL_SENDER_BOOST for more details. constexpr auto retryBoosterTimeout = CHIP_CONFIG_RMP_DEFAULT_MAX_RETRANS * CHIP_CONFIG_MRP_RETRY_INTERVAL_SENDER_BOOST; -#else -constexpr auto retryBoosterTimeout = System::Clock::Milliseconds32(0); -#endif class MockAppDelegate : public UnsolicitedMessageHandler, public ExchangeDelegate { diff --git a/src/protocols/secure_channel/tests/TestPASESession.cpp b/src/protocols/secure_channel/tests/TestPASESession.cpp index 66a6a74d2d9dc0..c9a3d6a2d45354 100644 --- a/src/protocols/secure_channel/tests/TestPASESession.cpp +++ b/src/protocols/secure_channel/tests/TestPASESession.cpp @@ -279,7 +279,8 @@ void SecurePairingHandshakeTestCommon(nlTestSuite * inSuite, void * inContext, S while (delegate.mMessageDropped) { - chip::test_utils::SleepMillis(100); + // Wait some time so the dropped message will be retransmitted when we drain the IO. + chip::test_utils::SleepMillis((100_ms + CHIP_CONFIG_MRP_RETRY_INTERVAL_SENDER_BOOST).count()); delegate.mMessageDropped = false; ReliableMessageMgr::Timeout(&ctx.GetSystemLayer(), ctx.GetExchangeManager().GetReliableMessageMgr()); ctx.DrainAndServiceIO();