wifi: Do no longer serialize/deserialize PHY headers
This commit is contained in:
committed by
Sebastien Deronne
parent
62c41bdb30
commit
bce3ec21e5
@@ -92,20 +92,8 @@ void
|
||||
HePpdu::SetPhyHeaders(const WifiTxVector& txVector, Time ppduDuration)
|
||||
{
|
||||
NS_LOG_FUNCTION(this << txVector << ppduDuration);
|
||||
|
||||
#ifdef NS3_BUILD_PROFILE_DEBUG
|
||||
LSigHeader lSig;
|
||||
SetLSigHeader(lSig, ppduDuration);
|
||||
|
||||
HeSigHeader heSig;
|
||||
SetHeSigHeader(heSig, txVector);
|
||||
|
||||
m_phyHeaders->AddHeader(heSig);
|
||||
m_phyHeaders->AddHeader(lSig);
|
||||
#else
|
||||
SetLSigHeader(m_lSig, ppduDuration);
|
||||
SetHeSigHeader(m_heSig, txVector);
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
@@ -171,27 +159,7 @@ HePpdu::DoGetTxVector() const
|
||||
{
|
||||
WifiTxVector txVector;
|
||||
txVector.SetPreambleType(m_preamble);
|
||||
|
||||
#ifdef NS3_BUILD_PROFILE_DEBUG
|
||||
auto phyHeaders = m_phyHeaders->Copy();
|
||||
|
||||
LSigHeader lSig;
|
||||
if (phyHeaders->RemoveHeader(lSig) == 0)
|
||||
{
|
||||
NS_FATAL_ERROR("Missing L-SIG header in HE PPDU");
|
||||
}
|
||||
|
||||
HeSigHeader heSig(IsDlMu());
|
||||
if (phyHeaders->PeekHeader(heSig) == 0)
|
||||
{
|
||||
NS_FATAL_ERROR("Missing HE-SIG header in HE PPDU");
|
||||
}
|
||||
|
||||
SetTxVectorFromPhyHeaders(txVector, lSig, heSig);
|
||||
#else
|
||||
SetTxVectorFromPhyHeaders(txVector, m_lSig, m_heSig);
|
||||
#endif
|
||||
|
||||
return txVector;
|
||||
}
|
||||
|
||||
@@ -300,35 +268,21 @@ HePpdu::GetTxDuration() const
|
||||
{
|
||||
Time ppduDuration = Seconds(0);
|
||||
const WifiTxVector& txVector = GetTxVector();
|
||||
|
||||
uint16_t length = 0;
|
||||
#ifdef NS3_BUILD_PROFILE_DEBUG
|
||||
LSigHeader lSig;
|
||||
m_phyHeaders->PeekHeader(lSig);
|
||||
length = lSig.GetLength();
|
||||
#else
|
||||
length = m_lSig.GetLength();
|
||||
#endif
|
||||
|
||||
Time tSymbol = NanoSeconds(12800 + txVector.GetGuardInterval());
|
||||
Time preambleDuration = WifiPhy::CalculatePhyPreambleAndHeaderDuration(txVector);
|
||||
uint8_t sigExtension = 0;
|
||||
const auto length = m_lSig.GetLength();
|
||||
const auto tSymbol = NanoSeconds(12800 + txVector.GetGuardInterval());
|
||||
const auto preambleDuration = WifiPhy::CalculatePhyPreambleAndHeaderDuration(txVector);
|
||||
NS_ASSERT(m_operatingChannel.IsSet());
|
||||
if (m_operatingChannel.GetPhyBand() == WIFI_PHY_BAND_2_4GHZ)
|
||||
{
|
||||
sigExtension = 6;
|
||||
}
|
||||
uint8_t sigExtension = (m_operatingChannel.GetPhyBand() == WIFI_PHY_BAND_2_4GHZ) ? 6 : 0;
|
||||
uint8_t m = IsDlMu() ? 1 : 2;
|
||||
// Equation 27-11 of IEEE P802.11ax/D4.0
|
||||
Time calculatedDuration =
|
||||
const auto calculatedDuration =
|
||||
MicroSeconds(((ceil(static_cast<double>(length + 3 + m) / 3)) * 4) + 20 + sigExtension);
|
||||
NS_ASSERT(calculatedDuration > preambleDuration);
|
||||
uint32_t nSymbols =
|
||||
floor(static_cast<double>((calculatedDuration - preambleDuration).GetNanoSeconds() -
|
||||
(sigExtension * 1000)) /
|
||||
tSymbol.GetNanoSeconds());
|
||||
ppduDuration = preambleDuration + (nSymbols * tSymbol) + MicroSeconds(sigExtension);
|
||||
return ppduDuration;
|
||||
return (preambleDuration + (nSymbols * tSymbol) + MicroSeconds(sigExtension));
|
||||
}
|
||||
|
||||
Ptr<WifiPpdu>
|
||||
@@ -378,18 +332,7 @@ HePpdu::GetPsdu(uint8_t bssColor, uint16_t staId /* = SU_STA_ID */) const
|
||||
return m_psdus.at(SU_STA_ID);
|
||||
}
|
||||
|
||||
uint8_t ppduBssColor = 0;
|
||||
#ifdef NS3_BUILD_PROFILE_DEBUG
|
||||
auto phyHeaders = m_phyHeaders->Copy();
|
||||
LSigHeader lSig;
|
||||
phyHeaders->RemoveHeader(lSig);
|
||||
HeSigHeader heSig(IsDlMu());
|
||||
phyHeaders->RemoveHeader(heSig);
|
||||
ppduBssColor = heSig.GetBssColor();
|
||||
#else
|
||||
ppduBssColor = m_heSig.GetBssColor();
|
||||
#endif
|
||||
|
||||
const auto ppduBssColor = m_heSig.GetBssColor();
|
||||
if (IsUlMu())
|
||||
{
|
||||
NS_ASSERT(m_psdus.size() == 1);
|
||||
|
||||
@@ -378,9 +378,7 @@ class HePpdu : public OfdmPpdu
|
||||
*/
|
||||
void SetHeMuUserInfos(WifiTxVector& txVector, const HeSigHeader& heSig) const;
|
||||
|
||||
#ifndef NS3_BUILD_PROFILE_DEBUG
|
||||
HeSigHeader m_heSig; //!< the HE-SIG PHY header
|
||||
#endif
|
||||
mutable TxPsdFlag m_txPsdFlag; //!< the transmit power spectral density flag
|
||||
|
||||
private:
|
||||
|
||||
@@ -53,20 +53,8 @@ void
|
||||
HtPpdu::SetPhyHeaders(const WifiTxVector& txVector, Time ppduDuration, std::size_t psduSize)
|
||||
{
|
||||
NS_LOG_FUNCTION(this << txVector << ppduDuration << psduSize);
|
||||
|
||||
#ifdef NS3_BUILD_PROFILE_DEBUG
|
||||
LSigHeader lSig;
|
||||
SetLSigHeader(lSig, ppduDuration);
|
||||
|
||||
HtSigHeader htSig;
|
||||
SetHtSigHeader(htSig, txVector, psduSize);
|
||||
|
||||
m_phyHeaders->AddHeader(htSig);
|
||||
m_phyHeaders->AddHeader(lSig);
|
||||
#else
|
||||
SetLSigHeader(m_lSig, ppduDuration);
|
||||
SetHtSigHeader(m_htSig, txVector, psduSize);
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
@@ -102,27 +90,7 @@ HtPpdu::DoGetTxVector() const
|
||||
{
|
||||
WifiTxVector txVector;
|
||||
txVector.SetPreambleType(m_preamble);
|
||||
|
||||
#ifdef NS3_BUILD_PROFILE_DEBUG
|
||||
auto phyHeaders = m_phyHeaders->Copy();
|
||||
|
||||
LSigHeader lSig;
|
||||
if (phyHeaders->RemoveHeader(lSig) == 0)
|
||||
{
|
||||
NS_FATAL_ERROR("Missing L-SIG header in HT PPDU");
|
||||
}
|
||||
|
||||
HtSigHeader htSig;
|
||||
if (phyHeaders->RemoveHeader(htSig) == 0)
|
||||
{
|
||||
NS_FATAL_ERROR("Missing HT-SIG header in HT PPDU");
|
||||
}
|
||||
|
||||
SetTxVectorFromPhyHeaders(txVector, lSig, htSig);
|
||||
#else
|
||||
SetTxVectorFromPhyHeaders(txVector, m_lSig, m_htSig);
|
||||
#endif
|
||||
|
||||
return txVector;
|
||||
}
|
||||
|
||||
@@ -141,27 +109,10 @@ HtPpdu::SetTxVectorFromPhyHeaders(WifiTxVector& txVector,
|
||||
Time
|
||||
HtPpdu::GetTxDuration() const
|
||||
{
|
||||
Time ppduDuration = Seconds(0);
|
||||
const WifiTxVector& txVector = GetTxVector();
|
||||
|
||||
uint16_t htLength = 0;
|
||||
#ifdef NS3_BUILD_PROFILE_DEBUG
|
||||
auto phyHeaders = m_phyHeaders->Copy();
|
||||
|
||||
LSigHeader lSig;
|
||||
phyHeaders->RemoveHeader(lSig);
|
||||
HtSigHeader htSig;
|
||||
phyHeaders->RemoveHeader(htSig);
|
||||
|
||||
htLength = htSig.GetHtLength();
|
||||
#else
|
||||
htLength = m_htSig.GetHtLength();
|
||||
#endif
|
||||
|
||||
const auto htLength = m_htSig.GetHtLength();
|
||||
NS_ASSERT(m_operatingChannel.IsSet());
|
||||
ppduDuration =
|
||||
WifiPhy::CalculateTxDuration(htLength, txVector, m_operatingChannel.GetPhyBand());
|
||||
return ppduDuration;
|
||||
return WifiPhy::CalculateTxDuration(htLength, txVector, m_operatingChannel.GetPhyBand());
|
||||
}
|
||||
|
||||
Ptr<WifiPpdu>
|
||||
|
||||
@@ -194,9 +194,7 @@ class HtPpdu : public OfdmPpdu
|
||||
const LSigHeader& lSig,
|
||||
const HtSigHeader& htSig) const;
|
||||
|
||||
#ifndef NS3_BUILD_PROFILE_DEBUG
|
||||
HtSigHeader m_htSig; //!< the HT-SIG PHY header
|
||||
#endif
|
||||
}; // class HtPpdu
|
||||
|
||||
} // namespace ns3
|
||||
|
||||
@@ -48,14 +48,7 @@ void
|
||||
DsssPpdu::SetPhyHeaders(const WifiTxVector& txVector, Time ppduDuration)
|
||||
{
|
||||
NS_LOG_FUNCTION(this << txVector);
|
||||
|
||||
#ifdef NS3_BUILD_PROFILE_DEBUG
|
||||
DsssSigHeader dsssSig;
|
||||
SetDsssHeader(dsssSig, txVector, ppduDuration);
|
||||
m_phyHeaders->AddHeader(dsssSig);
|
||||
#else
|
||||
SetDsssHeader(m_dsssSig, txVector, ppduDuration);
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
@@ -74,19 +67,7 @@ DsssPpdu::DoGetTxVector() const
|
||||
WifiTxVector txVector;
|
||||
txVector.SetPreambleType(m_preamble);
|
||||
txVector.SetChannelWidth(22);
|
||||
|
||||
#ifdef NS3_BUILD_PROFILE_DEBUG
|
||||
DsssSigHeader dsssSig;
|
||||
if (m_phyHeaders->PeekHeader(dsssSig) == 0)
|
||||
{
|
||||
NS_FATAL_ERROR("Missing DSSS SIG PHY header in DSSS PPDU");
|
||||
}
|
||||
|
||||
SetTxVectorFromDsssHeader(txVector, dsssSig);
|
||||
#else
|
||||
SetTxVectorFromDsssHeader(txVector, m_dsssSig);
|
||||
#endif
|
||||
|
||||
return txVector;
|
||||
}
|
||||
|
||||
@@ -99,18 +80,9 @@ DsssPpdu::SetTxVectorFromDsssHeader(WifiTxVector& txVector, const DsssSigHeader&
|
||||
Time
|
||||
DsssPpdu::GetTxDuration() const
|
||||
{
|
||||
Time ppduDuration = Seconds(0);
|
||||
const WifiTxVector& txVector = GetTxVector();
|
||||
uint16_t length = 0;
|
||||
#ifdef NS3_BUILD_PROFILE_DEBUG
|
||||
DsssSigHeader dsssSig;
|
||||
m_phyHeaders->PeekHeader(dsssSig);
|
||||
length = dsssSig.GetLength();
|
||||
#else
|
||||
length = m_dsssSig.GetLength();
|
||||
#endif
|
||||
ppduDuration = MicroSeconds(length) + WifiPhy::CalculatePhyPreambleAndHeaderDuration(txVector);
|
||||
return ppduDuration;
|
||||
const auto length = m_dsssSig.GetLength();
|
||||
return (MicroSeconds(length) + WifiPhy::CalculatePhyPreambleAndHeaderDuration(txVector));
|
||||
}
|
||||
|
||||
Ptr<WifiPpdu>
|
||||
|
||||
@@ -145,9 +145,7 @@ class DsssPpdu : public WifiPpdu
|
||||
virtual void SetTxVectorFromDsssHeader(WifiTxVector& txVector,
|
||||
const DsssSigHeader& dsssSig) const;
|
||||
|
||||
#ifndef NS3_BUILD_PROFILE_DEBUG
|
||||
DsssSigHeader m_dsssSig; //!< the DSSS SIG PHY header
|
||||
#endif
|
||||
}; // class DsssPpdu
|
||||
|
||||
} // namespace ns3
|
||||
|
||||
@@ -52,14 +52,7 @@ void
|
||||
OfdmPpdu::SetPhyHeaders(const WifiTxVector& txVector, std::size_t psduSize)
|
||||
{
|
||||
NS_LOG_FUNCTION(this << txVector << psduSize);
|
||||
|
||||
#ifdef NS3_BUILD_PROFILE_DEBUG
|
||||
LSigHeader lSig;
|
||||
SetLSigHeader(lSig, txVector, psduSize);
|
||||
m_phyHeaders->AddHeader(lSig);
|
||||
#else
|
||||
SetLSigHeader(m_lSig, txVector, psduSize);
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
@@ -74,19 +67,7 @@ OfdmPpdu::DoGetTxVector() const
|
||||
{
|
||||
WifiTxVector txVector;
|
||||
txVector.SetPreambleType(m_preamble);
|
||||
|
||||
#ifdef NS3_BUILD_PROFILE_DEBUG
|
||||
LSigHeader lSig;
|
||||
if (m_phyHeaders->PeekHeader(lSig) == 0)
|
||||
{
|
||||
NS_FATAL_ERROR("Missing L-SIG in PPDU");
|
||||
}
|
||||
|
||||
SetTxVectorFromLSigHeader(txVector, lSig);
|
||||
#else
|
||||
SetTxVectorFromLSigHeader(txVector, m_lSig);
|
||||
#endif
|
||||
|
||||
return txVector;
|
||||
}
|
||||
|
||||
@@ -103,14 +84,7 @@ Time
|
||||
OfdmPpdu::GetTxDuration() const
|
||||
{
|
||||
const WifiTxVector& txVector = GetTxVector();
|
||||
uint16_t length = 0;
|
||||
#ifdef NS3_BUILD_PROFILE_DEBUG
|
||||
LSigHeader lSig;
|
||||
m_phyHeaders->PeekHeader(lSig);
|
||||
length = lSig.GetLength();
|
||||
#else
|
||||
length = m_lSig.GetLength();
|
||||
#endif
|
||||
const auto length = m_lSig.GetLength();
|
||||
NS_ASSERT(m_operatingChannel.IsSet());
|
||||
return WifiPhy::CalculateTxDuration(length, txVector, m_operatingChannel.GetPhyBand());
|
||||
}
|
||||
|
||||
@@ -120,9 +120,7 @@ class OfdmPpdu : public WifiPpdu
|
||||
Ptr<WifiPpdu> Copy() const override;
|
||||
|
||||
protected:
|
||||
#ifndef NS3_BUILD_PROFILE_DEBUG
|
||||
LSigHeader m_lSig; //!< the L-SIG PHY header
|
||||
#endif
|
||||
|
||||
private:
|
||||
WifiTxVector DoGetTxVector() const override;
|
||||
|
||||
@@ -52,20 +52,8 @@ void
|
||||
VhtPpdu::SetPhyHeaders(const WifiTxVector& txVector, Time ppduDuration)
|
||||
{
|
||||
NS_LOG_FUNCTION(this << txVector << ppduDuration);
|
||||
|
||||
#ifdef NS3_BUILD_PROFILE_DEBUG
|
||||
LSigHeader lSig;
|
||||
SetLSigHeader(lSig, ppduDuration);
|
||||
|
||||
VhtSigHeader vhtSig;
|
||||
SetVhtSigHeader(vhtSig, txVector, ppduDuration);
|
||||
|
||||
m_phyHeaders->AddHeader(vhtSig);
|
||||
m_phyHeaders->AddHeader(lSig);
|
||||
#else
|
||||
SetLSigHeader(m_lSig, ppduDuration);
|
||||
SetVhtSigHeader(m_vhtSig, txVector, ppduDuration);
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
@@ -104,27 +92,7 @@ VhtPpdu::DoGetTxVector() const
|
||||
{
|
||||
WifiTxVector txVector;
|
||||
txVector.SetPreambleType(m_preamble);
|
||||
|
||||
#ifdef NS3_BUILD_PROFILE_DEBUG
|
||||
auto phyHeaders = m_phyHeaders->Copy();
|
||||
|
||||
LSigHeader lSig;
|
||||
if (phyHeaders->RemoveHeader(lSig) == 0)
|
||||
{
|
||||
NS_FATAL_ERROR("Missing L-SIG header in VHT PPDU");
|
||||
}
|
||||
|
||||
VhtSigHeader vhtSig;
|
||||
if (phyHeaders->RemoveHeader(vhtSig) == 0)
|
||||
{
|
||||
NS_FATAL_ERROR("Missing VHT-SIG header in VHT PPDU");
|
||||
}
|
||||
|
||||
SetTxVectorFromPhyHeaders(txVector, lSig, vhtSig);
|
||||
#else
|
||||
SetTxVectorFromPhyHeaders(txVector, m_lSig, m_vhtSig);
|
||||
#endif
|
||||
|
||||
return txVector;
|
||||
}
|
||||
|
||||
@@ -143,32 +111,13 @@ VhtPpdu::SetTxVectorFromPhyHeaders(WifiTxVector& txVector,
|
||||
Time
|
||||
VhtPpdu::GetTxDuration() const
|
||||
{
|
||||
Time ppduDuration = Seconds(0);
|
||||
const WifiTxVector& txVector = GetTxVector();
|
||||
|
||||
uint16_t length = 0;
|
||||
bool sgi = false;
|
||||
bool sgiDisambiguation = false;
|
||||
#ifdef NS3_BUILD_PROFILE_DEBUG
|
||||
auto phyHeaders = m_phyHeaders->Copy();
|
||||
|
||||
LSigHeader lSig;
|
||||
phyHeaders->RemoveHeader(lSig);
|
||||
VhtSigHeader vhtSig;
|
||||
phyHeaders->RemoveHeader(vhtSig);
|
||||
|
||||
length = lSig.GetLength();
|
||||
sgi = vhtSig.GetShortGuardInterval();
|
||||
sgiDisambiguation = vhtSig.GetShortGuardIntervalDisambiguation();
|
||||
#else
|
||||
length = m_lSig.GetLength();
|
||||
sgi = m_vhtSig.GetShortGuardInterval();
|
||||
sgiDisambiguation = m_vhtSig.GetShortGuardIntervalDisambiguation();
|
||||
#endif
|
||||
|
||||
Time tSymbol = NanoSeconds(3200 + txVector.GetGuardInterval());
|
||||
Time preambleDuration = WifiPhy::CalculatePhyPreambleAndHeaderDuration(txVector);
|
||||
Time calculatedDuration = MicroSeconds(((ceil(static_cast<double>(length + 3) / 3)) * 4) + 20);
|
||||
const auto length = m_lSig.GetLength();
|
||||
const auto sgi = m_vhtSig.GetShortGuardInterval();
|
||||
const auto sgiDisambiguation = m_vhtSig.GetShortGuardIntervalDisambiguation();
|
||||
const auto tSymbol = NanoSeconds(3200 + txVector.GetGuardInterval());
|
||||
const auto preambleDuration = WifiPhy::CalculatePhyPreambleAndHeaderDuration(txVector);
|
||||
const auto calculatedDuration = MicroSeconds(((ceil(static_cast<double>(length + 3) / 3)) * 4) + 20);
|
||||
uint32_t nSymbols =
|
||||
floor(static_cast<double>((calculatedDuration - preambleDuration).GetNanoSeconds()) /
|
||||
tSymbol.GetNanoSeconds());
|
||||
@@ -176,8 +125,7 @@ VhtPpdu::GetTxDuration() const
|
||||
{
|
||||
nSymbols--;
|
||||
}
|
||||
ppduDuration = preambleDuration + (nSymbols * tSymbol);
|
||||
return ppduDuration;
|
||||
return (preambleDuration + (nSymbols * tSymbol));
|
||||
}
|
||||
|
||||
Ptr<WifiPpdu>
|
||||
|
||||
@@ -209,9 +209,7 @@ class VhtPpdu : public OfdmPpdu
|
||||
const LSigHeader& lSig,
|
||||
const VhtSigHeader& vhtSig) const;
|
||||
|
||||
#ifndef NS3_BUILD_PROFILE_DEBUG
|
||||
VhtSigHeader m_vhtSig; //!< the VHT-SIG PHY header
|
||||
#endif
|
||||
}; // class VhtPpdu
|
||||
|
||||
} // namespace ns3
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
#include "wifi-psdu.h"
|
||||
|
||||
#include "ns3/log.h"
|
||||
#include "ns3/packet.h"
|
||||
#include "ns3/wifi-phy-operating-channel.h"
|
||||
|
||||
namespace ns3
|
||||
@@ -42,9 +41,6 @@ WifiPpdu::WifiPpdu(Ptr<const WifiPsdu> psdu,
|
||||
m_uid(uid),
|
||||
m_txVector(txVector),
|
||||
m_operatingChannel(channel),
|
||||
#ifdef NS3_BUILD_PROFILE_DEBUG
|
||||
m_phyHeaders(Create<Packet>()),
|
||||
#endif
|
||||
m_truncatedTx(false),
|
||||
m_txPowerLevel(txVector.GetTxPowerLevel())
|
||||
{
|
||||
@@ -65,9 +61,6 @@ WifiPpdu::WifiPpdu(const WifiConstPsduMap& psdus,
|
||||
m_uid(uid),
|
||||
m_txVector(txVector),
|
||||
m_operatingChannel(channel),
|
||||
#ifdef NS3_BUILD_PROFILE_DEBUG
|
||||
m_phyHeaders(Create<Packet>()),
|
||||
#endif
|
||||
m_truncatedTx(false),
|
||||
m_txPowerLevel(txVector.GetTxPowerLevel()),
|
||||
m_txAntennas(txVector.GetNTx())
|
||||
|
||||
@@ -209,10 +209,6 @@ class WifiPpdu : public SimpleRefCount<WifiPpdu>
|
||||
//!< std::nullopt if TXVECTOR has not been reconstructed yet)
|
||||
const WifiPhyOperatingChannel& m_operatingChannel; //!< the operating channel of the PHY
|
||||
|
||||
#ifdef NS3_BUILD_PROFILE_DEBUG
|
||||
Ptr<Packet> m_phyHeaders; //!< the PHY headers contained in this PPDU
|
||||
#endif
|
||||
|
||||
private:
|
||||
/**
|
||||
* Get the TXVECTOR used to send the PPDU.
|
||||
|
||||
Reference in New Issue
Block a user