From 7d6b267751b82e08c017e9ad592fe0c50de01e6f Mon Sep 17 00:00:00 2001 From: Stefano Avallone Date: Thu, 20 Feb 2025 16:52:30 +0100 Subject: [PATCH] wifi: EMLSR Manager relies on CAM for resetting backoffs when no PHY on link --- src/wifi/model/eht/advanced-emlsr-manager.cc | 10 ++------ src/wifi/model/eht/default-emlsr-manager.cc | 13 ++-------- src/wifi/model/eht/emlsr-manager.cc | 25 +------------------- src/wifi/model/eht/emlsr-manager.h | 5 ---- src/wifi/test/wifi-emlsr-test.cc | 1 - 5 files changed, 5 insertions(+), 49 deletions(-) diff --git a/src/wifi/model/eht/advanced-emlsr-manager.cc b/src/wifi/model/eht/advanced-emlsr-manager.cc index 4b06072ee..b4ff20363 100644 --- a/src/wifi/model/eht/advanced-emlsr-manager.cc +++ b/src/wifi/model/eht/advanced-emlsr-manager.cc @@ -364,7 +364,7 @@ AdvancedEmlsrManager::DoNotifyTxopEnd(uint8_t linkId) !m_switchAuxPhy || m_mainPhySwitchInfo.end >= Simulator::Now(), "Aux PHY next link ID should have a value when interrupting a main PHY switch"); uint8_t nextLinkId = m_switchAuxPhy ? m_mainPhySwitchInfo.from : GetMainPhyId(); - SwitchMainPhy(nextLinkId, false, DONT_RESET_BACKOFF, REQUEST_ACCESS, std::move(*traceInfo)); + SwitchMainPhy(nextLinkId, false, REQUEST_ACCESS, std::move(*traceInfo)); } else { @@ -381,11 +381,7 @@ AdvancedEmlsrManager::DoNotifyTxopEnd(uint8_t linkId) // no TXOP started on another link (which will require the main PHY to switch link) if (!GetEhtFem(linkId)->UsingOtherEmlsrLink()) { - SwitchMainPhy(GetMainPhyId(), - false, - DONT_RESET_BACKOFF, - REQUEST_ACCESS, - std::move(*traceInfo)); + SwitchMainPhy(GetMainPhyId(), false, REQUEST_ACCESS, std::move(*traceInfo)); } }); } @@ -760,7 +756,6 @@ AdvancedEmlsrManager::SwitchMainPhyIfTxopGainedByAuxPhy(uint8_t linkId, AcIndex SwitchMainPhy(linkId, false, - RESET_BACKOFF, DONT_REQUEST_ACCESS, EmlsrUlTxopAuxPhyNotTxCapableTrace(aci, Time{0}, remNav)); @@ -917,7 +912,6 @@ AdvancedEmlsrManager::SwitchMainPhyIfTxopToBeGainedByAuxPhy(uint8_t linkId, SwitchMainPhy(linkId, false, - RESET_BACKOFF, DONT_REQUEST_ACCESS, EmlsrUlTxopAuxPhyNotTxCapableTrace(aci, delay, remNav)); diff --git a/src/wifi/model/eht/default-emlsr-manager.cc b/src/wifi/model/eht/default-emlsr-manager.cc index 118d13e95..8e29d603f 100644 --- a/src/wifi/model/eht/default-emlsr-manager.cc +++ b/src/wifi/model/eht/default-emlsr-manager.cc @@ -263,7 +263,6 @@ DefaultEmlsrManager::SwitchMainPhyBackToPreferredLink(uint8_t linkId, { SwitchMainPhy(GetMainPhyId(), false, - DONT_RESET_BACKOFF, REQUEST_ACCESS, std::forward(traceInfo)); } @@ -275,11 +274,7 @@ DefaultEmlsrManager::SwitchMainPhyBackToPreferredLink(uint8_t linkId, // require the main PHY to switch link) if (!GetEhtFem(linkId)->UsingOtherEmlsrLink()) { - SwitchMainPhy(GetMainPhyId(), - false, - DONT_RESET_BACKOFF, - REQUEST_ACCESS, - std::move(*info)); + SwitchMainPhy(GetMainPhyId(), false, REQUEST_ACCESS, std::move(*info)); } }); } @@ -395,11 +390,7 @@ DefaultEmlsrManager::NotifyRtsSent(uint8_t linkId, NS_LOG_DEBUG("Schedule main Phy switch in " << delay.As(Time::US)); m_ulMainPhySwitch[linkId] = Simulator::Schedule(delay, [=, this]() { - SwitchMainPhy(linkId, - false, - RESET_BACKOFF, - DONT_REQUEST_ACCESS, - EmlsrUlTxopRtsSentByAuxPhyTrace{}); + SwitchMainPhy(linkId, false, DONT_REQUEST_ACCESS, EmlsrUlTxopRtsSentByAuxPhyTrace{}); }); } diff --git a/src/wifi/model/eht/emlsr-manager.cc b/src/wifi/model/eht/emlsr-manager.cc index 75b4223a8..70905cc6c 100644 --- a/src/wifi/model/eht/emlsr-manager.cc +++ b/src/wifi/model/eht/emlsr-manager.cc @@ -507,7 +507,6 @@ EmlsrManager::NotifyIcfReceived(uint8_t linkId) { SwitchMainPhy(linkId, true, // channel switch should occur instantaneously - RESET_BACKOFF, DONT_REQUEST_ACCESS, EmlsrDlTxopIcfReceivedByAuxPhyTrace{}); } @@ -873,12 +872,10 @@ EmlsrManager::SetCcaEdThresholdOnLinkSwitch(Ptr phy, uint8_t linkId) void EmlsrManager::SwitchMainPhy(uint8_t linkId, bool noSwitchDelay, - bool resetBackoff, bool requestAccess, EmlsrMainPhySwitchTrace&& traceInfo) { - NS_LOG_FUNCTION(this << linkId << noSwitchDelay << resetBackoff << requestAccess - << traceInfo.GetName()); + NS_LOG_FUNCTION(this << linkId << noSwitchDelay << requestAccess << traceInfo.GetName()); auto mainPhy = m_staMac->GetDevice()->GetPhy(m_mainPhyId); @@ -947,12 +944,6 @@ EmlsrManager::SwitchMainPhy(uint8_t linkId, m_staMac->NotifySwitchingEmlsrLink(mainPhy, linkId, timeToSwitchEnd); } - if (resetBackoff && currMainPhyLinkId.has_value()) - { - // reset the backoffs on the link left by the main PHY - m_staMac->GetChannelAccessManager(*currMainPhyLinkId)->ResetAllBackoffs(); - } - if (requestAccess) { // schedule channel access request on the new link when switch is completed @@ -1346,20 +1337,6 @@ EmlsrManager::ApplyMaxChannelWidthAndModClassOnAuxPhys() auxPhy->SetAttribute("ChannelSwitchDelay", TimeValue(Time{0})); auxPhy->SetOperatingChannel(channel); auxPhy->SetAttribute("ChannelSwitchDelay", TimeValue(delay)); - - // the way the ChannelAccessManager handles EMLSR link switch implies that a PHY listener - // is removed when the channel switch starts and another one is attached when the channel - // switch ends. In the meantime, no PHY is connected to the ChannelAccessManager. Thus, - // reset all backoffs (so that access timeout is also cancelled) when the channel switch - // starts and request channel access (if needed) when the channel switch ends. - cam->ResetAllBackoffs(); - for (const auto& [acIndex, ac] : wifiAcList) - { - m_staMac->GetQosTxop(acIndex)->StartAccessAfterEvent( - linkId, - Txop::DIDNT_HAVE_FRAMES_TO_TRANSMIT, - Txop::CHECK_MEDIUM_BUSY); - } } } diff --git a/src/wifi/model/eht/emlsr-manager.h b/src/wifi/model/eht/emlsr-manager.h index bb4d0f094..9c5e679c2 100644 --- a/src/wifi/model/eht/emlsr-manager.h +++ b/src/wifi/model/eht/emlsr-manager.h @@ -408,8 +408,6 @@ class EmlsrManager : public Object * * @param linkId the ID of the link on which the main PHY has to operate * @param noSwitchDelay whether switching delay should be zero - * @param resetBackoff whether backoff should be reset on the link on which the main PHY - * is operating * @param requestAccess whether channel access should be requested on the link on which the * main PHY is moving onto * @param traceInfo information to pass to the main PHY switch traced callback (the fromLinkId @@ -417,12 +415,9 @@ class EmlsrManager : public Object */ void SwitchMainPhy(uint8_t linkId, bool noSwitchDelay, - bool resetBackoff, bool requestAccess, EmlsrMainPhySwitchTrace&& traceInfo); - static constexpr bool RESET_BACKOFF = true; //!< reset backoff on main PHY switch - static constexpr bool DONT_RESET_BACKOFF = false; //!< do not reset backoff on main PHY switch static constexpr bool REQUEST_ACCESS = true; //!< request channel access when PHY switch ends static constexpr bool DONT_REQUEST_ACCESS = false; //!< do not request channel access when PHY switch ends diff --git a/src/wifi/test/wifi-emlsr-test.cc b/src/wifi/test/wifi-emlsr-test.cc index 235809602..d3eccced2 100644 --- a/src/wifi/test/wifi-emlsr-test.cc +++ b/src/wifi/test/wifi-emlsr-test.cc @@ -4923,7 +4923,6 @@ EmlsrCcaBusyTest::StartTraffic() m_staMacs[0]->GetEmlsrManager()->SwitchMainPhy( m_nextMainPhyLinkId, false, - EmlsrManager::DONT_RESET_BACKOFF, EmlsrManager::DONT_REQUEST_ACCESS, EmlsrDlTxopIcfReceivedByAuxPhyTrace{}); // trace info not used