wifi: Do not hardcode maximum RU type

This commit is contained in:
Sébastien Deronne
2024-11-09 14:55:45 +01:00
parent 1f97e9cc5a
commit 0808a07e6d
3 changed files with 7 additions and 6 deletions

View File

@@ -664,7 +664,7 @@ HePpdu::GetHeSigBContentChannels(const WifiTxVector& txVector, uint8_t p20Index)
std::optional<HeSigBUserSpecificField> cc2Central26ToneRu;
const auto& orderedMap = txVector.GetUserInfoMapOrderedByRus(p20Index);
std::optional<HeRu::RuType> prevRuType;
HeRu::RuType prevRuType{HeRu::RuType::RU_TYPE_MAX};
std::size_t prevRuIndex{0};
std::size_t prevCcIndex{0};
for (const auto& [ru, staIds] : orderedMap)
@@ -688,9 +688,9 @@ HePpdu::GetHeSigBContentChannels(const WifiTxVector& txVector, uint8_t p20Index)
}
const auto ruIndex = ru.GetPhyIndex(channelWidth, p20Index);
if (prevRuType && (*prevRuType != ruType))
if ((prevRuType < HeRu::RuType::RU_TYPE_MAX) && (prevRuType != ruType))
{
prevRuIndex *= HeRu::GetBandwidth(*prevRuType) / HeRu::GetBandwidth(ruType);
prevRuIndex *= HeRu::GetBandwidth(prevRuType) / HeRu::GetBandwidth(ruType);
}
if (ruType >= HeRu::RU_484_TONE)
{
@@ -725,7 +725,7 @@ HePpdu::GetHeSigBContentChannels(const WifiTxVector& txVector, uint8_t p20Index)
{
ccIndex = ((prevRuIndex / numRus) % 2 == 0) ? 0 : 1;
}
const auto central26TonesRus = HeRu::GetCentral26TonesRus(channelWidth, *prevRuType);
const auto central26TonesRus = HeRu::GetCentral26TonesRus(channelWidth, prevRuType);
const auto isCentral26ToneRu =
std::none_of(central26TonesRus.cbegin(),
central26TonesRus.cend(),

View File

@@ -36,7 +36,8 @@ class HeRu
RU_242_TONE,
RU_484_TONE,
RU_996_TONE,
RU_2x996_TONE
RU_2x996_TONE,
RU_TYPE_MAX
};
/// (lowest index, highest index) pair defining a subcarrier range

View File

@@ -152,7 +152,7 @@ SpectrumWifiPhy::GetHeRuBands(Ptr<WifiSpectrumPhyInterface> spectrumPhyInterface
{
for (uint32_t i = 0; i < (channelWidth / bw); ++i)
{
for (uint32_t type = 0; type < 7; type++)
for (uint32_t type = 0; type < HeRu::RuType::RU_TYPE_MAX; type++)
{
auto ruType = static_cast<HeRu::RuType>(type);
std::size_t nRus = HeRu::GetNRus(bw, ruType);