diff --git a/src/wifi/model/eht/default-emlsr-manager.cc b/src/wifi/model/eht/default-emlsr-manager.cc index 21c574847..73c15d659 100644 --- a/src/wifi/model/eht/default-emlsr-manager.cc +++ b/src/wifi/model/eht/default-emlsr-manager.cc @@ -130,10 +130,18 @@ DefaultEmlsrManager::NotifyMainPhySwitch(std::optional currLinkId, << " will switch to link " << +currLinkId.value() << " in " << duration.As(Time::US)); - m_auxPhySwitchEvent = - Simulator::Schedule(duration, [=, this, prevLinkId = m_mainPhySwitchInfo.from]() { - SwitchAuxPhy(auxPhy, nextLinkId, prevLinkId); - }); + if (duration.IsStrictlyPositive()) + { + m_auxPhySwitchEvent = + Simulator::Schedule(duration, [=, this, prevLinkId = m_mainPhySwitchInfo.from]() { + SwitchAuxPhy(auxPhy, nextLinkId, prevLinkId); + }); + } + else + { + SwitchAuxPhy(auxPhy, nextLinkId, m_mainPhySwitchInfo.from); + } + return; } diff --git a/src/wifi/model/eht/eht-frame-exchange-manager.cc b/src/wifi/model/eht/eht-frame-exchange-manager.cc index 922a6a6f4..a8eb7864d 100644 --- a/src/wifi/model/eht/eht-frame-exchange-manager.cc +++ b/src/wifi/model/eht/eht-frame-exchange-manager.cc @@ -1279,6 +1279,13 @@ EhtFrameExchangeManager::PostProcessFrame(Ptr psdu, const WifiTx UpdateTxopEndOnRxEnd(psdu->GetDuration()); } } + + if (m_staMac && m_icfReceived) + { + // notify the EMLSR manager + m_staMac->GetEmlsrManager()->NotifyIcfReceived(m_linkId); + m_icfReceived = false; + } } bool @@ -1391,8 +1398,6 @@ EhtFrameExchangeManager::ReceiveMpdu(Ptr mpdu, CheckEmlsrClientStartingTxop(hdr, txVector); } - bool icfReceived = false; - if (hdr.IsTrigger()) { if (!m_staMac) @@ -1423,7 +1428,7 @@ EhtFrameExchangeManager::ReceiveMpdu(Ptr mpdu, auto emlsrManager = m_staMac->GetEmlsrManager(); NS_ASSERT(emlsrManager); - icfReceived = true; + m_icfReceived = true; // we just got involved in a DL TXOP. Check if we are still involved in the TXOP in a // SIFS (we are expected to reply by sending a CTS frame) @@ -1436,17 +1441,12 @@ EhtFrameExchangeManager::ReceiveMpdu(Ptr mpdu, } } - if (!icfReceived && ShallDropReceivedMpdu(mpdu)) + if (!m_icfReceived && ShallDropReceivedMpdu(mpdu)) { return; } HeFrameExchangeManager::ReceiveMpdu(mpdu, rxSignalInfo, txVector, inAmpdu); - - if (icfReceived) - { - m_staMac->GetEmlsrManager()->NotifyIcfReceived(m_linkId); - } } void diff --git a/src/wifi/model/eht/eht-frame-exchange-manager.h b/src/wifi/model/eht/eht-frame-exchange-manager.h index a2475474a..347b34732 100644 --- a/src/wifi/model/eht/eht-frame-exchange-manager.h +++ b/src/wifi/model/eht/eht-frame-exchange-manager.h @@ -299,8 +299,10 @@ class EhtFrameExchangeManager : public HeFrameExchangeManager */ void TxopEnd(const std::optional& txopHolder); - EventId m_ongoingTxopEnd; //!< event indicating the possible end of the current TXOP (of which - //!< we are not the holder) + bool m_icfReceived{false}; //!< whether an ICF has been received and needs to be notified to + //!< the EMLSR manager after post-processing the frame + EventId m_ongoingTxopEnd; //!< event indicating the possible end of the current TXOP (of which + //!< we are not the holder) std::unordered_map m_transDelayTimer; //!< MLD address-indexed map of transition delay timers };