diff --git a/src/wifi/model/eht/advanced-emlsr-manager.cc b/src/wifi/model/eht/advanced-emlsr-manager.cc index 1abad3188..96e0c3af2 100644 --- a/src/wifi/model/eht/advanced-emlsr-manager.cc +++ b/src/wifi/model/eht/advanced-emlsr-manager.cc @@ -722,7 +722,7 @@ AdvancedEmlsrManager::InterruptSwitchMainPhyBackTimerIfNeeded() } void -AdvancedEmlsrManager::DoNotifyIcfReceived(uint8_t linkId) +AdvancedEmlsrManager::DoNotifyDlTxopStart(uint8_t linkId) { NS_LOG_FUNCTION(this << linkId); m_switchMainPhyBackEvent.Cancel(); diff --git a/src/wifi/model/eht/advanced-emlsr-manager.h b/src/wifi/model/eht/advanced-emlsr-manager.h index 979835a71..e683817d2 100644 --- a/src/wifi/model/eht/advanced-emlsr-manager.h +++ b/src/wifi/model/eht/advanced-emlsr-manager.h @@ -140,7 +140,7 @@ class AdvancedEmlsrManager : public DefaultEmlsrManager private: void DoNotifyTxopEnd(uint8_t linkId, Ptr edca) override; - void DoNotifyIcfReceived(uint8_t linkId) override; + void DoNotifyDlTxopStart(uint8_t linkId) override; void DoNotifyUlTxopStart(uint8_t linkId) override; bool m_allowUlTxopInRx; //!< whether a (main or aux) PHY is allowed to start an UL diff --git a/src/wifi/model/eht/default-emlsr-manager.cc b/src/wifi/model/eht/default-emlsr-manager.cc index 11634c609..65b66ab63 100644 --- a/src/wifi/model/eht/default-emlsr-manager.cc +++ b/src/wifi/model/eht/default-emlsr-manager.cc @@ -201,7 +201,7 @@ DefaultEmlsrManager::DoGetDelayUntilAccessRequest(uint8_t linkId) } void -DefaultEmlsrManager::DoNotifyIcfReceived(uint8_t linkId) +DefaultEmlsrManager::DoNotifyDlTxopStart(uint8_t linkId) { NS_LOG_FUNCTION(this << linkId); } diff --git a/src/wifi/model/eht/default-emlsr-manager.h b/src/wifi/model/eht/default-emlsr-manager.h index d87d002a2..16b2c9add 100644 --- a/src/wifi/model/eht/default-emlsr-manager.h +++ b/src/wifi/model/eht/default-emlsr-manager.h @@ -109,7 +109,7 @@ class DefaultEmlsrManager : public EmlsrManager uint8_t nextLinkId, Ptr auxPhy, Time duration) override; - void DoNotifyIcfReceived(uint8_t linkId) override; + void DoNotifyDlTxopStart(uint8_t linkId) override; void DoNotifyUlTxopStart(uint8_t linkId) override; void DoNotifyTxopEnd(uint8_t linkId, Ptr edca) override; void DoNotifyProtectionCompleted(uint8_t linkId) override; diff --git a/src/wifi/model/eht/eht-frame-exchange-manager.cc b/src/wifi/model/eht/eht-frame-exchange-manager.cc index bd599feab..5c88da1f5 100644 --- a/src/wifi/model/eht/eht-frame-exchange-manager.cc +++ b/src/wifi/model/eht/eht-frame-exchange-manager.cc @@ -1363,11 +1363,19 @@ EhtFrameExchangeManager::PostProcessFrame(Ptr psdu, const WifiTx } } - if (m_staMac && m_icfReceived) + if (m_staMac && m_dlTxopStart) { + // 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 in a SIFS) + m_ongoingTxopEnd.Cancel(); + NS_LOG_DEBUG("Expected TXOP end=" << (Simulator::Now() + m_phy->GetSifs()).As(Time::S)); + m_ongoingTxopEnd = Simulator::Schedule(m_phy->GetSifs() + TimeStep(1), + &EhtFrameExchangeManager::TxopEnd, + this, + psdu->GetAddr2()); // notify the EMLSR manager - m_staMac->GetEmlsrManager()->NotifyIcfReceived(m_linkId); - m_icfReceived = false; + m_staMac->GetEmlsrManager()->NotifyDlTxopStart(m_linkId); + m_dlTxopStart = false; } } @@ -1504,23 +1512,18 @@ EhtFrameExchangeManager::ReceiveMpdu(Ptr mpdu, return; } - auto emlsrManager = m_staMac->GetEmlsrManager(); - NS_ASSERT(emlsrManager); - - 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) - m_ongoingTxopEnd.Cancel(); - NS_LOG_DEBUG("Expected TXOP end=" << (Simulator::Now() + m_phy->GetSifs()).As(Time::S)); - m_ongoingTxopEnd = Simulator::Schedule(m_phy->GetSifs() + NanoSeconds(1), - &EhtFrameExchangeManager::TxopEnd, - this, - sender); + m_dlTxopStart = true; } } + else if (m_staMac && m_staMac->IsEmlsrLink(m_linkId) && !m_ongoingTxopEnd.IsPending() && + m_phy->GetPhyId() == m_staMac->GetEmlsrManager()->GetMainPhyId() && + (hdr.IsRts() || hdr.IsBlockAckReq() || (hdr.IsData() && hdr.GetAddr1() == m_self))) + { + // a frame that is starting a DL TXOP has been received by the main PHY + m_dlTxopStart = true; + } - if (!m_icfReceived && ShallDropReceivedMpdu(mpdu)) + if (!m_dlTxopStart && ShallDropReceivedMpdu(mpdu)) { NS_LOG_DEBUG("Drop received MPDU: " << *mpdu); return; @@ -1553,7 +1556,16 @@ EhtFrameExchangeManager::EndReceiveAmpdu(Ptr psdu, this << *psdu << rxSignalInfo << txVector << perMpduStatus.size() << std::all_of(perMpduStatus.begin(), perMpduStatus.end(), [](bool v) { return v; })); - if (ShallDropReceivedMpdu(*psdu->begin())) + const auto& hdr = psdu->GetHeader(0); + if (m_staMac && m_staMac->IsEmlsrLink(m_linkId) && !m_ongoingTxopEnd.IsPending() && + m_phy->GetPhyId() == m_staMac->GetEmlsrManager()->GetMainPhyId() && + (hdr.IsData() && hdr.GetAddr1() == m_self)) + { + // a frame that is starting a DL TXOP has been received by the main PHY + m_dlTxopStart = true; + } + + if (!m_dlTxopStart && ShallDropReceivedMpdu(*psdu->begin())) { return; } diff --git a/src/wifi/model/eht/eht-frame-exchange-manager.h b/src/wifi/model/eht/eht-frame-exchange-manager.h index b90cf9ce9..50b75c202 100644 --- a/src/wifi/model/eht/eht-frame-exchange-manager.h +++ b/src/wifi/model/eht/eht-frame-exchange-manager.h @@ -315,8 +315,8 @@ class EhtFrameExchangeManager : public HeFrameExchangeManager */ void TxopEnd(const std::optional& txopHolder); - bool m_icfReceived{false}; //!< whether an ICF has been received and needs to be notified to - //!< the EMLSR manager after post-processing the frame + bool m_dlTxopStart{false}; //!< whether a DL TXOP start is detected and needs to be notified to + //!< the EMLSR manager after post-processing the initial frame EventId m_ongoingTxopEnd; //!< event indicating the possible end of the current TXOP (of which //!< we are not the holder) std::unordered_map diff --git a/src/wifi/model/eht/emlsr-manager.cc b/src/wifi/model/eht/emlsr-manager.cc index 6053fc772..fbce1fe20 100644 --- a/src/wifi/model/eht/emlsr-manager.cc +++ b/src/wifi/model/eht/emlsr-manager.cc @@ -467,7 +467,7 @@ EmlsrManager::NotifyMgtFrameReceived(Ptr mpdu, uint8_t linkId) } void -EmlsrManager::NotifyIcfReceived(uint8_t linkId) +EmlsrManager::NotifyDlTxopStart(uint8_t linkId) { NS_LOG_FUNCTION(this << linkId); @@ -538,7 +538,7 @@ EmlsrManager::NotifyIcfReceived(uint8_t linkId) SetSleepStateForAllAuxPhys(true); } - DoNotifyIcfReceived(linkId); + DoNotifyDlTxopStart(linkId); } std::pair diff --git a/src/wifi/model/eht/emlsr-manager.h b/src/wifi/model/eht/emlsr-manager.h index f7394f2f9..77135880f 100644 --- a/src/wifi/model/eht/emlsr-manager.h +++ b/src/wifi/model/eht/emlsr-manager.h @@ -234,11 +234,11 @@ class EmlsrManager : public Object void NotifyMgtFrameReceived(Ptr mpdu, uint8_t linkId); /** - * Notify the reception of an initial Control frame on the given link. + * Notify the start of a DL TXOP on the given link. * - * @param linkId the ID of the link on which the initial Control frame was received + * @param linkId the ID of the given link */ - void NotifyIcfReceived(uint8_t linkId); + void NotifyDlTxopStart(uint8_t linkId); /** * Notify the start of an UL TXOP on the given link @@ -580,7 +580,7 @@ class EmlsrManager : public Object * * @param linkId the ID of the link on which the initial Control frame was received */ - virtual void DoNotifyIcfReceived(uint8_t linkId) = 0; + virtual void DoNotifyDlTxopStart(uint8_t linkId) = 0; /** * Notify the subclass of the start of an UL TXOP on the given link