wifi: Store the whole MLE Common Info field in remote station manager

This commit is contained in:
Stefano Avallone
2023-05-14 19:27:12 +02:00
committed by Stefano Avallone
parent c0ce2ea2b7
commit 8601e3a0ef
5 changed files with 40 additions and 36 deletions

View File

@@ -1995,18 +1995,9 @@ ApWifiMac::ParseReportedStaInfo(const AssocReqRefVariant& assoc, Mac48Address fr
return;
}
auto emlCapabilities = std::make_shared<CommonInfoBasicMle::EmlCapabilities>();
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);
auto mleCommonInfo = std::make_shared<CommonInfoBasicMle>(mle->GetCommonInfoBasic());
GetWifiRemoteStationManager(linkId)->AddStationMleCommonInfo(from, mleCommonInfo);
for (std::size_t i = 0; i < mle->GetNPerStaProfileSubelements(); i++)
{
@@ -2034,9 +2025,9 @@ ApWifiMac::ParseReportedStaInfo(const AssocReqRefVariant& assoc, Mac48Address fr
newLinkId);
GetWifiRemoteStationManager(newLinkId)->SetMldAddress(perStaProfile.GetStaMacAddress(),
mle->GetMldMacAddress());
GetWifiRemoteStationManager(newLinkId)->AddStationEmlCapabilities(
GetWifiRemoteStationManager(newLinkId)->AddStationMleCommonInfo(
perStaProfile.GetStaMacAddress(),
emlCapabilities);
mleCommonInfo);
}
};
@@ -2070,8 +2061,8 @@ ApWifiMac::ReceiveEmlNotification(MgtEmlOperatingModeNotification& frame,
NS_ASSERT_MSG(emlCapabilities, "EML Capabilities not stored for STA " << sender);
// update values stored in remote station manager
emlCapabilities->emlsrPaddingDelay = frame.m_emlsrParamUpdate->paddingDelay;
emlCapabilities->emlsrTransitionDelay = frame.m_emlsrParamUpdate->transitionDelay;
emlCapabilities->get().emlsrPaddingDelay = frame.m_emlsrParamUpdate->paddingDelay;
emlCapabilities->get().emlsrTransitionDelay = frame.m_emlsrParamUpdate->transitionDelay;
}
auto mldAddress = GetWifiRemoteStationManager(linkId)->GetMldAddress(sender);

View File

