[mac] support frames without sequence number (#10544)

This commit adds the capability to support frames without sequence
number.
This commit is contained in:
Yakun Xu
2024-08-02 09:50:45 -07:00
committed by GitHub
parent 03113e8502
commit e219fe92f1
7 changed files with 155 additions and 41 deletions
+5 -1
View File
@@ -606,7 +606,11 @@ static void radioReceive(otInstance *aInstance)
{
if (otMacFrameIsAckRequested(&sTransmitFrame))
{
isTxDone = isAck && otMacFrameGetSequence(&sReceiveFrame) == otMacFrameGetSequence(&sTransmitFrame);
uint8_t rxSeq;
uint8_t txSeq;
isTxDone = isAck && otMacFrameGetSequence(&sReceiveFrame, &rxSeq) == OT_ERROR_NONE &&
otMacFrameGetSequence(&sTransmitFrame, &txSeq) == OT_ERROR_NONE && rxSeq == txSeq;
}
#if OPENTHREAD_SIMULATION_VIRTUAL_TIME
// Simulate tx done when receiving the echo frame.
+14 -2
View File
@@ -139,9 +139,21 @@ exit:
return error;
}
uint8_t otMacFrameGetSequence(const otRadioFrame *aFrame)
otError otMacFrameGetSequence(const otRadioFrame *aFrame, uint8_t *aSequence)
{
return static_cast<const Mac::Frame *>(aFrame)->GetSequence();
otError error;
if (static_cast<const Mac::Frame *>(aFrame)->IsSequencePresent())
{
*aSequence = static_cast<const Mac::Frame *>(aFrame)->GetSequence();
error = kErrorNone;
}
else
{
error = kErrorParse;
}
return error;
}
void otMacFrameProcessTransmitAesCcm(otRadioFrame *aFrame, const otExtAddress *aExtAddress)
+4 -2
View File
@@ -169,11 +169,13 @@ otError otMacFrameGetDstAddr(const otRadioFrame *aFrame, otMacAddress *aMacAddre
* Get the sequence of @p aFrame.
*
* @param[in] aFrame A pointer to the frame.
* @param[out] aSequence A pointer to the sequence.
*
* @returns The sequence of the frame.
* @retval OT_ERROR_NONE Successfully got the sequence.
* @retval OT_ERROR_PARSE Failed to parse the sequence.
*
*/
uint8_t otMacFrameGetSequence(const otRadioFrame *aFrame);
otError otMacFrameGetSequence(const otRadioFrame *aFrame, uint8_t *aSequence);
/**
* Performs AES CCM on the frame which is going to be sent.