diff --git a/src/lib/spinel/radio_spinel.cpp b/src/lib/spinel/radio_spinel.cpp index e244d5ea8..87abaef93 100644 --- a/src/lib/spinel/radio_spinel.cpp +++ b/src/lib/spinel/radio_spinel.cpp @@ -93,6 +93,7 @@ RadioSpinel::RadioSpinel(void) , mRcpFailure(kRcpFailureNone) , mSrcMatchShortEntryCount(0) , mSrcMatchExtEntryCount(0) + , mSrcMatchEnabled(false) , mMacKeySet(false) , mCcaEnergyDetectThresholdSet(false) , mTransmitPowerSet(false) @@ -100,6 +101,7 @@ RadioSpinel::RadioSpinel(void) , mFemLnaGainSet(false) , mEnergyScanning(false) , mMacFrameCounterSet(false) + , mSrcMatchSet(false) #endif #if OPENTHREAD_CONFIG_DIAG_ENABLE , mDiagMode(false) @@ -944,7 +946,17 @@ exit: otError RadioSpinel::EnableSrcMatch(bool aEnable) { - return Set(SPINEL_PROP_MAC_SRC_MATCH_ENABLED, SPINEL_DATATYPE_BOOL_S, aEnable); + otError error; + + SuccessOrExit(error = Set(SPINEL_PROP_MAC_SRC_MATCH_ENABLED, SPINEL_DATATYPE_BOOL_S, aEnable)); + +#if OPENTHREAD_SPINEL_CONFIG_RCP_RESTORATION_MAX_COUNT > 0 + mSrcMatchSet = true; + mSrcMatchEnabled = aEnable; +#endif + +exit: + return error; } otError RadioSpinel::AddSrcMatchShortEntry(uint16_t aShortAddress) @@ -2077,6 +2089,11 @@ void RadioSpinel::RestoreProperties(void) Insert(SPINEL_PROP_MAC_SRC_MATCH_EXTENDED_ADDRESSES, SPINEL_DATATYPE_EUI64_S, mSrcMatchExtEntries[i].m8)); } + if (mSrcMatchSet) + { + SuccessOrDie(Set(SPINEL_PROP_MAC_SRC_MATCH_ENABLED, SPINEL_DATATYPE_BOOL_S, mSrcMatchEnabled)); + } + if (mCcaEnergyDetectThresholdSet) { SuccessOrDie(Set(SPINEL_PROP_PHY_CCA_THRESHOLD, SPINEL_DATATYPE_INT8_S, mCcaEnergyDetectThreshold)); diff --git a/src/lib/spinel/radio_spinel.hpp b/src/lib/spinel/radio_spinel.hpp index d053a9296..1117cfb58 100644 --- a/src/lib/spinel/radio_spinel.hpp +++ b/src/lib/spinel/radio_spinel.hpp @@ -1278,6 +1278,7 @@ private: int8_t mFemLnaGain; uint32_t mMacFrameCounter; bool mCoexEnabled : 1; + bool mSrcMatchEnabled : 1; bool mMacKeySet : 1; ///< Whether MAC key has been set. bool mCcaEnergyDetectThresholdSet : 1; ///< Whether CCA energy detect threshold has been set. @@ -1286,6 +1287,7 @@ private: bool mFemLnaGainSet : 1; ///< Whether FEM LNA gain has been set. bool mEnergyScanning : 1; ///< If fails while scanning, restarts scanning. bool mMacFrameCounterSet : 1; ///< Whether the MAC frame counter has been set. + bool mSrcMatchSet : 1; ///< Whether the source match feature has been set. #endif // OPENTHREAD_SPINEL_CONFIG_RCP_RESTORATION_MAX_COUNT > 0