Skip to content

Commit

Permalink
[data-poll-handler] reset tx attempts when replacing a frame (openthr…
Browse files Browse the repository at this point in the history
…ead#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.
  • Loading branch information
edmont committed Sep 5, 2023
1 parent a0a9cf2 commit c6bece0
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
19 changes: 13 additions & 6 deletions src/core/mac/data_poll_handler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ void DataPollHandler::RequestFrameChange(FrameChange aChange, Child &aChild)
}
else
{
ResetTxAttempts(aChild);
mCallbacks.HandleFrameChangeDone(aChild);
}
}
Expand Down Expand Up @@ -235,18 +236,15 @@ void DataPollHandler::HandleSentFrame(const Mac::TxFrame &aFrame, Error aError,
{
aChild.SetFramePurgePending(false);
aChild.SetFrameReplacePending(false);
aChild.ResetIndirectTxAttempts();
ResetTxAttempts(aChild);
mCallbacks.HandleFrameChangeDone(aChild);
ExitNow();
}

switch (aError)
{
case kErrorNone:
aChild.ResetIndirectTxAttempts();
#if OPENTHREAD_CONFIG_MAC_CSL_TRANSMITTER_ENABLE
aChild.ResetCslTxAttempts();
#endif
ResetTxAttempts(aChild);
aChild.SetFrameReplacePending(false);
break;

Expand All @@ -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();
}
Expand Down Expand Up @@ -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
1 change: 1 addition & 0 deletions src/core/mac/data_poll_handler.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit c6bece0

Please sign in to comment.