wifi: Add an EMSLR manager method to check if channel access is expected soon

This commit is contained in:
Stefano Avallone
2024-09-28 16:32:58 +02:00
parent 9c8e2a5505
commit 37b61c25e7
2 changed files with 33 additions and 0 deletions

View File

@@ -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()
{

View File

@@ -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)