wifi: Move IsValidTxVector to a member of WifiTxVector

This commit is contained in:
Sébastien Deronne
2017-12-13 13:15:04 +01:00
parent 2a9134fac6
commit 2c49a314fa
6 changed files with 44 additions and 51 deletions

View File

@@ -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 " <<

View File

@@ -316,12 +316,11 @@ bool
MinstrelHtWifiManager::IsValidMcs (Ptr<WifiPhy> 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

View File

@@ -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
{

View File

@@ -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.

View File

@@ -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 () <<

View File

@@ -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: