From f750cf045f14cb5e4d02267817b2c33c75e0136d Mon Sep 17 00:00:00 2001 From: Stefano Avallone Date: Mon, 17 Feb 2025 10:27:52 +0100 Subject: [PATCH] wifi: Do not switch main PHY if aux PHY CCA is not used and switch back delay < PIFS --- src/wifi/model/eht/advanced-emlsr-manager.cc | 9 ++++++++- src/wifi/test/wifi-emlsr-test.cc | 3 ++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/wifi/model/eht/advanced-emlsr-manager.cc b/src/wifi/model/eht/advanced-emlsr-manager.cc index 7cbe982c9..4b06072ee 100644 --- a/src/wifi/model/eht/advanced-emlsr-manager.cc +++ b/src/wifi/model/eht/advanced-emlsr-manager.cc @@ -640,7 +640,14 @@ AdvancedEmlsrManager::RequestMainPhyToSwitch(uint8_t linkId, AcIndex aci, const GetChannelForMainPhy(linkId).GetTotalWidth())) { // cannot use aux PHY CCA - minDelay += GetStaMac()->GetWifiPhy(linkId)->GetPifs(); + const auto pifs = GetStaMac()->GetWifiPhy(linkId)->GetPifs(); + if (m_switchMainPhyBackDelay < pifs) + { + NS_LOG_DEBUG( + "Main PHY has to perform CCA but switch main PHY back delay is less than PIFS"); + return false; + } + minDelay += pifs; } minDelay = std::max(delay, minDelay); diff --git a/src/wifi/test/wifi-emlsr-test.cc b/src/wifi/test/wifi-emlsr-test.cc index 184bf9b43..235809602 100644 --- a/src/wifi/test/wifi-emlsr-test.cc +++ b/src/wifi/test/wifi-emlsr-test.cc @@ -2732,8 +2732,9 @@ EmlsrUlTxopTest::DoSetup() UintegerValue(m_auxPhyChannelWidth)); Config::SetDefault("ns3::DefaultEmlsrManager::SwitchAuxPhy", BooleanValue(false)); Config::SetDefault("ns3::AdvancedEmlsrManager::UseAuxPhyCca", BooleanValue(m_useAuxPhyCca)); + // switch main PHY back delay should be at least a PIFS for the switch to occur Config::SetDefault("ns3::AdvancedEmlsrManager::SwitchMainPhyBackDelay", - TimeValue(MilliSeconds(m_switchMainPhyBackDelayTimeout ? 2 : 0))); + TimeValue(MicroSeconds(m_switchMainPhyBackDelayTimeout ? 2000 : 30))); Config::SetDefault("ns3::EhtConfiguration::MediumSyncDuration", TimeValue(m_mediumSyncDuration)); Config::SetDefault("ns3::EhtConfiguration::MsdMaxNTxops", UintegerValue(m_msdMaxNTxops));