wifi: Add check on channel width compatibility with the candidate AP

This commit is contained in:
Sébastien Deronne
2025-04-16 10:22:23 +02:00
parent 0db6eb7b80
commit ec780eb1bd
3 changed files with 60 additions and 1 deletions

View File

@@ -579,6 +579,28 @@ The wifi standard can be configured only once, i.e., it is not possible to
change standard during a simulation. It is instead possible to change the
channel settings at any time.
Advertisement of the channel width
++++++++++++++++++++++++++++++++++
STAs are advertizing their channel width in capabilities and operations (for APs) information elements
contained in management frames.
The channel width that is being advertised is the value that is returned by WifiPhy::ChannelWidth, which corresponds to
the value that is set in the ChannelSettings attribute (or the total width in case of non-contiguous channel operation).
Not all the channel widths can be advertised for non-AP STAs, depending on the standard and the band.
This is not a problem as long as the AP the non-AP STA is associated with is operating on the same channel width
or on a narrower one. Otherwise, the AP might select a larger channel width for the transmission of downlink PPDUs,
which would then be dropped by the PHY of the non-AP STA.
For example, since VHT Capabilities Information Elements only allow the advertisement of 80 and 160 MHz channel widths,
a VHT non-AP STA with its ChannelSettings set to use a 40 MHz channel width won't be able to receive any downlink PPDUs
if the VHT AP has its ChannelSettings set to operate on an 80 MHz channel width.
It is possible to configure the behavior of the association manager to either abort the simulation when such
a problematic situation is detected (default) or to allow the association anyway, depending on the configured value
for the ``ns3::WifiMac::AllowAssociationWithDifferentChannelWidth`` attribute.
SpectrumWifiPhyHelper
=====================

View File

@@ -10,8 +10,10 @@
#include "wifi-assoc-manager.h"
#include "sta-wifi-mac.h"
#include "wifi-phy.h"
#include "ns3/attribute-container.h"
#include "ns3/boolean.h"
#include "ns3/eht-configuration.h"
#include "ns3/enum.h"
#include "ns3/log.h"
@@ -67,7 +69,15 @@ WifiAssocManager::GetTypeId()
"set are processed. An empty set is equivalent to the set of all links.",
AttributeContainerValue<UintegerValue>(),
MakeAttributeContainerAccessor<UintegerValue>(&WifiAssocManager::m_allowedLinks),
MakeAttributeContainerChecker<UintegerValue>(MakeUintegerChecker<uint8_t>()));
MakeAttributeContainerChecker<UintegerValue>(MakeUintegerChecker<uint8_t>()))
.AddAttribute("AllowAssocAllChannelWidths",
"If set to true, it bypasses the check on channel width compatibility "
"with the candidate AP. A channel width is compatible if the STA can "
"advertise it to the AP, or AP operates on a channel width that is equal "
"or lower than that channel width.",
BooleanValue(false),
MakeBooleanAccessor(&WifiAssocManager::m_allowAssocAllChannelWidths),
MakeBooleanChecker());
return tid;
}
@@ -236,6 +246,10 @@ WifiAssocManager::ScanningTimeout()
m_apListIt.erase(bestAp.m_bssid);
} while (!CanBeReturned(bestAp));
NS_ABORT_MSG_IF(!m_allowAssocAllChannelWidths && !IsChannelWidthCompatible(bestAp),
"Channel width of STA is not part of the channel width set that can be "
"advertised to the AP");
m_mac->ScanningTimeout(std::move(bestAp));
}
@@ -361,4 +375,14 @@ WifiAssocManager::GetAllAffiliatedAps(const ReducedNeighborReport& rnr)
return apList;
}
bool
WifiAssocManager::IsChannelWidthCompatible(const StaWifiMac::ApInfo& apInfo) const
{
auto phy = m_mac->GetWifiPhy(apInfo.m_linkId);
return GetSupportedChannelWidthSet(phy->GetStandard(), apInfo.m_channel.band)
.contains(phy->GetChannelWidth()) ||
(phy->GetChannelWidth() >= m_mac->GetWifiRemoteStationManager(apInfo.m_linkId)
->GetChannelWidthSupported(apInfo.m_bssid));
}
} // namespace ns3

View File

@@ -199,6 +199,16 @@ class WifiAssocManager : public Object
*/
virtual bool CanBeReturned(const StaWifiMac::ApInfo& apInfo) const = 0;
/**
* Check whether the channel width of the STA is compatible with the channel width of the
* operating channel of a given AP. A channel width is compatible if the STA can advertise it to
* the AP, or AP operates on a channel width that is equal or lower than that channel width
*
* @param apInfo the given AP information
* @return true if the channel width of the STA is compatible, false otherwise
*/
bool IsChannelWidthCompatible(const StaWifiMac::ApInfo& apInfo) const;
/**
* Extract the best AP to associate with from the sorted list and return
* it, if any, to the STA wifi MAC along with the notification that scanning
@@ -226,6 +236,9 @@ class WifiAssocManager : public Object
std::set<uint8_t> m_allowedLinks; /**< "Only Beacon and Probe Response frames received on a
link belonging to the this set are processed */
bool m_allowAssocAllChannelWidths; ///< flag whether the check on channel width compatibility
///< with the candidate AP should be skipped
private:
/**
* Start a scanning procedure. This method needs to schedule a call to