[low-power] frame pending bit handling for enh-ack in simulation (#5853)

MAC command frame has its command ID encrypted in frame version
802.15.4-2015. Radio driver cannot decrypt this frame payload without
extended address. So the frame pending bit is not correctly set in the
ACK in response to data request command with version 2015. This commit
adds a special handling for frame version 2015 and only checks the
frame type when deciding if it needs to set the frame pending bit.
This commit is contained in:
Jintao Lin
2020-11-24 17:37:21 -08:00
committed by GitHub
parent 6918698345
commit b6e2c2c970
4 changed files with 23 additions and 3 deletions
+2 -1
View File
@@ -830,7 +830,8 @@ void radioSendAck(void)
if (
#if OPENTHREAD_CONFIG_THREAD_VERSION >= OT_THREAD_VERSION_1_2
// Determine if frame pending should be set
(otMacFrameIsData(&sReceiveFrame) || otMacFrameIsDataRequest(&sReceiveFrame))
((otMacFrameIsVersion2015(&sReceiveFrame) && otMacFrameIsCommand(&sReceiveFrame)) ||
otMacFrameIsData(&sReceiveFrame) || otMacFrameIsDataRequest(&sReceiveFrame))
#else
otMacFrameIsDataRequest(&sReceiveFrame)
#endif
+5
View File
@@ -76,6 +76,11 @@ bool otMacFrameIsData(const otRadioFrame *aFrame)
return static_cast<const Mac::Frame *>(aFrame)->GetType() == Mac::Frame::kFcfFrameData;
}
bool otMacFrameIsCommand(const otRadioFrame *aFrame)
{
return static_cast<const Mac::Frame *>(aFrame)->GetType() == Mac::Frame::kFcfFrameMacCmd;
}
bool otMacFrameIsDataRequest(const otRadioFrame *aFrame)
{
return static_cast<const Mac::Frame *>(aFrame)->IsDataRequestCommand();
+13 -1
View File
@@ -91,10 +91,22 @@ bool otMacFrameIsAck(const otRadioFrame *aFrame);
bool otMacFrameIsData(const otRadioFrame *aFrame);
/**
* Check if @p aFrame is an Data Request Command.
* Check if @p aFrame is a Command frame.
*
* @param[in] aFrame A pointer to the frame.
*
* @retval true It is a Command frame.
* @retval false It is not a Command frame.
*
*/
bool otMacFrameIsCommand(const otRadioFrame *aFrame);
/**
* Check if @p aFrame is a Data Request Command.
*
* @param[in] aFrame A pointer to the frame. For 802.15.4-2015 and above frame,
* the frame should be already decrypted.
*
* @retval true It is a Data Request Command frame.
* @retval false It is not a Data Request Command frame.
*
+3 -1
View File
@@ -733,7 +733,9 @@ public:
otError SetCommandId(uint8_t aCommandId);
/**
* This method indicates whether the frame is a MAC Data Request command (data poll)
* This method indicates whether the frame is a MAC Data Request command (data poll).
*
* For 802.15.4-2015 and above frame, the frame should be already decrypted.
*
* @returns TRUE if frame is a MAC Data Request command, FALSE otherwise.
*