diff --git a/src/wifi/model/ideal-wifi-manager.cc b/src/wifi/model/ideal-wifi-manager.cc index 14fe4514c..69228b341 100644 --- a/src/wifi/model/ideal-wifi-manager.cc +++ b/src/wifi/model/ideal-wifi-manager.cc @@ -329,7 +329,7 @@ IdealWifiManager::DoGetDataTxVector (WifiRemoteStation *st) // Derive NSS from the MCS index. There is a different mode for each possible NSS value. uint8_t nss = (mode.GetMcsValue () / 8) + 1; txVector.SetNss (nss); - if (WifiPhy::IsValidTxVector (txVector) == false + if (!txVector.IsValid () || nss > std::min (GetMaxNumberOfTransmitStreams (), GetNumberOfSupportedStreams (st))) { NS_LOG_DEBUG ("Skipping mode " << mode.GetUniqueName () << @@ -373,7 +373,7 @@ IdealWifiManager::DoGetDataTxVector (WifiRemoteStation *st) for (uint8_t nss = 1; nss <= std::min (GetMaxNumberOfTransmitStreams (), GetNumberOfSupportedStreams (station)); nss++) { txVector.SetNss (nss); - if (WifiPhy::IsValidTxVector (txVector) == false) + if (!txVector.IsValid ()) { NS_LOG_DEBUG ("Skipping mode " << mode.GetUniqueName () << " nss " << (uint16_t) nss << " width " << @@ -412,7 +412,7 @@ IdealWifiManager::DoGetDataTxVector (WifiRemoteStation *st) for (uint8_t nss = 1; nss <= GetNumberOfSupportedStreams (station); nss++) { txVector.SetNss (nss); - if (WifiPhy::IsValidTxVector (txVector) == false) + if (!txVector.IsValid ()) { NS_LOG_DEBUG ("Skipping mode " << mode.GetUniqueName () << " nss " << (uint16_t) nss << " width " << diff --git a/src/wifi/model/minstrel-ht-wifi-manager.cc b/src/wifi/model/minstrel-ht-wifi-manager.cc index 2740e361d..6dc4ff060 100644 --- a/src/wifi/model/minstrel-ht-wifi-manager.cc +++ b/src/wifi/model/minstrel-ht-wifi-manager.cc @@ -316,12 +316,11 @@ bool MinstrelHtWifiManager::IsValidMcs (Ptr phy, uint8_t streams, uint8_t chWidth, WifiMode mode) { NS_LOG_FUNCTION (this << phy << (uint16_t)streams << (uint16_t)chWidth << mode); - WifiTxVector txvector; txvector.SetNss (streams); txvector.SetChannelWidth (chWidth); txvector.SetMode (mode); - return phy->IsValidTxVector (txvector); + return txvector.IsValid (); } Time diff --git a/src/wifi/model/wifi-phy.cc b/src/wifi/model/wifi-phy.cc index 27f52ed21..be7897302 100644 --- a/src/wifi/model/wifi-phy.cc +++ b/src/wifi/model/wifi-phy.cc @@ -3458,42 +3458,6 @@ WifiPhy::GetHeMcs11 () return mcs; } -bool -WifiPhy::IsValidTxVector (WifiTxVector txVector) -{ - uint8_t chWidth = txVector.GetChannelWidth (); - uint8_t nss = txVector.GetNss (); - std::string modeName = txVector.GetMode ().GetUniqueName (); - - if (chWidth == 20) - { - if (nss != 3 && nss != 6) - { - return (modeName != "VhtMcs9"); - } - } - else if (chWidth == 80) - { - if (nss == 3 || nss == 7) - { - return (modeName != "VhtMcs6"); - } - else if (nss == 6) - { - return (modeName != "VhtMcs9"); - } - } - else if (chWidth == 160) - { - if (nss == 3) - { - return (modeName != "VhtMcs9"); - } - } - - return true; -} - bool WifiPhy::IsModeSupported (WifiMode mode) const { diff --git a/src/wifi/model/wifi-phy.h b/src/wifi/model/wifi-phy.h index c81ce348e..9fbc326cd 100644 --- a/src/wifi/model/wifi-phy.h +++ b/src/wifi/model/wifi-phy.h @@ -1202,16 +1202,6 @@ public: */ static WifiMode GetHeMcs11 (); - /** - * The standard disallows certain combinations of WifiMode, number of - * spatial streams, and channel widths. This method can be used to - * check whether this WifiTxVector contains an invalid combination. - * - * \param txVector the WifiTxVector to inspect - * \return true if the WifiTxVector parameters are allowed by the standard - */ - static bool IsValidTxVector (WifiTxVector txVector); - /** * Public method used to fire a PhyTxBegin trace. * Implemented for encapsulation purposes. diff --git a/src/wifi/model/wifi-tx-vector.cc b/src/wifi/model/wifi-tx-vector.cc index 573f8c5b8..c60391c0c 100644 --- a/src/wifi/model/wifi-tx-vector.cc +++ b/src/wifi/model/wifi-tx-vector.cc @@ -207,6 +207,38 @@ WifiTxVector::SetStbc (bool stbc) m_stbc = stbc; } +bool +WifiTxVector::IsValid (void) const +{ + std::string modeName = m_mode.GetUniqueName (); + if (m_channelWidth == 20) + { + if (m_nss != 3 && m_nss != 6) + { + return (modeName != "VhtMcs9"); + } + } + else if (m_channelWidth == 80) + { + if (m_nss == 3 || m_nss == 7) + { + return (modeName != "VhtMcs6"); + } + else if (m_nss == 6) + { + return (modeName != "VhtMcs9"); + } + } + else if (m_channelWidth == 160) + { + if (m_nss == 3) + { + return (modeName != "VhtMcs9"); + } + } + return true; +} + std::ostream & operator << ( std::ostream &os, const WifiTxVector &v) { os << "mode: " << v.GetMode () << diff --git a/src/wifi/model/wifi-tx-vector.h b/src/wifi/model/wifi-tx-vector.h index b21838496..8b6a083e8 100644 --- a/src/wifi/model/wifi-tx-vector.h +++ b/src/wifi/model/wifi-tx-vector.h @@ -203,6 +203,14 @@ public: * \param stbc enable or disable STBC */ void SetStbc (bool stbc); + /** + * The standard disallows certain combinations of WifiMode, number of + * spatial streams, and channel widths. This method can be used to + * check whether this WifiTxVector contains an invalid combination. + * + * \return true if the WifiTxVector parameters are allowed by the standard + */ + bool IsValid (void) const; private: