From c6bece0729f0c962766ccbf01d2178e984c9f8d4 Mon Sep 17 00:00:00 2001 From: Eduardo Montoya Date: Tue, 5 Sep 2023 19:48:03 +0200 Subject: [PATCH] [data-poll-handler] reset tx attempts when replacing a frame (#9397) Whenever an indirect/CSL transmitted frame is being purged or replaced, make sure that both indirect and CSL transmission attempts counts are reset in order to avoid issues like considering a new frame as a retransmission. --- src/core/mac/data_poll_handler.cpp | 19 +++++++++++++------ src/core/mac/data_poll_handler.hpp | 1 + 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/core/mac/data_poll_handler.cpp b/src/core/mac/data_poll_handler.cpp index b5033180345..d832c1c7991 100644 --- a/src/core/mac/data_poll_handler.cpp +++ b/src/core/mac/data_poll_handler.cpp @@ -121,6 +121,7 @@ void DataPollHandler::RequestFrameChange(FrameChange aChange, Child &aChild) } else { + ResetTxAttempts(aChild); mCallbacks.HandleFrameChangeDone(aChild); } } @@ -235,7 +236,7 @@ void DataPollHandler::HandleSentFrame(const Mac::TxFrame &aFrame, Error aError, { aChild.SetFramePurgePending(false); aChild.SetFrameReplacePending(false); - aChild.ResetIndirectTxAttempts(); + ResetTxAttempts(aChild); mCallbacks.HandleFrameChangeDone(aChild); ExitNow(); } @@ -243,10 +244,7 @@ void DataPollHandler::HandleSentFrame(const Mac::TxFrame &aFrame, Error aError, switch (aError) { case kErrorNone: - aChild.ResetIndirectTxAttempts(); -#if OPENTHREAD_CONFIG_MAC_CSL_TRANSMITTER_ENABLE - aChild.ResetCslTxAttempts(); -#endif + ResetTxAttempts(aChild); aChild.SetFrameReplacePending(false); break; @@ -265,7 +263,7 @@ void DataPollHandler::HandleSentFrame(const Mac::TxFrame &aFrame, Error aError, if (aChild.IsFrameReplacePending()) { aChild.SetFrameReplacePending(false); - aChild.ResetIndirectTxAttempts(); + ResetTxAttempts(aChild); mCallbacks.HandleFrameChangeDone(aChild); ExitNow(); } @@ -330,6 +328,15 @@ void DataPollHandler::ProcessPendingPolls(void) } } +void DataPollHandler::ResetTxAttempts(Child &aChild) +{ + aChild.ResetIndirectTxAttempts(); + +#if OPENTHREAD_CONFIG_MAC_CSL_TRANSMITTER_ENABLE + aChild.ResetCslTxAttempts(); +#endif +} + } // namespace ot #endif // #if OPENTHREAD_FTD diff --git a/src/core/mac/data_poll_handler.hpp b/src/core/mac/data_poll_handler.hpp index da7f744b76e..0bc58d3e839 100644 --- a/src/core/mac/data_poll_handler.hpp +++ b/src/core/mac/data_poll_handler.hpp @@ -275,6 +275,7 @@ class DataPollHandler : public InstanceLocator, private NonCopyable void HandleSentFrame(const Mac::TxFrame &aFrame, Error aError, Child &aChild); void ProcessPendingPolls(void); + void ResetTxAttempts(Child &aChild); // In the current implementation of `DataPollHandler`, we can have a // single indirect tx operation active at MAC layer at each point of