wifi: Handle HE TB PPDUs in TX vector

This commit is contained in:
Stefano Avallone
2019-06-12 18:36:49 +02:00
committed by Sébastien Deronne
parent d2d5459888
commit eb92e3c5a2
5 changed files with 28 additions and 17 deletions

View File

@@ -115,8 +115,7 @@ WifiMode::GetDataRate (WifiTxVector txVector, uint16_t staId) const
{
uint16_t bw = txVector.GetChannelWidth ();
uint8_t nss = txVector.GetNss (staId);
if (txVector.GetPreambleType () == WIFI_PREAMBLE_HE_MU
|| txVector.GetPreambleType () == WIFI_PREAMBLE_HE_TB)
if (txVector.IsMu ())
{
bw = HeRu::GetBandwidth (txVector.GetRu (staId).ruType);
}

View File

@@ -3243,7 +3243,7 @@ WifiPhy::EndReceive (Ptr<Event> event)
WifiTxVector txVector = event->GetTxVector ();
uint16_t channelWidth = std::min (GetChannelWidth (), txVector.GetChannelWidth ());
WifiSpectrumBand band;
if (txVector.GetPreambleType () == WIFI_PREAMBLE_HE_MU)
if (txVector.IsMu ())
{
band = GetRuBand (txVector, staId);
channelWidth = HeRu::GetBandwidth (txVector.GetRu (staId).ruType);
@@ -3278,7 +3278,7 @@ WifiPhy::GetReceptionStatus (Ptr<const WifiPsdu> psdu, Ptr<Event> event, uint16_
uint16_t channelWidth = std::min (GetChannelWidth (), event->GetTxVector ().GetChannelWidth ());
WifiTxVector txVector = event->GetTxVector ();
WifiSpectrumBand band;
if (txVector.GetPreambleType () == WIFI_PREAMBLE_HE_MU)
if (txVector.IsMu ())
{
band = GetRuBand (txVector, staId);
channelWidth = HeRu::GetBandwidth (txVector.GetRu (staId).ruType);
@@ -3317,7 +3317,7 @@ WifiPhy::GetReceptionStatus (Ptr<const WifiPsdu> psdu, Ptr<Event> event, uint16_
WifiSpectrumBand
WifiPhy::GetRuBand (WifiTxVector txVector, uint16_t staId)
{
NS_ASSERT (txVector.GetPreambleType () == WIFI_PREAMBLE_HE_MU);
NS_ASSERT (txVector.IsMu ());
WifiSpectrumBand band;
HeRu::RuSpec ru = txVector.GetRu (staId);
uint16_t channelWidth = txVector.GetChannelWidth ();

View File

@@ -52,7 +52,7 @@ WifiPpdu::WifiPpdu (const WifiConstPsduMap & psdus, WifiTxVector txVector, Time
m_txPowerLevel (txVector.GetTxPowerLevel ())
{
NS_LOG_FUNCTION (this << psdus << txVector << ppduDuration << band);
if (m_preamble == WIFI_PREAMBLE_HE_MU)
if (txVector.IsMu ())
{
m_muUserInfos = txVector.GetHeMuUserInfoMap ();
}

View File

@@ -110,7 +110,7 @@ WifiTxVector::GetMode (uint16_t staId) const
{
NS_FATAL_ERROR ("WifiTxVector mode must be set before using");
}
if (m_preamble == WIFI_PREAMBLE_HE_MU || m_preamble == WIFI_PREAMBLE_HE_TB)
if (IsMu ())
{
NS_ABORT_MSG_IF (staId > 2048, "STA-ID should be correctly set for HE MU (" << staId << ")");
NS_ASSERT (m_muUserInfos.find (staId) != m_muUserInfos.end ());
@@ -169,7 +169,7 @@ WifiTxVector::GetNTx (void) const
uint8_t
WifiTxVector::GetNss (uint16_t staId) const
{
if (m_preamble == WIFI_PREAMBLE_HE_MU || m_preamble == WIFI_PREAMBLE_HE_TB)
if (IsMu ())
{
NS_ABORT_MSG_IF (staId > 2048, "STA-ID should be correctly set for HE MU (" << staId << ")");
NS_ASSERT (m_muUserInfos.find (staId) != m_muUserInfos.end ());
@@ -182,7 +182,7 @@ uint8_t
WifiTxVector::GetNssMax (void) const
{
uint8_t nss = 0;
if (m_preamble == WIFI_PREAMBLE_HE_MU || m_preamble == WIFI_PREAMBLE_HE_TB)
if (IsMu ())
{
for (const auto & info : m_muUserInfos)
{
@@ -230,7 +230,7 @@ WifiTxVector::SetMode (WifiMode mode)
void
WifiTxVector::SetMode (WifiMode mode, uint16_t staId)
{
NS_ABORT_MSG_IF (m_preamble != WIFI_PREAMBLE_HE_MU, "Not an HE MU transmission");
NS_ABORT_MSG_IF (!IsMu (), "Not an HE MU transmission");
NS_ABORT_MSG_IF (staId > 2048, "STA-ID should be correctly set for HE MU");
m_muUserInfos[staId].mcs = mode;
m_modeInitialized = true;
@@ -275,7 +275,7 @@ WifiTxVector::SetNss (uint8_t nss)
void
WifiTxVector::SetNss (uint8_t nss, uint16_t staId)
{
NS_ABORT_MSG_IF (m_preamble != WIFI_PREAMBLE_HE_MU, "Not an HE MU transmission");
NS_ABORT_MSG_IF (!IsMu (), "Not an HE MU transmission");
NS_ABORT_MSG_IF (staId > 2048, "STA-ID should be correctly set for HE MU");
m_muUserInfos[staId].nss = nss;
}
@@ -352,10 +352,16 @@ WifiTxVector::IsValid (void) const
return true;
}
bool
WifiTxVector::IsMu (void) const
{
return (m_preamble == WIFI_PREAMBLE_HE_MU || m_preamble == WIFI_PREAMBLE_HE_TB);
}
HeRu::RuSpec
WifiTxVector::GetRu (uint16_t staId) const
{
NS_ABORT_MSG_IF (m_preamble != WIFI_PREAMBLE_HE_MU, "RU only available for MU");
NS_ABORT_MSG_IF (!IsMu (), "RU only available for MU");
NS_ABORT_MSG_IF (staId > 2048, "STA-ID should be correctly set for HE MU");
return m_muUserInfos.at (staId).ru;
}
@@ -363,7 +369,7 @@ WifiTxVector::GetRu (uint16_t staId) const
void
WifiTxVector::SetRu (HeRu::RuSpec ru, uint16_t staId)
{
NS_ABORT_MSG_IF (m_preamble != WIFI_PREAMBLE_HE_MU, "RU only available for MU");
NS_ABORT_MSG_IF (!IsMu (), "RU only available for MU");
NS_ABORT_MSG_IF (staId > 2048, "STA-ID should be correctly set for HE MU");
m_muUserInfos[staId].ru = ru;
}
@@ -371,14 +377,14 @@ WifiTxVector::SetRu (HeRu::RuSpec ru, uint16_t staId)
HeMuUserInfo
WifiTxVector::GetHeMuUserInfo (uint16_t staId) const
{
NS_ABORT_MSG_IF (m_preamble != WIFI_PREAMBLE_HE_MU, "HE MU user info only available for MU");
NS_ABORT_MSG_IF (!IsMu (), "HE MU user info only available for MU");
return m_muUserInfos.at (staId);
}
void
WifiTxVector::SetHeMuUserInfo (uint16_t staId, HeMuUserInfo userInfo)
{
NS_ABORT_MSG_IF (m_preamble != WIFI_PREAMBLE_HE_MU, "HE MU user info only available for MU");
NS_ABORT_MSG_IF (!IsMu (), "HE MU user info only available for MU");
NS_ABORT_MSG_IF (staId > 2048, "STA-ID should be correctly set for HE MU");
NS_ABORT_MSG_IF (userInfo.mcs.GetModulationClass () != WIFI_MOD_CLASS_HE, "Only HE modes authorized for HE MU");
m_muUserInfos[staId] = userInfo;
@@ -388,7 +394,7 @@ WifiTxVector::SetHeMuUserInfo (uint16_t staId, HeMuUserInfo userInfo)
const WifiTxVector::HeMuUserInfoMap&
WifiTxVector::GetHeMuUserInfoMap (void) const
{
NS_ABORT_MSG_IF (m_preamble != WIFI_PREAMBLE_HE_MU, "HE MU user info map only available for MU");
NS_ABORT_MSG_IF (!IsMu (), "HE MU user info map only available for MU");
return m_muUserInfos;
}
@@ -408,7 +414,7 @@ std::ostream & operator << ( std::ostream &os, const WifiTxVector &v)
<< " MPDU aggregation: " << v.IsAggregation ()
<< " STBC: " << v.IsStbc ()
<< " FEC coding: " << (v.IsLdpc () ? "LDPC" : "BCC");
if (v.GetPreambleType () == WIFI_PREAMBLE_HE_MU)
if (v.IsMu ())
{
WifiTxVector::HeMuUserInfoMap userInfoMap = v.GetHeMuUserInfoMap ();
os << " num User Infos: " << userInfoMap.size ();

View File

@@ -288,6 +288,12 @@ public:
*/
bool IsValid (void) const;
/**
* Return true if this TX vector is used for a multi-user transmission.
*
* \return true if this TX vector is used for a multi-user transmission
*/
bool IsMu (void) const;
/**
* Get the RU specification for the STA-ID.
* This is applicable only for HE MU.
*