mirror of
https://github.com/espressif/openthread.git
synced 2026-08-09 12:17:47 +00:00
[spinel] drop received frames between RCP disable and reset (#9793)
Signed-off-by: Ashishkumar Vara <[email protected]>
This commit is contained in:
@@ -371,7 +371,7 @@ public:
|
||||
|
||||
aFrame = (aFrame == nullptr) ? mBuffer : aFrame + aLength;
|
||||
|
||||
if (aFrame != mWriteFrameStart)
|
||||
if (HasSavedFrame() && (aFrame != mWriteFrameStart))
|
||||
{
|
||||
uint16_t totalLength = LittleEndian::ReadUint16(aFrame + kHeaderTotalLengthOffset);
|
||||
uint16_t skipLength = LittleEndian::ReadUint16(aFrame + kHeaderSkipLengthOffset);
|
||||
|
||||
@@ -670,6 +670,9 @@ void RadioSpinel::HandleValueIs(spinel_prop_key_t aKey, const uint8_t *aBuffer,
|
||||
ExitNow();
|
||||
}
|
||||
|
||||
// this clear is necessary in case the RCP has sent messages between disable and reset
|
||||
mRxFrameBuffer.Clear();
|
||||
|
||||
LogInfo("RCP reset: %s", spinel_status_to_cstr(status));
|
||||
sIsReady = true;
|
||||
}
|
||||
|
||||
@@ -291,5 +291,7 @@ exit:
|
||||
return error;
|
||||
}
|
||||
|
||||
void Encoder::ClearNcpBuffer(void) { mNcpBuffer.Clear(); }
|
||||
|
||||
} // namespace Spinel
|
||||
} // namespace ot
|
||||
|
||||
@@ -676,6 +676,12 @@ public:
|
||||
*/
|
||||
otError ResetToSaved(void);
|
||||
|
||||
/**
|
||||
* Clear NCP buffer on reset command.
|
||||
*
|
||||
*/
|
||||
void ClearNcpBuffer(void);
|
||||
|
||||
private:
|
||||
enum
|
||||
{
|
||||
|
||||
@@ -1285,6 +1285,8 @@ otError NcpBase::CommandHandler_RESET(uint8_t aHeader)
|
||||
|
||||
ResetCounters();
|
||||
|
||||
mEncoder.ClearNcpBuffer();
|
||||
|
||||
SuccessOrAssert(error = WriteLastStatusFrame(SPINEL_HEADER_FLAG | SPINEL_HEADER_TX_NOTIFICATION_IID,
|
||||
SPINEL_STATUS_RESET_POWER_ON));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user