diff --git a/src/wifi/model/wifi-phy.cc b/src/wifi/model/wifi-phy.cc index 7d7958121..46d4aa8d9 100644 --- a/src/wifi/model/wifi-phy.cc +++ b/src/wifi/model/wifi-phy.cc @@ -349,6 +349,7 @@ WifiPhy::WifiPhy() m_currentEvent(nullptr), m_previouslyRxPpduUid(UINT64_MAX), m_standard(WIFI_STANDARD_UNSPECIFIED), + m_maxModClassSupported(WIFI_MOD_CLASS_UNKNOWN), m_band(WIFI_PHY_BAND_UNSPECIFIED), m_sifs(Seconds(0)), m_slot(Seconds(0)), @@ -946,6 +947,19 @@ WifiPhy::Configure80211be() AddPhyEntity(WIFI_MOD_CLASS_EHT, Create()); } +void +WifiPhy::SetMaxModulationClassSupported(WifiModulationClass modClass) +{ + NS_LOG_FUNCTION(this << modClass); + m_maxModClassSupported = modClass; +} + +WifiModulationClass +WifiPhy::GetMaxModulationClassSupported() const +{ + return m_maxModClassSupported; +} + void WifiPhy::ConfigureStandard(WifiStandard standard) { @@ -956,6 +970,11 @@ WifiPhy::ConfigureStandard(WifiStandard standard) m_standard = standard; + if (m_maxModClassSupported == WIFI_MOD_CLASS_UNKNOWN) + { + m_maxModClassSupported = GetModulationClassForStandard(m_standard); + } + if (!m_operatingChannel.IsSet()) { NS_LOG_DEBUG("Setting the operating channel first"); @@ -1864,8 +1883,9 @@ WifiPhy::StartReceivePreamble(Ptr ppdu, { NS_LOG_FUNCTION(this << ppdu << rxDuration); WifiModulationClass modulation = ppdu->GetModulation(); - auto it = m_phyEntities.find(modulation); - if (it != m_phyEntities.end()) + NS_ASSERT(m_maxModClassSupported != WIFI_MOD_CLASS_UNKNOWN); + if (auto it = m_phyEntities.find(modulation); + it != m_phyEntities.end() && modulation <= m_maxModClassSupported) { it->second->StartReceivePreamble(ppdu, rxPowersW, rxDuration); } diff --git a/src/wifi/model/wifi-phy.h b/src/wifi/model/wifi-phy.h index 058065157..35958fa83 100644 --- a/src/wifi/model/wifi-phy.h +++ b/src/wifi/model/wifi-phy.h @@ -508,6 +508,20 @@ class WifiPhy : public Object */ virtual void ConfigureStandard(WifiStandard standard); + /** + * Set the maximum modulation class that has to be supported by this PHY object. + * The maximum modulation class supported will be the minimum between the given modulation + * class and the maximum modulation class supported based on the configured standard. + * + * \param modClass the given modulation class + */ + void SetMaxModulationClassSupported(WifiModulationClass modClass); + + /** + * \return the maximum modulation class that has to be supported by this PHY object. + */ + WifiModulationClass GetMaxModulationClassSupported() const; + /** * Get the configured Wi-Fi standard * @@ -1470,8 +1484,9 @@ class WifiPhy : public Object */ static std::map>& GetStaticPhyEntities(); - WifiStandard m_standard; //!< WifiStandard - WifiPhyBand m_band; //!< WifiPhyBand + WifiStandard m_standard; //!< WifiStandard + WifiModulationClass m_maxModClassSupported; //!< max modulation class supported + WifiPhyBand m_band; //!< WifiPhyBand ChannelTuple m_channelSettings; //!< Store operating channel settings until initialization WifiPhyOperatingChannel m_operatingChannel; //!< Operating channel bool m_fixedPhyBand; //!< True to prohibit changing PHY band after initialization