Skip to content

Commit

Permalink
[multipan] Fix for multipan use case to handle tx timeout.
Browse files Browse the repository at this point in the history
There are two changes:
1. Address the issue of handling tx timeout in case of multipan enabled. When RCP recovery initiates due to a timeout, the SPINEL attempts to transition to the Rx state and switch channels to initialize the RCP. However, these actions should be ignored when operating as Multiprotocol RCP, as another host/protocol might be scanning, and encountering the Rx state or channel switch could result in an error. Considering such scenarios, ignore the error rather than assert it for multipan.
2. Make the CMake option OT_MULTIPAN_RCP depend on the compile time value OPENTHREAD_CONFIG_MULTIPAN_RCP_ENABLE, rather than being initialized to OFF.
  • Loading branch information
parag-silabs committed Jan 18, 2024
1 parent f75e2bb commit 60f9565
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion etc/cmake/options.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ ot_option(OT_MESH_DIAG OPENTHREAD_CONFIG_MESH_DIAG_ENABLE "mesh diag")
ot_option(OT_MESSAGE_USE_HEAP OPENTHREAD_CONFIG_MESSAGE_USE_HEAP_ENABLE "heap allocator for message buffers")
ot_option(OT_MLE_LONG_ROUTES OPENTHREAD_CONFIG_MLE_LONG_ROUTES_ENABLE "MLE long routes extension (experimental)")
ot_option(OT_MLR OPENTHREAD_CONFIG_MLR_ENABLE "Multicast Listener Registration (MLR)")
ot_option(OT_MULTIPAN_RCP OPENTHREAD_CONFIG_MULTIPAN_RCP_ENABLE "enable multi-PAN RCP")
ot_option(OT_MULTIPLE_INSTANCE OPENTHREAD_CONFIG_MULTIPLE_INSTANCE_ENABLE "multiple instances")
ot_option(OT_NAT64_BORDER_ROUTING OPENTHREAD_CONFIG_NAT64_BORDER_ROUTING_ENABLE "border routing NAT64")
ot_option(OT_NAT64_TRANSLATOR OPENTHREAD_CONFIG_NAT64_TRANSLATOR_ENABLE "NAT64 translator support")
Expand Down Expand Up @@ -248,7 +249,6 @@ ot_option(OT_UDP_FORWARD OPENTHREAD_CONFIG_UDP_FORWARD_ENABLE "UDP forward")
ot_option(OT_UPTIME OPENTHREAD_CONFIG_UPTIME_ENABLE "uptime")

option(OT_DOC "build OpenThread documentation")
option(OT_MULTIPAN_RCP "Multi-PAN RCP" OFF)
message(STATUS "- - - - - - - - - - - - - - - - ")

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Expand Down
15 changes: 15 additions & 0 deletions src/lib/spinel/radio_spinel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2128,12 +2128,22 @@ void RadioSpinel::RecoverFromRcpFailure(void)
case kStateSleep:
break;
case kStateReceive:
#if OPENTHREAD_CONFIG_MULTIPAN_RCP_ENABLE
// In case multiple PANs are running, don't force RCP to receive state.
IgnoreError(Set(SPINEL_PROP_MAC_RAW_STREAM_ENABLED, SPINEL_DATATYPE_BOOL_S, true));
#else
SuccessOrDie(Set(SPINEL_PROP_MAC_RAW_STREAM_ENABLED, SPINEL_DATATYPE_BOOL_S, true));
#endif
mState = kStateReceive;
break;
case kStateTransmitting:
case kStateTransmitDone:
#if OPENTHREAD_CONFIG_MULTIPAN_RCP_ENABLE
// In case multiple PANs are running, don't force RCP to receive state.
IgnoreError(Set(SPINEL_PROP_MAC_RAW_STREAM_ENABLED, SPINEL_DATATYPE_BOOL_S, true));
#else
SuccessOrDie(Set(SPINEL_PROP_MAC_RAW_STREAM_ENABLED, SPINEL_DATATYPE_BOOL_S, true));
#endif
mTxError = OT_ERROR_ABORT;
mState = kStateTransmitDone;
break;
Expand All @@ -2158,7 +2168,12 @@ void RadioSpinel::RestoreProperties(void)
SuccessOrDie(Set(SPINEL_PROP_MAC_15_4_PANID, SPINEL_DATATYPE_UINT16_S, mPanId));
SuccessOrDie(Set(SPINEL_PROP_MAC_15_4_SADDR, SPINEL_DATATYPE_UINT16_S, mShortAddress));
SuccessOrDie(Set(SPINEL_PROP_MAC_15_4_LADDR, SPINEL_DATATYPE_EUI64_S, mExtendedAddress.m8));
#if OPENTHREAD_CONFIG_MULTIPAN_RCP_ENABLE
// In case multiple PANs are running, don't force RCP to change channel.
IgnoreError(Set(SPINEL_PROP_PHY_CHAN, SPINEL_DATATYPE_UINT8_S, mChannel));
#else
SuccessOrDie(Set(SPINEL_PROP_PHY_CHAN, SPINEL_DATATYPE_UINT8_S, mChannel));
#endif

if (mMacKeySet)
{
Expand Down

0 comments on commit 60f9565

Please sign in to comment.