From 65ec6d6c0aa365ea1afec221952b28131114feeb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Deronne?= Date: Sun, 13 Nov 2022 17:25:12 +0100 Subject: [PATCH] wifi: Channel width is only held by OfdmPpdu to distinguish 5 MHz, 10 MHz or 20 MHz PPDUs --- src/wifi/model/he/he-ppdu.cc | 2 +- src/wifi/model/ht/ht-ppdu.cc | 2 +- src/wifi/model/non-ht/erp-ofdm-ppdu.cc | 3 +-- src/wifi/model/non-ht/ofdm-ppdu.cc | 6 +++--- src/wifi/model/non-ht/ofdm-ppdu.h | 8 +++++--- src/wifi/model/vht/vht-ppdu.cc | 2 +- 6 files changed, 12 insertions(+), 11 deletions(-) diff --git a/src/wifi/model/he/he-ppdu.cc b/src/wifi/model/he/he-ppdu.cc index 91f14b495..d6e532262 100644 --- a/src/wifi/model/he/he-ppdu.cc +++ b/src/wifi/model/he/he-ppdu.cc @@ -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*/); } diff --git a/src/wifi/model/ht/ht-ppdu.cc b/src/wifi/model/ht/ht-ppdu.cc index eb859c250..4ff6d07c0 100644 --- a/src/wifi/model/ht/ht-ppdu.cc +++ b/src/wifi/model/ht/ht-ppdu.cc @@ -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); diff --git a/src/wifi/model/non-ht/erp-ofdm-ppdu.cc b/src/wifi/model/non-ht/erp-ofdm-ppdu.cc index 289981bb6..f7f002ace 100644 --- a/src/wifi/model/non-ht/erp-ofdm-ppdu.cc +++ b/src/wifi/model/non-ht/erp-ofdm-ppdu.cc @@ -43,9 +43,8 @@ ErpOfdmPpdu::ErpOfdmPpdu(Ptr 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 diff --git a/src/wifi/model/non-ht/ofdm-ppdu.cc b/src/wifi/model/non-ht/ofdm-ppdu.cc index ebcb42ebe..4541983ad 100644 --- a/src/wifi/model/non-ht/ofdm-ppdu.cc +++ b/src/wifi/model/non-ht/ofdm-ppdu.cc @@ -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 diff --git a/src/wifi/model/non-ht/ofdm-ppdu.h b/src/wifi/model/non-ht/ofdm-ppdu.h index f7289bf7a..96c4d6b88 100644 --- a/src/wifi/model/non-ht/ofdm-ppdu.h +++ b/src/wifi/model/non-ht/ofdm-ppdu.h @@ -122,8 +122,7 @@ class OfdmPpdu : public WifiPpdu Ptr 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 diff --git a/src/wifi/model/vht/vht-ppdu.cc b/src/wifi/model/vht/vht-ppdu.cc index e926ff73f..13a4d2477 100644 --- a/src/wifi/model/vht/vht-ppdu.cc +++ b/src/wifi/model/vht/vht-ppdu.cc @@ -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(