From 0614ff6e432c1c0dea1d330ca3608bd7d4135616 Mon Sep 17 00:00:00 2001 From: Eduardo Montoya Date: Tue, 17 Jan 2023 18:58:27 +0100 Subject: [PATCH] [data-poll-sender] faster rtx polling for CSL (#8654) Make sure that retransmission of data polls happens at least at the CSL period rate, when this is lower than OPENTHREAD_CONFIG_MAC_RETX_POLL_PERIOD. This greatly improves latency under situations of heavy traffic, where CSL synchronization might be lost ocassionaly due to the mix of CSL and indirect transmissions. --- src/core/mac/data_poll_sender.cpp | 7 +++++++ src/core/mac/mac.hpp | 8 ++++++++ src/core/thread/mle.cpp | 3 +-- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/core/mac/data_poll_sender.cpp b/src/core/mac/data_poll_sender.cpp index c8a6d388b02..c42bba579f1 100644 --- a/src/core/mac/data_poll_sender.cpp +++ b/src/core/mac/data_poll_sender.cpp @@ -513,6 +513,13 @@ uint32_t DataPollSender::CalculatePollPeriod(void) const if (mRetxMode) { period = Min(period, kRetxPollPeriod); + +#if OPENTHREAD_CONFIG_MAC_CSL_RECEIVER_ENABLE + if (Get().GetCslPeriodMs() > 0) + { + period = Min(period, Get().GetCslPeriodMs()); + } +#endif } if (mRemainingFastPolls != 0) diff --git a/src/core/mac/mac.hpp b/src/core/mac/mac.hpp index 1abff07fa26..35893f89821 100644 --- a/src/core/mac/mac.hpp +++ b/src/core/mac/mac.hpp @@ -617,6 +617,14 @@ class Mac : public InstanceLocator, private NonCopyable */ uint16_t GetCslPeriod(void) const { return mCslPeriod; } + /** + * This method gets the CSL period. + * + * @returns CSL period in milliseconds. + * + */ + uint32_t GetCslPeriodMs(void) const { return mCslPeriod * kUsPerTenSymbols / 1000; } + /** * This method sets the CSL period. * diff --git a/src/core/thread/mle.cpp b/src/core/thread/mle.cpp index 45debf3ec38..132b6f6ea31 100644 --- a/src/core/thread/mle.cpp +++ b/src/core/thread/mle.cpp @@ -1900,8 +1900,7 @@ void Mle::ScheduleMessageTransmissionTimer(void) #if OPENTHREAD_CONFIG_MAC_CSL_RECEIVER_ENABLE if (Get().IsCslEnabled()) { - ExitNow(interval = Get().GetCslPeriod() * kUsPerTenSymbols / 1000 + - static_cast(kUnicastRetransmissionDelay)); + ExitNow(interval = Get().GetCslPeriodMs() + static_cast(kUnicastRetransmissionDelay)); } else #endif