From a9965c13bf78dbf710887fb8d148262298a33380 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Deronne?= Date: Wed, 16 Apr 2025 10:01:37 +0200 Subject: [PATCH] wifi: Skip candidate AP if its channel width is not compatible with the non-AP STA --- src/wifi/doc/source/wifi-user.rst | 4 ++++ src/wifi/model/wifi-default-assoc-manager.cc | 15 +++++++++++++-- src/wifi/model/wifi-default-assoc-manager.h | 8 +++++--- 3 files changed, 22 insertions(+), 5 deletions(-) diff --git a/src/wifi/doc/source/wifi-user.rst b/src/wifi/doc/source/wifi-user.rst index 2b9c8c737..b4665efbc 100644 --- a/src/wifi/doc/source/wifi-user.rst +++ b/src/wifi/doc/source/wifi-user.rst @@ -601,6 +601,10 @@ It is possible to configure the behavior of the association manager to either ab a problematic situation is detected (default) or to allow the association anyway, depending on the configured value for the ``ns3::WifiMac::AllowAssociationWithDifferentChannelWidth`` attribute. +If the default association manager is used, it is also possible to skip candidate APs that are operating on a +larger channel width than the non-AP STA and which would result in the problematic situation described above. +This is done by setting the ``ns3::WifiMac::SkipCandidateAPsWithLargerChannelWidth`` attribute to true. + SpectrumWifiPhyHelper ===================== diff --git a/src/wifi/model/wifi-default-assoc-manager.cc b/src/wifi/model/wifi-default-assoc-manager.cc index 501257b00..ec943969b 100644 --- a/src/wifi/model/wifi-default-assoc-manager.cc +++ b/src/wifi/model/wifi-default-assoc-manager.cc @@ -13,6 +13,7 @@ #include "wifi-net-device.h" #include "wifi-phy.h" +#include "ns3/boolean.h" #include "ns3/log.h" #include "ns3/simulator.h" #include "ns3/vht-configuration.h" @@ -40,7 +41,16 @@ WifiDefaultAssocManager::GetTypeId() "notified within this amount of time, we give up setting up that link.", TimeValue(MilliSeconds(5)), MakeTimeAccessor(&WifiDefaultAssocManager::m_channelSwitchTimeout), - MakeTimeChecker(Seconds(0))); + MakeTimeChecker(Seconds(0))) + .AddAttribute( + "SkipAssocIncompatibleChannelWidth", + "If set to true, it does not include APs with incompatible channel width with the " + "STA in the list of candidate APs. An incompatible channel width is one that the " + "STA cannot advertise to the AP, unless AP operates on a channel width that is " + "equal or lower than that channel width.", + BooleanValue(false), + MakeBooleanAccessor(&WifiDefaultAssocManager::m_skipAssocIncompatibleChannelWidth), + MakeBooleanChecker()); return tid; } @@ -290,7 +300,8 @@ WifiDefaultAssocManager::ChannelSwitchTimeout(uint8_t linkId) bool WifiDefaultAssocManager::CanBeInserted(const StaWifiMac::ApInfo& apInfo) const { - return (m_waitBeaconEvent.IsPending() || m_probeRequestEvent.IsPending()); + return ((m_waitBeaconEvent.IsPending() || m_probeRequestEvent.IsPending()) && + (!m_skipAssocIncompatibleChannelWidth || IsChannelWidthCompatible(apInfo))); } bool diff --git a/src/wifi/model/wifi-default-assoc-manager.h b/src/wifi/model/wifi-default-assoc-manager.h index bcd8b73ad..a772815d4 100644 --- a/src/wifi/model/wifi-default-assoc-manager.h +++ b/src/wifi/model/wifi-default-assoc-manager.h @@ -57,9 +57,11 @@ class WifiDefaultAssocManager : public WifiAssocManager */ void ChannelSwitchTimeout(uint8_t linkId); - EventId m_waitBeaconEvent; ///< wait beacon event - EventId m_probeRequestEvent; ///< probe request event - Time m_channelSwitchTimeout; ///< maximum delay for channel switching + EventId m_waitBeaconEvent; ///< wait beacon event + EventId m_probeRequestEvent; ///< probe request event + Time m_channelSwitchTimeout; ///< maximum delay for channel switching + bool m_skipAssocIncompatibleChannelWidth; ///< flag whether to skip APs with incompatible + ///< channel width /** Channel switch info */ struct ChannelSwitchInfo