diff --git a/src/wifi/model/eht/emlsr-manager.cc b/src/wifi/model/eht/emlsr-manager.cc index a3cc8bcde..f01d3a3bf 100644 --- a/src/wifi/model/eht/emlsr-manager.cc +++ b/src/wifi/model/eht/emlsr-manager.cc @@ -934,6 +934,28 @@ EmlsrManager::MediumSyncDelayNTxopsExceeded(uint8_t linkId) return timerIt->second.msdNTxopsLeft == 0; } +bool +EmlsrManager::GetExpectedAccessWithinDelay(uint8_t linkId, const Time& delay) const +{ + const auto deadline = Simulator::Now() + delay; + for (const auto& [acIndex, ac] : wifiAcList) + { + if (auto edca = m_staMac->GetQosTxop(acIndex); edca->HasFramesToTransmit(linkId)) + { + const auto backoffEnd = + m_staMac->GetChannelAccessManager(linkId)->GetBackoffEndFor(edca); + + if (backoffEnd <= deadline) + { + NS_LOG_DEBUG("Backoff end for " << acIndex << " on link " << +linkId << ": " + << backoffEnd.As(Time::US)); + return true; + } + } + } + return false; +} + MgtEmlOmn EmlsrManager::GetEmlOmn() { diff --git a/src/wifi/model/eht/emlsr-manager.h b/src/wifi/model/eht/emlsr-manager.h index 77da233c5..101007074 100644 --- a/src/wifi/model/eht/emlsr-manager.h +++ b/src/wifi/model/eht/emlsr-manager.h @@ -488,6 +488,17 @@ class EmlsrManager : public Object */ void CancelAllSleepEvents(); + /** + * Get whether channel access is expected to be granted on the given link within the given + * delay to an Access Category that has traffic to send on the given link. + * + * @param linkId the ID of the given link + * @param delay the given delay + * @return whether channel access is expected to be granted on the given link within the given + * delay + */ + bool GetExpectedAccessWithinDelay(uint8_t linkId, const Time& delay) const; + Time m_emlsrPaddingDelay; //!< EMLSR Padding delay Time m_emlsrTransitionDelay; //!< EMLSR Transition delay uint8_t m_mainPhyId; //!< ID of main PHY (position in the vector of PHYs held by WifiNetDevice)