Skip to content

Commit

Permalink
Default MRP_RETRY_INTERVAL_SENDER_BOOST to 0 ms (#27555)
Browse files Browse the repository at this point in the history
  • Loading branch information
arkq authored and pull[bot] committed Feb 8, 2024
1 parent d628baf commit 1520516
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 13 deletions.
2 changes: 0 additions & 2 deletions src/messaging/ReliableMessageMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
4 changes: 3 additions & 1 deletion src/messaging/ReliableMessageProtocolConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions src/messaging/tests/TestAbortExchangesForFabric.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 3 additions & 7 deletions src/messaging/tests/TestReliableMessageProtocol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
3 changes: 2 additions & 1 deletion src/protocols/secure_channel/tests/TestPASESession.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 1520516

Please sign in to comment.