From 884a3972a2135901a70b9400fdbc27126b3b783a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Deronne?= Date: Sat, 25 Nov 2023 14:27:10 +0100 Subject: [PATCH] wifi: Do not call SwitchMaybeToCcaBusy in wifiPhy::Reset function --- src/wifi/model/wifi-phy.cc | 11 ++++++----- src/wifi/model/wifi-phy.h | 2 +- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/wifi/model/wifi-phy.cc b/src/wifi/model/wifi-phy.cc index b5c2ced02..1a3288f0e 100644 --- a/src/wifi/model/wifi-phy.cc +++ b/src/wifi/model/wifi-phy.cc @@ -1409,7 +1409,7 @@ WifiPhy::ResumeFromSleep() case WifiPhyState::SLEEP: { NS_LOG_DEBUG("resuming from sleep mode"); m_state->SwitchFromSleep(); - SwitchMaybeToCcaBusy(nullptr); + SwitchMaybeToCcaBusy(); break; } default: { @@ -1437,7 +1437,7 @@ WifiPhy::ResumeFromOff() case WifiPhyState::OFF: { NS_LOG_DEBUG("resuming from off mode"); m_state->SwitchFromOff(); - SwitchMaybeToCcaBusy(nullptr); + SwitchMaybeToCcaBusy(); break; } default: { @@ -1836,6 +1836,8 @@ WifiPhy::Send(WifiConstPsduMap psdus, const WifiTxVector& txVector) m_powerRestricted = false; Simulator::Schedule(txDuration, &WifiPhy::Reset, this); + + Simulator::Schedule(txDuration, &WifiPhy::SwitchMaybeToCcaBusy, this, nullptr); } uint64_t @@ -1863,7 +1865,6 @@ WifiPhy::Reset() } m_endPhyRxEvent.Cancel(); m_endTxEvent.Cancel(); - SwitchMaybeToCcaBusy(nullptr); } void @@ -1885,7 +1886,7 @@ WifiPhy::StartReceivePreamble(Ptr ppdu, // structure) NS_LOG_DEBUG("Unsupported modulation received (" << modulation << "), consider as noise"); m_interference->Add(ppdu, rxDuration, rxPowersW); - SwitchMaybeToCcaBusy(nullptr); + SwitchMaybeToCcaBusy(); } } @@ -2104,7 +2105,7 @@ WifiPhy::GetLastRxEndTime() const } void -WifiPhy::SwitchMaybeToCcaBusy(const Ptr ppdu) +WifiPhy::SwitchMaybeToCcaBusy(const Ptr ppdu /* = nullptr */) { NS_LOG_FUNCTION(this); GetLatestPhyEntity()->SwitchMaybeToCcaBusy(ppdu); diff --git a/src/wifi/model/wifi-phy.h b/src/wifi/model/wifi-phy.h index 4c2b2c94b..af882b465 100644 --- a/src/wifi/model/wifi-phy.h +++ b/src/wifi/model/wifi-phy.h @@ -1237,7 +1237,7 @@ class WifiPhy : public Object * * \param ppdu the incoming PPDU or nullptr for any signal */ - void SwitchMaybeToCcaBusy(const Ptr ppdu); + void SwitchMaybeToCcaBusy(const Ptr ppdu = nullptr); /** * Notify PHY state helper to switch to CCA busy state, *