@@ -218,7 +218,7 @@ EhtFrameExchangeManager::EmlsrSwitchToListening(const Mac48Address& address, con
// unblock all EMLSR links when the transition delay elapses
Simulator::Schedule(delay + CommonInfoBasicMle::DecodeEmlsrTransitionDelay(
emlCapabilities->emlsrTransitionDelay),
emlCapabilities->get().emlsrTransitionDelay),
[=]() {
m_mac->UnblockUnicastTxOnLinks(
WifiQueueBlockedReason::WAITING_EMLSR_TRANSITION_DELAY,
@@ -311,7 +311,7 @@ EhtFrameExchangeManager::SendMuRts(const WifiTxParameters& txParams)
auto emlCapabilities = GetWifiRemoteStationManager()->GetStationEmlCapabilities(address);
NS_ASSERT(emlCapabilities);
maxPaddingDelay = std::max(maxPaddingDelay, emlCapabilities->emlsrPaddingDelay);
maxPaddingDelay = std::max(maxPaddingDelay, emlCapabilities->get().emlsrPaddingDelay);
auto mldAddress = GetWifiRemoteStationManager()->GetMldAddress(address);
NS_ASSERT(mldAddress);

View File

@@ -616,6 +616,7 @@ StaWifiMac::ScanningTimeout(const std::optional<ApInfo>& bestAp)
// send Association Request on the link where the Beacon/Probe Response was received
GetLink(bestAp->m_linkId).sendAssocReq = true;
GetLink(bestAp->m_linkId).bssid = bestAp->m_bssid;
std::shared_ptr<CommonInfoBasicMle> mleCommonInfo;
// update info on links to setup (11be MLDs only)
const auto& mle =
std::visit([](auto&& frame) { return frame.template Get<MultiLinkElement>(); },
@@ -628,6 +629,11 @@ StaWifiMac::ScanningTimeout(const std::optional<ApInfo>& bestAp)
GetLink(localLinkId).apLinkId = apLinkId;
GetLink(localLinkId).bssid = bssid;
GetWifiRemoteStationManager(localLinkId)->SetMldAddress(bssid, mle->GetMldMacAddress());
if (!mleCommonInfo)
{
mleCommonInfo = std::make_shared<CommonInfoBasicMle>(mle->GetCommonInfoBasic());
}
GetWifiRemoteStationManager(localLinkId)->AddStationMleCommonInfo(bssid, mleCommonInfo);
}
// lambda to get beacon interval from Beacon or Probe Response
auto getBeaconInterval = [](auto&& frame) {

View File

@@ -1422,7 +1422,7 @@ WifiRemoteStationManager::LookupState(Mac48Address address) const
state->m_vhtCapabilities = nullptr;
state->m_heCapabilities = nullptr;
state->m_ehtCapabilities = nullptr;
state->m_emlCapabilities = nullptr;
state->m_mleCommonInfo = nullptr;
state->m_emlsrEnabled = false;
state->m_channelWidth = m_wifiPhy->GetChannelWidth();
state->m_guardInterval = GetGuardInterval();
@@ -1600,12 +1600,12 @@ WifiRemoteStationManager::AddStationEhtCapabilities(Mac48Address from,
}
void
WifiRemoteStationManager::AddStationEmlCapabilities(
WifiRemoteStationManager::AddStationMleCommonInfo(
Mac48Address from,
const std::shared_ptr<CommonInfoBasicMle::EmlCapabilities>& emlCapabilities)
const std::shared_ptr<CommonInfoBasicMle>& mleCommonInfo)
{
NS_LOG_FUNCTION(this << from);
LookupState(from)->m_emlCapabilities = emlCapabilities;
LookupState(from)->m_mleCommonInfo = mleCommonInfo;
}
Ptr<const HtCapabilities>
@@ -1632,10 +1632,15 @@ WifiRemoteStationManager::GetStationEhtCapabilities(Mac48Address from)
return LookupState(from)->m_ehtCapabilities;
}
std::shared_ptr<CommonInfoBasicMle::EmlCapabilities>
std::optional<std::reference_wrapper<CommonInfoBasicMle::EmlCapabilities>>
WifiRemoteStationManager::GetStationEmlCapabilities(const Mac48Address& from)
{
return LookupState(from)->m_emlCapabilities;
if (auto state = LookupState(from);
state->m_mleCommonInfo && state->m_mleCommonInfo->m_emlCapabilities)
{
return state->m_mleCommonInfo->m_emlCapabilities.value();
}
return std::nullopt;
}
bool
@@ -2014,8 +2019,9 @@ WifiRemoteStationManager::GetEhtSupported(const WifiRemoteStation* station) cons
bool
WifiRemoteStationManager::GetEmlsrSupported(const WifiRemoteStation* station) const
{
auto emlCapabilities = station->m_state->m_emlCapabilities;
return emlCapabilities && emlCapabilities->emlsrSupport == 1;
auto mleCommonInfo = station->m_state->m_mleCommonInfo;
return mleCommonInfo && mleCommonInfo->m_emlCapabilities &&
mleCommonInfo->m_emlCapabilities->emlsrSupport == 1;
}
bool
@@ -2128,8 +2134,9 @@ WifiRemoteStationManager::GetEhtSupported(Mac48Address address) const
bool
WifiRemoteStationManager::GetEmlsrSupported(const Mac48Address& address) const
{
auto emlCapabilities = LookupState(address)->m_emlCapabilities;
return emlCapabilities && emlCapabilities->emlsrSupport == 1;
auto mleCommonInfo = LookupState(address)->m_mleCommonInfo;
return mleCommonInfo && mleCommonInfo->m_emlCapabilities &&
mleCommonInfo->m_emlCapabilities->emlsrSupport == 1;
}
bool

View File

@@ -114,8 +114,8 @@ struct WifiRemoteStationState
Ptr<const VhtCapabilities> m_vhtCapabilities; //!< remote station VHT capabilities
Ptr<const HeCapabilities> m_heCapabilities; //!< remote station HE capabilities
Ptr<const EhtCapabilities> m_ehtCapabilities; //!< remote station EHT capabilities
/// remote station EML capabilities
std::shared_ptr<CommonInfoBasicMle::EmlCapabilities> m_emlCapabilities;
/// remote station Multi-Link Element Common Info
std::shared_ptr<CommonInfoBasicMle> m_mleCommonInfo;
bool m_emlsrEnabled; //!< whether EMLSR mode is enabled on this link
uint16_t m_channelWidth; //!< Channel width (in MHz) supported by the remote station
@@ -270,14 +270,14 @@ class WifiRemoteStationManager : public Object
*/
void AddStationEhtCapabilities(Mac48Address from, EhtCapabilities ehtCapabilities);
/**
* Records EML capabilities of the remote station.
* Records the Common Info field advertised by the given remote station in a Multi-Link
* Element. It includes the MLD address of the remote station.
*
* \param from the address of the station being recorded
* \param emlCapabilities the EML capabilities of the station
* \param mleCommonInfo the MLE Common Info advertised by the station
*/
void AddStationEmlCapabilities(
Mac48Address from,
const std::shared_ptr<CommonInfoBasicMle::EmlCapabilities>& emlCapabilities);
void AddStationMleCommonInfo(Mac48Address from,
const std::shared_ptr<CommonInfoBasicMle>& mleCommonInfo);
/**
* Return the HT capabilities sent by the remote station.
*
@@ -310,8 +310,8 @@ class WifiRemoteStationManager : public Object
* \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<CommonInfoBasicMle::EmlCapabilities> GetStationEmlCapabilities(
const Mac48Address& from);
std::optional<std::reference_wrapper<CommonInfoBasicMle::EmlCapabilities>>
GetStationEmlCapabilities(const Mac48Address& from);
/**
* Return whether the device has HT capability support enabled.
*