From c31c5d96cc8a0f544a93e1d9c435e2c7e13f59e6 Mon Sep 17 00:00:00 2001 From: Stefano Avallone Date: Sun, 30 Jun 2024 23:16:35 +0200 Subject: [PATCH] wifi: No need to create a WifiPsdu when scheduling end of an MPDU --- src/wifi/model/phy-entity.cc | 20 ++++++++++---------- src/wifi/model/phy-entity.h | 10 +++++----- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/wifi/model/phy-entity.cc b/src/wifi/model/phy-entity.cc index 5bbea97a4..11d4387a0 100644 --- a/src/wifi/model/phy-entity.cc +++ b/src/wifi/model/phy-entity.cc @@ -658,7 +658,7 @@ PhyEntity::ScheduleEndOfMpdus(Ptr event) &PhyEntity::EndOfMpdu, this, event, - Create(*mpdu, false), + *mpdu, i, relativeStart, mpduDuration)); @@ -672,7 +672,7 @@ PhyEntity::ScheduleEndOfMpdus(Ptr event) void PhyEntity::EndOfMpdu(Ptr event, - Ptr psdu, + Ptr mpdu, size_t mpduIndex, Time relativeStart, Time mpduDuration) @@ -683,7 +683,7 @@ PhyEntity::EndOfMpdu(Ptr event, uint16_t staId = GetStaId(ppdu); std::pair rxInfo = - GetReceptionStatus(psdu, event, staId, relativeStart, mpduDuration); + GetReceptionStatus(mpdu, event, staId, relativeStart, mpduDuration); NS_LOG_DEBUG("Extracted MPDU #" << mpduIndex << ": duration: " << mpduDuration.As(Time::NS) << ", correct reception: " << rxInfo.first << ", Signal/Noise: " << rxInfo.second.signal << "/" << rxInfo.second.noise << "dBm"); @@ -703,7 +703,7 @@ PhyEntity::EndOfMpdu(Ptr event, if (rxInfo.first && GetAddressedPsduInPpdu(ppdu)->GetNMpdus() > 1) { // only done for correct MPDU that is part of an A-MPDU - m_state->NotifyRxMpdu(psdu, rxSignalInfo, txVector); + m_state->NotifyRxMpdu(Create(mpdu, false), rxSignalInfo, txVector); } } @@ -801,13 +801,13 @@ PhyEntity::DoEndReceivePayload(Ptr ppdu) } std::pair -PhyEntity::GetReceptionStatus(Ptr psdu, +PhyEntity::GetReceptionStatus(Ptr mpdu, Ptr event, uint16_t staId, Time relativeMpduStart, Time mpduDuration) { - NS_LOG_FUNCTION(this << *psdu << *event << staId << relativeMpduStart << mpduDuration); + NS_LOG_FUNCTION(this << *mpdu << *event << staId << relativeMpduStart << mpduDuration); const auto channelWidthAndBand = GetChannelWidthAndBand(event->GetPpdu()->GetTxVector(), staId); SnrPer snrPer = m_wifiPhy->m_interference->CalculatePayloadSnrPer( event, @@ -819,7 +819,7 @@ PhyEntity::GetReceptionStatus(Ptr psdu, WifiMode mode = event->GetPpdu()->GetTxVector().GetMode(staId); NS_LOG_DEBUG("rate=" << (mode.GetDataRate(event->GetPpdu()->GetTxVector(), staId)) << ", SNR(dB)=" << RatioToDb(snrPer.snr) << ", PER=" << snrPer.per - << ", size=" << psdu->GetSize() + << ", size=" << mpdu->GetSize() << ", relativeStart = " << relativeMpduStart.As(Time::NS) << ", duration = " << mpduDuration.As(Time::NS)); @@ -832,14 +832,14 @@ PhyEntity::GetReceptionStatus(Ptr psdu, signalNoise.noise = WToDbm(event->GetRxPowerW(channelWidthAndBand.second) / snrPer.snr); if (GetRandomValue() > snrPer.per && !(m_wifiPhy->m_postReceptionErrorModel && - m_wifiPhy->m_postReceptionErrorModel->IsCorrupt(psdu->GetPacket()->Copy()))) + m_wifiPhy->m_postReceptionErrorModel->IsCorrupt(mpdu->GetPacket()->Copy()))) { - NS_LOG_DEBUG("Reception succeeded: " << psdu); + NS_LOG_DEBUG("Reception succeeded: " << *mpdu); return {true, signalNoise}; } else { - NS_LOG_DEBUG("Reception failed: " << psdu); + NS_LOG_DEBUG("Reception failed: " << *mpdu); return {false, signalNoise}; } } diff --git a/src/wifi/model/phy-entity.h b/src/wifi/model/phy-entity.h index 75765558e..a2fe58521 100644 --- a/src/wifi/model/phy-entity.h +++ b/src/wifi/model/phy-entity.h @@ -44,7 +44,7 @@ namespace ns3 */ using RxPowerWattPerChannelBand = std::map; -class WifiPsdu; +class WifiMpdu; class WifiPhy; class InterferenceHelper; class Event; @@ -663,7 +663,7 @@ class PhyEntity : public SimpleRefCount /** * Get the reception status for the provided MPDU and notify. * - * \param psdu the arriving MPDU formatted as a PSDU + * \param mpdu the arriving MPDU * \param event the event holding incoming PPDU's information * \param staId the station ID of the PSDU (only used for MU) * \param relativeMpduStart the relative start time of the MPDU within the A-MPDU. @@ -672,7 +672,7 @@ class PhyEntity : public SimpleRefCount * * \return information on MPDU reception: status, signal power (dBm), and noise power (in dBm) */ - std::pair GetReceptionStatus(Ptr psdu, + std::pair GetReceptionStatus(Ptr mpdu, Ptr event, uint16_t staId, Time relativeMpduStart, @@ -681,13 +681,13 @@ class PhyEntity : public SimpleRefCount * The last symbol of an MPDU in an A-MPDU has arrived. * * \param event the event holding incoming PPDU's information - * \param psdu the arriving MPDU formatted as a PSDU containing a normal MPDU + * \param mpdu the arriving MPDU * \param mpduIndex the index of the MPDU within the A-MPDU * \param relativeStart the relative start time of the MPDU within the A-MPDU. * \param mpduDuration the duration of the MPDU */ void EndOfMpdu(Ptr event, - Ptr psdu, + Ptr mpdu, size_t mpduIndex, Time relativeStart, Time mpduDuration);