diff --git a/src/wifi/model/he/he-phy.cc b/src/wifi/model/he/he-phy.cc index d2ec76560..58accec8b 100644 --- a/src/wifi/model/he/he-phy.cc +++ b/src/wifi/model/he/he-phy.cc @@ -70,7 +70,8 @@ const PhyEntity::PpduFormats HePhy::m_hePpduFormats { //Ignoring PE (Packet Exte HePhy::HePhy (bool buildModeList /* = true */) : VhtPhy (false), //don't add VHT modes to list - m_trigVectorExpirationTime (Seconds (0)) + m_trigVectorExpirationTime (Seconds (0)), + m_rxHeTbPpdus (0) { NS_LOG_FUNCTION (this << buildModeList); m_bssMembershipSelector = HE_PHY; @@ -720,6 +721,34 @@ HePhy::DoStartReceivePayload (Ptr event) } } +void +HePhy::RxPayloadSucceeded (Ptr psdu, RxSignalInfo rxSignalInfo, + const WifiTxVector& txVector, uint16_t staId, + const std::vector& statusPerMpdu) +{ + NS_LOG_FUNCTION (this << *psdu << txVector); + m_state->NotifyRxPsduSucceeded (Copy (psdu), rxSignalInfo, txVector, staId, statusPerMpdu); + if (!txVector.IsUlMu ()) + { + m_state->SwitchFromRxEndOk (); + } + else + { + m_rxHeTbPpdus++; + } +} + +void +HePhy::RxPayloadFailed (Ptr psdu, double snr, const WifiTxVector& txVector) +{ + NS_LOG_FUNCTION (this << *psdu << txVector << snr); + m_state->NotifyRxPsduFailed (Copy (psdu), snr); + if (!txVector.IsUlMu ()) + { + m_state->SwitchFromRxEndError (); + } +} + void HePhy::DoEndReceivePayload (Ptr ppdu) { @@ -739,8 +768,19 @@ HePhy::DoEndReceivePayload (Ptr ppdu) } if (m_endRxPayloadEvents.empty ()) { - //We've got the last PPDU of the UL-OFDMA transmission + //We've got the last PPDU of the UL-OFDMA transmission. + //Indicate a successfull reception is terminated if at least one HE TB PPDU + //has been successfully received, otherwise indicate a unsuccessfull reception is terminated. + if (m_rxHeTbPpdus > 0) + { + m_state->SwitchFromRxEndOk (); + } + else + { + m_state->SwitchFromRxEndError (); + } NotifyInterferenceRxEndAndClear (true); //reset WifiPhy + m_rxHeTbPpdus = 0; } } else @@ -768,6 +808,7 @@ HePhy::StartReceiveOfdmaPayload (Ptr event) } NS_LOG_FUNCTION (this << *event << it->second); NS_ASSERT (GetCurrentEvent () != 0); + NS_ASSERT (m_rxHeTbPpdus == 0); auto itEvent = m_beginOfdmaPayloadRxEvents.find (GetStaId (ppdu)); /** * m_beginOfdmaPayloadRxEvents should still be running only for APs, since canceled in StartReceivePayload for STAs. diff --git a/src/wifi/model/he/he-phy.h b/src/wifi/model/he/he-phy.h index b990f9c95..9588ae643 100644 --- a/src/wifi/model/he/he-phy.h +++ b/src/wifi/model/he/he-phy.h @@ -388,6 +388,10 @@ protected: bool IsConfigSupported (Ptr ppdu) const override; void DoStartReceivePayload (Ptr event) override; std::pair GetChannelWidthAndBand (const WifiTxVector& txVector, uint16_t staId) const override; + void RxPayloadSucceeded (Ptr psdu, RxSignalInfo rxSignalInfo, + const WifiTxVector& txVector, uint16_t staId, + const std::vector& statusPerMpdu) override; + void RxPayloadFailed (Ptr psdu, double snr, const WifiTxVector& txVector) override; void DoEndReceivePayload (Ptr ppdu) override; void DoResetReceive (Ptr event) override; void DoAbortCurrentReception (WifiPhyRxfailureReason reason) override; @@ -462,6 +466,8 @@ private: WifiPhyBand band); static const PpduFormats m_hePpduFormats; //!< HE PPDU formats + + std::size_t m_rxHeTbPpdus; //!< Number of successfully received HE TB PPDUS }; //class HePhy } //namespace ns3 diff --git a/src/wifi/model/phy-entity.cc b/src/wifi/model/phy-entity.cc index d31e7eed1..5f7f14959 100644 --- a/src/wifi/model/phy-entity.cc +++ b/src/wifi/model/phy-entity.cc @@ -662,7 +662,7 @@ PhyEntity::EndReceivePayload (Ptr event) } else { - RxPayloadFailed (psdu, snr); + RxPayloadFailed (psdu, snr, txVector); } DoEndReceivePayload (ppdu); @@ -674,13 +674,15 @@ PhyEntity::RxPayloadSucceeded (Ptr psdu, RxSignalInfo rxSignalIn const WifiTxVector& txVector, uint16_t staId, const std::vector& statusPerMpdu) { + NS_LOG_FUNCTION (this << *psdu << txVector); m_state->NotifyRxPsduSucceeded (Copy (psdu), rxSignalInfo, txVector, staId, statusPerMpdu); m_state->SwitchFromRxEndOk (); } void -PhyEntity::RxPayloadFailed (Ptr psdu, double snr) +PhyEntity::RxPayloadFailed (Ptr psdu, double snr, const WifiTxVector& txVector) { + NS_LOG_FUNCTION (this << *psdu << txVector << snr); m_state->NotifyRxPsduFailed (Copy (psdu), snr); m_state->SwitchFromRxEndError (); } diff --git a/src/wifi/model/phy-entity.h b/src/wifi/model/phy-entity.h index 5a8c6eb12..c3174ebaa 100644 --- a/src/wifi/model/phy-entity.h +++ b/src/wifi/model/phy-entity.h @@ -658,8 +658,9 @@ protected: * * \param psdu the PSDU that we failed to received * \param snr the SNR of the received PSDU in linear scale + * \param txVector TXVECTOR of the PSDU */ - virtual void RxPayloadFailed (Ptr psdu, double snr); + virtual void RxPayloadFailed (Ptr psdu, double snr, const WifiTxVector& txVector); /** * Perform amendment-specific actions at the end of the reception of