From 6deb869ce00f32f1fadbe4791b01076ffbee5607 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Deronne?= Date: Sat, 25 Nov 2023 14:18:56 +0100 Subject: [PATCH] wifi: Handle case PHY is switched off when checking on current state --- src/wifi/model/phy-entity.cc | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/src/wifi/model/phy-entity.cc b/src/wifi/model/phy-entity.cc index 6c663dc74..8933f8c4c 100644 --- a/src/wifi/model/phy-entity.cc +++ b/src/wifi/model/phy-entity.cc @@ -414,17 +414,6 @@ PhyEntity::StartReceivePreamble(Ptr ppdu, } Time endRx = Simulator::Now() + rxDuration; - if (m_state->GetState() == WifiPhyState::OFF) - { - NS_LOG_DEBUG("Cannot start RX because device is OFF"); - if (endRx > (Simulator::Now() + m_state->GetDelayUntilIdle())) - { - m_wifiPhy->SwitchMaybeToCcaBusy(nullptr); - } - DropPreambleEvent(ppdu, WifiPhyRxfailureReason::POWERED_OFF, endRx); - return; - } - if (ppdu->IsTruncatedTx()) { NS_LOG_DEBUG("Packet reception stopped because transmitter has been switched off"); @@ -512,6 +501,10 @@ PhyEntity::StartReceivePreamble(Ptr ppdu, NS_LOG_DEBUG("Drop packet because in sleep mode"); DropPreambleEvent(ppdu, SLEEPING, endRx); break; + case WifiPhyState::OFF: + NS_LOG_DEBUG("Drop packet because in switched off"); + DropPreambleEvent(ppdu, WifiPhyRxfailureReason::POWERED_OFF, endRx); + break; default: NS_FATAL_ERROR("Invalid WifiPhy state."); break;