diff --git a/src/wifi/model/he/he-ppdu.cc b/src/wifi/model/he/he-ppdu.cc index 69d1d0399..eb642126a 100644 --- a/src/wifi/model/he/he-ppdu.cc +++ b/src/wifi/model/he/he-ppdu.cc @@ -98,6 +98,7 @@ HePpdu::SetPhyHeaders (const WifiTxVector& txVector, Time ppduDuration) if (txVector.IsDlMu ()) { m_heSig.SetMuFlag (true); + m_heSig.SetMcs (txVector.GetSigBMode ().GetMcsValue ()); } else if (!txVector.IsUlMu ()) { @@ -125,6 +126,10 @@ HePpdu::DoGetTxVector (void) const { txVector.SetHeMuUserInfo (muUserInfo.first, muUserInfo.second); } + if (txVector.IsDlMu ()) + { + txVector.SetSigBMode (HePhy::GetVhtMcs (m_heSig.GetMcs ())); + } return txVector; } diff --git a/src/wifi/model/he/rr-multi-user-scheduler.cc b/src/wifi/model/he/rr-multi-user-scheduler.cc index aaf48a5ad..def1cca5c 100644 --- a/src/wifi/model/he/rr-multi-user-scheduler.cc +++ b/src/wifi/model/he/rr-multi-user-scheduler.cc @@ -705,6 +705,11 @@ RrMultiUserScheduler::FinalizeTxVector (WifiTxVector& txVector) candidateIt++; } + auto hePhy = DynamicCast (m_apMac->GetWifiPhy ()->GetPhyEntity (WIFI_MOD_CLASS_HE)); + NS_ASSERT (hePhy); + auto sigBMode = hePhy->GetSigBMode (txVector); + txVector.SetSigBMode (sigBMode); + // remove candidates that will not be served m_candidates.erase (candidateIt, m_candidates.end ()); } diff --git a/src/wifi/model/wifi-tx-vector.cc b/src/wifi/model/wifi-tx-vector.cc index 7b1409d01..66520ad82 100644 --- a/src/wifi/model/wifi-tx-vector.cc +++ b/src/wifi/model/wifi-tx-vector.cc @@ -89,7 +89,8 @@ WifiTxVector::WifiTxVector (const WifiTxVector& txVector) m_bssColor (txVector.m_bssColor), m_length (txVector.m_length), m_modeInitialized (txVector.m_modeInitialized), - m_inactiveSubchannels (txVector.m_inactiveSubchannels) + m_inactiveSubchannels (txVector.m_inactiveSubchannels), + m_sigBMcs (txVector.m_sigBMcs) { m_muUserInfos.clear (); if (!txVector.m_muUserInfos.empty ()) //avoids crashing for loop @@ -334,6 +335,18 @@ WifiTxVector::GetLength (void) const return m_length; } +void +WifiTxVector::SetSigBMode (const WifiMode& mode) +{ + m_sigBMcs = mode; +} + +WifiMode +WifiTxVector::GetSigBMode () const +{ + return m_sigBMcs; +} + bool WifiTxVector::IsValid (void) const { diff --git a/src/wifi/model/wifi-tx-vector.h b/src/wifi/model/wifi-tx-vector.h index 9015cc8e6..fa1136911 100644 --- a/src/wifi/model/wifi-tx-vector.h +++ b/src/wifi/model/wifi-tx-vector.h @@ -406,6 +406,18 @@ public: */ const std::vector& GetInactiveSubchannels (void) const; + /** + * Set the MCS used for SIG-B + * \param mode MCS used for SIG-B + */ + void SetSigBMode (const WifiMode& mode); + + /** + * Get MCS used for SIG-B + * \return MCS for SIG-B + */ + WifiMode GetSigBMode () const; + private: WifiMode m_mode; /**< The DATARATE parameter in Table 15-4. It is the value that will be passed @@ -432,7 +444,9 @@ private: indexed by station ID (STA-ID) corresponding to the 11 LSBs of the AID of the recipient STA This list shall be used only for HE MU */ - std::vector m_inactiveSubchannels;/**< Bitmap of inactive subchannels used for preamble puncturing */ + std::vector m_inactiveSubchannels; /**< Bitmap of inactive subchannels used for preamble puncturing */ + + WifiMode m_sigBMcs; // sizes, std::list staIds; + uint16_t staId = 1; for (const auto & userInfo : userInfos) { txVector.SetHeMuUserInfo (staId, userInfo); staIds.push_back (staId++); } + + txVector.SetSigBMode (VhtPhy::GetVhtMcs0 ()); + Ptr phy = CreateObject (); std::list testedBands {WIFI_PHY_BAND_5GHZ, WIFI_PHY_BAND_6GHZ, WIFI_PHY_BAND_2_4GHZ}; //Durations vary depending on frequency; test also 2.4 GHz (bug 1971) for (auto & testedBand : testedBands) @@ -621,6 +625,7 @@ HeSigBDurationTest::DoRun (void) userInfos.push_back ({{HeRu::RU_106_TONE, 1, true}, HePhy::GetHeMcs11 (), 1}); userInfos.push_back ({{HeRu::RU_106_TONE, 2, true}, HePhy::GetHeMcs10 (), 4}); WifiTxVector txVector = BuildTxVector (20, userInfos); + txVector.SetSigBMode (VhtPhy::GetVhtMcs5 ()); NS_TEST_EXPECT_MSG_EQ (hePhy->GetSigMode (WIFI_PPDU_FIELD_SIG_B, txVector), VhtPhy::GetVhtMcs5 (), "HE-SIG-B should be sent at MCS 5"); std::pair numUsersPerCc = txVector.GetNumRusPerHeSigBContentChannel (); NS_TEST_EXPECT_MSG_EQ (numUsersPerCc.first, 2, "Both users should be on HE-SIG-B content channel 1"); @@ -633,6 +638,7 @@ HeSigBDurationTest::DoRun (void) userInfos.push_back ({{HeRu::RU_52_TONE, 7, true}, HePhy::GetHeMcs5 (), 3}); userInfos.push_back ({{HeRu::RU_52_TONE, 8, true}, HePhy::GetHeMcs6 (), 2}); txVector = BuildTxVector (40, userInfos); + txVector.SetSigBMode (VhtPhy::GetVhtMcs4 ()); NS_TEST_EXPECT_MSG_EQ (hePhy->GetSigMode (WIFI_PPDU_FIELD_SIG_B, txVector), VhtPhy::GetVhtMcs4 (), "HE-SIG-B should be sent at MCS 4"); numUsersPerCc = txVector.GetNumRusPerHeSigBContentChannel (); NS_TEST_EXPECT_MSG_EQ (numUsersPerCc.first, 2, "Two users should be on HE-SIG-B content channel 1"); @@ -642,6 +648,7 @@ HeSigBDurationTest::DoRun (void) //40 MHz band, odd number of users per HE-SIG-B content channel userInfos.push_back ({{HeRu::RU_26_TONE, 13, true}, HePhy::GetHeMcs3 (), 1}); txVector = BuildTxVector (40, userInfos); + txVector.SetSigBMode (VhtPhy::GetVhtMcs3 ()); NS_TEST_EXPECT_MSG_EQ (hePhy->GetSigMode (WIFI_PPDU_FIELD_SIG_B, txVector), VhtPhy::GetVhtMcs3 (), "HE-SIG-B should be sent at MCS 3"); numUsersPerCc = txVector.GetNumRusPerHeSigBContentChannel (); NS_TEST_EXPECT_MSG_EQ (numUsersPerCc.first, 2, "Two users should be on HE-SIG-B content channel 1"); @@ -652,6 +659,7 @@ HeSigBDurationTest::DoRun (void) userInfos.push_back ({{HeRu::RU_242_TONE, 3, true}, HePhy::GetHeMcs1 (), 1}); userInfos.push_back ({{HeRu::RU_242_TONE, 4, true}, HePhy::GetHeMcs4 (), 1}); txVector = BuildTxVector (80, userInfos); + txVector.SetSigBMode (VhtPhy::GetVhtMcs1 ()); NS_TEST_EXPECT_MSG_EQ (hePhy->GetSigMode (WIFI_PPDU_FIELD_SIG_B, txVector), VhtPhy::GetVhtMcs1 (), "HE-SIG-B should be sent at MCS 1"); numUsersPerCc = txVector.GetNumRusPerHeSigBContentChannel (); NS_TEST_EXPECT_MSG_EQ (numUsersPerCc.first, 3, "Three users should be on HE-SIG-B content channel 1"); @@ -661,6 +669,7 @@ HeSigBDurationTest::DoRun (void) //160 MHz band userInfos.push_back ({{HeRu::RU_996_TONE, 1, false}, HePhy::GetHeMcs1 (), 1}); txVector = BuildTxVector (160, userInfos); + txVector.SetSigBMode (VhtPhy::GetVhtMcs1 ()); NS_TEST_EXPECT_MSG_EQ (hePhy->GetSigMode (WIFI_PPDU_FIELD_SIG_B, txVector), VhtPhy::GetVhtMcs1 (), "HE-SIG-B should be sent at MCS 1"); numUsersPerCc = txVector.GetNumRusPerHeSigBContentChannel (); NS_TEST_EXPECT_MSG_EQ (numUsersPerCc.first, 4, "Four users should be on HE-SIG-B content channel 1"); @@ -911,6 +920,7 @@ PhyHeaderSectionsTest::DoRun (void) { 2, { {HeRu::RU_106_TONE, 1, true}, HePhy::GetHeMcs9 (), 1 } } }; sigAMode = HePhy::GetVhtMcs0 (); sigBMode = HePhy::GetVhtMcs4 (); //because of first user info map + txVector.SetSigBMode (sigBMode); // -> HE SU format txVector.SetPreambleType (WIFI_PREAMBLE_HE_SU); diff --git a/src/wifi/test/wifi-mac-ofdma-test.cc b/src/wifi/test/wifi-mac-ofdma-test.cc index 34bbc6e07..826f16bba 100644 --- a/src/wifi/test/wifi-mac-ofdma-test.cc +++ b/src/wifi/test/wifi-mac-ofdma-test.cc @@ -308,6 +308,7 @@ TestMultiUserScheduler::ComputeWifiTxVector (void) m_txVector.SetHeMuUserInfo (sta.first, {{ruType, ruIndex++, primary80}, WifiMode ("HeMcs11"), 1}); } + m_txVector.SetSigBMode (VhtPhy::GetVhtMcs5 ()); } MultiUserScheduler::DlMuInfo diff --git a/src/wifi/test/wifi-phy-ofdma-test.cc b/src/wifi/test/wifi-phy-ofdma-test.cc index 9c26d3c2d..adb7b2d37 100644 --- a/src/wifi/test/wifi-phy-ofdma-test.cc +++ b/src/wifi/test/wifi-phy-ofdma-test.cc @@ -493,6 +493,8 @@ TestDlOfdmaPhyTransmission::SendMuPpdu (uint16_t rxStaId1, uint16_t rxStaId2) NS_ASSERT_MSG (false, "Unsupported channel width"); } + txVector.SetSigBMode (VhtPhy::GetVhtMcs5 ()); + HeRu::RuSpec ru1 (ruType, 1, true); txVector.SetRu (ru1, rxStaId1); txVector.SetMode (HePhy::GetHeMcs7 (), rxStaId1); @@ -1128,6 +1130,8 @@ TestDlOfdmaPhyPuncturing::SendMuPpdu (uint16_t rxStaId1, uint16_t rxStaId2, cons txVector.SetMode (HePhy::GetHeMcs9 (), rxStaId2); txVector.SetNss (1, rxStaId2); + txVector.SetSigBMode (VhtPhy::GetVhtMcs5 ()); + Ptr pkt1 = Create (1000); WifiMacHeader hdr1; hdr1.SetType (WIFI_MAC_QOSDATA); @@ -1670,6 +1674,7 @@ TestUlOfdmaPpduUid::SendMuPpdu (void) txVector.SetRu (ru2, rxStaId2); txVector.SetMode (HePhy::GetHeMcs9 (), rxStaId2); txVector.SetNss (1, rxStaId2); + txVector.SetSigBMode (VhtPhy::GetVhtMcs5 ()); Ptr pkt1 = Create (1000); WifiMacHeader hdr1; diff --git a/src/wifi/test/wifi-primary-channels-test.cc b/src/wifi/test/wifi-primary-channels-test.cc index 719443645..1105b3a82 100644 --- a/src/wifi/test/wifi-primary-channels-test.cc +++ b/src/wifi/test/wifi-primary-channels-test.cc @@ -724,6 +724,7 @@ WifiPrimaryChannelsTest::SendDlMuPpdu (uint8_t bss, uint16_t txChannelWidth, HeR hdr.SetAddr1 (staDev->GetMac ()->GetAddress ()); psduMap[staId] = Create (Create (1000), hdr); } + txVector.SetSigBMode (VhtPhy::GetVhtMcs5 ()); apDev->GetPhy ()->Send (psduMap, txVector); }