diff --git a/src/wifi/model/eht/advanced-ap-emlsr-manager.cc b/src/wifi/model/eht/advanced-ap-emlsr-manager.cc index c0de5184b..451d0fb9d 100644 --- a/src/wifi/model/eht/advanced-ap-emlsr-manager.cc +++ b/src/wifi/model/eht/advanced-ap-emlsr-manager.cc @@ -25,6 +25,7 @@ #include "ns3/boolean.h" #include "ns3/log.h" #include "ns3/wifi-phy.h" +#include "ns3/wifi-psdu.h" namespace ns3 { @@ -47,6 +48,13 @@ AdvancedApEmlsrManager::GetTypeId() BooleanValue(true), MakeBooleanAccessor(&AdvancedApEmlsrManager::m_useNotifiedMacHdr), MakeBooleanChecker()) + .AddAttribute("EarlySwitchToListening", + "Whether the AP MLD assumes that an EMLSR client is able to detect at " + "the end of the MAC header that a PSDU is not addressed to it and " + "immediately starts switching to listening mode.", + BooleanValue(false), + MakeBooleanAccessor(&AdvancedApEmlsrManager::m_earlySwitchToListening), + MakeBooleanChecker()) .AddAttribute( "WaitTransDelayOnPsduRxError", "If true, the AP MLD waits for a response timeout after a PSDU reception " @@ -166,4 +174,23 @@ AdvancedApEmlsrManager::NotifyPsduRxError(uint8_t linkId, Ptr ps linkIds); } +Time +AdvancedApEmlsrManager::GetDelayOnTxPsduNotForEmlsr(Ptr psdu, + const WifiTxVector& txVector, + WifiPhyBand band) +{ + NS_LOG_FUNCTION(this << psdu << txVector << band); + + if (!m_earlySwitchToListening) + { + return DefaultApEmlsrManager::GetDelayOnTxPsduNotForEmlsr(psdu, txVector, band); + } + + // EMLSR clients switch back to listening operation at the end of MAC header RX + auto macHdrSize = (*psdu->begin())->GetHeader().GetSerializedSize() + + ((psdu->GetNMpdus() > 1 || psdu->IsSingle()) ? 4 : 0); + // return the duration of the MAC header TX + return DataRate(txVector.GetMode().GetDataRate(txVector)).CalculateBytesTxTime(macHdrSize); +} + } // namespace ns3 diff --git a/src/wifi/model/eht/advanced-ap-emlsr-manager.h b/src/wifi/model/eht/advanced-ap-emlsr-manager.h index 422ce611d..e5b2ad06b 100644 --- a/src/wifi/model/eht/advanced-ap-emlsr-manager.h +++ b/src/wifi/model/eht/advanced-ap-emlsr-manager.h @@ -53,6 +53,9 @@ class AdvancedApEmlsrManager : public DefaultApEmlsrManager void NotifyPsduRxOk(uint8_t linkId, Ptr psdu) override; void NotifyPsduRxError(uint8_t linkId, Ptr psdu) override; + Time GetDelayOnTxPsduNotForEmlsr(Ptr psdu, + const WifiTxVector& txVector, + WifiPhyBand band) override; protected: void DoDispose() override; @@ -73,9 +76,13 @@ class AdvancedApEmlsrManager : public DefaultApEmlsrManager private: std::set - m_blockedLinksOnMacHdrRx; //!< links that have been blocked upon receiving a MAC header - bool m_useNotifiedMacHdr; //!< whether to use the information about the MAC header of - //!< the MPDU being received (if notified by the PHY) + m_blockedLinksOnMacHdrRx; //!< links that have been blocked upon receiving a MAC header + bool m_useNotifiedMacHdr; //!< whether to use the information about the MAC header of + //!< the MPDU being received (if notified by the PHY) + bool m_earlySwitchToListening; //!< Whether the AP MLD assumes that an EMLSR client is able to + //!< detect at the end of the MAC header that a PSDU is not + //!< addressed to it and immediately starts switching to + //!< listening mode bool m_waitTransDelayOnPsduRxError; //!< Whether the AP MLD waits for a response timeout after a //!< PSDU reception error before starting the transition //!< delay