wifi: Channel width is only held by OfdmPpdu to distinguish 5 MHz, 10 MHz or 20 MHz PPDUs

This commit is contained in:
Sébastien Deronne
2022-11-13 17:25:12 +01:00
parent 32f8be80a8
commit 65ec6d6c0a
6 changed files with 12 additions and 11 deletions

View File

@@ -154,7 +154,7 @@ HePpdu::SetHeSigHeader(HeSigHeader& heSig, const WifiTxVector& txVector) const
heSig.SetNStreams(txVector.GetNss());
}
heSig.SetBssColor(txVector.GetBssColor());
heSig.SetChannelWidth(m_channelWidth);
heSig.SetChannelWidth(txVector.GetChannelWidth());
heSig.SetGuardIntervalAndLtfSize(txVector.GetGuardInterval(), 2 /*NLTF currently unused*/);
}

View File

@@ -91,7 +91,7 @@ void
HtPpdu::SetHtSigHeader(HtSigHeader& htSig, const WifiTxVector& txVector, std::size_t psduSize) const
{
htSig.SetMcs(txVector.GetMode().GetMcsValue());
htSig.SetChannelWidth(m_channelWidth);
htSig.SetChannelWidth(txVector.GetChannelWidth());
htSig.SetHtLength(psduSize);
htSig.SetAggregation(txVector.IsAggregation());
htSig.SetShortGuardInterval(txVector.GetGuardInterval() == 400);

View File

@@ -43,9 +43,8 @@ ErpOfdmPpdu::ErpOfdmPpdu(Ptr<const WifiPsdu> psdu,
void
ErpOfdmPpdu::SetTxVectorFromLSigHeader(WifiTxVector& txVector, const LSigHeader& lSig) const
{
NS_ASSERT(m_channelWidth == 20);
txVector.SetMode(ErpOfdmPhy::GetErpOfdmRate(lSig.GetRate()));
txVector.SetChannelWidth(m_channelWidth);
txVector.SetChannelWidth(20);
}
Ptr<WifiPpdu>

View File

@@ -94,10 +94,10 @@ OfdmPpdu::DoGetTxVector() const
void
OfdmPpdu::SetTxVectorFromLSigHeader(WifiTxVector& txVector, const LSigHeader& lSig) const
{
NS_ASSERT(m_channelWidth <= 20);
// OFDM uses 20 MHz, unless PHY channel width is 5 MHz or 10 MHz
uint16_t channelWidth = m_channelWidth < 20 ? m_channelWidth : 20;
txVector.SetMode(OfdmPhy::GetOfdmRate(lSig.GetRate(m_channelWidth), channelWidth));
txVector.SetChannelWidth(channelWidth);
txVector.SetMode(OfdmPhy::GetOfdmRate(lSig.GetRate(m_channelWidth), m_channelWidth));
txVector.SetChannelWidth(m_channelWidth);
}
Time

View File

@@ -122,8 +122,7 @@ class OfdmPpdu : public WifiPpdu
Ptr<WifiPpdu> Copy() const override;
protected:
WifiPhyBand m_band; //!< the WifiPhyBand used to transmit that PPDU
uint16_t m_channelWidth; //!< the channel width used to transmit that PPDU in MHz
WifiPhyBand m_band; //!< the WifiPhyBand used to transmit that PPDU
#ifndef NS3_BUILD_PROFILE_DEBUG
LSigHeader m_lSig; //!< the L-SIG PHY header
#endif
@@ -155,7 +154,10 @@ class OfdmPpdu : public WifiPpdu
* \param lSig the L-SIG header
*/
virtual void SetTxVectorFromLSigHeader(WifiTxVector& txVector, const LSigHeader& lSig) const;
}; // class OfdmPpdu
uint16_t m_channelWidth; //!< the channel width used to transmit that PPDU in MHz (needed to
//!< distinguish 5 MHz, 10 MHz or 20 MHz PPDUs)
}; // class OfdmPpdu
} // namespace ns3

View File

@@ -85,7 +85,7 @@ VhtPpdu::SetVhtSigHeader(VhtSigHeader& vhtSig,
Time ppduDuration) const
{
vhtSig.SetMuFlag(m_preamble == WIFI_PREAMBLE_VHT_MU);
vhtSig.SetChannelWidth(m_channelWidth);
vhtSig.SetChannelWidth(txVector.GetChannelWidth());
vhtSig.SetShortGuardInterval(txVector.GetGuardInterval() == 400);
uint32_t nSymbols =
(static_cast<double>(