diff --git a/src/wifi/model/he/he-ppdu.cc b/src/wifi/model/he/he-ppdu.cc index ef3d40531..f228ca4dc 100644 --- a/src/wifi/model/he/he-ppdu.cc +++ b/src/wifi/model/he/he-ppdu.cc @@ -217,6 +217,10 @@ HePpdu::SetHeMuUserInfos(WifiTxVector& txVector, auto ruAllocIndex = contentChannelIndex; for (const auto& userInfo : contentChannel) { + if (userInfo.staId == NO_USER_STA_ID) + { + continue; + } auto ruSpecs = HeRu::GetRuSpecs(ruAllocation.at(ruAllocIndex)); if (ruSpecs.empty()) { diff --git a/src/wifi/model/wifi-tx-vector.cc b/src/wifi/model/wifi-tx-vector.cc index 3c844eaa6..1260bc29d 100644 --- a/src/wifi/model/wifi-tx-vector.cc +++ b/src/wifi/model/wifi-tx-vector.cc @@ -688,22 +688,37 @@ WifiTxVector::GetContentChannels(uint8_t p20Index) const continue; } - size_t numRus{1}; - if (ruType < HeRu::RU_242_TONE) - { - numRus = HeRu::m_heRuSubcarrierGroups.at({20, ruType}).size(); - } - + std::size_t numRus = (ruType >= HeRu::RU_242_TONE) + ? 1 + : HeRu::m_heRuSubcarrierGroups.at({20, ruType}).size(); if (((ruIdx - 1) / numRus) % 2 == 0) { - contentChannels[0].push_back({staId, userInfo.nss, userInfo.mcs}); + contentChannels.at(0).push_back({staId, userInfo.nss, userInfo.mcs}); } else { - contentChannels[1].push_back({staId, userInfo.nss, userInfo.mcs}); + contentChannels.at(1).push_back({staId, userInfo.nss, userInfo.mcs}); } } + // Add unassigned RUs + auto numNumRusPerHeSigBContentChannel = + HePpdu::GetNumRusPerHeSigBContentChannel(m_channelWidth, GetRuAllocation(p20Index)); + std::size_t contentChannelIndex = 1; + for (auto& contentChannel : contentChannels) + { + const auto totalUsersInContentChannel = (contentChannelIndex == 1) + ? numNumRusPerHeSigBContentChannel.first + : numNumRusPerHeSigBContentChannel.second; + NS_ASSERT(contentChannel.size() <= totalUsersInContentChannel); + std::size_t unallocatedRus = totalUsersInContentChannel - contentChannel.size(); + for (std::size_t i = 0; i < unallocatedRus; i++) + { + contentChannel.push_back({NO_USER_STA_ID, 0, 0}); + } + contentChannelIndex++; + } + return contentChannels; }