[radio-spinel] fix incorrect RX channel after frame TX on another channel (#6837)

This commit fixes a bug in `RadioSpinel` platform implementation where
the request from OT core stack to enter RX mode may be ignored
causing the RCP/radio to stay in RX mode on an incorrect channel.

This situation can happen after a frame TX request on a different
channel (note that the `otRadioFrame` struct specifies the channel on
which the frame should be transmitted). After frame TX, radio driver
is expected to enter RX mode on the same channel on which the frame
TX happened. The OpenThread MAC layer always explicitly instructs the
radio to enter RX mode on the PAN channel (from `Mac::UpdateIdleMode()`
which in turn calls the radio platform API `otPlatRadioRecive()` with
the channel passed in as a parameter). The earlier `RadioSpinel`
platform implementation did not update `mChannel` on a tx request
which caused the subsequent `Receive()` to skip setting the channel on
RCP if the channel was same as before.
This commit is contained in:
Abtin Keshavarzian
2021-07-26 21:46:13 -07:00
committed by GitHub
parent 6f537ca34a
commit 68e3b049b5
+3
View File
@@ -1514,6 +1514,8 @@ otError RadioSpinel<InterfaceType, ProcessContextType>::EnergyScan(uint8_t aScan
SuccessOrExit(error = Set(SPINEL_PROP_MAC_SCAN_PERIOD, SPINEL_DATATYPE_UINT16_S, aScanDuration));
SuccessOrExit(error = Set(SPINEL_PROP_MAC_SCAN_STATE, SPINEL_DATATYPE_UINT8_S, SPINEL_SCAN_STATE_ENERGY));
mChannel = aScanChannel;
exit:
return error;
}
@@ -1923,6 +1925,7 @@ otError RadioSpinel<InterfaceType, ProcessContextType>::Transmit(otRadioFrame &a
// Waiting for `TransmitDone` event.
mState = kStateTransmitting;
mTxRadioEndUs = otPlatTimeGet() + TX_WAIT_US;
mChannel = mTransmitFrame->mChannel;
}
exit: