wifi: Add function to retrieve the supported channel width set that can be advertised in PHY capabilities

This commit is contained in:
Sébastien Deronne
2025-03-29 08:53:24 +01:00
parent 17033f858a
commit 0db6eb7b80
2 changed files with 48 additions and 0 deletions

View File

@@ -232,6 +232,44 @@ GetModulationClassForStandard(WifiStandard standard)
return modulationClass;
}
std::set<MHz_u>
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>{MHz_u{20}, MHz_u{40}}
: std::set<MHz_u>{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)
{

View File

@@ -19,6 +19,7 @@
#include "ns3/ptr.h"
#include <ostream>
#include <set>
#include <vector>
/**
@@ -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<MHz_u> GetSupportedChannelWidthSet(WifiStandard standard, WifiPhyBand band);
/**
* Get the maximum channel width allowed for the given modulation class.
*