From 684c8ba9c2c17093329382cbc150b63cb185db5f Mon Sep 17 00:00:00 2001 From: Stefano Avallone Date: Tue, 17 May 2022 10:46:29 +0200 Subject: [PATCH] wifi: Add a max delay with which a TB PPDU can arrive Partially reverts d7662fbe --- src/wifi/model/he/he-configuration.cc | 22 ++++++++++++++++++++++ src/wifi/model/he/he-configuration.h | 9 +++++++++ src/wifi/model/he/he-phy.cc | 20 ++++++++++++++++++-- src/wifi/test/wifi-phy-ofdma-test.cc | 26 +++++++++++++++++++++++--- 4 files changed, 72 insertions(+), 5 deletions(-) diff --git a/src/wifi/model/he/he-configuration.cc b/src/wifi/model/he/he-configuration.cc index 12c6bb802..685b84cd3 100644 --- a/src/wifi/model/he/he-configuration.cc +++ b/src/wifi/model/he/he-configuration.cc @@ -52,6 +52,16 @@ HeConfiguration::GetTypeId (void) MakeUintegerAccessor (&HeConfiguration::GetBssColor, &HeConfiguration::SetBssColor), MakeUintegerChecker ()) + .AddAttribute ("MaxTbPpduDelay", + "Specify the maximum delay with which a TB PPDU can be received " + "after the reception of the first TB PPDU. If the delay is higher " + "than this value, the TB PPDU is dropped and considered interference. " + "A zero value indicates no delay limit. This attribute is only " + "valid for APs.", + TimeValue (Seconds (0)), + MakeTimeAccessor (&HeConfiguration::GetMaxTbPpduDelay, + &HeConfiguration::SetMaxTbPpduDelay), + MakeTimeChecker ()) .AddAttribute ("MpduBufferSize", "The MPDU buffer size for receiving A-MPDUs", UintegerValue (64), @@ -197,6 +207,18 @@ HeConfiguration::GetBssColor (void) const return m_bssColor; } +Time +HeConfiguration::GetMaxTbPpduDelay (void) const +{ + return m_maxTbPpduDelay; +} + +void +HeConfiguration::SetMaxTbPpduDelay (Time maxTbPpduDelay) +{ + m_maxTbPpduDelay = maxTbPpduDelay; +} + void HeConfiguration::SetMpduBufferSize (uint16_t size) { diff --git a/src/wifi/model/he/he-configuration.h b/src/wifi/model/he/he-configuration.h index 49b6c3e4a..5f046ece1 100644 --- a/src/wifi/model/he/he-configuration.h +++ b/src/wifi/model/he/he-configuration.h @@ -60,6 +60,14 @@ public: * \return the BSS color */ uint8_t GetBssColor (void) const; + /** + * \param maxTbPpduDelay the maximum TB PPDU delay + */ + void SetMaxTbPpduDelay (Time maxTbPpduDelay); + /** + * \return the maximum TB PPDU delay + */ + Time GetMaxTbPpduDelay (void) const; /** * \param size the MPDU buffer size to receive A-MPDUs */ @@ -73,6 +81,7 @@ public: private: Time m_guardInterval; //!< Supported HE guard interval uint8_t m_bssColor; //!< BSS color + Time m_maxTbPpduDelay; //!< Max TB PPDU delay uint16_t m_mpduBufferSize; //!< MPDU buffer size uint8_t m_muBeAifsn; //!< AIFSN for BE in MU EDCA Parameter Set uint8_t m_muBkAifsn; //!< AIFSN for BK in MU EDCA Parameter Set diff --git a/src/wifi/model/he/he-phy.cc b/src/wifi/model/he/he-phy.cc index 887deb2c4..d2ec76560 100644 --- a/src/wifi/model/he/he-phy.cc +++ b/src/wifi/model/he/he-phy.cc @@ -449,8 +449,24 @@ HePhy::DoGetEvent (Ptr ppdu, RxPowerWattPerChannelBand& rxPowers NS_LOG_DEBUG ("Received another HE TB PPDU for UID " << ppdu->GetUid () << " from STA-ID " << ppdu->GetStaId () << " and BSS color " << +txVector.GetBssColor ()); event = it->second; - //Update received power of the event associated to that UL MU transmission - UpdateInterferenceEvent (event, rxPowersW); + auto heConfiguration = m_wifiPhy->GetDevice ()->GetHeConfiguration (); + NS_ASSERT (heConfiguration); + Time maxDelay = heConfiguration->GetMaxTbPpduDelay (); + + if (maxDelay.IsStrictlyPositive () + && Simulator::Now () - event->GetStartTime () > maxDelay) + { + // This HE TB PPDU arrived too late to be decoded properly. The HE TB PPDU + // is dropped and added as interference + event = CreateInterferenceEvent (ppdu, txVector, rxDuration, rxPowersW); + NS_LOG_DEBUG ("Drop HE TB PPDU that arrived too late"); + m_wifiPhy->NotifyRxDrop (GetAddressedPsduInPpdu (ppdu), HE_TB_PPDU_TOO_LATE); + } + else + { + //Update received power of the event associated to that UL MU transmission + UpdateInterferenceEvent (event, rxPowersW); + } if ((GetCurrentEvent () != 0) && (GetCurrentEvent ()->GetPpdu ()->GetUid () != ppdu->GetUid ())) { diff --git a/src/wifi/test/wifi-phy-ofdma-test.cc b/src/wifi/test/wifi-phy-ofdma-test.cc index 1efc6c128..7a3a38b61 100644 --- a/src/wifi/test/wifi-phy-ofdma-test.cc +++ b/src/wifi/test/wifi-phy-ofdma-test.cc @@ -1074,6 +1074,8 @@ TestUlOfdmaPpduUid::DoSetup (void) apDev->SetPhy (m_phyAp); apNode->AggregateObject (apMobility); apNode->AddDevice (apDev); + apDev->SetStandard (WIFI_STANDARD_80211ax); + apDev->SetHeConfiguration (CreateObject ()); Ptr sta1Node = CreateObject (); Ptr sta1Dev = CreateObject (); @@ -1541,6 +1543,7 @@ void TestMultipleHeTbPreambles::DoSetup (void) { Ptr dev = CreateObject (); + dev->SetStandard (WIFI_STANDARD_80211ax); m_phy = CreateObject (0); m_phy->ConfigureStandard (WIFI_STANDARD_80211ax); Ptr interferenceHelper = CreateObject (); @@ -1558,6 +1561,9 @@ TestMultipleHeTbPreambles::DoSetup (void) preambleDetectionModel->SetAttribute ("Threshold", DoubleValue (4)); preambleDetectionModel->SetAttribute ("MinimumRssi", DoubleValue (-82)); m_phy->SetPreambleDetectionModel (preambleDetectionModel); + Ptr heConfiguration = CreateObject (); + heConfiguration->SetMaxTbPpduDelay (NanoSeconds (400)); + dev->SetHeConfiguration (heConfiguration); } void @@ -1647,14 +1653,16 @@ TestMultipleHeTbPreambles::DoRun (void) { //Verify the correct reception of a single UL MU transmission with two stations belonging to the same BSS, - //and the second PPDU arrives 500ns after the first PPDU + //and the second PPDU arrives 500ns after the first PPDU, i.e. it exceeds the configured delay spread of 400ns std::vector uids {9}; Simulator::Schedule (Seconds (6), &TestMultipleHeTbPreambles::RxHeTbPpdu, this, uids[0], 1, txPowerWatts, 1001); Simulator::Schedule (Seconds (6) + NanoSeconds (500), &TestMultipleHeTbPreambles::RxHeTbPpdu, this, uids[0], 2, txPowerWatts, 1002); //Check that we received a single UL MU transmission with the corresponding UID Simulator::Schedule (Seconds (6.0) + MicroSeconds (1), &TestMultipleHeTbPreambles::CheckHeTbPreambles, this, 1, uids); - //No packet is dropped (we check after 5us to verify that PD is successful) - Simulator::Schedule (Seconds (6.0) + MicroSeconds (5), &TestMultipleHeTbPreambles::CheckBytesDropped, this, 0); + //The first packet of 1001 bytes should be dropped because preamble is not detected after 4us (because the PPDU that arrived at 500ns is interfering): + //the second HE TB PPDU is acting as interference since it arrived after the maximum allowed 400ns. + //Obviously, that second packet of 1002 bytes is dropped as well. + Simulator::Schedule (Seconds (6.0) + MicroSeconds (5), &TestMultipleHeTbPreambles::CheckBytesDropped, this, 1001 + 1002); Simulator::Schedule (Seconds (6.5), &TestMultipleHeTbPreambles::Reset, this); } @@ -2280,6 +2288,8 @@ TestUlOfdmaPhyTransmission::DoSetup (void) Ptr sta1Node = CreateObject (); Ptr sta1Dev = CreateObject (); + sta1Dev->SetStandard (WIFI_STANDARD_80211ax); + sta1Dev->SetHeConfiguration (CreateObject ()); m_phySta1 = CreateObject (1); m_phySta1->CreateWifiSpectrumPhyInterface (sta1Dev); m_phySta1->ConfigureStandard (WIFI_STANDARD_80211ax); @@ -2298,6 +2308,8 @@ TestUlOfdmaPhyTransmission::DoSetup (void) Ptr sta2Node = CreateObject (); Ptr sta2Dev = CreateObject (); + sta2Dev->SetStandard (WIFI_STANDARD_80211ax); + sta2Dev->SetHeConfiguration (CreateObject ()); m_phySta2 = CreateObject (2); m_phySta2->CreateWifiSpectrumPhyInterface (sta2Dev); m_phySta2->ConfigureStandard (WIFI_STANDARD_80211ax); @@ -2316,6 +2328,8 @@ TestUlOfdmaPhyTransmission::DoSetup (void) Ptr sta3Node = CreateObject (); Ptr sta3Dev = CreateObject (); + sta3Dev->SetStandard (WIFI_STANDARD_80211ax); + sta3Dev->SetHeConfiguration (CreateObject ()); m_phySta3 = CreateObject (3); m_phySta3->CreateWifiSpectrumPhyInterface (sta3Dev); m_phySta3->ConfigureStandard (WIFI_STANDARD_80211ax); @@ -3178,6 +3192,8 @@ TestPhyPaddingExclusion::DoSetup (void) Ptr apMobility = CreateObject (); m_phyAp->SetMobility (apMobility); apDev->SetPhy (m_phyAp); + apDev->SetStandard (WIFI_STANDARD_80211ax); + apDev->SetHeConfiguration (CreateObject ()); apNode->AggregateObject (apMobility); apNode->AddDevice (apDev); @@ -3198,6 +3214,8 @@ TestPhyPaddingExclusion::DoSetup (void) Ptr sta1Mobility = CreateObject (); m_phySta1->SetMobility (sta1Mobility); sta1Dev->SetPhy (m_phySta1); + sta1Dev->SetStandard (WIFI_STANDARD_80211ax); + sta1Dev->SetHeConfiguration (CreateObject ()); sta1Node->AggregateObject (sta1Mobility); sta1Node->AddDevice (sta1Dev); @@ -3218,6 +3236,8 @@ TestPhyPaddingExclusion::DoSetup (void) Ptr sta2Mobility = CreateObject (); m_phySta2->SetMobility (sta2Mobility); sta2Dev->SetPhy (m_phySta2); + sta2Dev->SetStandard (WIFI_STANDARD_80211ax); + sta2Dev->SetHeConfiguration (CreateObject ()); sta2Node->AggregateObject (sta2Mobility); sta2Node->AddDevice (sta2Dev);