diff --git a/src/wifi/model/eht/ap-emlsr-manager.h b/src/wifi/model/eht/ap-emlsr-manager.h index 3f05a7813..6af3376af 100644 --- a/src/wifi/model/eht/ap-emlsr-manager.h +++ b/src/wifi/model/eht/ap-emlsr-manager.h @@ -21,13 +21,16 @@ #define AP_EMLSR_MANAGER_H #include "ns3/object.h" +#include "ns3/wifi-phy-band.h" namespace ns3 { class ApWifiMac; class EhtFrameExchangeManager; +class Time; class WifiPsdu; +class WifiTxVector; /** * \ingroup wifi @@ -69,6 +72,19 @@ class ApEmlsrManager : public Object */ virtual void NotifyPsduRxError(uint8_t linkId, Ptr psdu); + /** + * This method is intended to be called when the AP MLD starts transmitting an SU frame that + * is not addressed to EMLSR clients that were previously involved in the ongoing DL TXOP. + * + * \param psdu the PSDU being transmitted + * \param txVector the TXVECTOR used to transmit the PSDU + * \param band the PHY band in which the PSDU is being transmitted + * \return the delay after which the AP MLD starts the transition delay for the EMLSR client + */ + virtual Time GetDelayOnTxPsduNotForEmlsr(Ptr psdu, + const WifiTxVector& txVector, + WifiPhyBand band) = 0; + protected: void DoDispose() override; diff --git a/src/wifi/model/eht/default-ap-emlsr-manager.cc b/src/wifi/model/eht/default-ap-emlsr-manager.cc index e1d5b06c7..52f193c57 100644 --- a/src/wifi/model/eht/default-ap-emlsr-manager.cc +++ b/src/wifi/model/eht/default-ap-emlsr-manager.cc @@ -20,6 +20,8 @@ #include "default-ap-emlsr-manager.h" #include "ns3/log.h" +#include "ns3/wifi-phy.h" +#include "ns3/wifi-psdu.h" namespace ns3 { @@ -48,4 +50,14 @@ DefaultApEmlsrManager::~DefaultApEmlsrManager() NS_LOG_FUNCTION_NOARGS(); } +Time +DefaultApEmlsrManager::GetDelayOnTxPsduNotForEmlsr(Ptr psdu, + const WifiTxVector& txVector, + WifiPhyBand band) +{ + NS_LOG_FUNCTION(this << psdu << txVector << band); + // EMLSR clients switch back to listening operation at the end of the PPDU + return WifiPhy::CalculateTxDuration(psdu, txVector, band); +} + } // namespace ns3 diff --git a/src/wifi/model/eht/default-ap-emlsr-manager.h b/src/wifi/model/eht/default-ap-emlsr-manager.h index 66cac656c..1cf0bff60 100644 --- a/src/wifi/model/eht/default-ap-emlsr-manager.h +++ b/src/wifi/model/eht/default-ap-emlsr-manager.h @@ -41,6 +41,10 @@ class DefaultApEmlsrManager : public ApEmlsrManager DefaultApEmlsrManager(); ~DefaultApEmlsrManager() override; + + Time GetDelayOnTxPsduNotForEmlsr(Ptr psdu, + const WifiTxVector& txVector, + WifiPhyBand band) override; }; } // namespace ns3 diff --git a/src/wifi/model/eht/eht-frame-exchange-manager.cc b/src/wifi/model/eht/eht-frame-exchange-manager.cc index ef7c3af71..077f9b8c5 100644 --- a/src/wifi/model/eht/eht-frame-exchange-manager.cc +++ b/src/wifi/model/eht/eht-frame-exchange-manager.cc @@ -428,10 +428,13 @@ EhtFrameExchangeManager::ForwardPsduDown(Ptr psdu, WifiTxVector& HeFrameExchangeManager::ForwardPsduDown(psdu, txVector); UpdateTxopEndOnTxStart(txDuration, psdu->GetDuration()); - if (m_apMac) + if (m_apMac && m_apMac->GetApEmlsrManager()) { - // check if the EMLSR clients shall switch back to listening operation at the end of this - // PPDU + auto delay = m_apMac->GetApEmlsrManager()->GetDelayOnTxPsduNotForEmlsr(psdu, + txVector, + m_phy->GetPhyBand()); + + // check if the EMLSR clients shall switch back to listening operation for (auto clientIt = m_protectedStas.begin(); clientIt != m_protectedStas.end();) { auto aid = GetWifiRemoteStationManager()->GetAssociationId(*clientIt); @@ -439,7 +442,7 @@ EhtFrameExchangeManager::ForwardPsduDown(Ptr psdu, WifiTxVector& if (GetWifiRemoteStationManager()->GetEmlsrEnabled(*clientIt) && GetEmlsrSwitchToListening(psdu, aid, *clientIt)) { - EmlsrSwitchToListening(*clientIt, txDuration); + EmlsrSwitchToListening(*clientIt, delay); // this client is no longer involved in the current TXOP clientIt = m_protectedStas.erase(clientIt); }