[csl] update CSL information in radio when parent changes (#7911)

Cover the case of parent change while the CSL child is still attached.
This commit is contained in:
Eduardo Montoya
2022-07-18 14:12:20 -07:00
committed by GitHub
parent ec96609070
commit a68cd059cc
2 changed files with 7 additions and 3 deletions
+6 -3
View File
@@ -97,6 +97,7 @@ void SubMac::Init(void)
#if OPENTHREAD_CONFIG_MAC_CSL_RECEIVER_ENABLE
mCslPeriod = 0;
mCslChannel = 0;
mCslPeerShort = 0;
mIsCslSampling = false;
mCslSampleTime = TimeMicro{0};
mCslLastSync = TimeMicro{0};
@@ -1051,13 +1052,15 @@ bool SubMac::UpdateCsl(uint16_t aPeriod, uint8_t aChannel, otShortAddress aShort
{
bool diffPeriod = aPeriod != mCslPeriod;
bool diffChannel = aChannel != mCslChannel;
bool retval = diffPeriod || diffChannel;
bool diffPeer = aShortAddr != mCslPeerShort;
bool retval = diffPeriod || diffChannel || diffPeer;
VerifyOrExit(retval);
mCslChannel = aChannel;
VerifyOrExit(diffPeriod);
mCslPeriod = aPeriod;
VerifyOrExit(diffPeriod || diffPeer);
mCslPeriod = aPeriod;
mCslPeerShort = aShortAddr;
IgnoreError(Get<Radio>().EnableCsl(aPeriod, aShortAddr, aExtAddr));
mCslTimer.Stop();
+1
View File
@@ -662,6 +662,7 @@ private:
uint8_t mCslChannel : 7; // The CSL sample channel.
bool mIsCslSampling : 1; // Indicates that the radio is receiving in CSL state for platforms not supporting delayed
// reception.
uint16_t mCslPeerShort; // The CSL peer short address.
TimeMicro mCslSampleTime; // The CSL sample time of the current period.
TimeMicro mCslLastSync; // The timestamp of the last successful CSL synchronization.
uint8_t mCslParentAccuracy; // Drift of timer used for scheduling CSL tx by the parent, in ± ppm.