From e55628fc387755f7162ebaa9363472c65973e150 Mon Sep 17 00:00:00 2001 From: Stefano Avallone Date: Wed, 22 Jun 2022 11:08:08 +0200 Subject: [PATCH] wifi: Limit the delay among TB PPDUs to the duration of training fields --- src/wifi/model/he/he-configuration.cc | 13 +++++++------ src/wifi/model/he/he-phy.cc | 15 ++++++++++++--- 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/src/wifi/model/he/he-configuration.cc b/src/wifi/model/he/he-configuration.cc index 685b84cd3..9229a1836 100644 --- a/src/wifi/model/he/he-configuration.cc +++ b/src/wifi/model/he/he-configuration.cc @@ -53,15 +53,16 @@ HeConfiguration::GetTypeId (void) &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.", + "If positive, the value of this attribute specifies 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. The maximum delay " + "is anyway capped at the duration of the training fields in the PPDU. " + "This attribute is only valid for APs.", TimeValue (Seconds (0)), MakeTimeAccessor (&HeConfiguration::GetMaxTbPpduDelay, &HeConfiguration::SetMaxTbPpduDelay), - MakeTimeChecker ()) + MakeTimeChecker (Seconds (0))) .AddAttribute ("MpduBufferSize", "The MPDU buffer size for receiving A-MPDUs", UintegerValue (64), diff --git a/src/wifi/model/he/he-phy.cc b/src/wifi/model/he/he-phy.cc index 953c6fa73..040bf4d3c 100644 --- a/src/wifi/model/he/he-phy.cc +++ b/src/wifi/model/he/he-phy.cc @@ -452,10 +452,19 @@ HePhy::DoGetEvent (Ptr ppdu, RxPowerWattPerChannelBand& rxPowers auto heConfiguration = m_wifiPhy->GetDevice ()->GetHeConfiguration (); NS_ASSERT (heConfiguration); - Time maxDelay = heConfiguration->GetMaxTbPpduDelay (); + // DoStartReceivePayload(), which is called when we start receiving the Data field, + // computes the max offset among TB PPDUs based on the begin OFDMA payload RX events, + // which are scheduled by StartReceivePreamble() when starting the reception of the + // OFDMA portion. Therefore, the maximum delay cannot exceed the duration of the + // training fields that are between the start of the OFDMA portion and the start + // of the Data field. + Time maxDelay = GetDuration (WIFI_PPDU_FIELD_TRAINING, txVector); + if (heConfiguration->GetMaxTbPpduDelay ().IsStrictlyPositive ()) + { + maxDelay = Min (maxDelay, heConfiguration->GetMaxTbPpduDelay ()); + } - if (maxDelay.IsStrictlyPositive () - && Simulator::Now () - event->GetStartTime () > maxDelay) + if (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