From 012031c79debf0c8c246e554365aed4d94e3f53f Mon Sep 17 00:00:00 2001 From: Stefano Avallone Date: Mon, 29 Jan 2024 13:41:46 +0100 Subject: [PATCH] wifi: Perform instantaneous channel switch when resizing aux PHY channel width --- src/wifi/model/eht/emlsr-manager.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/wifi/model/eht/emlsr-manager.cc b/src/wifi/model/eht/emlsr-manager.cc index d3df4eb5d..ddda34c3c 100644 --- a/src/wifi/model/eht/emlsr-manager.cc +++ b/src/wifi/model/eht/emlsr-manager.cc @@ -987,7 +987,11 @@ EmlsrManager::ApplyMaxChannelWidthAndModClassOnAuxPhys() auto cam = m_staMac->GetChannelAccessManager(linkId); cam->NotifySwitchingEmlsrLink(auxPhy, channel, linkId); + // apply channel width limitation assuming an instantaneous channel switch + const auto delay = auxPhy->GetChannelSwitchDelay(); + auxPhy->SetAttribute("ChannelSwitchDelay", TimeValue(Time{0})); auxPhy->SetOperatingChannel(channel); + auxPhy->SetAttribute("ChannelSwitchDelay", TimeValue(delay)); // the way the ChannelAccessManager handles EMLSR link switch implies that a PHY listener // is removed when the channel switch starts and another one is attached when the channel @@ -995,7 +999,7 @@ EmlsrManager::ApplyMaxChannelWidthAndModClassOnAuxPhys() // reset all backoffs (so that access timeout is also cancelled) when the channel switch // starts and request channel access (if needed) when the channel switch ends. cam->ResetAllBackoffs(); - Simulator::Schedule(auxPhy->GetChannelSwitchDelay(), [=, this]() { + Simulator::ScheduleNow([=, this]() { for (const auto& [acIndex, ac] : wifiAcList) { m_staMac->GetQosTxop(acIndex)->StartAccessAfterEvent(