Skip to content

Commit

Permalink
[rcp] always support sleep-to-tx capability (openthread#10856)
Browse files Browse the repository at this point in the history
This commit declares sleep-to-tx capability on RCP side so that the host
doesn't need to issue Receive() before Transmit().
  • Loading branch information
bukepo authored Oct 24, 2024
1 parent 2935435 commit 7886083
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
4 changes: 4 additions & 0 deletions src/core/mac/sub_mac.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,10 @@ otRadioCaps SubMac::GetCaps(void) const
caps |= OT_RADIO_CAPS_RX_ON_WHEN_IDLE;
#endif

#if OPENTHREAD_RADIO
caps |= OT_RADIO_CAPS_SLEEP_TO_TX;
#endif

#else
caps = OT_RADIO_CAPS_ACK_TIMEOUT | OT_RADIO_CAPS_CSMA_BACKOFF | OT_RADIO_CAPS_TRANSMIT_RETRIES |
OT_RADIO_CAPS_ENERGY_SCAN | OT_RADIO_CAPS_TRANSMIT_SEC | OT_RADIO_CAPS_TRANSMIT_TIMING |
Expand Down
5 changes: 0 additions & 5 deletions tests/gtest/radio_spinel_rcp_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ TEST(RadioSpinelTransmit, shouldPassDesiredTxPowerToRadioPlatform)
.Times(1);

ASSERT_EQ(platform.mRadioSpinel.Enable(FakePlatform::CurrentInstance()), kErrorNone);
ASSERT_EQ(platform.mRadioSpinel.Receive(11), kErrorNone);
ASSERT_EQ(platform.mRadioSpinel.Transmit(txFrame), kErrorNone);

platform.GoInMs(1000);
Expand Down Expand Up @@ -129,7 +128,6 @@ TEST(RadioSpinelTransmit, shouldCauseSwitchingToRxChannelAfterTxDone)
txFrame.mInfo.mTxInfo.mRxChannelAfterTxDone = 25;

ASSERT_EQ(platform.mRadioSpinel.Enable(FakePlatform::CurrentInstance()), kErrorNone);
ASSERT_EQ(platform.mRadioSpinel.Receive(11), kErrorNone);
ASSERT_EQ(platform.mRadioSpinel.Transmit(txFrame), kErrorNone);
platform.GoInMs(1000);
EXPECT_EQ(platform.GetReceiveChannel(), 25);
Expand Down Expand Up @@ -186,7 +184,6 @@ TEST(RadioSpinelTransmit, shouldSkipCsmaCaWhenDisabled)
EXPECT_CALL(platform, Receive(11)).Times(1);

ASSERT_EQ(platform.mRadioSpinel.Enable(FakePlatform::CurrentInstance()), kErrorNone);
ASSERT_EQ(platform.mRadioSpinel.Receive(12), kErrorNone);
ASSERT_EQ(platform.mRadioSpinel.Transmit(txFrame), kErrorNone);

platform.GoInMs(1000);
Expand Down Expand Up @@ -237,14 +234,12 @@ TEST(RadioSpinelTransmit, shouldPerformCsmaCaWhenEnabled)
})))
.Times(1);

EXPECT_CALL(platform, Receive).Times(AnyNumber());
// Receive(11) will be called exactly twice:
// 1. one time to prepare for TX because the fake platform doesn't support sleep-to-tx capability.
// 2. one time in CSMA backoff because rx-on-when-idle is true.
EXPECT_CALL(platform, Receive(11)).Times(2);

ASSERT_EQ(platform.mRadioSpinel.Enable(FakePlatform::CurrentInstance()), kErrorNone);
ASSERT_EQ(platform.mRadioSpinel.Receive(12), kErrorNone);
ASSERT_EQ(platform.mRadioSpinel.Transmit(txFrame), kErrorNone);

platform.GoInMs(1000);
Expand Down

0 comments on commit 7886083

Please sign in to comment.