[low-power] use correct CslFrameRequestAhead for scheduling CSL transmission (#5764)

This commit is contained in:
Jintao Lin
2020-11-02 22:06:16 -08:00
committed by GitHub
parent abdf275126
commit f886f34d00
2 changed files with 4 additions and 6 deletions
+3 -5
View File
@@ -75,9 +75,7 @@ void CslTxScheduler::InitFrameRequestAhead(void)
// longest frame on bus is 127 bytes with some metadata, use 150 bytes for bus Tx time estimation
uint32_t busTxTimeUs = ((busSpeedHz == 0) ? 0 : (150 * 8 * 1000000 + busSpeedHz - 1) / busSpeedHz);
// Use ceiling to get next closest integer
mCslFrameRequestAhead =
(OPENTHREAD_CONFIG_MAC_CSL_REQUEST_AHEAD_US + busTxTimeUs + kUsPerTenSymbols - 1) / kUsPerTenSymbols;
mCslFrameRequestAheadUs = OPENTHREAD_CONFIG_MAC_CSL_REQUEST_AHEAD_US + busTxTimeUs;
}
void CslTxScheduler::Update(void)
@@ -161,11 +159,11 @@ uint32_t CslTxScheduler::GetNextCslTransmissionDelay(const Child &aChild,
uint64_t firstTxWindow = aChild.GetLastRxTimestamp() + aChild.GetCslPhase() * kUsPerTenSymbols;
uint64_t nextTxWindow = aRadioNow - (aRadioNow % periodInUs) + (firstTxWindow % periodInUs);
while (aRadioNow + mCslFrameRequestAhead >= nextTxWindow) nextTxWindow += periodInUs;
while (aRadioNow + mCslFrameRequestAheadUs >= nextTxWindow) nextTxWindow += periodInUs;
aDelayFromLastRx = static_cast<uint32_t>(nextTxWindow - aChild.GetLastRxTimestamp());
return static_cast<uint32_t>(nextTxWindow - aRadioNow);
return static_cast<uint32_t>(nextTxWindow - aRadioNow - mCslFrameRequestAheadUs);
}
otError CslTxScheduler::HandleFrameRequest(Mac::TxFrame &aFrame)
+1 -1
View File
@@ -202,7 +202,7 @@ private:
void HandleSentFrame(const Mac::TxFrame &aFrame, otError aError, Child &aChild);
uint32_t mCslFrameRequestAhead;
uint32_t mCslFrameRequestAheadUs;
Child * mCslTxChild;
Message * mCslTxMessage;
Callbacks::FrameContext mFrameContext;