diff --git a/src/wifi/model/ap-wifi-mac.cc b/src/wifi/model/ap-wifi-mac.cc index b595c4f58..f8dc297c0 100644 --- a/src/wifi/model/ap-wifi-mac.cc +++ b/src/wifi/model/ap-wifi-mac.cc @@ -1976,7 +1976,18 @@ ApWifiMac::ParseReportedStaInfo(const AssocReqRefVariant& assoc, Mac48Address fr return; } + auto emlCapabilities = std::make_shared(); + if (mle->HasEmlCapabilities()) + { + emlCapabilities->emlsrSupport = mle->IsEmlsrSupported() ? 1 : 0; + emlCapabilities->emlsrPaddingDelay = + CommonInfoBasicMle::EncodeEmlsrPaddingDelay(mle->GetEmlsrPaddingDelay()); + emlCapabilities->emlsrTransitionDelay = + CommonInfoBasicMle::EncodeEmlsrTransitionDelay(mle->GetEmlsrTransitionDelay()); + } + GetWifiRemoteStationManager(linkId)->SetMldAddress(from, mle->GetMldMacAddress()); + GetWifiRemoteStationManager(linkId)->AddStationEmlCapabilities(from, emlCapabilities); for (std::size_t i = 0; i < mle->GetNPerStaProfileSubelements(); i++) { @@ -2004,6 +2015,9 @@ ApWifiMac::ParseReportedStaInfo(const AssocReqRefVariant& assoc, Mac48Address fr newLinkId); GetWifiRemoteStationManager(newLinkId)->SetMldAddress(perStaProfile.GetStaMacAddress(), mle->GetMldMacAddress()); + GetWifiRemoteStationManager(newLinkId)->AddStationEmlCapabilities( + perStaProfile.GetStaMacAddress(), + emlCapabilities); } }; diff --git a/src/wifi/model/wifi-remote-station-manager.cc b/src/wifi/model/wifi-remote-station-manager.cc index af34129ea..fbe57f4bd 100644 --- a/src/wifi/model/wifi-remote-station-manager.cc +++ b/src/wifi/model/wifi-remote-station-manager.cc @@ -1388,6 +1388,7 @@ WifiRemoteStationManager::LookupState(Mac48Address address) const state->m_vhtCapabilities = nullptr; state->m_heCapabilities = nullptr; state->m_ehtCapabilities = nullptr; + state->m_emlCapabilities = nullptr; state->m_channelWidth = m_wifiPhy->GetChannelWidth(); state->m_guardInterval = GetGuardInterval(); state->m_ness = 0; @@ -1556,6 +1557,15 @@ WifiRemoteStationManager::AddStationEhtCapabilities(Mac48Address from, SetQosSupport(from, true); } +void +WifiRemoteStationManager::AddStationEmlCapabilities( + Mac48Address from, + const std::shared_ptr& emlCapabilities) +{ + NS_LOG_FUNCTION(this << from); + LookupState(from)->m_emlCapabilities = emlCapabilities; +} + Ptr WifiRemoteStationManager::GetStationHtCapabilities(Mac48Address from) { @@ -1580,6 +1590,12 @@ WifiRemoteStationManager::GetStationEhtCapabilities(Mac48Address from) return LookupState(from)->m_ehtCapabilities; } +std::shared_ptr +WifiRemoteStationManager::GetStationEmlCapabilities(const Mac48Address& from) +{ + return LookupState(from)->m_emlCapabilities; +} + bool WifiRemoteStationManager::GetLdpcSupported(Mac48Address address) const { @@ -1953,6 +1969,13 @@ WifiRemoteStationManager::GetEhtSupported(const WifiRemoteStation* station) cons return (bool)(station->m_state->m_ehtCapabilities); } +bool +WifiRemoteStationManager::GetEmlsrSupported(const WifiRemoteStation* station) const +{ + auto emlCapabilities = station->m_state->m_emlCapabilities; + return emlCapabilities && emlCapabilities->emlsrSupport == 1; +} + uint8_t WifiRemoteStationManager::GetNMcsSupported(const WifiRemoteStation* station) const { @@ -2054,6 +2077,13 @@ WifiRemoteStationManager::GetEhtSupported(Mac48Address address) const return (bool)(LookupState(address)->m_ehtCapabilities); } +bool +WifiRemoteStationManager::GetEmlsrSupported(const Mac48Address& address) const +{ + auto emlCapabilities = LookupState(address)->m_emlCapabilities; + return emlCapabilities && emlCapabilities->emlsrSupport == 1; +} + void WifiRemoteStationManager::SetDefaultTxPowerLevel(uint8_t txPower) { diff --git a/src/wifi/model/wifi-remote-station-manager.h b/src/wifi/model/wifi-remote-station-manager.h index 1828d0866..aa4e24cc5 100644 --- a/src/wifi/model/wifi-remote-station-manager.h +++ b/src/wifi/model/wifi-remote-station-manager.h @@ -30,6 +30,7 @@ #include "ns3/he-capabilities.h" #include "ns3/ht-capabilities.h" #include "ns3/mac48-address.h" +#include "ns3/multi-link-element.h" #include "ns3/object.h" #include "ns3/traced-callback.h" #include "ns3/vht-capabilities.h" @@ -113,6 +114,8 @@ struct WifiRemoteStationState Ptr m_vhtCapabilities; //!< remote station VHT capabilities Ptr m_heCapabilities; //!< remote station HE capabilities Ptr m_ehtCapabilities; //!< remote station EHT capabilities + /// remote station EML capabilities + std::shared_ptr m_emlCapabilities; uint16_t m_channelWidth; //!< Channel width (in MHz) supported by the remote station uint16_t m_guardInterval; //!< HE Guard interval duration (in nanoseconds) supported by the @@ -260,6 +263,15 @@ class WifiRemoteStationManager : public Object * \param ehtCapabilities the EHT capabilities of the station */ void AddStationEhtCapabilities(Mac48Address from, EhtCapabilities ehtCapabilities); + /** + * Records EML capabilities of the remote station. + * + * \param from the address of the station being recorded + * \param emlCapabilities the EML capabilities of the station + */ + void AddStationEmlCapabilities( + Mac48Address from, + const std::shared_ptr& emlCapabilities); /** * Return the HT capabilities sent by the remote station. * @@ -288,6 +300,12 @@ class WifiRemoteStationManager : public Object * \return the EHT capabilities sent by the remote station */ Ptr GetStationEhtCapabilities(Mac48Address from); + /** + * \param from the (MLD or link) address of the remote non-AP MLD + * \return the EML Capabilities advertised by the remote non-AP MLD + */ + std::shared_ptr GetStationEmlCapabilities( + const Mac48Address& from); /** * Return whether the device has HT capability support enabled. * @@ -610,6 +628,11 @@ class WifiRemoteStationManager : public Object * false otherwise */ bool GetEhtSupported(Mac48Address address) const; + /** + * \param address the (MLD or link) address of the non-AP MLD + * \return whether the non-AP MLD supports EMLSR + */ + bool GetEmlsrSupported(const Mac48Address& address) const; /** * Return a mode for non-unicast packets. @@ -1113,6 +1136,11 @@ class WifiRemoteStationManager : public Object * false otherwise */ bool GetEhtSupported(const WifiRemoteStation* station) const; + /** + * \param station the station of a non-AP MLD + * \return whether the non-AP MLD supports EMLSR + */ + bool GetEmlsrSupported(const WifiRemoteStation* station) const; /** * Return the WifiMode supported by the specified station at the specified index. *