Skip to content

Commit

Permalink
[data-poll-sender] faster rtx polling for CSL (openthread#8654)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
edmont authored Jan 17, 2023
1 parent b832cb2 commit 0614ff6
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
7 changes: 7 additions & 0 deletions src/core/mac/data_poll_sender.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<Mac::Mac>().GetCslPeriodMs() > 0)
{
period = Min(period, Get<Mac::Mac>().GetCslPeriodMs());
}
#endif
}

if (mRemainingFastPolls != 0)
Expand Down
8 changes: 8 additions & 0 deletions src/core/mac/mac.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand Down
3 changes: 1 addition & 2 deletions src/core/thread/mle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1900,8 +1900,7 @@ void Mle::ScheduleMessageTransmissionTimer(void)
#if OPENTHREAD_CONFIG_MAC_CSL_RECEIVER_ENABLE
if (Get<Mac::Mac>().IsCslEnabled())
{
ExitNow(interval = Get<Mac::Mac>().GetCslPeriod() * kUsPerTenSymbols / 1000 +
static_cast<uint32_t>(kUnicastRetransmissionDelay));
ExitNow(interval = Get<Mac::Mac>().GetCslPeriodMs() + static_cast<uint32_t>(kUnicastRetransmissionDelay));
}
else
#endif
Expand Down

0 comments on commit 0614ff6

Please sign in to comment.