wifi: Set TXVECTOR's RU PHY indices in HePpdu constructor

This is a better place than WifiPhy::Send() because it is an operation
specific to HE. Also, we avoid copying the WifiTxVector to pass to
WifiPhy::Send().
This commit is contained in:
Stefano Avallone
2022-01-15 16:07:04 +01:00
parent 039121640d
commit b035ad56f0
6 changed files with 16 additions and 18 deletions

View File

@@ -328,7 +328,8 @@ HePhy::BuildPpdu (const WifiConstPsduMap & psdus, const WifiTxVector& txVector,
flag = HePpdu::PSD_NON_HE_TB;
}
return Create<HePpdu> (psdus, txVector, ppduDuration, m_wifiPhy->GetPhyBand (),
ObtainNextUid (txVector), flag);
ObtainNextUid (txVector), flag,
m_wifiPhy->GetOperatingChannel ().GetPrimaryChannelIndex (20));
}
void

View File

@@ -48,7 +48,7 @@ std::ostream& operator<< (std::ostream& os, const HePpdu::TxPsdFlag &flag)
}
HePpdu::HePpdu (const WifiConstPsduMap & psdus, const WifiTxVector& txVector, Time ppduDuration,
WifiPhyBand band, uint64_t uid, TxPsdFlag flag)
WifiPhyBand band, uint64_t uid, TxPsdFlag flag, uint8_t p20Index)
: OfdmPpdu (psdus.begin ()->second, txVector, band, uid, false) //don't instantiate LSigHeader of OfdmPpdu
{
NS_LOG_FUNCTION (this << psdus << txVector << ppduDuration << band << uid << flag);
@@ -59,7 +59,13 @@ HePpdu::HePpdu (const WifiConstPsduMap & psdus, const WifiTxVector& txVector, Ti
m_psdus = psdus;
if (IsMu ())
{
m_muUserInfos = txVector.GetHeMuUserInfoMap ();
for (auto heMuUserInfo : txVector.GetHeMuUserInfoMap ())
{
// Set RU PHY index
heMuUserInfo.second.ru.SetPhyIndex (txVector.GetChannelWidth (), p20Index);
auto [it, ret] = m_muUserInfos.emplace (heMuUserInfo);
NS_ABORT_MSG_IF (!ret, "STA-ID " << heMuUserInfo.first << " already present");
}
}
SetPhyHeaders (txVector, ppduDuration);
@@ -159,7 +165,7 @@ HePpdu::GetTxDuration (void) const
Ptr<WifiPpdu>
HePpdu::Copy (void) const
{
return Create<HePpdu> (m_psdus, GetTxVector (), GetTxDuration (), m_band, m_uid, m_txPsdFlag);
return ns3::Copy (Ptr (this));
}
WifiPpduType

View File

@@ -184,9 +184,10 @@ public:
* \param band the WifiPhyBand used for the transmission of this PPDU
* \param uid the unique ID of this PPDU or of the triggering PPDU if this is an HE TB PPDU
* \param flag the flag indicating the type of Tx PSD to build
* \param p20Index the index of the primary 20 MHz channel
*/
HePpdu (const WifiConstPsduMap & psdus, const WifiTxVector& txVector, Time ppduDuration,
WifiPhyBand band, uint64_t uid, TxPsdFlag flag);
WifiPhyBand band, uint64_t uid, TxPsdFlag flag, uint8_t p20Index);
/**
* Destructor for HePpdu.
*/

View File

@@ -1687,7 +1687,7 @@ WifiPhy::Send (Ptr<const WifiPsdu> psdu, const WifiTxVector& txVector)
}
void
WifiPhy::Send (WifiConstPsduMap psdus, WifiTxVector txVector)
WifiPhy::Send (WifiConstPsduMap psdus, const WifiTxVector& txVector)
{
NS_LOG_FUNCTION (this << psdus << txVector);
/* Transmission can happen if:
@@ -1713,16 +1713,6 @@ WifiPhy::Send (WifiConstPsduMap psdus, WifiTxVector txVector)
}
return;
}
// Set RU PHY indices
if (txVector.IsMu ())
{
for (auto& heMuUserInfo : txVector.GetHeMuUserInfoMap ())
{
heMuUserInfo.second.ru.SetPhyIndex (txVector.GetChannelWidth (),
m_operatingChannel.GetPrimaryChannelIndex (20));
}
}
Time txDuration = CalculateTxDuration (psdus, txVector, GetPhyBand ());

View File

@@ -147,7 +147,7 @@ public:
* this PSDU, and txPowerLevel, a power level to use to send the whole PPDU. The real transmission
* power is calculated as txPowerMin + txPowerLevel * (txPowerMax - txPowerMin) / nTxLevels
*/
void Send (WifiConstPsduMap psdus, WifiTxVector txVector);
void Send (WifiConstPsduMap psdus, const WifiTxVector& txVector);
/**
* \param ppdu the PPDU to send

View File

@@ -1463,7 +1463,7 @@ TestMultipleHeTbPreambles::RxHeTbPpdu (uint64_t uid, uint16_t staId, double txPo
Time ppduDuration = m_phy->CalculateTxDuration (psdu->GetSize (), txVector, m_phy->GetPhyBand (), staId);
Ptr<HePpdu> ppdu = Create<HePpdu> (psdus, txVector, ppduDuration, WIFI_PHY_BAND_5GHZ, uid,
HePpdu::PSD_HE_TB_NON_OFDMA_PORTION);
HePpdu::PSD_HE_TB_NON_OFDMA_PORTION, 0);
//Send non-OFDMA part
Time nonOfdmaDuration = m_phy->GetHePhy ()->CalculateNonOfdmaDurationForHeTb (txVector);