[spinel] drop received frames between RCP disable and reset (#9793)

Signed-off-by: Ashishkumar Vara <[email protected]>
This commit is contained in:
Ashish
2024-02-27 16:01:29 -08:00
committed by GitHub
parent aff159f40c
commit 37fef5ed54
5 changed files with 14 additions and 1 deletions
+1 -1
View File
@@ -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);
+3
View File
@@ -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;
}
+2
View File
@@ -291,5 +291,7 @@ exit:
return error;
}
void Encoder::ClearNcpBuffer(void) { mNcpBuffer.Clear(); }
} // namespace Spinel
} // namespace ot
+6
View File
@@ -676,6 +676,12 @@ public:
*/
otError ResetToSaved(void);
/**
* Clear NCP buffer on reset command.
*
*/
void ClearNcpBuffer(void);
private:
enum
{
+2
View File
@@ -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));
}