aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAbtin Keshavarzian <abtink@google.com>2022-07-19 15:55:59 -0700
committerJonathan Hui <jonhui@google.com>2022-07-20 15:11:34 -0700
commit7b6071671304b5b6bb1fdcd6b8b845f568b6c4f5 (patch)
treec3c98be710314f4379ef0ae71d2f32ed1a935e00
parented0334f626db27752800a5d324936b4870e38cb8 (diff)
downloadopenthread-7b6071671304b5b6bb1fdcd6b8b845f568b6c4f5.tar.gz
[csl] ensure `SubMac`is 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.
-rw-r--r--src/core/mac/mac.cpp23
1 files changed, 10 insertions, 13 deletions
diff --git a/src/core/mac/mac.cpp b/src/core/mac/mac.cpp
index dbe3c974a..8ad0518fe 100644
--- a/src/core/mac/mac.cpp
+++ b/src/core/mac/mac.cpp
@@ -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)