From 3256ecabfe6be8bbba198ce243ac926331828bbb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Deronne?= Date: Sun, 5 Feb 2023 14:25:24 +0100 Subject: [PATCH] wifi: Generate PHY-CCA.indication upon channel switching --- src/wifi/model/spectrum-wifi-phy.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/wifi/model/spectrum-wifi-phy.cc b/src/wifi/model/spectrum-wifi-phy.cc index ffcf3499d..26d13e34a 100644 --- a/src/wifi/model/spectrum-wifi-phy.cc +++ b/src/wifi/model/spectrum-wifi-phy.cc @@ -272,17 +272,19 @@ SpectrumWifiPhy::DoChannelSwitch() if ((frequencyBefore == frequencyAfter) && (widthBefore == widthAfter)) { NS_LOG_DEBUG("Same RF channel as before, do nothing"); + SwitchMaybeToCcaBusy(nullptr); return; } auto newSpectrumPhyInterface = GetInterfaceCoveringChannelBand(frequencyAfter, widthAfter); + const auto interfaceChanged = (newSpectrumPhyInterface != m_currentSpectrumPhyInterface); NS_ABORT_MSG_IF(!newSpectrumPhyInterface, "No spectrum channel covers frequency range [" << frequencyAfter - (widthAfter / 2) << " MHz - " << frequencyAfter + (widthAfter / 2) << " MHz]"); - if (newSpectrumPhyInterface != m_currentSpectrumPhyInterface) + if (interfaceChanged) { NS_LOG_DEBUG("Switch to existing RF interface with frequency/width pair of (" << frequencyAfter << ", " << widthAfter << ")"); @@ -301,6 +303,8 @@ SpectrumWifiPhy::DoChannelSwitch() // it again in the entry associated with the new RX spectrum model UID) m_currentSpectrumPhyInterface = newSpectrumPhyInterface; ResetSpectrumModel(); + + SwitchMaybeToCcaBusy(nullptr); } bool