wifi: No need to create a WifiPsdu when scheduling end of an MPDU

This commit is contained in:
Stefano Avallone
2024-06-30 23:16:35 +02:00
parent aa7d690a1d
commit c31c5d96cc
2 changed files with 15 additions and 15 deletions

View File

@@ -658,7 +658,7 @@ PhyEntity::ScheduleEndOfMpdus(Ptr<Event> event)
&PhyEntity::EndOfMpdu,
this,
event,
Create<WifiPsdu>(*mpdu, false),
*mpdu,
i,
relativeStart,
mpduDuration));
@@ -672,7 +672,7 @@ PhyEntity::ScheduleEndOfMpdus(Ptr<Event> event)
void
PhyEntity::EndOfMpdu(Ptr<Event> event,
Ptr<const WifiPsdu> psdu,
Ptr<WifiMpdu> mpdu,
size_t mpduIndex,
Time relativeStart,
Time mpduDuration)
@@ -683,7 +683,7 @@ PhyEntity::EndOfMpdu(Ptr<Event> event,
uint16_t staId = GetStaId(ppdu);
std::pair<bool, SignalNoiseDbm> 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> 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<const WifiPsdu>(mpdu, false), rxSignalInfo, txVector);
}
}
@@ -801,13 +801,13 @@ PhyEntity::DoEndReceivePayload(Ptr<const WifiPpdu> ppdu)
}
std::pair<bool, SignalNoiseDbm>
PhyEntity::GetReceptionStatus(Ptr<const WifiPsdu> psdu,
PhyEntity::GetReceptionStatus(Ptr<WifiMpdu> mpdu,
Ptr<Event> 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<const WifiPsdu> 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<const WifiPsdu> 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};
}
}

View File

@@ -44,7 +44,7 @@ namespace ns3
*/
using RxPowerWattPerChannelBand = std::map<WifiSpectrumBandInfo, Watt_u>;
class WifiPsdu;
class WifiMpdu;
class WifiPhy;
class InterferenceHelper;
class Event;
@@ -663,7 +663,7 @@ class PhyEntity : public SimpleRefCount<PhyEntity>
/**
* 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<PhyEntity>
*
* \return information on MPDU reception: status, signal power (dBm), and noise power (in dBm)
*/
std::pair<bool, SignalNoiseDbm> GetReceptionStatus(Ptr<const WifiPsdu> psdu,
std::pair<bool, SignalNoiseDbm> GetReceptionStatus(Ptr<WifiMpdu> mpdu,
Ptr<Event> event,
uint16_t staId,
Time relativeMpduStart,
@@ -681,13 +681,13 @@ class PhyEntity : public SimpleRefCount<PhyEntity>
* 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> event,
Ptr<const WifiPsdu> psdu,
Ptr<WifiMpdu> mpdu,
size_t mpduIndex,
Time relativeStart,
Time mpduDuration);