From f2ed78770e45aa65037d59a6ec72a80bcb655774 Mon Sep 17 00:00:00 2001 From: parag-silabs <111579455+parag-silabs@users.noreply.github.com> Date: Fri, 16 Dec 2022 00:37:12 -0500 Subject: [PATCH] [rcp] fix transaction ID caching and guard max power table code (#8408) - Separate out max power table related code. - Cache the transaction ID for async response only if otLinkRawTransmit() succeeds. --- src/lib/spinel/radio_spinel_impl.hpp | 2 ++ src/ncp/ncp_base_radio.cpp | 8 ++++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/lib/spinel/radio_spinel_impl.hpp b/src/lib/spinel/radio_spinel_impl.hpp index ec6cc98d4..4c7b17e3c 100644 --- a/src/lib/spinel/radio_spinel_impl.hpp +++ b/src/lib/spinel/radio_spinel_impl.hpp @@ -2388,6 +2388,7 @@ void RadioSpinel::RestoreProperties(void) SuccessOrDie(Set(SPINEL_PROP_PHY_FEM_LNA_GAIN, SPINEL_DATATYPE_INT8_S, mFemLnaGain)); } +#if OPENTHREAD_POSIX_CONFIG_MAX_POWER_TABLE_ENABLE for (uint8_t channel = Radio::kChannelMin; channel <= Radio::kChannelMax; channel++) { int8_t power = mMaxPowerTable.GetTransmitPower(channel); @@ -2403,6 +2404,7 @@ void RadioSpinel::RestoreProperties(void) } } } +#endif // OPENTHREAD_POSIX_CONFIG_MAX_POWER_TABLE_ENABLE CalcRcpTimeOffset(); } diff --git a/src/ncp/ncp_base_radio.cpp b/src/ncp/ncp_base_radio.cpp index 975cc3fcb..58e6d0316 100644 --- a/src/ncp/ncp_base_radio.cpp +++ b/src/ncp/ncp_base_radio.cpp @@ -446,12 +446,12 @@ otError NcpBase::HandlePropertySet_SPINEL_PROP_STREAM_RAW(uint8_t aHeader) SuccessOrExit(error = DecodeStreamRawTxRequest(*frame)); - // Cache the transaction ID for async response - mCurTransmitTID = SPINEL_HEADER_GET_TID(aHeader); - // Pass frame to the radio layer. Note, this fails if we // haven't enabled raw stream or are already transmitting. - error = otLinkRawTransmit(mInstance, &NcpBase::LinkRawTransmitDone); + SuccessOrExit(error = otLinkRawTransmit(mInstance, &NcpBase::LinkRawTransmitDone)); + + // Cache the transaction ID for async response + mCurTransmitTID = SPINEL_HEADER_GET_TID(aHeader); exit: