diff --git a/src/wifi/model/wifi-phy-common.cc b/src/wifi/model/wifi-phy-common.cc index 1703d2933..5a13d38d3 100644 --- a/src/wifi/model/wifi-phy-common.cc +++ b/src/wifi/model/wifi-phy-common.cc @@ -232,6 +232,44 @@ GetModulationClassForStandard(WifiStandard standard) return modulationClass; } +std::set +GetSupportedChannelWidthSet(WifiStandard standard, WifiPhyBand band) +{ + switch (standard) + { + case WIFI_STANDARD_80211p: + return {MHz_u{5}}; + case WIFI_STANDARD_80211a: + case WIFI_STANDARD_80211g: + return {MHz_u{20}}; + case WIFI_STANDARD_80211b: + return {MHz_u{22}}; + case WIFI_STANDARD_80211n: + return {MHz_u{20}, MHz_u{40}}; + case WIFI_STANDARD_80211ac: + return {MHz_u{80}, MHz_u{160}}; + case WIFI_STANDARD_80211ax: + return (band == WifiPhyBand::WIFI_PHY_BAND_2_4GHZ) ? std::set{MHz_u{20}, MHz_u{40}} + : std::set{MHz_u{80}, MHz_u{160}}; + case WIFI_STANDARD_80211be: + switch (band) + { + case WifiPhyBand::WIFI_PHY_BAND_2_4GHZ: + return {MHz_u{20}, MHz_u{40}}; + case WifiPhyBand::WIFI_PHY_BAND_5GHZ: + return {MHz_u{80}, MHz_u{160}}; + case WifiPhyBand::WIFI_PHY_BAND_6GHZ: + return {MHz_u{20}, MHz_u{80}, MHz_u{160}}; + default: + NS_ABORT_MSG("Unknown band: " << band); + return {}; + } + default: + NS_ABORT_MSG("Unknown standard: " << standard); + return {}; + } +} + MHz_u GetMaximumChannelWidth(WifiModulationClass modulation) { diff --git a/src/wifi/model/wifi-phy-common.h b/src/wifi/model/wifi-phy-common.h index 8e20415df..fec8cfc58 100644 --- a/src/wifi/model/wifi-phy-common.h +++ b/src/wifi/model/wifi-phy-common.h @@ -19,6 +19,7 @@ #include "ns3/ptr.h" #include +#include #include /** @@ -681,6 +682,15 @@ bool IsUlMu(WifiPreamble preamble); */ WifiModulationClass GetModulationClassForStandard(WifiStandard standard); +/** + * Get the supported channel width set that can be advertised in PHY capabilities. + * + * @param standard the standard + * @param band the PHY band + * @return the supported channel width set that can be advertised for the given standard and band + */ +std::set GetSupportedChannelWidthSet(WifiStandard standard, WifiPhyBand band); + /** * Get the maximum channel width allowed for the given modulation class. *