mirror of
https://github.com/espressif/openthread.git
synced 2026-10-02 13:57:38 +00:00
[mac] avoid data poll timeout when a duplicate frame is received (#2563)
This commit changes how `Mac::HandleReceivedFrame()` handles duplicate received frame when a sleepy device is waiting for data after a data poll ack from parent indicating a pending frame. This change ensures that the sleepy device can go to sleep faster and avoid a data poll timeout.
This commit is contained in:
committed by
Jonathan Hui
parent
a94f8fb229
commit
00a3905fde
+31
-1
@@ -1741,7 +1741,35 @@ void Mac::HandleReceivedFrame(Frame *aFrame, otError aError)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Security Processing
|
// Security Processing
|
||||||
SuccessOrExit(error = ProcessReceiveSecurity(*aFrame, srcaddr, neighbor));
|
error = ProcessReceiveSecurity(*aFrame, srcaddr, neighbor);
|
||||||
|
|
||||||
|
switch (error)
|
||||||
|
{
|
||||||
|
case OT_ERROR_DUPLICATED:
|
||||||
|
|
||||||
|
// Allow a duplicate received frame pass, only if the
|
||||||
|
// current operation is `kOperationWaitingForData` (i.e.,
|
||||||
|
// the sleepy device is waiting to receive a frame after
|
||||||
|
// a data poll ack from parent indicating there is a
|
||||||
|
// pending frame for it). This ensures that the sleepy
|
||||||
|
// device goes to sleep faster and avoids a data poll
|
||||||
|
// timeout.
|
||||||
|
//
|
||||||
|
// Note that `error` is checked again later after the
|
||||||
|
// operation `kOperationWaitingForData` is processed
|
||||||
|
// so the duplicate frame will not be passed to any
|
||||||
|
// registered `Receiver`.
|
||||||
|
|
||||||
|
VerifyOrExit(mOperation == kOperationWaitingForData);
|
||||||
|
|
||||||
|
// Fall through
|
||||||
|
|
||||||
|
case OT_ERROR_NONE:
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
ExitNow();
|
||||||
|
}
|
||||||
|
|
||||||
if (neighbor != NULL)
|
if (neighbor != NULL)
|
||||||
{
|
{
|
||||||
@@ -1811,6 +1839,8 @@ void Mac::HandleReceivedFrame(Frame *aFrame, otError aError)
|
|||||||
FinishOperation();
|
FinishOperation();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SuccessOrExit(error);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|||||||
Reference in New Issue
Block a user