From 867d960e3c39772c451ebc359f310277afe7b383 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Deronne?= Date: Sat, 19 Nov 2022 11:33:48 +0100 Subject: [PATCH] wifi: Rename flag in HeSigHeader --- src/wifi/model/he/he-ppdu.cc | 32 ++++++++++++++++++-------------- src/wifi/model/he/he-ppdu.h | 14 +++++++------- 2 files changed, 25 insertions(+), 21 deletions(-) diff --git a/src/wifi/model/he/he-ppdu.cc b/src/wifi/model/he/he-ppdu.cc index 5bfd47bd2..203f06a02 100644 --- a/src/wifi/model/he/he-ppdu.cc +++ b/src/wifi/model/he/he-ppdu.cc @@ -141,7 +141,7 @@ HePpdu::SetHeSigHeader(HeSigHeader& heSig, const WifiTxVector& txVector) const if (txVector.IsDlMu()) { const auto p20Index = m_operatingChannel.GetPrimaryChannelIndex(20); - heSig.SetMuFlag(true); + heSig.SetHeSigBPresent(true); heSig.SetSigBMcs(txVector.GetSigBMode().GetMcsValue()); heSig.SetRuAllocation(txVector.GetRuAllocation(p20Index)); heSig.SetHeSigBContentChannels(txVector.GetContentChannels(p20Index)); @@ -152,7 +152,7 @@ HePpdu::SetHeSigHeader(HeSigHeader& heSig, const WifiTxVector& txVector) const } else { - heSig.SetMuFlag(false); + heSig.SetHeSigBPresent(false); if (!ns3::IsUlMu(m_preamble)) { heSig.SetMcs(txVector.GetMode().GetMcsValue()); @@ -589,7 +589,7 @@ HePpdu::HeSigHeader::HeSigHeader() { } -HePpdu::HeSigHeader::HeSigHeader(bool mu) +HePpdu::HeSigHeader::HeSigHeader(bool heSigBPresent) : m_format(0), m_bssColor(0), m_mcs(0), @@ -597,7 +597,7 @@ HePpdu::HeSigHeader::HeSigHeader(bool mu) m_gi_ltf_size(0), m_nsts(0), m_sigBMcs(0), - m_mu(mu) + m_heSigBPresent(heSigBPresent) { } @@ -621,8 +621,8 @@ void HePpdu::HeSigHeader::Print(std::ostream& os) const { os << "MCS=" << +m_mcs << " CHANNEL_WIDTH=" << GetChannelWidth() << " GI=" << GetGuardInterval() - << " NSTS=" << +m_nsts << " BSSColor=" << +m_bssColor << " MU=" << +m_mu; - if (m_mu) + << " NSTS=" << +m_nsts << " BSSColor=" << +m_bssColor; + if (m_heSigBPresent) { os << " SIG-B_MCS=" << +m_sigBMcs << " RU_ALLOCATION="; for (auto alloc : m_ruAllocation) @@ -653,7 +653,7 @@ HePpdu::HeSigHeader::GetSerializedSize() const uint32_t size = 0; size += 4; // HE-SIG-A1 size += 4; // HE-SIG-A2 - if (m_mu) + if (m_heSigBPresent) { size += GetSigBSize(); // HE-SIG-B } @@ -661,9 +661,9 @@ HePpdu::HeSigHeader::GetSerializedSize() const } void -HePpdu::HeSigHeader::SetMuFlag(bool mu) +HePpdu::HeSigHeader::SetHeSigBPresent(bool heSigBPresent) { - m_mu = mu; + m_heSigBPresent = heSigBPresent; } uint32_t @@ -802,6 +802,7 @@ void HePpdu::HeSigHeader::SetSigBMcs(uint8_t mcs) { NS_ASSERT(mcs <= 5); + NS_ASSERT(m_heSigBPresent); m_sigBMcs = mcs; } @@ -814,6 +815,7 @@ HePpdu::HeSigHeader::GetSigBMcs() const void HePpdu::HeSigHeader::SetRuAllocation(const RuAllocation& ruAlloc) { + NS_ASSERT(m_heSigBPresent); m_ruAllocation = ruAlloc; } @@ -826,6 +828,7 @@ HePpdu::HeSigHeader::GetRuAllocation() const void HePpdu::HeSigHeader::SetHeSigBContentChannels(const HeSigBContentChannels& contentChannels) { + NS_ASSERT(m_heSigBPresent); m_contentChannels = contentChannels; } @@ -839,6 +842,7 @@ void HePpdu::HeSigHeader::SetCenter26ToneRuIndication( std::optional center26ToneRuIndication) { + NS_ASSERT(m_heSigBPresent); m_center26ToneRuIndication = center26ToneRuIndication; } @@ -1041,7 +1045,7 @@ HePpdu::HeSigHeader::Serialize(Buffer::Iterator start) const { // HE-SIG-A1 uint32_t sigA1 = 0; - if (!m_mu) + if (!m_heSigBPresent) { sigA1 |= m_format & 0x01; if (m_format == 1) // HE SU or HE ER SU PPDU @@ -1073,14 +1077,14 @@ HePpdu::HeSigHeader::Serialize(Buffer::Iterator start) const // HE-SIG-A2 uint32_t sigA2 = 0; - if (!m_mu && (m_format == 1)) + if (!m_heSigBPresent && (m_format == 1)) { // HE SU or HE ER SU PPDU sigA2 |= (0x01 << 14); // Set Reserved bit #14 to 1 } start.WriteU32(sigA2); - if (m_mu) + if (m_heSigBPresent) { // HE-SIG-B std::vector userBlockFieldsContentChannel1; @@ -1117,7 +1121,7 @@ HePpdu::HeSigHeader::Deserialize(Buffer::Iterator start) // HE-SIG-A1 uint32_t sigA1 = i.ReadU32(); - if (!m_mu) + if (!m_heSigBPresent) { m_format = (sigA1 & 0x01); if (m_format == 1) @@ -1148,7 +1152,7 @@ HePpdu::HeSigHeader::Deserialize(Buffer::Iterator start) // HE-SIG-A2 i.ReadU32(); - if (m_mu) + if (m_heSigBPresent) { // HE-SIG-B m_ruAllocation.clear(); diff --git a/src/wifi/model/he/he-ppdu.h b/src/wifi/model/he/he-ppdu.h index 4b053c4ea..5b5064348 100644 --- a/src/wifi/model/he/he-ppdu.h +++ b/src/wifi/model/he/he-ppdu.h @@ -57,9 +57,9 @@ class HePpdu : public OfdmPpdu /** * Constructor. * - * \param mu the MU flag + * \param heSigBPresent the flag indicating whether HE-SIG-B fields should be present or not */ - HeSigHeader(bool mu); + HeSigHeader(bool heSigBPresent); /** * \brief Get the type ID. @@ -74,11 +74,11 @@ class HePpdu : public OfdmPpdu uint32_t Deserialize(Buffer::Iterator start) override; /** - * Set the Multi-User (MU) flag. + * Set whether HE-SIG-B fields are present or not. * - * \param mu the MU flag + * \param heSigBPresent the flag indicating whether HE-SIG-B fields should be present or not */ - void SetMuFlag(bool mu); + void SetHeSigBPresent(bool heSigBPresent); /** * Fill the FORMAT field of HE-SIG-A1 for HE SU, HE ER SU and HE TB PPDUs. @@ -244,8 +244,8 @@ class HePpdu : public OfdmPpdu uint8_t m_nsts; ///< NSTS uint8_t m_sigBMcs; ///< HE-SIG-B MCS - /// This is used to decide whether MU SIG-B should be added or not - bool m_mu; // TODO: rename to express the need for HE-SIG-B + bool + m_heSigBPresent; //!< flag used to decide whether HE-SIG-B fields should be added or not RuAllocation m_ruAllocation; //!< RU allocations that are going to be carried in SIG-B //!< common subfields