wifi: EMLSR Manager notifies STA wifi MAC of EMLSR mode changes

This commit is contained in:
Stefano Avallone
2023-03-24 11:26:53 +01:00
committed by Stefano Avallone
parent 64b90eded5
commit efec608c15
3 changed files with 50 additions and 2 deletions

View File

@@ -330,9 +330,9 @@ EmlsrManager::ChangeEmlsrMode()
m_emlsrLinks.swap(*m_nextEmlsrLinks);
m_nextEmlsrLinks.reset();
// TODO Make other non-AP STAs operating on the corresponding EMLSR links transition to
// Make other non-AP STAs operating on the corresponding EMLSR links transition to
// active mode or passive mode (depending on whether EMLSR mode has been enabled or disabled)
m_staMac->NotifyEmlsrModeChanged(m_emlsrLinks);
NotifyEmlsrModeChanged();
}

View File

@@ -288,6 +288,39 @@ StaWifiMac::GetCurrentChannel(uint8_t linkId) const
return {ch, phy->GetPhyBand()};
}
void
StaWifiMac::NotifyEmlsrModeChanged(const std::set<uint8_t>& linkIds)
{
NS_LOG_FUNCTION(this << linkIds.size());
for (const auto& [linkId, lnk] : GetLinks())
{
auto& link = GetStaLink(lnk);
if (linkIds.count(linkId) > 0)
{
// EMLSR mode enabled
link.emlsrEnabled = true;
link.pmMode = WIFI_PM_ACTIVE;
}
else
{
// EMLSR mode disabled
if (link.emlsrEnabled)
{
link.pmMode = WIFI_PM_POWERSAVE;
}
link.emlsrEnabled = false;
}
}
}
bool
StaWifiMac::IsEmlsrLink(uint8_t linkId) const
{
return GetLink(linkId).emlsrEnabled;
}
void
StaWifiMac::SendProbeRequest(uint8_t linkId)
{

View File

@@ -294,6 +294,20 @@ class StaWifiMac : public WifiMac
void NotifyChannelSwitching(uint8_t linkId) override;
/**
* Notify the MAC that EMLSR mode has changed on the given set of links.
*
* \param linkIds the IDs of the links that are now EMLSR links (EMLSR mode is disabled
* on other links)
*/
void NotifyEmlsrModeChanged(const std::set<uint8_t>& linkIds);
/**
* \param linkId the ID of the given link
* \return whether the EMLSR mode is enabled on the given link
*/
bool IsEmlsrLink(uint8_t linkId) const;
/**
* Assign a fixed random variable stream number to the random variables
* used by this model. Return the number of streams (possibly zero) that
@@ -324,6 +338,7 @@ class StaWifiMac : public WifiMac
WifiPowerManagementMode pmMode{WIFI_PM_ACTIVE}; /**< the current PM mode, if the STA is
associated, or the PM mode to switch
to upon association, otherwise */
bool emlsrEnabled{false}; //!< whether EMLSR mode is enabled on this link
};
/**