wifi: Put Aux PHY in sleep mode if operating on the same link as the main PHY

This commit is contained in:
Stefano Avallone
2023-09-25 23:35:22 +02:00
committed by Stefano Avallone
parent 8dc920e488
commit fafd2d9306
4 changed files with 27 additions and 7 deletions

View File

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

View File

@@ -51,13 +51,16 @@ class DefaultEmlsrManager : public EmlsrManager
private:
void DoNotifyMgtFrameReceived(Ptr<const WifiMpdu> 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<WifiPhy> 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

View File

@@ -620,7 +620,7 @@ EmlsrManager::SwitchMainPhy(uint8_t linkId,
}
SetCcaEdThresholdOnLinkSwitch(mainPhy, linkId);
NotifyMainPhySwitch(*currMainPhyLinkId, linkId);
NotifyMainPhySwitch(*currMainPhyLinkId, linkId, timeToSwitchEnd);
}
void

View File

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