From c7b37d1caa65e1c374656ea95d9c62ad1a7f46d0 Mon Sep 17 00:00:00 2001 From: Stefano Avallone Date: Thu, 29 Jun 2023 17:58:09 +0200 Subject: [PATCH] wifi: Reduce amount of scheduled operations when switching main PHY --- src/wifi/model/eht/eht-frame-exchange-manager.cc | 5 ++--- src/wifi/model/eht/emlsr-manager.cc | 12 +++++++----- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/wifi/model/eht/eht-frame-exchange-manager.cc b/src/wifi/model/eht/eht-frame-exchange-manager.cc index 9139cb787..574130190 100644 --- a/src/wifi/model/eht/eht-frame-exchange-manager.cc +++ b/src/wifi/model/eht/eht-frame-exchange-manager.cc @@ -836,9 +836,8 @@ EhtFrameExchangeManager::ReceiveMpdu(Ptr mpdu, } NS_ASSERT(m_staMac->GetEmlsrManager()); - Simulator::ScheduleNow(&EmlsrManager::NotifyIcfReceived, - m_staMac->GetEmlsrManager(), - m_linkId); + m_staMac->GetEmlsrManager()->NotifyIcfReceived(m_linkId); + // 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(); diff --git a/src/wifi/model/eht/emlsr-manager.cc b/src/wifi/model/eht/emlsr-manager.cc index 6dd86c1e2..8f2de59de 100644 --- a/src/wifi/model/eht/emlsr-manager.cc +++ b/src/wifi/model/eht/emlsr-manager.cc @@ -370,13 +370,15 @@ EmlsrManager::NotifyIcfReceived(uint8_t linkId) return; } - SwitchMainPhy(linkId, true); // channel switch should occur instantaneously + Simulator::ScheduleNow([=, this]() { + SwitchMainPhy(linkId, true); // channel switch should occur instantaneously - // aux PHY received the ICF but main PHY will send the response - auto uid = auxPhy->GetPreviouslyRxPpduUid(); - mainPhy->SetPreviouslyRxPpduUid(uid); + // aux PHY received the ICF but main PHY will send the response + auto uid = auxPhy->GetPreviouslyRxPpduUid(); + mainPhy->SetPreviouslyRxPpduUid(uid); - DoNotifyIcfReceived(linkId); + DoNotifyIcfReceived(linkId); + }); } void