diff --git a/src/wifi/model/eht/default-emlsr-manager.cc b/src/wifi/model/eht/default-emlsr-manager.cc index cd2b39ae2..dd229bd3e 100644 --- a/src/wifi/model/eht/default-emlsr-manager.cc +++ b/src/wifi/model/eht/default-emlsr-manager.cc @@ -51,6 +51,13 @@ DefaultEmlsrManager::GetTypeId() "no PHY will be listening on that EMLSR link).", BooleanValue(true), MakeBooleanAccessor(&DefaultEmlsrManager::m_switchAuxPhy), + MakeBooleanChecker()) + .AddAttribute("PutAuxPhyToSleep", + "Whether Aux PHY should be put into sleep mode while the Main PHY " + "is operating on the same link as the Aux PHY (this only matters " + "when the Aux PHY does not switch channel).", + BooleanValue(true), + MakeBooleanAccessor(&DefaultEmlsrManager::m_auxPhyToSleep), MakeBooleanChecker()); return tid; } @@ -96,9 +103,9 @@ DefaultEmlsrManager::NotifyEmlsrModeChanged() } void -DefaultEmlsrManager::NotifyMainPhySwitch(uint8_t currLinkId, uint8_t nextLinkId) +DefaultEmlsrManager::NotifyMainPhySwitch(uint8_t currLinkId, uint8_t nextLinkId, Time duration) { - NS_LOG_FUNCTION(this << currLinkId << nextLinkId); + NS_LOG_FUNCTION(this << currLinkId << nextLinkId << duration.As(Time::US)); if (m_switchAuxPhy) { @@ -117,6 +124,8 @@ DefaultEmlsrManager::NotifyMainPhySwitch(uint8_t currLinkId, uint8_t nextLinkId) // the Aux PHY is not actually switching (hence no switching delay) GetStaMac()->NotifySwitchingEmlsrLink(m_auxPhyToReconnect, currLinkId, Seconds(0)); + // resume aux PHY from sleep (once reconnected to its original link) + Simulator::ScheduleNow(&WifiPhy::ResumeFromSleep, m_auxPhyToReconnect); SetCcaEdThresholdOnLinkSwitch(m_auxPhyToReconnect, currLinkId); m_auxPhyToReconnect = nullptr; } @@ -125,6 +134,13 @@ DefaultEmlsrManager::NotifyMainPhySwitch(uint8_t currLinkId, uint8_t nextLinkId) { // the main PHY is moving to a non-primary link and the aux PHY does not switch link m_auxPhyToReconnect = GetStaMac()->GetWifiPhy(nextLinkId); + + if (m_auxPhyToSleep) + { + // the main PHY is switching to takeover a TXOP; the aux PHY does not switch, + // so it can be put into sleep mode + Simulator::Schedule(duration, &WifiPhy::SetSleepMode, m_auxPhyToReconnect); + } } } diff --git a/src/wifi/model/eht/default-emlsr-manager.h b/src/wifi/model/eht/default-emlsr-manager.h index d62ee06ae..8a7c567fe 100644 --- a/src/wifi/model/eht/default-emlsr-manager.h +++ b/src/wifi/model/eht/default-emlsr-manager.h @@ -51,13 +51,16 @@ class DefaultEmlsrManager : public EmlsrManager private: void DoNotifyMgtFrameReceived(Ptr mpdu, uint8_t linkId) override; void NotifyEmlsrModeChanged() override; - void NotifyMainPhySwitch(uint8_t currLinkId, uint8_t nextLinkId) override; + void NotifyMainPhySwitch(uint8_t currLinkId, uint8_t nextLinkId, Time duration) override; void DoNotifyIcfReceived(uint8_t linkId) override; void DoNotifyUlTxopStart(uint8_t linkId) override; void DoNotifyTxopEnd(uint8_t linkId) override; - bool m_switchAuxPhy; /**< whether Aux PHY should switch channel to operate on the link on which - the Main PHY was operating before moving to the link of the Aux PHY */ + bool m_switchAuxPhy; /**< whether Aux PHY should switch channel to operate on the link on which + the Main PHY was operating before moving to the link of the Aux PHY */ + bool m_auxPhyToSleep; //!< whether Aux PHY should be put into sleep mode while the Main PHY + //!< is operating on the same link as the Aux PHY + Ptr m_auxPhyToReconnect; //!< Aux PHY the ChannelAccessManager of the link on which //!< the main PHY is operating has to connect a listener to //!< when the main PHY is back operating on its previous link diff --git a/src/wifi/model/eht/emlsr-manager.cc b/src/wifi/model/eht/emlsr-manager.cc index 08d1005be..4b5a378fe 100644 --- a/src/wifi/model/eht/emlsr-manager.cc +++ b/src/wifi/model/eht/emlsr-manager.cc @@ -620,7 +620,7 @@ EmlsrManager::SwitchMainPhy(uint8_t linkId, } SetCcaEdThresholdOnLinkSwitch(mainPhy, linkId); - NotifyMainPhySwitch(*currMainPhyLinkId, linkId); + NotifyMainPhySwitch(*currMainPhyLinkId, linkId, timeToSwitchEnd); } void diff --git a/src/wifi/model/eht/emlsr-manager.h b/src/wifi/model/eht/emlsr-manager.h index 5d6fc4961..4dc507aeb 100644 --- a/src/wifi/model/eht/emlsr-manager.h +++ b/src/wifi/model/eht/emlsr-manager.h @@ -436,8 +436,9 @@ class EmlsrManager : public Object * * \param currLinkId the ID of the link on which the main PHY is operating * \param nextLinkId the ID of the link on which the main PHY will be operating + * \param duration the channel switch duration */ - virtual void NotifyMainPhySwitch(uint8_t currLinkId, uint8_t nextLinkId) = 0; + virtual void NotifyMainPhySwitch(uint8_t currLinkId, uint8_t nextLinkId, Time duration) = 0; /** * Information about the status of the MediumSyncDelay timer associated with a link.