wifi: Cleanup unused and minor improvements in HeRu
This commit is contained in:
@@ -17,8 +17,8 @@
|
||||
namespace ns3
|
||||
{
|
||||
|
||||
const HeRu::SubcarrierGroups HeRu::m_heRuSubcarrierGroups = {
|
||||
// RUs in a 20 MHz HE PPDU (Table 28-6)
|
||||
const HeRu::SubcarrierGroups HeRu::m_heRuSubcarrierGroups{
|
||||
// RUs in a 20 MHz HE PPDU (Table 27-7 IEEE802.11ax-2021)
|
||||
{{MHz_u{20}, HeRu::RU_26_TONE},
|
||||
{/* 1 */ {{-121, -96}},
|
||||
/* 2 */ {{-95, -70}},
|
||||
@@ -38,7 +38,7 @@ const HeRu::SubcarrierGroups HeRu::m_heRuSubcarrierGroups = {
|
||||
{/* 1 */ {{-122, -17}},
|
||||
/* 2 */ {{17, 122}}}},
|
||||
{{MHz_u{20}, HeRu::RU_242_TONE}, {/* 1 */ {{-122, -2}, {2, 122}}}},
|
||||
// RUs in a 40 MHz HE PPDU (Table 28-7)
|
||||
// RUs in a 40 MHz HE PPDU (Table 27-8 IEEE802.11ax-2021)
|
||||
{{MHz_u{40}, HeRu::RU_26_TONE},
|
||||
{/* 1 */ {{-243, -218}},
|
||||
/* 2 */ {{-217, -192}},
|
||||
@@ -76,7 +76,7 @@ const HeRu::SubcarrierGroups HeRu::m_heRuSubcarrierGroups = {
|
||||
{/* 1 */ {{-244, -3}},
|
||||
/* 2 */ {{3, 244}}}},
|
||||
{{MHz_u{40}, HeRu::RU_484_TONE}, {/* 1 */ {{-244, -3}, {3, 244}}}},
|
||||
// RUs in an 80 MHz HE PPDU (Table 28-8)
|
||||
// RUs in an 80 MHz HE PPDU (Table 27-9 IEEE802.11ax-2021)
|
||||
{{MHz_u{80}, HeRu::RU_26_TONE},
|
||||
{/* 1 */ {{-499, -474}},
|
||||
/* 2 */ {{-473, -448}},
|
||||
@@ -382,7 +382,7 @@ std::vector<HeRu::RuSpec>
|
||||
HeRu::GetRuSpecs(uint16_t ruAllocation)
|
||||
{
|
||||
std::optional<std::size_t> idx;
|
||||
if (((ruAllocation >= 0) && (ruAllocation <= 15)) || (ruAllocation == 112))
|
||||
if ((ruAllocation <= 15) || (ruAllocation == 112))
|
||||
{
|
||||
idx = ruAllocation;
|
||||
}
|
||||
@@ -430,11 +430,6 @@ HeRu::GetEqualizedRuAllocation(RuType ruType, bool isOdd, bool hasUsers)
|
||||
}
|
||||
}
|
||||
|
||||
HeRu::RuSpec::RuSpec()
|
||||
: m_index(0) // indicates undefined RU
|
||||
{
|
||||
}
|
||||
|
||||
HeRu::RuSpec::RuSpec(RuType ruType, std::size_t index, bool primary80MHz)
|
||||
: m_ruType(ruType),
|
||||
m_index(index),
|
||||
@@ -469,8 +464,8 @@ HeRu::RuSpec::GetPhyIndex(MHz_u bw, uint8_t p20Index) const
|
||||
{
|
||||
bool primary80IsLower80 = (p20Index < bw / MHz_u{40});
|
||||
|
||||
if (bw < MHz_u{160} || m_ruType == HeRu::RU_2x996_TONE ||
|
||||
(primary80IsLower80 && m_primary80MHz) || (!primary80IsLower80 && !m_primary80MHz))
|
||||
if (bw < MHz_u{160} || m_ruType == RU_2x996_TONE || (primary80IsLower80 && m_primary80MHz) ||
|
||||
(!primary80IsLower80 && !m_primary80MHz))
|
||||
{
|
||||
return m_index;
|
||||
}
|
||||
@@ -503,7 +498,12 @@ HeRu::GetNRus(MHz_u bw, RuType ruType)
|
||||
std::vector<HeRu::RuSpec>
|
||||
HeRu::GetRusOfType(MHz_u bw, HeRu::RuType ruType)
|
||||
{
|
||||
if (ruType == HeRu::RU_2x996_TONE)
|
||||
if (GetNRus(bw, ruType) == 0)
|
||||
{
|
||||
return {};
|
||||
}
|
||||
|
||||
if (ruType == RU_2x996_TONE)
|
||||
{
|
||||
NS_ASSERT(bw >= MHz_u{160});
|
||||
return {{ruType, 1, true}};
|
||||
@@ -657,29 +657,6 @@ HeRu::DoesOverlap(MHz_u bw, RuSpec ru, const std::vector<RuSpec>& v)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
HeRu::DoesOverlap(MHz_u bw, RuSpec ru, const SubcarrierGroup& toneRanges, uint8_t p20Index)
|
||||
{
|
||||
for (const auto& range : toneRanges)
|
||||
{
|
||||
if (bw == MHz_u{160} && ru.GetRuType() == RU_2x996_TONE)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
SubcarrierGroup rangesRu =
|
||||
GetSubcarrierGroup(bw, ru.GetRuType(), ru.GetPhyIndex(bw, p20Index));
|
||||
for (auto& r : rangesRu)
|
||||
{
|
||||
if (range.second >= r.first && r.second >= range.first)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
HeRu::RuSpec
|
||||
HeRu::FindOverlappingRu(MHz_u bw, RuSpec referenceRu, RuType searchedRuType)
|
||||
{
|
||||
@@ -841,7 +818,15 @@ HeRu::GetEqualSizedRusForStations(MHz_u bandwidth,
|
||||
}
|
||||
|
||||
nStations = nRusAssigned;
|
||||
nCentral26TonesRus = GetNumCentral26TonesRus(bandwidth, ruType);
|
||||
|
||||
return ruType;
|
||||
}
|
||||
|
||||
uint8_t
|
||||
HeRu::GetNumCentral26TonesRus(MHz_u bandwidth, HeRu::RuType ruType)
|
||||
{
|
||||
uint8_t nCentral26TonesRus{0};
|
||||
switch (ruType)
|
||||
{
|
||||
case RU_52_TONE:
|
||||
@@ -872,7 +857,7 @@ HeRu::GetEqualSizedRusForStations(MHz_u bandwidth,
|
||||
nCentral26TonesRus *= 2;
|
||||
}
|
||||
|
||||
return ruType;
|
||||
return nCentral26TonesRus;
|
||||
}
|
||||
|
||||
bool
|
||||
|
||||
@@ -41,10 +41,10 @@ class HeRu
|
||||
};
|
||||
|
||||
/// (lowest index, highest index) pair defining a subcarrier range
|
||||
typedef std::pair<int16_t, int16_t> SubcarrierRange;
|
||||
using SubcarrierRange = std::pair<int16_t, int16_t>;
|
||||
|
||||
/// a vector of subcarrier ranges defining a subcarrier group
|
||||
typedef std::vector<SubcarrierRange> SubcarrierGroup;
|
||||
using SubcarrierGroup = std::vector<SubcarrierRange>;
|
||||
|
||||
/**
|
||||
* RU Specification. Stores the information carried by the RU Allocation subfield
|
||||
@@ -60,7 +60,7 @@ class HeRu
|
||||
/**
|
||||
* Default constructor
|
||||
*/
|
||||
RuSpec();
|
||||
RuSpec() = default;
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
@@ -120,10 +120,10 @@ class HeRu
|
||||
bool operator<(const RuSpec& other) const;
|
||||
|
||||
private:
|
||||
RuType m_ruType; //!< RU type
|
||||
std::size_t m_index; /**< RU index (starting at 1) as defined by Tables 27-7
|
||||
RuType m_ruType{}; //!< RU type
|
||||
std::size_t m_index{}; /**< RU index (starting at 1) as defined by Tables 27-7
|
||||
to 27-9 of 802.11ax D8.0 */
|
||||
bool m_primary80MHz; //!< true if the RU is allocated in the primary 80MHz channel
|
||||
bool m_primary80MHz{}; //!< true if the RU is allocated in the primary 80MHz channel
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -172,7 +172,7 @@ class HeRu
|
||||
* @param ruType the RU type (number of tones)
|
||||
* @return the set of distinct RUs available
|
||||
*/
|
||||
static std::vector<HeRu::RuSpec> GetRusOfType(MHz_u bw, HeRu::RuType ruType);
|
||||
static std::vector<RuSpec> GetRusOfType(MHz_u bw, RuType ruType);
|
||||
|
||||
/**
|
||||
* Get the set of 26-tone RUs that can be additionally allocated if the given
|
||||
@@ -182,7 +182,7 @@ class HeRu
|
||||
* @param ruType the RU type (number of tones)
|
||||
* @return the set of 26-tone RUs that can be additionally allocated
|
||||
*/
|
||||
static std::vector<HeRu::RuSpec> GetCentral26TonesRus(MHz_u bw, HeRu::RuType ruType);
|
||||
static std::vector<RuSpec> GetCentral26TonesRus(MHz_u bw, RuType ruType);
|
||||
|
||||
/**
|
||||
* Get the subcarrier group of the RU having the given PHY index among all the
|
||||
@@ -212,22 +212,6 @@ class HeRu
|
||||
*/
|
||||
static bool DoesOverlap(MHz_u bw, RuSpec ru, const std::vector<RuSpec>& v);
|
||||
|
||||
/**
|
||||
* Check whether the given RU overlaps with the given tone ranges.
|
||||
* Note that for channel width of 160 MHz the returned range is relative to
|
||||
* the 160 MHz channel (i.e. -1012 to 1012).
|
||||
*
|
||||
* @param bw the bandwidth of the HE PPDU (20, 40, 80, 160)
|
||||
* @param ru the given RU allocation
|
||||
* @param toneRanges the given set of tone ranges
|
||||
* @param p20Index the index of the primary20 channel
|
||||
* @return true if the given RU overlaps with the given set of tone ranges.
|
||||
*/
|
||||
static bool DoesOverlap(MHz_u bw,
|
||||
RuSpec ru,
|
||||
const SubcarrierGroup& toneRanges,
|
||||
uint8_t p20Index);
|
||||
|
||||
/**
|
||||
* Find the RU allocation of the given RU type overlapping the given
|
||||
* reference RU allocation.
|
||||
@@ -274,10 +258,10 @@ class HeRu
|
||||
std::size_t& nCentral26TonesRus);
|
||||
|
||||
/// (bandwidth, number of tones) pair
|
||||
typedef std::pair<MHz_u, RuType> BwTonesPair;
|
||||
using BwTonesPair = std::pair<MHz_u, RuType>;
|
||||
|
||||
/// map (bandwidth, number of tones) pairs to the group of subcarrier ranges
|
||||
typedef std::map<BwTonesPair, std::vector<SubcarrierGroup>> SubcarrierGroups;
|
||||
using SubcarrierGroups = std::map<BwTonesPair, std::vector<SubcarrierGroup>>;
|
||||
|
||||
/// Subcarrier groups for all RUs (with indices being applicable to primary 80 MHz channel)
|
||||
static const SubcarrierGroups m_heRuSubcarrierGroups;
|
||||
@@ -303,6 +287,17 @@ class HeRu
|
||||
|
||||
/// Empty 242-tone RU identifier
|
||||
static constexpr uint8_t EMPTY_242_TONE_RU = 113;
|
||||
|
||||
private:
|
||||
/**
|
||||
* Get the number of 26-tone RUs that can be allocated if returned RU size is greater than 26
|
||||
* tones.
|
||||
*
|
||||
* @param bw the bandwidth (MHz) of the HE PPDU (20, 40, 80, 160)
|
||||
* @param ruType the RU type (number of tones)
|
||||
* @return the number of 26-tone RUs that can be allocated
|
||||
*/
|
||||
static uint8_t GetNumCentral26TonesRus(MHz_u bw, RuType ruType);
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user