wifi: Do not instantiate HE PHY headers for EHT PPDUs

This commit is contained in:
Sébastien Deronne
2024-09-29 15:32:46 +02:00
parent 742f736723
commit dd5ce2e037
4 changed files with 76 additions and 20 deletions

View File

@@ -28,7 +28,7 @@ EhtPpdu::EhtPpdu(const WifiConstPsduMap& psdus,
Time ppduDuration,
uint64_t uid,
TxPsdFlag flag)
: HePpdu(psdus, txVector, channel, ppduDuration, uid, flag)
: HePpdu(psdus, txVector, channel, ppduDuration, uid, flag, false)
{
NS_LOG_FUNCTION(this << psdus << txVector << channel << ppduDuration << uid << flag);
SetPhyHeaders(txVector, ppduDuration);
@@ -38,6 +38,7 @@ void
EhtPpdu::SetPhyHeaders(const WifiTxVector& txVector, Time ppduDuration)
{
NS_LOG_FUNCTION(this << txVector << ppduDuration);
SetLSigHeader(ppduDuration);
SetEhtPhyHeader(txVector);
}
@@ -133,7 +134,7 @@ EhtPpdu::SetTxVectorFromPhyHeaders(WifiTxVector& txVector) const
{
// TODO: use punctured channel information
}
txVector.SetSigBMode(HePhy::GetVhtMcs(ehtPhyHeader->m_ehtSigMcs));
txVector.SetSigBMode(EhtPhy::GetVhtMcs(ehtPhyHeader->m_ehtSigMcs));
txVector.SetGuardInterval(GetGuardIntervalFromEncoding(ehtPhyHeader->m_giLtfSize));
const auto ruAllocation = ehtPhyHeader->m_ruAllocationA; // RU Allocation-B not supported
// yet
@@ -313,6 +314,44 @@ EhtPpdu::GetPuncturedInfo(const std::vector<bool>& inactiveSubchannels,
return 0;
}
Ptr<const WifiPsdu>
EhtPpdu::GetPsdu(uint8_t bssColor, uint16_t staId /* = SU_STA_ID */) const
{
if (m_psdus.contains(SU_STA_ID))
{
NS_ASSERT(m_psdus.size() == 1);
return m_psdus.at(SU_STA_ID);
}
if (IsUlMu())
{
auto ehtPhyHeader = std::get_if<EhtTbPhyHeader>(&m_ehtPhyHeader);
NS_ASSERT(ehtPhyHeader);
NS_ASSERT(m_psdus.size() == 1);
if ((bssColor == 0) || (ehtPhyHeader->m_bssColor == 0) ||
(bssColor == ehtPhyHeader->m_bssColor))
{
return m_psdus.cbegin()->second;
}
}
else if (IsDlMu())
{
auto ehtPhyHeader = std::get_if<EhtMuPhyHeader>(&m_ehtPhyHeader);
NS_ASSERT(ehtPhyHeader);
if ((bssColor == 0) || (ehtPhyHeader->m_bssColor == 0) ||
(bssColor == ehtPhyHeader->m_bssColor))
{
const auto it = m_psdus.find(staId);
if (it != m_psdus.cend())
{
return it->second;
}
}
}
return nullptr;
}
Ptr<WifiPpdu>
EhtPpdu::Copy() const
{

View File

@@ -90,6 +90,7 @@ class EhtPpdu : public HePpdu
TxPsdFlag flag);
WifiPpduType GetType() const override;
Ptr<const WifiPsdu> GetPsdu(uint8_t bssColor, uint16_t staId = SU_STA_ID) const override;
Ptr<WifiPpdu> Copy() const override;
/**
@@ -161,7 +162,7 @@ class EhtPpdu : public HePpdu
* @param txVector the TXVECTOR that was used for this PPDU
* @param ppduDuration the transmission duration of this PPDU
*/
void SetPhyHeaders(const WifiTxVector& txVector, Time ppduDuration);
void SetPhyHeaders(const WifiTxVector& txVector, Time ppduDuration) override;
/**
* Fill in the EHT PHY header.

View File

@@ -46,7 +46,8 @@ HePpdu::HePpdu(const WifiConstPsduMap& psdus,
const WifiPhyOperatingChannel& channel,
Time ppduDuration,
uint64_t uid,
TxPsdFlag flag)
TxPsdFlag flag,
bool instantiateHeaders /* = true */)
: OfdmPpdu(psdus.begin()->second,
txVector,
channel,
@@ -54,20 +55,25 @@ HePpdu::HePpdu(const WifiConstPsduMap& psdus,
false), // don't instantiate LSigHeader of OfdmPpdu
m_txPsdFlag(flag)
{
NS_LOG_FUNCTION(this << psdus << txVector << channel << ppduDuration << uid << flag);
NS_LOG_FUNCTION(this << psdus << txVector << channel << ppduDuration << uid << flag
<< instantiateHeaders);
// overwrite with map (since only first element used by OfdmPpdu)
m_psdus.begin()->second = nullptr;
m_psdus.clear();
m_psdus = psdus;
SetPhyHeaders(txVector, ppduDuration);
if (instantiateHeaders)
{
SetPhyHeaders(txVector, ppduDuration);
}
}
HePpdu::HePpdu(Ptr<const WifiPsdu> psdu,
const WifiTxVector& txVector,
const WifiPhyOperatingChannel& channel,
Time ppduDuration,
uint64_t uid)
uint64_t uid,
bool instantiateHeaders /* = true */)
: OfdmPpdu(psdu,
txVector,
channel,
@@ -75,9 +81,13 @@ HePpdu::HePpdu(Ptr<const WifiPsdu> psdu,
false), // don't instantiate LSigHeader of OfdmPpdu
m_txPsdFlag(PSD_NON_HE_PORTION)
{
NS_LOG_FUNCTION(this << psdu << txVector << channel << ppduDuration << uid);
NS_LOG_FUNCTION(this << psdu << txVector << channel << ppduDuration << uid
<< instantiateHeaders);
NS_ASSERT(!IsMu());
SetPhyHeaders(txVector, ppduDuration);
if (instantiateHeaders)
{
SetPhyHeaders(txVector, ppduDuration);
}
}
void

View File

@@ -114,12 +114,15 @@ class HePpdu : public OfdmPpdu
* @param channel the operating channel of the PHY used to transmit this PPDU
* @param ppduDuration the transmission duration of this PPDU
* @param uid the unique ID of this PPDU
* @param instantiateHeaders flag used to instantiate HE header, should be disabled by child
* classes
*/
HePpdu(Ptr<const WifiPsdu> psdu,
const WifiTxVector& txVector,
const WifiPhyOperatingChannel& channel,
Time ppduDuration,
uint64_t uid);
uint64_t uid,
bool instantiateHeaders = true);
/**
* Create an MU HE PPDU, storing a map of PSDUs.
*
@@ -131,13 +134,16 @@ class HePpdu : public OfdmPpdu
* @param ppduDuration the transmission duration 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 instantiateHeaders flag used to instantiate HE header, should be disabled by child
* classes
*/
HePpdu(const WifiConstPsduMap& psdus,
const WifiTxVector& txVector,
const WifiPhyOperatingChannel& channel,
Time ppduDuration,
uint64_t uid,
TxPsdFlag flag);
TxPsdFlag flag,
bool instantiateHeaders = true);
Time GetTxDuration() const override;
Ptr<WifiPpdu> Copy() const override;
@@ -152,7 +158,7 @@ class HePpdu : public OfdmPpdu
* @param staId the STA-ID of the PHY calling this function.
* @return the PSDU
*/
Ptr<const WifiPsdu> GetPsdu(uint8_t bssColor, uint16_t staId = SU_STA_ID) const;
virtual Ptr<const WifiPsdu> GetPsdu(uint8_t bssColor, uint16_t staId = SU_STA_ID) const;
/**
* @return the transmit PSD flag set for this PPDU
@@ -231,6 +237,13 @@ class HePpdu : public OfdmPpdu
*/
virtual void SetTxVectorFromPhyHeaders(WifiTxVector& txVector) const;
/**
* Fill in the L-SIG header.
*
* @param ppduDuration the transmission duration of this PPDU
*/
void SetLSigHeader(Time ppduDuration);
/**
* Reconstruct HeMuUserInfoMap from HE-SIG-B header.
*
@@ -341,14 +354,7 @@ class HePpdu : public OfdmPpdu
* @param txVector the TXVECTOR that was used for this PPDU
* @param ppduDuration the transmission duration of this PPDU
*/
void SetPhyHeaders(const WifiTxVector& txVector, Time ppduDuration);
/**
* Fill in the L-SIG header.
*
* @param ppduDuration the transmission duration of this PPDU
*/
void SetLSigHeader(Time ppduDuration);
virtual void SetPhyHeaders(const WifiTxVector& txVector, Time ppduDuration);
/**
* Fill in the HE-SIG header.