From 9b327c556bb92391a905c5b17cf8be472f48abe2 Mon Sep 17 00:00:00 2001 From: Stefano Avallone Date: Fri, 3 Nov 2023 17:54:54 +0100 Subject: [PATCH] wifi: DefaultAssocManager handles non-AP MLDs not supporting 160 MHz operations --- src/wifi/model/wifi-default-assoc-manager.cc | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/wifi/model/wifi-default-assoc-manager.cc b/src/wifi/model/wifi-default-assoc-manager.cc index b57ba6b05..6978a77f7 100644 --- a/src/wifi/model/wifi-default-assoc-manager.cc +++ b/src/wifi/model/wifi-default-assoc-manager.cc @@ -10,10 +10,12 @@ #include "wifi-default-assoc-manager.h" #include "sta-wifi-mac.h" +#include "wifi-net-device.h" #include "wifi-phy.h" #include "ns3/log.h" #include "ns3/simulator.h" +#include "ns3/vht-configuration.h" #include @@ -201,8 +203,15 @@ WifiDefaultAssocManager::EndScanning() // switching channel while a PHY is in sleep state fails phy->ResumeFromSleep(); } - // switch this link to using the channel used by a reported AP - // TODO check if the STA only supports a narrower channel width + // switch this link to using the channel used by a reported AP (or its primary80 + // in case the reported AP is using a 160 MHz and the non-AP MLD does not support + // 160 MHz operations) + if (apChannel.GetTotalWidth() > 80 && + !phy->GetDevice()->GetVhtConfiguration()->Get160MHzOperationSupported()) + { + apChannel = apChannel.GetPrimaryChannel(80); + } + NS_LOG_DEBUG("Switch link " << +linkId << " to using " << apChannel); phy->SetOperatingChannel(apChannel); // actual channel switching may be delayed, thus setup a channel switch timer