From 1acc3840eca02a5ccdd1e18bf8b0c18f479281c4 Mon Sep 17 00:00:00 2001 From: Sharan Naribole Date: Tue, 3 Sep 2024 15:27:07 +0200 Subject: [PATCH] wifi: Update RNR MLD Parameters to 802.11be draft 6.0 --- src/wifi/model/ap-wifi-mac.cc | 2 +- src/wifi/model/reduced-neighbor-report.cc | 40 +++++++----------- src/wifi/model/reduced-neighbor-report.h | 43 ++++++++------------ src/wifi/model/wifi-assoc-manager.cc | 2 +- src/wifi/model/wifi-default-assoc-manager.cc | 2 +- src/wifi/test/wifi-eht-info-elems-test.cc | 8 ++-- src/wifi/test/wifi-mlo-test.cc | 16 ++++---- 7 files changed, 45 insertions(+), 68 deletions(-) diff --git a/src/wifi/model/ap-wifi-mac.cc b/src/wifi/model/ap-wifi-mac.cc index 7415fd8ba..375935baa 100644 --- a/src/wifi/model/ap-wifi-mac.cc +++ b/src/wifi/model/ap-wifi-mac.cc @@ -687,7 +687,7 @@ ApWifiMac::GetReducedNeighborReport(uint8_t linkId) const rnr.SetShortSsid(nbrId, 0, 0); rnr.SetBssParameters(nbrId, 0, 0); rnr.SetPsd20MHz(nbrId, 0, 0); - rnr.SetMldParameters(nbrId, 0, 0, index, 0); + rnr.SetMldParameters(nbrId, 0, {0, index, 0, 0, 0}); } } return rnr; diff --git a/src/wifi/model/reduced-neighbor-report.cc b/src/wifi/model/reduced-neighbor-report.cc index 365a7ad6b..c64d4d604 100644 --- a/src/wifi/model/reduced-neighbor-report.cc +++ b/src/wifi/model/reduced-neighbor-report.cc @@ -520,17 +520,13 @@ ReducedNeighborReport::GetPsd20MHz(std::size_t nbrApInfoId, std::size_t index) c void ReducedNeighborReport::SetMldParameters(std::size_t nbrApInfoId, std::size_t index, - uint8_t mldId, - uint8_t linkId, - uint8_t changeCount) + const MldParameters& mldParams) { NS_ASSERT(nbrApInfoId < m_nbrApInfoFields.size()); NS_ASSERT(index < m_nbrApInfoFields.at(nbrApInfoId).tbttInformationSet.size()); auto it = std::next(m_nbrApInfoFields.at(nbrApInfoId).tbttInformationSet.begin(), index); - it->mldParameters.mldId = mldId; - it->mldParameters.linkId = (linkId & 0x0f); - it->mldParameters.bssParamsChangeCount = changeCount; + it->mldParameters = mldParams; m_nbrApInfoFields.at(nbrApInfoId).hasMldParams = true; } @@ -543,23 +539,13 @@ ReducedNeighborReport::HasMldParameters(std::size_t nbrApInfoId) const return m_nbrApInfoFields.at(nbrApInfoId).hasMldParams; } -uint8_t -ReducedNeighborReport::GetMldId(std::size_t nbrApInfoId, std::size_t index) const +const ReducedNeighborReport::MldParameters& +ReducedNeighborReport::GetMldParameters(std::size_t nbrApInfoId, std::size_t index) const { NS_ASSERT(HasMldParameters(nbrApInfoId)); NS_ASSERT(index < m_nbrApInfoFields.at(nbrApInfoId).tbttInformationSet.size()); - return m_nbrApInfoFields.at(nbrApInfoId).tbttInformationSet.at(index).mldParameters.mldId; -} - -uint8_t -ReducedNeighborReport::GetLinkId(std::size_t nbrApInfoId, std::size_t index) const -{ - NS_ASSERT(HasMldParameters(nbrApInfoId)); - NS_ASSERT(index < m_nbrApInfoFields.at(nbrApInfoId).tbttInformationSet.size()); - - return m_nbrApInfoFields.at(nbrApInfoId).tbttInformationSet.at(index).mldParameters.linkId & - 0x0f; + return m_nbrApInfoFields.at(nbrApInfoId).tbttInformationSet.at(index).mldParameters; } void @@ -661,10 +647,12 @@ ReducedNeighborReport::SerializeInformationField(Buffer::Iterator start) const } if (neighborApInfo.hasMldParams) { - start.WriteU8(tbttInformation.mldParameters.mldId); + start.WriteU8(tbttInformation.mldParameters.apMldId); uint16_t other = 0; other |= (tbttInformation.mldParameters.linkId & 0x0f); other |= (tbttInformation.mldParameters.bssParamsChangeCount << 4); + other |= (tbttInformation.mldParameters.allUpdates << 12); + other |= (tbttInformation.mldParameters.disabledLink << 13); start.WriteHtolsbU16(other); } } @@ -723,14 +711,14 @@ ReducedNeighborReport::DeserializeInformationField(Buffer::Iterator start, uint1 } if (m_nbrApInfoFields.back().hasMldParams) { - m_nbrApInfoFields.back().tbttInformationSet.back().mldParameters.mldId = i.ReadU8(); + auto& mldParams = m_nbrApInfoFields.back().tbttInformationSet.back().mldParameters; + mldParams.apMldId = i.ReadU8(); uint16_t other = i.ReadLsbtohU16(); count += 3; - m_nbrApInfoFields.back().tbttInformationSet.back().mldParameters.linkId = - other & 0x000f; - m_nbrApInfoFields.back() - .tbttInformationSet.back() - .mldParameters.bssParamsChangeCount = (other >> 4) & 0x00ff; + mldParams.linkId = other & 0x000f; + mldParams.bssParamsChangeCount = (other >> 4) & 0x00ff; + mldParams.allUpdates = (other >> 12) & 0x01; + mldParams.disabledLink = (other >> 13) & 0x01; } } } diff --git a/src/wifi/model/reduced-neighbor-report.h b/src/wifi/model/reduced-neighbor-report.h index 0bf3b1f0a..1a39c9492 100644 --- a/src/wifi/model/reduced-neighbor-report.h +++ b/src/wifi/model/reduced-neighbor-report.h @@ -34,9 +34,11 @@ class ReducedNeighborReport : public WifiInformationElement */ struct MldParameters { - uint8_t mldId; //!< MLD ID - uint8_t linkId; //!< Link ID + uint8_t apMldId; //!< AP MLD ID + uint8_t linkId : 4; //!< Link ID uint8_t bssParamsChangeCount; //!< BSS Parameters Change Count + uint8_t allUpdates : 1; ///< All Updates Included + uint8_t disabledLink : 1; ///< Disabled Link Indication }; /** @@ -44,12 +46,12 @@ class ReducedNeighborReport : public WifiInformationElement */ struct TbttInformation { - uint8_t neighborApTbttOffset{0}; //!< Neighbor AP TBTT Offset - Mac48Address bssid; //!< BSSID (optional) - uint32_t shortSsid{0}; //!< Short SSID (optional) - uint8_t bssParameters{0}; //!< BSS parameters (optional) - uint8_t psd20MHz{0}; //!< 20 MHz PSD (optional) - MldParameters mldParameters{0, 0, 0}; //!< MLD Parameters (optional) + uint8_t neighborApTbttOffset{0}; //!< Neighbor AP TBTT Offset + Mac48Address bssid; //!< BSSID (optional) + uint32_t shortSsid{0}; //!< Short SSID (optional) + uint8_t bssParameters{0}; //!< BSS parameters (optional) + uint8_t psd20MHz{0}; //!< 20 MHz PSD (optional) + MldParameters mldParameters{}; //!< MLD Parameters (optional) }; /** @@ -249,15 +251,11 @@ class ReducedNeighborReport : public WifiInformationElement * * @param nbrApInfoId identifier of the given Neighbor AP Information field * @param index the index of the given TBTT Information field - * @param mldId the MLD ID value - * @param linkId the Link ID value - * @param changeSequence the Change Sequence value + * @param mldParams the MLD parameters */ void SetMldParameters(std::size_t nbrApInfoId, std::size_t index, - uint8_t mldId, - uint8_t linkId, - uint8_t changeSequence); + const MldParameters& mldParams); /** * Return true if the MLD Parameters subfield is present in all the TBTT Information fields * of the given Neighbor AP Information field. @@ -267,23 +265,14 @@ class ReducedNeighborReport : public WifiInformationElement */ bool HasMldParameters(std::size_t nbrApInfoId) const; /** - * Get the MLD ID value in the MLD Parameters subfield (must be present) in the - * i-th TBTT Information field of the given Neighbor AP Information field. + * Get the MLD Parameters subfield (must be present) in the i-th TBTT Information field + * of the given Neighbor AP Information field. * * @param nbrApInfoId identifier of the given Neighbor AP Information field * @param index the index of the given TBTT Information field - * @return the MLD ID value + * @return the MLD parameters */ - uint8_t GetMldId(std::size_t nbrApInfoId, std::size_t index) const; - /** - * Get the Link ID value in the MLD Parameters subfield (must be present) in the - * i-th TBTT Information field of the given Neighbor AP Information field. - * - * @param nbrApInfoId identifier of the given Neighbor AP Information field - * @param index the index of the given TBTT Information field - * @return the Link ID value - */ - uint8_t GetLinkId(std::size_t nbrApInfoId, std::size_t index) const; + const MldParameters& GetMldParameters(std::size_t nbrApInfoId, std::size_t index) const; private: /** diff --git a/src/wifi/model/wifi-assoc-manager.cc b/src/wifi/model/wifi-assoc-manager.cc index 349fb27e2..f311e2e66 100644 --- a/src/wifi/model/wifi-assoc-manager.cc +++ b/src/wifi/model/wifi-assoc-manager.cc @@ -328,7 +328,7 @@ WifiAssocManager::GetNextAffiliatedAp(const ReducedNeighborReport& rnr, std::siz std::size_t tbttInfoFieldIndex = 0; while (tbttInfoFieldIndex < rnr.GetNTbttInformationFields(nbrApInfoId) && - rnr.GetMldId(nbrApInfoId, tbttInfoFieldIndex) != 0) + rnr.GetMldParameters(nbrApInfoId, tbttInfoFieldIndex).apMldId != 0) { tbttInfoFieldIndex++; } diff --git a/src/wifi/model/wifi-default-assoc-manager.cc b/src/wifi/model/wifi-default-assoc-manager.cc index a6ac45dd6..183d7fa40 100644 --- a/src/wifi/model/wifi-default-assoc-manager.cc +++ b/src/wifi/model/wifi-default-assoc-manager.cc @@ -196,7 +196,7 @@ WifiDefaultAssocManager::EndScanning() Mac48Address bssid = rnr->get().GetBssid(apIt->m_nbrApInfoId, apIt->m_tbttInfoFieldId); setupLinks.emplace_back(StaWifiMac::ApInfo::SetupLinksInfo{ linkId, - rnr->get().GetLinkId(apIt->m_nbrApInfoId, apIt->m_tbttInfoFieldId), + rnr->get().GetMldParameters(apIt->m_nbrApInfoId, apIt->m_tbttInfoFieldId).linkId, bssid}); if (needChannelSwitch) diff --git a/src/wifi/test/wifi-eht-info-elems-test.cc b/src/wifi/test/wifi-eht-info-elems-test.cc index 743dbae1b..fa8f814d6 100644 --- a/src/wifi/test/wifi-eht-info-elems-test.cc +++ b/src/wifi/test/wifi-eht-info-elems-test.cc @@ -649,7 +649,7 @@ ReducedNeighborReportTest::GetReducedNeighborReport(PhyOpChannelIt channel2_4It, rnr.SetShortSsid(nbrId, 0, 0); rnr.SetBssParameters(nbrId, 0, 10); rnr.SetPsd20MHz(nbrId, 0, 50); - rnr.SetMldParameters(nbrId, 0, 0, 2, 3); + rnr.SetMldParameters(nbrId, 0, {0, 2, 3, 1, 1}); } if (channel5It != WifiPhyOperatingChannel::m_frequencyChannels.cend()) @@ -666,14 +666,14 @@ ReducedNeighborReportTest::GetReducedNeighborReport(PhyOpChannelIt channel2_4It, rnr.SetShortSsid(nbrId, 0, 0); rnr.SetBssParameters(nbrId, 0, 20); rnr.SetPsd20MHz(nbrId, 0, 60); - rnr.SetMldParameters(nbrId, 0, 0, 3, 4); + rnr.SetMldParameters(nbrId, 0, {0, 3, 4, 0, 1}); // Add another TBTT Information Field rnr.AddTbttInformationField(nbrId); rnr.SetBssid(nbrId, 1, Mac48Address("00:00:00:00:01:05")); rnr.SetShortSsid(nbrId, 1, 0); rnr.SetBssParameters(nbrId, 1, 30); rnr.SetPsd20MHz(nbrId, 1, 70); - rnr.SetMldParameters(nbrId, 1, 0, 4, 5); + rnr.SetMldParameters(nbrId, 1, {0, 4, 5, 1, 0}); } if (channel6It != WifiPhyOperatingChannel::m_frequencyChannels.cend()) @@ -690,7 +690,7 @@ ReducedNeighborReportTest::GetReducedNeighborReport(PhyOpChannelIt channel2_4It, rnr.SetShortSsid(nbrId, 0, 0); rnr.SetBssParameters(nbrId, 0, 40); rnr.SetPsd20MHz(nbrId, 0, 80); - rnr.SetMldParameters(nbrId, 0, 0, 5, 6); + rnr.SetMldParameters(nbrId, 0, {0, 5, 6, 0, 0}); } NS_LOG_DEBUG(info.str()); diff --git a/src/wifi/test/wifi-mlo-test.cc b/src/wifi/test/wifi-mlo-test.cc index 6e9200d2a..6b150a887 100644 --- a/src/wifi/test/wifi-mlo-test.cc +++ b/src/wifi/test/wifi-mlo-test.cc @@ -71,11 +71,11 @@ GetRnrLinkInfoTest::DoRun() rnr.AddTbttInformationField(nbrId); tbttId = rnr.GetNTbttInformationFields(nbrId) - 1; - rnr.SetMldParameters(nbrId, tbttId, 0, 0, 0); + rnr.SetMldParameters(nbrId, tbttId, {0, 0, 0, 1, 1}); rnr.AddTbttInformationField(nbrId); tbttId = rnr.GetNTbttInformationFields(nbrId) - 1; - rnr.SetMldParameters(nbrId, tbttId, 5, 0, 0); + rnr.SetMldParameters(nbrId, tbttId, {5, 0, 0, 1, 0}); // Add a third Neighbor AP Information field with MLD Parameters; none of the // TBTT Information fields is related to an AP affiliated to the same AP MLD @@ -85,11 +85,11 @@ GetRnrLinkInfoTest::DoRun() rnr.AddTbttInformationField(nbrId); tbttId = rnr.GetNTbttInformationFields(nbrId) - 1; - rnr.SetMldParameters(nbrId, tbttId, 3, 0, 0); + rnr.SetMldParameters(nbrId, tbttId, {3, 0, 0, 0, 1}); rnr.AddTbttInformationField(nbrId); tbttId = rnr.GetNTbttInformationFields(nbrId) - 1; - rnr.SetMldParameters(nbrId, tbttId, 4, 0, 0); + rnr.SetMldParameters(nbrId, tbttId, {4, 0, 0, 0, 0}); // Add a fourth Neighbor AP Information field with MLD Parameters; the first // TBTT Information field is not related to an AP affiliated to the same AP MLD @@ -99,11 +99,11 @@ GetRnrLinkInfoTest::DoRun() rnr.AddTbttInformationField(nbrId); tbttId = rnr.GetNTbttInformationFields(nbrId) - 1; - rnr.SetMldParameters(nbrId, tbttId, 6, 0, 0); + rnr.SetMldParameters(nbrId, tbttId, {6, 0, 0, 1, 1}); rnr.AddTbttInformationField(nbrId); tbttId = rnr.GetNTbttInformationFields(nbrId) - 1; - rnr.SetMldParameters(nbrId, tbttId, 0, 0, 0); + rnr.SetMldParameters(nbrId, tbttId, {0, 0, 0, 0, 0}); // check implementation of WifiAssocManager::GetNextAffiliatedAp() auto ret = WifiAssocManager::GetNextAffiliatedAp(rnr, 0); @@ -1117,7 +1117,7 @@ MultiLinkSetupTest::CheckBeacon(Ptr mpdu, uint8_t linkId) NS_TEST_EXPECT_MSG_EQ(rnr->GetNTbttInformationFields(nbrApInfoId), 1, "Expected only one TBTT Info subfield per Neighbor AP Info"); - uint8_t nbrLinkId = rnr->GetLinkId(nbrApInfoId, 0); + uint8_t nbrLinkId = rnr->GetMldParameters(nbrApInfoId, 0).linkId; NS_TEST_EXPECT_MSG_EQ(rnr->GetBssid(nbrApInfoId, 0), m_apMac->GetFrameExchangeManager(nbrLinkId)->GetAddress(), "BSSID advertised in Neighbor AP Info field " @@ -1176,7 +1176,7 @@ MultiLinkSetupTest::CheckProbeResponse(Ptr mpdu, uint8_t linkId) NS_TEST_EXPECT_MSG_EQ(rnr->GetNTbttInformationFields(nbrApInfoId), 1, "Expected only one TBTT Info subfield per Neighbor AP Info"); - uint8_t nbrLinkId = rnr->GetLinkId(nbrApInfoId, 0); + uint8_t nbrLinkId = rnr->GetMldParameters(nbrApInfoId, 0).linkId; NS_TEST_EXPECT_MSG_EQ(rnr->GetBssid(nbrApInfoId, 0), m_apMac->GetFrameExchangeManager(nbrLinkId)->GetAddress(), "BSSID advertised in Neighbor AP Info field "