wifi: Do not rely on AssocManager subclass to store BSSIDs in remote station manager
This commit is contained in:
committed by
Stefano Avallone
parent
82f43ec5e1
commit
c0ce2ea2b7
@@ -617,22 +617,17 @@ StaWifiMac::ScanningTimeout(const std::optional<ApInfo>& bestAp)
|
||||
GetLink(bestAp->m_linkId).sendAssocReq = true;
|
||||
GetLink(bestAp->m_linkId).bssid = bestAp->m_bssid;
|
||||
// update info on links to setup (11be MLDs only)
|
||||
for (const auto& [localLinkId, apLinkId] : bestAp->m_setupLinks)
|
||||
const auto& mle =
|
||||
std::visit([](auto&& frame) { return frame.template Get<MultiLinkElement>(); },
|
||||
bestAp->m_frame);
|
||||
for (const auto& [localLinkId, apLinkId, bssid] : bestAp->m_setupLinks)
|
||||
{
|
||||
NS_ASSERT_MSG(mle, "We get here only for ML setup");
|
||||
NS_LOG_DEBUG("Setting up link (local ID=" << +localLinkId << ", AP ID=" << +apLinkId
|
||||
<< ")");
|
||||
GetLink(localLinkId).apLinkId = apLinkId;
|
||||
if (localLinkId == bestAp->m_linkId)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
auto mldAddress =
|
||||
GetWifiRemoteStationManager(bestAp->m_linkId)->GetMldAddress(bestAp->m_bssid);
|
||||
NS_ABORT_MSG_IF(!mldAddress.has_value(), "AP MLD address not set");
|
||||
auto bssid = GetWifiRemoteStationManager(localLinkId)->GetAffiliatedStaAddress(*mldAddress);
|
||||
NS_ABORT_MSG_IF(!mldAddress.has_value(),
|
||||
"AP link address not set for local link " << +localLinkId);
|
||||
GetLink(localLinkId).bssid = *bssid;
|
||||
GetLink(localLinkId).bssid = bssid;
|
||||
GetWifiRemoteStationManager(localLinkId)->SetMldAddress(bssid, mle->GetMldMacAddress());
|
||||
}
|
||||
// lambda to get beacon interval from Beacon or Probe Response
|
||||
auto getBeaconInterval = [](auto&& frame) {
|
||||
|
||||
@@ -162,14 +162,24 @@ class StaWifiMac : public WifiMac
|
||||
*/
|
||||
struct ApInfo
|
||||
{
|
||||
/**
|
||||
* Information about links to setup
|
||||
*/
|
||||
struct SetupLinksInfo
|
||||
{
|
||||
uint8_t localLinkId; ///< local link ID
|
||||
uint8_t apLinkId; ///< AP link ID
|
||||
Mac48Address bssid; ///< BSSID
|
||||
};
|
||||
|
||||
Mac48Address m_bssid; ///< BSSID
|
||||
Mac48Address m_apAddr; ///< AP MAC address
|
||||
double m_snr; ///< SNR in linear scale
|
||||
MgtFrameType m_frame; ///< The body of the management frame used to update AP info
|
||||
WifiScanParams::Channel m_channel; ///< The channel the management frame was received on
|
||||
uint8_t m_linkId; ///< ID of the link used to communicate with the AP
|
||||
/// list of (local link ID, AP link ID) pairs identifying the links to setup between MLDs
|
||||
std::list<std::pair<uint8_t, uint8_t>> m_setupLinks;
|
||||
std::list<SetupLinksInfo>
|
||||
m_setupLinks; ///< information about the links to setup between MLDs
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -234,10 +234,10 @@ WifiAssocManager::ScanningTimeout()
|
||||
m_mac->ScanningTimeout(std::move(bestAp));
|
||||
}
|
||||
|
||||
std::list<std::pair<uint8_t, uint8_t>>&
|
||||
std::list<StaWifiMac::ApInfo::SetupLinksInfo>&
|
||||
WifiAssocManager::GetSetupLinks(const StaWifiMac::ApInfo& apInfo)
|
||||
{
|
||||
return const_cast<std::list<std::pair<uint8_t, uint8_t>>&>(apInfo.m_setupLinks);
|
||||
return const_cast<std::list<StaWifiMac::ApInfo::SetupLinksInfo>&>(apInfo.m_setupLinks);
|
||||
}
|
||||
|
||||
bool
|
||||
|
||||
@@ -178,7 +178,7 @@ class WifiAssocManager : public Object
|
||||
* \param apInfo the info about the given AP
|
||||
* \return a reference to the list of the links to setup with the given AP
|
||||
*/
|
||||
std::list<std::pair<uint8_t, uint8_t>>& GetSetupLinks(const StaWifiMac::ApInfo& apInfo);
|
||||
std::list<StaWifiMac::ApInfo::SetupLinksInfo>& GetSetupLinks(const StaWifiMac::ApInfo& apInfo);
|
||||
|
||||
/**
|
||||
* \return the scanning parameters.
|
||||
|
||||
@@ -133,15 +133,12 @@ WifiDefaultAssocManager::EndScanning()
|
||||
}
|
||||
|
||||
auto& bestAp = *GetSortedList().begin();
|
||||
|
||||
// store AP MLD MAC address in the WifiRemoteStationManager associated with
|
||||
// the link on which the Beacon/Probe Response was received
|
||||
m_mac->GetWifiRemoteStationManager(bestAp.m_linkId)
|
||||
->SetMldAddress(bestAp.m_apAddr, mle->get().GetMldMacAddress());
|
||||
auto& setupLinks = GetSetupLinks(bestAp);
|
||||
|
||||
setupLinks.clear();
|
||||
setupLinks.emplace_back(bestAp.m_linkId, mle->get().GetLinkIdInfo());
|
||||
setupLinks.emplace_back(StaWifiMac::ApInfo::SetupLinksInfo{bestAp.m_linkId,
|
||||
mle->get().GetLinkIdInfo(),
|
||||
bestAp.m_bssid});
|
||||
|
||||
// sort local PHY objects so that radios with constrained PHY band comes first,
|
||||
// then radios with no constraint
|
||||
@@ -203,14 +200,10 @@ WifiDefaultAssocManager::EndScanning()
|
||||
// if we get here, it means we can setup a link with this affiliated AP
|
||||
// set the BSSID for this link
|
||||
Mac48Address bssid = rnr->get().GetBssid(apIt->m_nbrApInfoId, apIt->m_tbttInfoFieldId);
|
||||
// store AP MLD MAC address in the WifiRemoteStationManager associated with
|
||||
// the link requested to setup
|
||||
m_mac->GetWifiRemoteStationManager(linkId)->SetMldAddress(
|
||||
bssid,
|
||||
mle->get().GetMldMacAddress());
|
||||
setupLinks.emplace_back(
|
||||
setupLinks.emplace_back(StaWifiMac::ApInfo::SetupLinksInfo{
|
||||
linkId,
|
||||
rnr->get().GetLinkId(apIt->m_nbrApInfoId, apIt->m_tbttInfoFieldId));
|
||||
rnr->get().GetLinkId(apIt->m_nbrApInfoId, apIt->m_tbttInfoFieldId),
|
||||
bssid});
|
||||
|
||||
if (needChannelSwitch)
|
||||
{
|
||||
@@ -264,12 +257,6 @@ WifiDefaultAssocManager::NotifyChannelSwitched(uint8_t linkId)
|
||||
// we were waiting for this notification
|
||||
m_channelSwitchInfo[linkId].timer.Cancel();
|
||||
|
||||
// the remote station manager has been reset after switching, hence store
|
||||
// information about AP link address and AP MLD address
|
||||
m_mac->GetWifiRemoteStationManager(linkId)->SetMldAddress(
|
||||
m_channelSwitchInfo[linkId].apLinkAddress,
|
||||
m_channelSwitchInfo[linkId].apMldAddress);
|
||||
|
||||
if (std::none_of(m_channelSwitchInfo.begin(), m_channelSwitchInfo.end(), [](auto&& info) {
|
||||
return info.timer.IsRunning();
|
||||
}))
|
||||
@@ -289,7 +276,7 @@ WifiDefaultAssocManager::ChannelSwitchTimeout(uint8_t linkId)
|
||||
auto& bestAp = *GetSortedList().begin();
|
||||
auto& setupLinks = GetSetupLinks(bestAp);
|
||||
auto it = std::find_if(setupLinks.begin(), setupLinks.end(), [&linkId](auto&& linkIds) {
|
||||
return linkIds.first == linkId;
|
||||
return linkIds.localLinkId == linkId;
|
||||
});
|
||||
NS_ASSERT(it != setupLinks.end());
|
||||
setupLinks.erase(it);
|
||||
|
||||
Reference in New Issue
Block a user