wifi: Check if band is appropriate for (ERP-)OFDM modulation class

This commit is contained in:
Stefano Avallone
2023-12-03 18:32:06 +01:00
committed by Stefano Avallone
parent 6134312b5d
commit b1b9ff1ecc
3 changed files with 17 additions and 3 deletions

View File

@@ -1736,7 +1736,7 @@ WifiPhy::Send(WifiConstPsduMap psdus, const WifiTxVector& txVector)
NS_ASSERT(!m_state->IsStateTx() && !m_state->IsStateSwitching());
NS_ASSERT(m_endTxEvent.IsExpired());
if (!txVector.IsValid())
if (!txVector.IsValid(m_band))
{
NS_FATAL_ERROR("TX-VECTOR is invalid!");
}

View File

@@ -446,7 +446,7 @@ WifiTxVector::GetEhtPpduType() const
}
bool
WifiTxVector::IsValid() const
WifiTxVector::IsValid(WifiPhyBand band) const
{
if (!GetModeInitialized())
{
@@ -517,6 +517,16 @@ WifiTxVector::IsValid() const
return false;
}
}
if (band != WIFI_PHY_BAND_UNSPECIFIED)
{
NS_ABORT_MSG_IF(GetModulationClass() == WIFI_MOD_CLASS_OFDM && band == WIFI_PHY_BAND_2_4GHZ,
"Cannot use OFDM modulation class in the 2.4 GHz band");
NS_ABORT_MSG_IF(GetModulationClass() == WIFI_MOD_CLASS_ERP_OFDM &&
band != WIFI_PHY_BAND_2_4GHZ,
"ERP-OFDM modulation class can only be used in the 2.4 GHz band");
}
return true;
}

View File

@@ -22,6 +22,7 @@
#define WIFI_TX_VECTOR_H
#include "wifi-mode.h"
#include "wifi-phy-band.h"
#include "wifi-phy-common.h"
#include "ns3/he-ru.h"
@@ -356,10 +357,13 @@ class WifiTxVector
* 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.
* If a PHY band is specified, it is checked that the PHY band is appropriate for
* the modulation class of the TXVECTOR, in case the latter is OFDM or ERP-OFDM.
*
* \param band the PHY band
* \return true if the WifiTxVector parameters are allowed by the standard
*/
bool IsValid() const;
bool IsValid(WifiPhyBand band = WIFI_PHY_BAND_UNSPECIFIED) const;
/**
* \return true if this TX vector is used for a multi-user (OFDMA and/or MU-MIMO) transmission
*/