[csl] ensure SubMacis informed when CSL support changes (#7918)

This commit changes `Mac::UpdateCsl()` to ensure we inform `SubMac`
and disable CSL when CSL support changes (e.g., device gets
detached). This ensures that `SubMac` internal variables (CSL period,
channel) are updated on a detach and if the device later attaches
again, we detect the change in CSL configuration and trigger the tx
of MLE Child Update Request.
This commit is contained in:
Abtin Keshavarzian
2022-07-20 15:11:34 -07:00
committed by Jonathan Hui
parent ed0334f626
commit 7b60716713
+10 -13
View File
@@ -2267,27 +2267,24 @@ exit:
#if OPENTHREAD_CONFIG_MAC_CSL_RECEIVER_ENABLE
void Mac::UpdateCsl(void)
{
uint16_t period;
uint8_t channel;
VerifyOrExit(IsCslSupported());
period = Get<Mle::Mle>().IsRxOnWhenIdle() ? 0 : GetCslPeriod();
channel = GetCslChannel() ? GetCslChannel() : mRadioChannel;
uint16_t period = IsCslEnabled() ? GetCslPeriod() : 0;
uint8_t channel = GetCslChannel() ? GetCslChannel() : mRadioChannel;
if (mLinks.UpdateCsl(period, channel, Get<Mle::Mle>().GetParent().GetRloc16(),
&Get<Mle::Mle>().GetParent().GetExtAddress()))
{
Get<DataPollSender>().RecalculatePollPeriod();
if (period)
if (Get<Mle::Mle>().IsChild())
{
Get<Mle::Mle>().ScheduleChildUpdateRequest();
Get<DataPollSender>().RecalculatePollPeriod();
if (period != 0)
{
Get<Mle::Mle>().ScheduleChildUpdateRequest();
}
}
UpdateIdleMode();
}
exit:
return;
}
void Mac::SetCslChannel(uint8_t aChannel)